@ftschopp/dynatable-core 1.2.2 → 1.2.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## @ftschopp/dynatable-core [1.2.3](https://github.com/ftschopp/dynatable/compare/@ftschopp/dynatable-core@1.2.2...@ftschopp/dynatable-core@1.2.3) (2026-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * resolve both required and optional keys in generate fields ([2c06b43](https://github.com/ftschopp/dynatable/commit/2c06b435d4578cb28f773798c80c19bf4eb9ef28))
7
+
1
8
  ## @ftschopp/dynatable-core [1.2.2](https://github.com/ftschopp/dynatable/compare/@ftschopp/dynatable-core@1.2.1...@ftschopp/dynatable-core@1.2.2) (2026-04-15)
2
9
 
3
10
 
@@ -38,8 +38,8 @@ const createEntityAPI = (tableName, modelName, model, client, options = {}) => {
38
38
  isUpdate: false,
39
39
  timestamps,
40
40
  });
41
- // Resolve keys again with defaults
42
- const fullKey = (0, model_utils_1.resolveKeys)(model, withDefaults);
41
+ // Resolve keys again with defaults (including GSI index keys)
42
+ const fullKey = (0, model_utils_1.resolveKeys)(model, withDefaults, 'both');
43
43
  // Combine keys and data into full item, adding _type field
44
44
  const fullItem = {
45
45
  ...withDefaults,
@@ -106,8 +106,8 @@ const createEntityAPI = (tableName, modelName, model, client, options = {}) => {
106
106
  isUpdate: false,
107
107
  timestamps,
108
108
  });
109
- // Resolve keys again with defaults
110
- const fullKey = (0, model_utils_1.resolveKeys)(model, withDefaults);
109
+ // Resolve keys again with defaults (including GSI index keys)
110
+ const fullKey = (0, model_utils_1.resolveKeys)(model, withDefaults, 'both');
111
111
  // Combine keys and data into full item, adding _type field
112
112
  return {
113
113
  ...withDefaults,
@@ -1 +1 @@
1
- {"version":3,"file":"zod-utils.d.ts","sourceRoot":"","sources":["../../src/utils/zod-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAK,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,mBAAmB,KAAG,OA+BrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,KAAG,SAAS,CAAC,GAAG,CAMhE,CAAC"}
1
+ {"version":3,"file":"zod-utils.d.ts","sourceRoot":"","sources":["../../src/utils/zod-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAK,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,mBAAmB,KAAG,OAgCrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,KAAG,SAAS,CAAC,GAAG,CAMhE,CAAC"}
@@ -39,7 +39,8 @@ const typeToZod = (attr) => {
39
39
  ? zod_1.z.date()
40
40
  : zod_1.z.unknown();
41
41
  }
42
- return attr.required ? zodType : zodType.optional();
42
+ const isGenerated = 'generate' in attr;
43
+ return attr.required && !isGenerated ? zodType : zodType.optional();
43
44
  };
44
45
  exports.typeToZod = typeToZod;
45
46
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftschopp/dynatable-core",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Core library for DynamoDB single table design",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -71,8 +71,8 @@ export const createEntityAPI = <Model extends ModelDefinition>(
71
71
  timestamps,
72
72
  });
73
73
 
74
- // Resolve keys again with defaults
75
- const fullKey = resolveKeys(model, withDefaults);
74
+ // Resolve keys again with defaults (including GSI index keys)
75
+ const fullKey = resolveKeys(model, withDefaults, 'both');
76
76
 
77
77
  // Combine keys and data into full item, adding _type field
78
78
  const fullItem = {
@@ -194,8 +194,8 @@ export const createEntityAPI = <Model extends ModelDefinition>(
194
194
  timestamps,
195
195
  });
196
196
 
197
- // Resolve keys again with defaults
198
- const fullKey = resolveKeys(model, withDefaults);
197
+ // Resolve keys again with defaults (including GSI index keys)
198
+ const fullKey = resolveKeys(model, withDefaults, 'both');
199
199
 
200
200
  // Combine keys and data into full item, adding _type field
201
201
  return {
@@ -38,7 +38,8 @@ export const typeToZod = (attr: AttributeDefinition): ZodType => {
38
38
  : z.unknown();
39
39
  }
40
40
 
41
- return attr.required ? zodType : zodType.optional();
41
+ const isGenerated = 'generate' in attr;
42
+ return attr.required && !isGenerated ? zodType : zodType.optional();
42
43
  };
43
44
 
44
45
  /**