@lunora/codegen 1.0.0-alpha.53 → 1.0.0-alpha.55

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/dist/index.d.mts CHANGED
@@ -2505,7 +2505,12 @@ interface SchemaDrift {
2505
2505
  /**
2506
2506
  * Build a {@link SchemaSnapshot} from a parsed {@link SchemaIR} and the set of
2507
2507
  * declared migration ids. Tables and migration ids are sorted so the emitted
2508
- * JSON is byte-stable across runs (no spurious diffs / churn).
2508
+ * JSON is byte-stable across runs AND across machines (no spurious diffs /
2509
+ * churn) — see {@link sortKeys} for why that ordering must not be locale-aware.
2510
+ *
2511
+ * Field / index / relation keys are deliberately NOT sorted: they are emitted in
2512
+ * declaration order from the schema source, which is already deterministic for a
2513
+ * given source file and keeps the snapshot readable next to the schema it mirrors.
2509
2514
  */
2510
2515
  declare const buildSchemaSnapshot: (schema: SchemaIR, migrationIds: ReadonlyArray<string>) => SchemaSnapshot;
2511
2516
  /** Serialize a snapshot to the exact bytes written to `lunora/.lunora-schema.json` (trailing newline). */
package/dist/index.d.ts CHANGED
@@ -2505,7 +2505,12 @@ interface SchemaDrift {
2505
2505
  /**
2506
2506
  * Build a {@link SchemaSnapshot} from a parsed {@link SchemaIR} and the set of
2507
2507
  * declared migration ids. Tables and migration ids are sorted so the emitted
2508
- * JSON is byte-stable across runs (no spurious diffs / churn).
2508
+ * JSON is byte-stable across runs AND across machines (no spurious diffs /
2509
+ * churn) — see {@link sortKeys} for why that ordering must not be locale-aware.
2510
+ *
2511
+ * Field / index / relation keys are deliberately NOT sorted: they are emitted in
2512
+ * declaration order from the schema source, which is already deterministic for a
2513
+ * given source file and keeps the snapshot readable next to the schema it mirrors.
2509
2514
  */
2510
2515
  declare const buildSchemaSnapshot: (schema: SchemaIR, migrationIds: ReadonlyArray<string>) => SchemaSnapshot;
2511
2516
  /** Serialize a snapshot to the exact bytes written to `lunora/.lunora-schema.json` (trailing newline). */
package/dist/index.mjs CHANGED
@@ -26,8 +26,8 @@ export { G as GENERATED_HEADER, e as emitAgents, a as emitApi, b as emitCollecti
26
26
  export { emitApp } from './packem_shared/emitApp-DbMM8iHe.mjs';
27
27
  export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-DCQSLuFc.mjs';
28
28
  export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-DvDChMhC.mjs';
29
- export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME--TKFIHmr.mjs';
30
- export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
29
+ export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-YAL6GrxI.mjs';
30
+ export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-DGD73E_n.mjs';
31
31
  export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
32
32
  export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-DvTLozCu.mjs';
33
33
  export { redact, secretKindOf } from './packem_shared/redact-oTmsol5A.mjs';
@@ -33,7 +33,7 @@ import { discoverWorkflows } from './WORKFLOWS_FILENAME-Dtuzvluc.mjs';
33
33
  import { emitApp } from './emitApp-DbMM8iHe.mjs';
34
34
  import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-DCQSLuFc.mjs';
35
35
  import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-DvDChMhC.mjs';
36
- import { buildSchemaSnapshot, serializeSchemaSnapshot } from './SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
36
+ import { buildSchemaSnapshot, serializeSchemaSnapshot } from './SCHEMA_SNAPSHOT_VERSION-DGD73E_n.mjs';
37
37
 
38
38
  const HTTP_VERBS$1 = /* @__PURE__ */ new Set(["delete", "get", "head", "options", "patch", "post", "put"]);
39
39
  const TERMINAL_STEPS$1 = /* @__PURE__ */ new Set(["handler", "stream"]);
@@ -30,7 +30,9 @@ const tableSnapshotOf = (table) => {
30
30
  };
31
31
  const sortKeys = (record) => {
32
32
  const sorted = {};
33
- for (const key of Object.keys(record).toSorted((a, b) => a.localeCompare(b))) {
33
+ const keys = Object.keys(record);
34
+ keys.sort();
35
+ for (const key of keys) {
34
36
  sorted[key] = record[key];
35
37
  }
36
38
  return sorted;
@@ -40,9 +42,10 @@ const buildSchemaSnapshot = (schema, migrationIds) => {
40
42
  for (const table of schema.tables) {
41
43
  tables[table.name] = tableSnapshotOf(table);
42
44
  }
45
+ const sortedMigrationIds = [...migrationIds].sort();
43
46
  return {
44
47
  jurisdiction: schema.jurisdiction,
45
- migrationIds: [...migrationIds].toSorted((a, b) => a.localeCompare(b)),
48
+ migrationIds: sortedMigrationIds,
46
49
  tables: sortKeys(tables),
47
50
  version: SCHEMA_SNAPSHOT_VERSION
48
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.53",
3
+ "version": "1.0.0-alpha.55",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,14 +46,14 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/advisor": "1.0.0-alpha.33",
50
- "@lunora/agent": "1.0.0-alpha.9",
51
- "@lunora/container": "1.0.0-alpha.15",
52
- "@lunora/errors": "1.0.0-alpha.7",
53
- "@lunora/queue": "1.0.0-alpha.9",
54
- "@lunora/scheduler": "1.0.0-alpha.11",
55
- "@lunora/values": "1.0.0-alpha.10",
56
- "@lunora/workflow": "1.0.0-alpha.12",
49
+ "@lunora/advisor": "1.0.0-alpha.34",
50
+ "@lunora/agent": "1.0.0-alpha.10",
51
+ "@lunora/container": "1.0.0-alpha.16",
52
+ "@lunora/errors": "1.0.0-alpha.8",
53
+ "@lunora/queue": "1.0.0-alpha.10",
54
+ "@lunora/scheduler": "1.0.0-alpha.12",
55
+ "@lunora/values": "1.0.0-alpha.11",
56
+ "@lunora/workflow": "1.0.0-alpha.13",
57
57
  "ts-morph": "^28.0.0"
58
58
  },
59
59
  "engines": {