electrodb 1.8.4 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -16
- package/index.d.ts +3 -1551
- package/package.json +8 -8
- package/src/entity.d.ts +94 -0
- package/src/entity.js +69 -25
- package/src/entity.test-d.ts +110 -0
- package/src/service.d.ts +17 -0
- package/src/types/client.ts +15 -0
- package/src/types/collections.ts +243 -0
- package/src/types/events.ts +47 -0
- package/src/types/index.ts +72 -0
- package/src/types/model.ts +132 -0
- package/src/types/options.ts +81 -0
- package/src/types/schema.test-d.ts +2507 -0
- package/src/types/schema.ts +1016 -0
- package/src/types/tests.test-d.ts +3 -0
- package/src/types/types.test-d.ts +142 -0
- package/src/types/where.test-d.ts +1939 -0
- package/src/types/where.ts +94 -0
- package/src/util.js +38 -1
- package/CHANGELOG.md +0 -185
package/README.md
CHANGED
|
@@ -2908,6 +2908,8 @@ The two-dimensional array returned by batch get most easily used when deconstruc
|
|
|
2908
2908
|
|
|
2909
2909
|
The `results` array are records that were returned DynamoDB as `Responses` on the BatchGet query. They will appear in the same format as other ElectroDB queries.
|
|
2910
2910
|
|
|
2911
|
+
> _NOTE: By default ElectroDB will return items without concern for order. If the order returned by ElectroDB must match the order provided, the [query option](#query-options) `preserveBatchOrder` can be used. When enabled, ElectroDB will ensure the order returned by a batchGet will be the same as the order provided. When enabled, if a record is returned from DynamoDB as "unprocessed" ([read more here](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html)), ElectroDB will return a null value at that index._
|
|
2912
|
+
|
|
2911
2913
|
Elements of the `unprocessed` array are unlike results received from a query. Instead of containing all the attributes of a record, an unprocessed record only includes the composite attributes defined in the Table Index. This is in keeping with DynamoDB's practice of returning only Keys in the case of unprocessed records. For convenience, ElectroDB will return these keys as composite attributes, but you can pass the [query option](#query-options) `{unprocessed:"raw"}` override this behavior and return the Keys as they came from DynamoDB.
|
|
2912
2914
|
|
|
2913
2915
|
### Delete Method
|
|
@@ -4297,25 +4299,27 @@ By default, **ElectroDB** enables you to work with records as the names and prop
|
|
|
4297
4299
|
pages?: number;
|
|
4298
4300
|
logger?: (event) => void;
|
|
4299
4301
|
listeners Array<(event) => void>;
|
|
4302
|
+
preserveBatchOrder?: boolean;
|
|
4300
4303
|
};
|
|
4301
4304
|
```
|
|
4302
4305
|
|
|
4303
|
-
Option
|
|
4304
|
-
|
|
4305
|
-
params
|
|
4306
|
-
table
|
|
4307
|
-
raw
|
|
4308
|
-
includeKeys
|
|
4309
|
-
pager
|
|
4310
|
-
originalErr
|
|
4311
|
-
concurrent
|
|
4312
|
-
unprocessed
|
|
4313
|
-
response
|
|
4314
|
-
ignoreOwnership
|
|
4315
|
-
limit
|
|
4316
|
-
pages
|
|
4317
|
-
listeners
|
|
4318
|
-
logger
|
|
4306
|
+
Option | Default | Description
|
|
4307
|
+
------------------ | :------------------: | -----------
|
|
4308
|
+
params | `{}` | Properties added to this object will be merged onto the params sent to the document client. Any conflicts with **ElectroDB** will favor the params specified here.
|
|
4309
|
+
table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](#service-options)
|
|
4310
|
+
raw | `false` | Returns query results as they were returned by the docClient.
|
|
4311
|
+
includeKeys | `false` | By default, **ElectroDB** does not return partition, sort, or global keys in its response.
|
|
4312
|
+
pager | `"named"` | Used in with pagination (`.pages()`) calls to override ElectroDBs default behaviour to break apart `LastEvaluatedKeys` records into composite attributes. See more detail about this in the sections for [Pager Query Options](#pager-query-options).
|
|
4313
|
+
originalErr | `false` | By default, **ElectroDB** alters the stacktrace of any exceptions thrown by the DynamoDB client to give better visibility to the developer. Set this value equal to `true` to turn off this functionality and return the error unchanged.
|
|
4314
|
+
concurrent | `1` | When performing batch operations, how many requests (1 batch operation == 1 request) to DynamoDB should ElectroDB make at one time. Be mindful of your DynamoDB throughput configurations
|
|
4315
|
+
unprocessed | `"item"` | Used in batch processing to override ElectroDBs default behaviour to break apart DynamoDBs `Unprocessed` records into composite attributes. See more detail about this in the sections for [BatchGet](#batch-get), [BatchDelete](#batch-write-delete-records), and [BatchPut](#batch-write-put-records).
|
|
4316
|
+
response | `"default"` | Used as a convenience for applying the DynamoDB parameter `ReturnValues`. The options here are the same as the parameter values for the DocumentClient except lowercase. The `"none"` option will cause the method to return null and will bypass ElectroDB's response formatting -- useful if formatting performance is a concern.
|
|
4317
|
+
ignoreOwnership | `false` | By default, **ElectroDB** interrogates items returned from a query for the presence of matching entity "identifiers". This helps to ensure other entities, or other versions of an entity, are filtered from your results. If you are using ElectroDB with an existing table/dataset you can turn off this feature by setting this property to `true`.
|
|
4318
|
+
limit | _none_ | A target for the number of items to return from DynamoDB. If this option is passed, Queries on entities and through collections will paginate DynamoDB until this limit is reached or all items for that query have been returned.
|
|
4319
|
+
pages | ∞ | How many DynamoDB pages should a query iterate through before stopping. By default ElectroDB paginate through all results for your query.
|
|
4320
|
+
listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](#events) occur.
|
|
4321
|
+
logger | _none_ | A convenience option for a single event listener that semantically can be used for logging.
|
|
4322
|
+
preserveBatchOrder | `false` | When used with a [batchGet](#batch-get) operation, ElectroDB will ensure the order returned by a batchGet will be the same as the order provided. When enabled, if a record is returned from DynamoDB as "unprocessed" ([read more here](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html)), ElectroDB will return a null value at that index.
|
|
4319
4323
|
|
|
4320
4324
|
# AWS DynamoDB Client
|
|
4321
4325
|
ElectroDB supports both the [v2](https://www.npmjs.com/package/aws-sdk) and [v3](https://www.npmjs.com/package/@aws-sdk/client-dynamodb) aws clients. The client can be supplied creating a new Entity or Service, or added to a Entity/Service instance via the `setClient()` method.
|