[{"name":"DynamoDB","comment":" Pure Elm client for the [AWS DynamoDB](https://aws.amazon.com/dynamodb/) NoSQL database service.\n\n\n# Types\n\n@docs Request\n\n\n# Turning a Request into a Task\n\n@docs send\n\n\n# Creating requests\n\n@docs getItem, getItemWithMetadata\n@docs putItem, putItemWithMetadata\n@docs deleteItem, deleteItemWithMetadata\n@docs ScanValue, scan, scanWithMetadata\n@docs TransactGetItem, TransactGetItemValue, transactGetItems, transactGetItemsWithMetadata\n@docs TransactWrite, transactWriteItems, transactWriteItemsWithMetadata\n\n\n# Accessing values in items\n\n@docs itemStringValue, itemFloatValue, itemIntValue\n\n\n# Utility functions\n\n@docs makeItem, removeKeyFields, addKeyFields, keyNames\n\n\n# Reading accounts into Elm\n\n@docs readAccounts, decodeAccounts, accountDecoder, encodeAccount\n\n\n# Low-level functions\n\n@docs makeRequest, makeFullRequest\n\n","unions":[{"name":"TransactWrite","comment":" One action for the list passed to `transactWriteItems`.\n\n`TransactWriteDelete` deletes the attribute with the given `key`.\n\n`TransactWritePut` writes (or overwrites) the given `item`, merging\nthe `key` name/value pairs into `item`, if `key` is not Nothing.\n\n","args":[],"cases":[["TransactWriteDelete",["{ tableName : DynamoDB.Types.TableName, key : DynamoDB.Types.Key }"]],["TransactWritePut",["{ tableName : DynamoDB.Types.TableName, key : Maybe.Maybe DynamoDB.Types.Key, item : DynamoDB.Types.Item }"]]]}],"aliases":[{"name":"Request","comment":" A request that can be turned into a Task by `DynamoDB.send`.\n\n`a` is the type of the successful `Task` result from `DynamoDB.send`.\n\n","args":["a"],"type":"AWS.Http.Request AWS.Http.AWSAppError a"},{"name":"ScanValue","comment":" The return value for `scan` and `scanWithMetadata`\n\nPass `lastEvaluatedKey` to a subsequent call to scan to get more.\n\nThis doesn't include `ScannedCount`, because that's the same as\n`Count` unless you do filtering, which isn't yet supported.\n\n","args":[],"type":"{ count : Basics.Int, items : List.List DynamoDB.Types.Item, lastEvaluatedKey : Maybe.Maybe DynamoDB.Types.Key }"},{"name":"TransactGetItem","comment":" Specify one item for `transactGetItems`.\n\nAll attributes are returned if `returnedAttributeNames` is `Nothing`.\n\n","args":[],"type":"{ tableName : DynamoDB.Types.TableName, key : DynamoDB.Types.Key, returnedAttributeNames : Maybe.Maybe (List.List String.String) }"},{"name":"TransactGetItemValue","comment":" One of the return values from `transactGetItems`.\n","args":[],"type":"{ tableName : DynamoDB.Types.TableName, key : DynamoDB.Types.Key, item : Maybe.Maybe DynamoDB.Types.Item }"}],"values":[{"name":"accountDecoder","comment":" A `Decoder` for the `Account` type.\n","type":"Json.Decode.Decoder DynamoDB.Types.Account"},{"name":"addKeyFields","comment":" Add key fields to an `Item`.\n","type":"DynamoDB.Types.Key -> DynamoDB.Types.Item -> DynamoDB.Types.Item"},{"name":"decodeAccounts","comment":" Decode a JSON string encoding a list of `Account`s\n","type":"String.String -> Result.Result DynamoDB.Types.Error (List.List DynamoDB.Types.Account)"},{"name":"deleteItem","comment":" Delete an item from a table. There is no return value.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html>\n\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Request ()"},{"name":"deleteItemWithMetadata","comment":" Delete an item from a table, returning the Http request `Metadata`.\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Request Http.Metadata"},{"name":"encodeAccount","comment":" Encode an account as a JSON value.\n","type":"DynamoDB.Types.Account -> Json.Encode.Value"},{"name":"getItem","comment":" Get an item from a table.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html>\n\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Request (Maybe.Maybe DynamoDB.Types.Item)"},{"name":"getItemWithMetadata","comment":" Get an item, returning the Http request `Metadata`.\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Request ( Http.Metadata, Maybe.Maybe DynamoDB.Types.Item )"},{"name":"itemFloatValue","comment":" Return the value of an item's float attribute.\n\nIf the attribute does not exist or doesn't have a float value, return `NaN`.\n\n","type":"String.String -> DynamoDB.Types.Item -> Basics.Float"},{"name":"itemIntValue","comment":" Round an item's float value to an integer.\n\nIf the attribute does not exist or doesn't have a float value, returns\n`NaN` as an integer, which can only be detected via `isNan (toFloat n)`.\n\n","type":"String.String -> DynamoDB.Types.Item -> Basics.Int"},{"name":"itemStringValue","comment":" Return the value of an item's string attribute.\n\nIf the attribute does not exist or doesn't have a string value, return `\"\"`.\n\n","type":"String.String -> DynamoDB.Types.Item -> String.String"},{"name":"keyNames","comment":" Return a list of the key names in a `Key`.\n","type":"DynamoDB.Types.Key -> List.List String.String"},{"name":"makeFullRequest","comment":" Request creator with retained `Metadata`\n\nSame as `makeRequest`, but the decoder takes metadata\n\n","type":"String.String -> Json.Encode.Value -> (Http.Metadata -> Json.Decode.Decoder a) -> DynamoDB.Request a"},{"name":"makeItem","comment":" Create an `Item` from a list of (key, value) tuples.\n","type":"List.List ( String.String, DynamoDB.Types.AttributeValue ) -> DynamoDB.Types.Item"},{"name":"makeRequest","comment":" Low-level request creator.\n\nSimilar to`AWS.Http.request`, but assumes the HTTP result is JSON and\nuses `AWS.Http.awsAppErrDecoder` as the `ErrorDecoder`.\n\n","type":"String.String -> Json.Encode.Value -> Json.Decode.Decoder a -> DynamoDB.Request a"},{"name":"putItem","comment":" Put an item into a table. There is no return value.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html>\n\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Types.Item -> DynamoDB.Request ()"},{"name":"putItemWithMetadata","comment":" Put an item into a table, returning the Http request `Metadata`.\n","type":"DynamoDB.Types.TableName -> DynamoDB.Types.Key -> DynamoDB.Types.Item -> DynamoDB.Request Http.Metadata"},{"name":"readAccounts","comment":" Read JSON from a URL and turn it into a list of `Account`s.\n\nIf `Nothing` is passed for the first arg (the URL), will use the default of `\"accounts.json\"`.\n\nYou're not going to want to store the secret keys in this JSON in plain text anywhere but your development machine. In applications, they will ususally be stored in `LocalStorage`.\n\nExample JSON:\n\n    [{\"name\": \"Dynamo DB\",\n      \"region\": \"us-east-1\",\n      \"access-key\": \"<20-character access key>\",\n      \"secret-key\": \"<40-character secret key>\",\n      \"tableName\": \"<your table name>\"\n     }\n    ]\n\n","type":"Maybe.Maybe String.String -> Task.Task DynamoDB.Types.Error (List.List DynamoDB.Types.Account)"},{"name":"removeKeyFields","comment":" Remove the key fields from an `Item`.\n\nThe `Item` that comes back from `getItem` or `getItemWithMetadata` contains the key fields. Sometimes you'd rather not see them there.\n\n","type":"DynamoDB.Types.Key -> DynamoDB.Types.Item -> DynamoDB.Types.Item"},{"name":"scan","comment":" Scan a table for items.\n\nIf `Maybe Key` isn't `Nothing`, it's the `ExclusiveStartKey`.\n\nIf `Maybe Int` isn't `Nothing`, it's the `Limit`.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html>\n\n","type":"DynamoDB.Types.TableName -> Maybe.Maybe DynamoDB.Types.Key -> Maybe.Maybe Basics.Int -> DynamoDB.Request (Maybe.Maybe DynamoDB.ScanValue)"},{"name":"scanWithMetadata","comment":" Scan a table for items, returning the Http request `Metadata`.\n\nIf `Maybe Key` isn't `Nothing`, it's the `ExclusiveStartKey`.\n\nIf `Maybe Int` isn't `Nothing`, it's the `Limit`.\n\n","type":"DynamoDB.Types.TableName -> Maybe.Maybe DynamoDB.Types.Key -> Maybe.Maybe Basics.Int -> DynamoDB.Request ( Http.Metadata, Maybe.Maybe DynamoDB.ScanValue )"},{"name":"send","comment":" Create a `Task` to send a signed request over the wire.\n","type":"DynamoDB.Types.Account -> DynamoDB.Request a -> Task.Task DynamoDB.Types.Error a"},{"name":"transactGetItems","comment":" Do a bunch of `TransactGetItem` requests inside a transaction.\n\nWill error if the list has more than 100 elements.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html>\n\n","type":"List.List DynamoDB.TransactGetItem -> DynamoDB.Request (List.List DynamoDB.TransactGetItemValue)"},{"name":"transactGetItemsWithMetadata","comment":" Do a bunch of `TransactGetItem` requests inside a transaction, returning the Http request `Metadata`.\n\nWill error if the list has more than 100 elements.\n\n","type":"List.List DynamoDB.TransactGetItem -> DynamoDB.Request ( Http.Metadata, List.List DynamoDB.TransactGetItemValue )"},{"name":"transactWriteItems","comment":" Do a bunch of `TransactWrite` requests inside a transaction. There is no return value.\n\nWill error if the list has more than 100 elements.\n\nSee <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html>\n\n","type":"List.List DynamoDB.TransactWrite -> DynamoDB.Request ()"},{"name":"transactWriteItemsWithMetadata","comment":" Do a bunch of `TransactWrite` requests inside a transaction, returning the Http request `Metdata`.\n\nWill error if the list has more than 100 elements.\n\n","type":"List.List DynamoDB.TransactWrite -> DynamoDB.Request Http.Metadata"}],"binops":[]},{"name":"DynamoDB.AppState","comment":" Support for storing application state in DynamoDB.\n\nCall `initialLoad` when your application starts, to get the `saveCount` and\n`keyCounts` from DynamoDB, and compare them to local versions, usually\nsaved in `LocalStorage`.\n\nSpecify key/value pairs to save by calling `save`.\n\nOnce a second, call `idle` to make sure unstored changes get pushed to DynamoDB, at `idlePeriod` intervals.\n\nCall `update` to pull changes from DynamoDB, at `updatePeriod` intervals.\n\nCall `isActive` at `updateActive` intervals to make your app stop calling `update`, until the user does something to make it necessary.\n\nCall `goActive` when the user does something that requires pulling changes from other browsers.\n\n\n# State\n\n@docs AppState, makeAppState\n\n\n# Updating state\n\n@docs Error, accountIncomplete, save, idle, isIdleTime\n\n\n# Getting updates from other browsers.\n\n@docs Updates, update, initialLoad\n\n\n# Stop calling `update` periodically.\n\n@docs isActive, goActive\n\n\n# User Interface\n\n@docs emptyAccount, renderAccount\n\n\n# Internals\n\n@docs store, mergeAccount\n\n","unions":[],"aliases":[{"name":"AppState","comment":" Track updates for DynamoDB persistence.\n","args":[],"type":"{ account : DynamoDB.Types.Account, idlePeriod : Basics.Int, updatePeriod : Basics.Int, activePeriod : Basics.Int, keyName : String.String, valueAttributeName : String.String, saveCountAttributeName : String.String, saveCountKey : String.String, keyCountsKey : String.String, keyPrefix : Maybe.Maybe String.String, lastIdleTime : Basics.Int, lastUpdateTime : Basics.Int, saveCount : Basics.Int, lastActiveTime : Basics.Int, updates : Dict.Dict String.String (Maybe.Maybe Json.Encode.Value), keyCounts : Dict.Dict String.String Basics.Int }"},{"name":"Error","comment":" The `Error` in the result from executing the task returned by `save` and `idle`.\n","args":[],"type":"{ appState : DynamoDB.AppState.AppState, error : DynamoDB.Types.Error }"},{"name":"Updates","comment":" The successful Result of `update` and `initialLoad`.\n","args":[],"type":"{ saveCount : Basics.Int, keyCounts : Dict.Dict String.String Basics.Int, updates : Dict.Dict String.String (Maybe.Maybe String.String) }"}],"values":[{"name":"accountIncomplete","comment":" Return `True` if an `Account` does not have all its field filled in.\n\nDo NOT call `save`, `idle`, or `update` if this returns `True`.\nYou'll get an error on attempting to connect to the DynamoDB server.\n\n","type":"DynamoDB.AppState.AppState -> Basics.Bool"},{"name":"emptyAccount","comment":" An empty `DynamoDB.Account`.\n","type":"DynamoDB.Types.Account"},{"name":"goActive","comment":" Go active, usually due to UI action that requires update from afar.\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> DynamoDB.AppState.AppState"},{"name":"idle","comment":" Push the saved changes to DynamoDB if the idle time has elapsed.\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> Maybe.Maybe ( DynamoDB.AppState.AppState, Task.Task DynamoDB.AppState.Error Basics.Int )"},{"name":"initialLoad","comment":" Load the `saveCount` and `keyCounts` from DynamoDB.\n\nAlso load any key/value pairs that are more recent in the database than\nthey are in the passed `keyCounts`:\n\n    initialLoad appState saveCount keyCounts\n\n","type":"DynamoDB.AppState.AppState -> Basics.Int -> Dict.Dict String.String Basics.Int -> Task.Task DynamoDB.AppState.Error (Maybe.Maybe DynamoDB.AppState.Updates)"},{"name":"isActive","comment":" Check for activity. Return True if active.\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> Basics.Bool"},{"name":"isIdleTime","comment":" Is it time to query the database for updates from other apps?\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> Basics.Bool"},{"name":"makeAppState","comment":" Make an AppState with good defaults.\n","type":"DynamoDB.Types.Account -> DynamoDB.AppState.AppState"},{"name":"mergeAccount","comment":" Merge information from `Account` into AppState.\n","type":"DynamoDB.Types.Account -> DynamoDB.AppState.AppState -> DynamoDB.AppState.AppState"},{"name":"renderAccount","comment":" A UI for entering account information.\n\nYou can certainly do this yourself, if you want it to look different,\nbut this gives you a good start.\n\nThe callback is called when a field changes.\n\nYou need to do OK and Cancel buttons yourself.\n\n","type":"(DynamoDB.Types.Account -> msg) -> DynamoDB.Types.Account -> Html.Html msg"},{"name":"save","comment":" Add a new key/value pair to the DynamoDB store.\n\nDon't actually push it to DynamoDB you've accumulated as many keys as\ncan fit in one transaction. Call `idle` to force a push.\n\nThe task that saves to DynamoDB has as its value the number of keys\nthat were saved. It does nothing and has a value of 0, if the\nsave doesn't yet fill a transaction.\n\n","type":"Basics.Int -> String.String -> Maybe.Maybe Json.Encode.Value -> DynamoDB.AppState.AppState -> Maybe.Maybe ( DynamoDB.AppState.AppState, Task.Task DynamoDB.AppState.Error Basics.Int )"},{"name":"store","comment":" Push all saved updates to DynamoDB.\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> Maybe.Maybe ( DynamoDB.AppState.AppState, Task.Task DynamoDB.AppState.Error Basics.Int )"},{"name":"update","comment":" Probe the database for updates from other browsers.\n\nReturns `Nothing` if it's not yet time for the update.\n\nThe Task's value will be `Nothing` if your state is up-to-date with\nthe database. Otherwise, you'll need to update your copy of the\n`AppState` with the returned `updates.saveCount` & `updates.keyCounts`,\nand process the `updates.updates`, likely running appropriate JSON\ndecoders on the values (which will be `Nothing` if the key was deleted\nin the database).\n\n","type":"Basics.Int -> DynamoDB.AppState.AppState -> Maybe.Maybe ( DynamoDB.AppState.AppState, Task.Task DynamoDB.AppState.Error (Maybe.Maybe DynamoDB.AppState.Updates) )"}],"binops":[]},{"name":"DynamoDB.EncodeDecode","comment":" Encoders and decoders\n\n@docs encodeKey, keyDecoder\n@docs encodeItem, itemDecoder\n@docs encodeAttributeValue, attributeValueDecoder\n\n","unions":[],"aliases":[],"values":[{"name":"attributeValueDecoder","comment":" Decoder for an `AttributeValue`\n","type":"Json.Decode.Decoder DynamoDB.Types.AttributeValue"},{"name":"encodeAttributeValue","comment":" Encode an `AttributeValue`\n","type":"DynamoDB.Types.AttributeValue -> Json.Encode.Value"},{"name":"encodeItem","comment":" Encode an `Item`.\n","type":"DynamoDB.Types.Item -> Json.Encode.Value"},{"name":"encodeKey","comment":" Encode a `Key`\n","type":"DynamoDB.Types.Key -> Json.Encode.Value"},{"name":"itemDecoder","comment":" Decoder for an `Item`\n","type":"Json.Decode.Decoder DynamoDB.Types.Item"},{"name":"keyDecoder","comment":" Decoder for a `Key`\n","type":"Json.Decode.Decoder DynamoDB.Types.Key"}],"binops":[]},{"name":"DynamoDB.Html","comment":" Simple rendering for a list of `DynamoDB.Types.Item`.\n\n@docs renderItemTable, renderItemTableWithClass\n@docs TableConfig, renderTable, renderTableWithClass\n@docs prettyTableCssClass\n\n","unions":[],"aliases":[{"name":"TableConfig","comment":" Describe a table column for `renderTable`.\n","args":["element","columnDescriptor"],"type":"{ columnDescriptors : List.List columnDescriptor, columnDescriptorToString : columnDescriptor -> String.String, elementToString : columnDescriptor -> element -> Maybe.Maybe String.String }"}],"values":[{"name":"prettyTableCssClass","comment":" Defines the `prettytable` CSS class for `table` elements.\n\nPutting this anywhere but the `<head>` of your HTML document isn't supposed\nto work, but it does in most browsers.\n\nBest practive would be to include the following in your application's CSS,\nbut this works in a pinch.\n\n    table.prettytable {\n      margin: 0em 0.5em 0.5em 0.5em;\n      background: whitesmoke;\n      border-collapse: collapse;\n    }\n    table.prettytable th, table.prettytable td {\n      border: 1px silver solid;\n      padding: 0.2em;\n    }\n    table.prettytable th {\n      background: gainsboro;\n      text-align: center;\n    }\n    table.prettytable tr:nth-child(even) td {\n      background: white;\n    }\n    table.prettytable caption {\n      margin-left: inherit;\n      margin-right: inherit;\n\n","type":"Html.Html msg"},{"name":"renderItemTable","comment":" Render a table for a list of `Item`s.\n\nUses `\"prettytable\"` as the table's CSS class.\n\nThe list of strings is the key names which should appear first in the\ndisplayed table.\n\nThe wrapper, `(Item -> msg)`, is called when the user clicks on a row.\n\n","type":"(DynamoDB.Types.Item -> msg) -> List.List String.String -> List.List DynamoDB.Types.Item -> Html.Html msg"},{"name":"renderItemTableWithClass","comment":" Render a table for a list of `Item`s.\n\nThe `String` arg is the CSS class for the table.\n\nThe list of strings is the key names which should appear first in the\ndisplayed table.\n\nThe wrapper, `(Item -> msg)`, is called when the user clicks on a row.\n\n","type":"String.String -> (DynamoDB.Types.Item -> msg) -> List.List String.String -> List.List DynamoDB.Types.Item -> Html.Html msg"},{"name":"renderTable","comment":" Render a table. `renderItemTable` is implemented with this.\n\nUses `\"prettytable\"` as the table's CSS class.\n\nThe wrapper, `(element -> msg)`, is called when the user clicks on a row.\n\n","type":"(element -> msg) -> DynamoDB.Html.TableConfig element columnDescriptor -> List.List element -> Html.Html msg"},{"name":"renderTableWithClass","comment":" Render a table. `renderItemTableWithClass` is implemented with this.\n\nThe `String` arg is the CSS class for the table.\n\nThe wrapper, `(element -> msg)`, is called when the user clicks on a row.\n\n","type":"String.String -> (element -> msg) -> DynamoDB.Html.TableConfig element columnDescriptor -> List.List element -> Html.Html msg"}],"binops":[]},{"name":"DynamoDB.Types","comment":" Types for DynamoDB module\n\n\n# Types\n\n@docs TableName\n@docs Key, Item, AttributeValue\n@docs Error, Account\n\n\n# Utilities\n\n@docs emptyAccount\n\n","unions":[{"name":"AttributeValue","comment":" A value in a database key or item.\n\nSee: <https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html>\n\n","args":[],"cases":[["BinaryValue",["String.String"]],["BoolValue",["Basics.Bool"]],["BinarySetValue",["List.List String.String"]],["ListValue",["List.List DynamoDB.Types.AttributeValue"]],["MapValue",["Dict.Dict String.String DynamoDB.Types.AttributeValue"]],["NumberValue",["Basics.Float"]],["NumberSetValue",["List.List Basics.Float"]],["NullValue",[]],["StringValue",["String.String"]],["StringSetValue",["List.List String.String"]]]},{"name":"Error","comment":" Errors returned from S3 operations\n\n`HttpError` is from the standard Elm `Http` module.\n\n`AWSError` is from the AWS.Http module.\n\n`DecodeError` denotes a Decoder error in parsing DynamoDB account info.\n\n","args":[],"cases":[["HttpError",["Http.Error"]],["AWSError",["AWS.Http.AWSAppError"]],["DecodeError",["String.String"]]]},{"name":"Key","comment":" A key for a database item.\n","args":[],"cases":[["SimpleKey",["( String.String, DynamoDB.Types.AttributeValue )"]],["CompositeKey",["( String.String, DynamoDB.Types.AttributeValue )","( String.String, DynamoDB.Types.AttributeValue )"]]]}],"aliases":[{"name":"Account","comment":" Information about a DynamoDB account\n","args":[],"type":"{ name : String.String, region : Maybe.Maybe String.String, accessKey : String.String, secretKey : String.String, tableName : DynamoDB.Types.TableName }"},{"name":"Item","comment":" An item in a database.\n","args":[],"type":"Dict.Dict String.String DynamoDB.Types.AttributeValue"},{"name":"TableName","comment":" The name of a DynamoDB table.\n","args":[],"type":"String.String"}],"values":[{"name":"emptyAccount","comment":" An empty `DynamoDB.Account`.\n\nThis belongs in the DynamoDB module. Move when adding this to that.\n\n","type":"DynamoDB.Types.Account"}],"binops":[]}]