@jskit-ai/crud-server-generator 0.1.61 → 0.1.63

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.
@@ -1,7 +1,7 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/crud-server-generator",
4
- version: "0.1.61",
4
+ version: "0.1.63",
5
5
  kind: "generator",
6
6
  description: "CRUD server generator with routes, actions, and persistence scaffolding.",
7
7
  options: {
@@ -151,13 +151,13 @@ export default Object.freeze({
151
151
  mutations: {
152
152
  dependencies: {
153
153
  runtime: {
154
- "@jskit-ai/auth-core": "0.1.52",
155
- "@jskit-ai/crud-core": "0.1.61",
156
- "@jskit-ai/database-runtime": "0.1.53",
157
- "@jskit-ai/http-runtime": "0.1.52",
158
- "@jskit-ai/kernel": "0.1.53",
159
- "@jskit-ai/realtime": "0.1.52",
160
- "@jskit-ai/users-core": "0.1.63",
154
+ "@jskit-ai/auth-core": "0.1.54",
155
+ "@jskit-ai/crud-core": "0.1.63",
156
+ "@jskit-ai/database-runtime": "0.1.55",
157
+ "@jskit-ai/http-runtime": "0.1.54",
158
+ "@jskit-ai/kernel": "0.1.55",
159
+ "@jskit-ai/realtime": "0.1.54",
160
+ "@jskit-ai/users-core": "0.1.65",
161
161
  "@local/${option:namespace|kebab}": "file:packages/${option:namespace|kebab}",
162
162
  "typebox": "^1.0.81"
163
163
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/crud-server-generator",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -13,11 +13,11 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@babel/parser": "^7.29.2",
16
- "@jskit-ai/crud-core": "0.1.61",
17
- "@jskit-ai/database-runtime": "0.1.53",
18
- "@jskit-ai/http-runtime": "0.1.52",
19
- "@jskit-ai/kernel": "0.1.53",
20
- "@jskit-ai/users-core": "0.1.63",
16
+ "@jskit-ai/crud-core": "0.1.63",
17
+ "@jskit-ai/database-runtime": "0.1.55",
18
+ "@jskit-ai/http-runtime": "0.1.54",
19
+ "@jskit-ai/kernel": "0.1.55",
20
+ "@jskit-ai/users-core": "0.1.65",
21
21
  "recast": "^0.23.11",
22
22
  "typebox": "^1.0.81"
23
23
  }
@@ -832,9 +832,9 @@ function renderInputNormalizer(column) {
832
832
  }
833
833
  if (typeKind === "datetime") {
834
834
  if (nullable) {
835
- return "(value) => { const normalized = normalizeText(value); return normalized ? toDatabaseDateTimeUtc(normalized) : null; }";
835
+ return "(value) => { const normalized = normalizeText(value); return normalized ? toIsoString(normalized) : null; }";
836
836
  }
837
- return "toDatabaseDateTimeUtc";
837
+ return "toIsoString";
838
838
  }
839
839
  if (typeKind === "date") {
840
840
  if (nullable) {
@@ -1513,12 +1513,23 @@ function renderFieldMetaEntryLines(entry = {}) {
1513
1513
  const lines = ["RESOURCE_FIELD_META.push({"];
1514
1514
  const topLevelProperties = [`key: ${JSON.stringify(entry.key)}`];
1515
1515
  const repositoryColumn = normalizeText(entry?.repository?.column);
1516
- if (repositoryColumn) {
1517
- topLevelProperties.push([
1516
+ const repositoryWriteSerializer = normalizeText(entry?.repository?.writeSerializer);
1517
+ if (repositoryColumn || repositoryWriteSerializer) {
1518
+ const repositoryLines = [
1518
1519
  "repository: {",
1519
- ` column: ${JSON.stringify(repositoryColumn)}`,
1520
- "}"
1521
- ].join("\n"));
1520
+ ...(repositoryColumn ? [` column: ${JSON.stringify(repositoryColumn)}`] : []),
1521
+ ...(repositoryWriteSerializer ? [` writeSerializer: ${JSON.stringify(repositoryWriteSerializer)}`] : [])
1522
+ ];
1523
+ if (repositoryLines.length > 2) {
1524
+ repositoryLines[repositoryLines.length - 1] = repositoryLines[repositoryLines.length - 1].replace(/,$/, "");
1525
+ }
1526
+ repositoryLines.push("}");
1527
+ for (let index = 1; index < repositoryLines.length - 1; index += 1) {
1528
+ if (index < repositoryLines.length - 2) {
1529
+ repositoryLines[index] = `${repositoryLines[index]},`;
1530
+ }
1531
+ }
1532
+ topLevelProperties.push(repositoryLines.join("\n"));
1522
1533
  }
1523
1534
 
1524
1535
  const relation = entry.relation && typeof entry.relation === "object" ? entry.relation : null;
@@ -1824,7 +1835,6 @@ function buildReplacementsFromSnapshot({
1824
1835
  const needsRecordIdSchemas = resourceColumns.some((column) => column.typeKind === "integer" && column.isRecordIdColumn === true);
1825
1836
  const needsFiniteNumber = resourceColumns.some((column) => column.typeKind === "number");
1826
1837
  const needsDateTimeOutput = outputColumns.some((column) => column.typeKind === "datetime");
1827
- const needsDateTimeInput = writableColumns.some((column) => column.typeKind === "datetime");
1828
1838
  const needsNullableDateTimeInput = writableColumns.some(
1829
1839
  (column) => column.typeKind === "datetime" && column.nullable === true
1830
1840
  );
@@ -1936,8 +1946,8 @@ function buildReplacementsFromSnapshot({
1936
1946
  )
1937
1947
  }),
1938
1948
  __JSKIT_CRUD_RESOURCE_DATABASE_RUNTIME_IMPORT__: renderResourceDatabaseRuntimeImport({
1939
- needsToIsoString: needsDateTimeOutput || needsDate,
1940
- needsToDatabaseDateTimeUtc: needsDateTimeInput
1949
+ needsToIsoString: needsDateTimeOutput || needsDate || writableColumns.some((column) => column.typeKind === "datetime"),
1950
+ needsToDatabaseDateTimeUtc: false
1941
1951
  }),
1942
1952
  __JSKIT_CRUD_RESOURCE_NORMALIZE_SUPPORT_IMPORT__: renderResourceNormalizeSupportImport({
1943
1953
  needsNormalizeText,
@@ -1,7 +1,6 @@
1
1
  import { Type } from "typebox";
2
2
  import {
3
- toIsoString,
4
- toDatabaseDateTimeUtc
3
+ toIsoString
5
4
  } from "@jskit-ai/database-runtime/shared";
6
5
  import {
7
6
  normalizeObjectInput,
@@ -100,7 +99,7 @@ const createBodyValidator = Object.freeze({
100
99
  normalized.textField = normalizeText(source.textField);
101
100
  }
102
101
  if (Object.hasOwn(source, "dateField")) {
103
- normalized.dateField = toDatabaseDateTimeUtc(source.dateField);
102
+ normalized.dateField = toIsoString(source.dateField);
104
103
  }
105
104
  if (Object.hasOwn(source, "numberField")) {
106
105
  normalized.numberField = normalizeFiniteNumber(source.numberField);
@@ -2,8 +2,10 @@ import { createCrudResourceRuntime } from "@jskit-ai/crud-core/server/resourceRu
2
2
  import { resource } from "../shared/${option:namespace|singular|camel}Resource.js";
3
3
  import { LIST_CONFIG } from "./listConfig.js";
4
4
 
5
+ const REPOSITORY_CONTEXT = "${option:namespace|snake} repository";
6
+
5
7
  const REPOSITORY_CONFIG = Object.freeze({
6
- context: "${option:namespace|snake} repository",
8
+ context: REPOSITORY_CONTEXT,
7
9
  list: LIST_CONFIG
8
10
  });
9
11
 
@@ -952,7 +952,7 @@ test("buildReplacementsFromSnapshot normalizes nullable temporal inputs without
952
952
 
953
953
  assert.match(
954
954
  replacements.__JSKIT_CRUD_RESOURCE_INPUT_NORMALIZATION_LINES__,
955
- /normalizeIfInSource\(source, normalized, "scheduledAt", \(value\) => \{ const normalized = normalizeText\(value\); return normalized \? toDatabaseDateTimeUtc\(normalized\) : null; \}\);/
955
+ /normalizeIfInSource\(source, normalized, "scheduledAt", \(value\) => \{ const normalized = normalizeText\(value\); return normalized \? toIsoString\(normalized\) : null; \}\);/
956
956
  );
957
957
  assert.match(
958
958
  replacements.__JSKIT_CRUD_RESOURCE_INPUT_NORMALIZATION_LINES__,
@@ -962,6 +962,10 @@ test("buildReplacementsFromSnapshot normalizes nullable temporal inputs without
962
962
  replacements.__JSKIT_CRUD_RESOURCE_INPUT_NORMALIZATION_LINES__,
963
963
  /normalizeIfInSource\(source, normalized, "preferredTime", \(value\) => \{ const normalized = normalizeText\(value\); return normalized \|\| null; \}\);/
964
964
  );
965
+ assert.doesNotMatch(
966
+ replacements.__JSKIT_CRUD_RESOURCE_FIELD_META_PUSH_LINES__,
967
+ /writeSerializer: "datetime-utc"/
968
+ );
965
969
  });
966
970
 
967
971
  test("crud repository template defines explicit one-line CRUD methods over repository primitives", async () => {
@@ -11,7 +11,7 @@ test("crudResource normalizes create payload", () => {
11
11
 
12
12
  assert.deepEqual(normalized, {
13
13
  textField: "Example text",
14
- dateField: "2026-03-11 00:00:00.000",
14
+ dateField: "2026-03-11T00:00:00.000Z",
15
15
  numberField: 42.5
16
16
  });
17
17
  });