@jskit-ai/agent-docs 0.1.15 → 0.1.16

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.
@@ -847,6 +847,8 @@ In JSKIT CRUD:
847
847
  Use these rules:
848
848
 
849
849
  - for explicit DB column overrides, use `repository.column`
850
+ - standard writable `date-time` fields are serialized automatically during CRUD writes
851
+ - use `repository.writeSerializer` only for non-default DB write serialization
850
852
  - for computed output fields, use `repository.storage: "virtual"`
851
853
  - do not put computed fields in create/patch write schemas
852
854
 
@@ -892,6 +894,8 @@ Once registered there:
892
894
  - generic CRUD `listByIds`
893
895
  - generic CRUD `listByForeignIds`
894
896
 
897
+ and generic CRUD writes automatically serialize standard writable `date-time` fields during create/update payload mapping, so normal datetime DB formatting does not need per-field metadata or repository-specific `preparePayload` hooks. Keep `repository.writeSerializer` for non-default cases only.
898
+
895
899
  all pick up the projection automatically, so you should not hand-patch `clearSelect()` / re-select logic into each method.
896
900
 
897
901
  Important limits:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Distributed JSKIT agent workflows, guides, and generated reference maps.",
5
5
  "type": "module",
6
6
  "files": [
package/patterns/INDEX.md CHANGED
@@ -28,7 +28,7 @@ How to use it:
28
28
  - `ui-testing.md`
29
29
  - filter, filters, search facets, chips, date range, enum filter, lookup filter, `useCrudListFilters`, `createCrudListFilters`
30
30
  - `filters.md`
31
- - fieldMeta, `repository.column`, computed field, virtual field, projection, `createCrudResourceRuntime`, `remainingBatchWeight`
31
+ - fieldMeta, `repository.column`, `repository.writeSerializer`, computed field, virtual field, projection, `createCrudResourceRuntime`, `remainingBatchWeight`, datetime write serialization
32
32
  - `crud-repository-mapping.md`
33
33
 
34
34
  ## Current Patterns
@@ -9,9 +9,11 @@ Default JSKIT pattern:
9
9
  1. Treat the schema as the API contract only.
10
10
  2. Put persistence mapping in `resource.fieldMeta`.
11
11
  3. Use `repository.column` for explicit DB column overrides.
12
- 4. Use `repository.storage: "virtual"` for computed output fields.
13
- 5. Register computed SQL projections once in the repository runtime with `virtualFields`.
14
- 6. Let generic CRUD read paths apply those projections automatically.
12
+ 4. Let generic CRUD runtime handle standard writable `date-time` fields automatically at the DB write seam.
13
+ 5. Use `repository.writeSerializer` only for non-default write serialization.
14
+ 6. Use `repository.storage: "virtual"` for computed output fields.
15
+ 7. Register computed SQL projections once in the repository runtime with `virtualFields`.
16
+ 8. Let generic CRUD read paths apply those projections automatically.
15
17
 
16
18
  Field meta rules:
17
19
  - for a normal override, write:
@@ -36,14 +38,29 @@ RESOURCE_FIELD_META.push({
36
38
  });
37
39
  ```
38
40
 
41
+ - for a non-default write serializer override, write:
42
+
43
+ ```js
44
+ RESOURCE_FIELD_META.push({
45
+ key: "arrivalDatetime",
46
+ repository: {
47
+ writeSerializer: "datetime-utc"
48
+ }
49
+ });
50
+ ```
51
+
39
52
  - omit `repository` entirely when the field is column-backed and the default snake_case mapping is correct
53
+ - standard writable `format: "date-time"` fields do not need explicit `repository.writeSerializer`
54
+ - use `repository.writeSerializer` only for non-default DB write behavior; keep `bodyValidator.normalize(...)` in API shape
40
55
  - `repository.storage: "virtual"` cannot also define `repository.column`
56
+ - `repository.storage: "virtual"` cannot also define `repository.writeSerializer`
41
57
  - `repository.storage: "virtual"` fields must not appear in create/patch write schemas
42
58
 
43
59
  Repository pattern:
44
60
  - build the runtime with `createCrudResourceRuntime(resource, { ... })`
45
61
  - register computed projections in `virtualFields`
46
62
  - keep SQL in the repository, not in shared metadata
63
+ - let generic CRUD runtime apply `repository.writeSerializer` during create/update writes
47
64
 
48
65
  Example:
49
66
 
@@ -64,6 +81,8 @@ const repositoryRuntime = createCrudResourceRuntime(resource, {
64
81
 
65
82
  What CRUD core now does for you:
66
83
  - default select columns include only column-backed output fields
84
+ - create/update write payloads serialize standard writable `date-time` fields centrally
85
+ - create/update write payloads also apply any explicit field write serializers centrally
67
86
  - `list`, `findById`, `listByIds`, and `listByForeignIds` apply registered virtual projections automatically
68
87
  - search and parent-filter fallback derivation only use column-backed fields
69
88
  - `listByIds(..., { valueKey })` requires that `valueKey` be column-backed
@@ -76,6 +95,8 @@ Avoid:
76
95
  Review checks:
77
96
  - schema defines contract, not storage
78
97
  - `fieldMeta.repository` owns mapping
98
+ - standard datetime DB write serialization stays automatic and runtime-owned
99
+ - any non-default DB write serialization lives in `repository.writeSerializer`, not in per-repository hooks
79
100
  - computed fields use `repository.storage: "virtual"`
80
101
  - repository runtime registers matching `virtualFields`
81
102
  - no per-method projection duplication when generic CRUD reads already cover the field
@@ -211,7 +211,7 @@ Exports
211
211
  - `deriveRepositoryMappingFromResource(resource = {}, { context = "crudRepository" } = {})`
212
212
  - `applyCrudListQueryFilters(query, { idColumn = "id", cursor = "", applyCursor = true, q = "", searchColumns = [], parentFilters = {}, parentFilterColumns = {} } = {})`
213
213
  - `mapRecordRow(row, fieldKeys = [], overrides = {}, { recordIdKeys = [] } = {})`
214
- - `buildWritePayload(sourcePayload = {}, fieldKeys = [], overrides = {})`
214
+ - `buildWritePayload(sourcePayload = {}, fieldKeys = [], overrides = {}, { serializerByKey = {} } = {})`
215
215
  - `resolveColumnName(fieldKey, overrides = {})`
216
216
  - `resolveCrudIdColumn(idColumn, { fallback = "id" } = {})`
217
217
  - `buildRepositoryColumnMetadata({ outputKeys = [], writeKeys = [], columnOverrides = {}, fieldStorageByKey = {} } = {})`
@@ -220,6 +220,7 @@ Local functions
220
220
  - `requireObjectSchemaProperties(schema, { context = "crudRepository", schemaLabel = "schema" } = {})`
221
221
  - `normalizeResourceFieldMetaEntries(fieldMeta = [])`
222
222
  - `schemaIncludesStringType(schema = {})`
223
+ - `schemaIncludesDateTimeFormat(schema = {})`
223
224
  - `schemaIncludesRecordIdType(schema = {})`
224
225
 
225
226
  ### `src/server/resourceRuntime/index.js`
@@ -317,12 +318,14 @@ Local functions
317
318
  Exports
318
319
  - `CRUD_FIELD_REPOSITORY_STORAGE_COLUMN`
319
320
  - `CRUD_FIELD_REPOSITORY_STORAGE_VIRTUAL`
321
+ - `CRUD_FIELD_REPOSITORY_WRITE_SERIALIZER_DATETIME_UTC`
320
322
  - `CRUD_LOOKUP_FORM_CONTROL_AUTOCOMPLETE`
321
323
  - `CRUD_LOOKUP_FORM_CONTROL_SELECT`
322
324
  - `CRUD_RUNTIME_LOOKUPS_FIELD_KEY`
323
325
  - `checkCrudLookupFormControl(value, { context = "crud fieldMeta ui.formControl", defaultValue = CRUD_LOOKUP_FORM_CONTROL_AUTOCOMPLETE } = {})`
324
326
  - `isCrudRuntimeOutputOnlyFieldKey(value = "", { lookupContainerKey = CRUD_RUNTIME_LOOKUPS_FIELD_KEY } = {})`
325
327
  - `normalizeCrudFieldRepositoryConfig(fieldMetaEntry = {}, { context = "crud fieldMeta repository", fieldKey = "" } = {})`
328
+ - `normalizeCrudFieldRepositoryWriteSerializer(value, { context = "crud fieldMeta repository", fieldKey = "" } = {})`
326
329
 
327
330
  ### `src/shared/crudNamespaceSupport.js`
328
331
  Exports
@@ -215,6 +215,39 @@ Exports
215
215
  Exports
216
216
  - None
217
217
 
218
+ ### .tmp-crud-server-template-fixture-FNbPfi
219
+
220
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/actionIds.js`
221
+ Exports
222
+ - `actionIds`
223
+
224
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/actions.js`
225
+ Exports
226
+ - `createActions({ surface = "" } = {})`
227
+ Local functions
228
+ - `requireActionSurface(surface = "")`
229
+
230
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/listConfig.js`
231
+ Exports
232
+ - `LIST_CONFIG`
233
+
234
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/registerRoutes.js`
235
+ Exports
236
+ - `registerRoutes(app, { routeOwnershipFilter = "public", routeSurface = "", routeRelativePath = "" } = {})`
237
+
238
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/repository.js`
239
+ Exports
240
+ - `createRepository(knex, options = {})`
241
+
242
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/server/service.js`
243
+ Exports
244
+ - `createService({ customersRepository, fieldAccess = DEFAULT_FIELD_ACCESS } = {})`
245
+ - `serviceEvents`
246
+
247
+ ### `.tmp-crud-server-template-fixture-FNbPfi/src/shared/customerResource.js`
248
+ Exports
249
+ - `resource`
250
+
218
251
  ### test-support
219
252
 
220
253
  ### `test-support/templateServerFixture.js`