diff --git a/index.d.ts b/index.d.ts index 95007a41..f651bce2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2537,7 +2537,6 @@ export interface QueryOptions { logger?: ElectroEventListener; data?: "raw" | "includeKeys" | "attributes"; order?: "asc" | "desc"; - consistent?: boolean; } diff --git a/www/src/pages/en/queries/batch-get.mdx b/www/src/pages/en/queries/batch-get.mdx index 8812e07c..8ae3c178 100644 --- a/www/src/pages/en/queries/batch-get.mdx +++ b/www/src/pages/en/queries/batch-get.mdx @@ -107,6 +107,7 @@ By default, **ElectroDB** enables you to work with records as the names and prop listeners Array<(event) => void>; preserveBatchOrder?: boolean; attributes?: string[]; + consistent?: boolean; }; ``` @@ -124,3 +125,4 @@ By default, **ElectroDB** enables you to work with records as the names and prop | listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. | | logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | | preserveBatchOrder | `false` | When used with a [batchGet](/en/queries/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. | +| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. | diff --git a/www/src/pages/en/queries/get.mdx b/www/src/pages/en/queries/get.mdx index b9be8b85..c19567f8 100644 --- a/www/src/pages/en/queries/get.mdx +++ b/www/src/pages/en/queries/get.mdx @@ -67,17 +67,19 @@ By default, **ElectroDB** enables you to work with records as the names and prop logger?: (event) => void; listeners Array<(event) => void>; attributes?: string[]; + consistent?: boolean; }; ``` -| Option | Default | Description | -| --------------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 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. | -| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](/en/modeling/service#options) | -| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | -| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | -| 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. | -| 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. | -| 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`. | -| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. | -| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| Option | Default | Description | +| --------------- | :------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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. | +| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](/en/modeling/service#options) | +| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | +| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | +| 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. | +| 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. | +| 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`. | +| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. | +| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. | diff --git a/www/src/partials/batch-mutation-execution-options.mdx b/www/src/partials/batch-mutation-execution-options.mdx index 45b8c557..aeb2b442 100644 --- a/www/src/partials/batch-mutation-execution-options.mdx +++ b/www/src/partials/batch-mutation-execution-options.mdx @@ -14,18 +14,20 @@ By default, **ElectroDB** enables you to work with records as the names and prop logger?: (event) => void; listeners Array<(event) => void>; attributes?: string[]; + consistent?: boolean; }; ``` -| Option | Default | Description | -| ----------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 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. | -| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](#service-options) | -| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | -| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | -| 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. | -| 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. | -| 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). | -| 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. | -| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](#events) occur. | -| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| Option | Default | Description | +| ----------- | :------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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. | +| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](#service-options) | +| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | +| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | +| 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. | +| 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. | +| 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). | +| 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. | +| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](#events) occur. | +| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. | diff --git a/www/src/partials/mutation-query-options.mdx b/www/src/partials/mutation-query-options.mdx index 3142914b..46b2a090 100644 --- a/www/src/partials/mutation-query-options.mdx +++ b/www/src/partials/mutation-query-options.mdx @@ -15,19 +15,21 @@ By default, **ElectroDB** enables you to work with records as the names and prop logger?: (event) => void; listeners Array<(event) => void>; attributes?: string[]; + consistent?: boolean; } ``` -| Option | Default | Description | -| --------------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 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. | -| table | _(from constructor)_ | Use a different table than the one defined when creating your Entity or Service. | -| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | -| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | -| 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. | -| 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. | -| 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). | -| 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. | -| 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`. | -| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. | -| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| Option | Default | Description | +| --------------- | :------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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. | +| table | _(from constructor)_ | Use a different table than the one defined when creating your Entity or Service. | +| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. | +| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. | +| 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. | +| 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. | +| 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). | +| 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. | +| 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`. | +| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. | +| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. | +| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. | diff --git a/www/src/partials/query-options.mdx b/www/src/partials/query-options.mdx index 483dae48..c9c5585f 100644 --- a/www/src/partials/query-options.mdx +++ b/www/src/partials/query-options.mdx @@ -19,6 +19,7 @@ By default, **ElectroDB** enables you to work with records as the names and prop attributes?: string[]; order?: 'asc' | 'desc'; compare?: 'attributes' | 'keys' | 'v2'; + consistent?: boolean; }; ``` @@ -82,4 +83,8 @@ When performing comparison queries (e.g. `gt`, `gte`, `lte`, `lt`, `between`) it By default (`comparison: "keys"`), ElectroDB builds comparison queries without applying attribute filters. In this way, the query's comparison applies to the item's "keys". This approach gives you complete control of your indexes, though your query may return unexpected data if you are not careful with item sorting. -When set to `attributes`, the `comparison` option instructs ElectroDB to apply attribute filters on each Sort Key composite attribute provided. In this way, the query comparison applies to the item's "attributes." \ No newline at end of file +When set to `attributes`, the `comparison` option instructs ElectroDB to apply attribute filters on each Sort Key composite attribute provided. In this way, the query comparison applies to the item's "attributes." + +### consistent +**Default Value:** _none_ +When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes.