@travetto/model-dynamodb 8.0.0-alpha.13 → 8.0.0-alpha.14

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/util.ts +5 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-dynamodb",
3
- "version": "8.0.0-alpha.13",
3
+ "version": "8.0.0-alpha.14",
4
4
  "type": "module",
5
5
  "description": "DynamoDB backing for the travetto model module.",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "@aws-sdk/client-dynamodb": "^3.1027.0",
30
30
  "@travetto/config": "^8.0.0-alpha.12",
31
31
  "@travetto/model": "^8.0.0-alpha.12",
32
- "@travetto/model-indexed": "^8.0.0-alpha.13"
32
+ "@travetto/model-indexed": "^8.0.0-alpha.14"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@travetto/cli": "^8.0.0-alpha.17"
package/src/util.ts CHANGED
@@ -5,7 +5,7 @@ import type {
5
5
 
6
6
  import type { Class } from '@travetto/runtime';
7
7
  import { ModelCrudUtil, ModelExpiryUtil, ModelRegistryIndex, NotFoundError, type ModelType } from '@travetto/model';
8
- import { isModelIndexedIndex } from '@travetto/model-indexed';
8
+ import { warnIfIndexedUniqueIndex, warnIfNonIndexedIndex } from '@travetto/model-indexed';
9
9
 
10
10
  /**
11
11
  * Configuration for DynamoDB indices
@@ -51,12 +51,11 @@ export class DynamoDBUtil {
51
51
  const attributes: AttributeDefinition[] = [];
52
52
  const toCreate: GlobalSecondaryIndex[] = [];
53
53
 
54
- for (const idx of indexes) {
55
- if (!isModelIndexedIndex(idx) || ('unique' in idx && idx.unique)) {
56
- console.warn('Non-indexed indices are not supported in DynamoDB for', { cls: cls.Ⲑid, idx: idx.name });
57
- continue;
58
- }
54
+ const filtered = indexes
55
+ .filter(idx => !warnIfIndexedUniqueIndex(this, cls, [idx]))
56
+ .filter(idx => !warnIfNonIndexedIndex(this, cls, [idx]));
59
57
 
58
+ for (const idx of filtered) {
60
59
  const keys: KeySchemaElement[] = [];
61
60
 
62
61
  const safeName = this.toSafeName(idx.name);