neoorm 0.9.7 → 0.9.8

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 (149) hide show
  1. package/dist/codegen/diff-manifest.js +1 -1
  2. package/dist/codegen/diff-manifest.js.map +1 -1
  3. package/dist/codegen/emit-includes.d.ts.map +1 -1
  4. package/dist/codegen/emit-includes.js +11 -8
  5. package/dist/codegen/emit-includes.js.map +1 -1
  6. package/dist/codegen/emit-models.d.ts.map +1 -1
  7. package/dist/codegen/emit-models.js +9 -8
  8. package/dist/codegen/emit-models.js.map +1 -1
  9. package/dist/codegen/emit-query-types.d.ts.map +1 -1
  10. package/dist/codegen/emit-query-types.js +18 -16
  11. package/dist/codegen/emit-query-types.js.map +1 -1
  12. package/dist/codegen/manifest-relations.d.ts.map +1 -1
  13. package/dist/codegen/manifest-relations.js +2 -1
  14. package/dist/codegen/manifest-relations.js.map +1 -1
  15. package/dist/codegen/schema-to-manifest.d.ts.map +1 -1
  16. package/dist/codegen/schema-to-manifest.js +109 -8
  17. package/dist/codegen/schema-to-manifest.js.map +1 -1
  18. package/dist/codegen/ts-syntax.d.ts +12 -0
  19. package/dist/codegen/ts-syntax.d.ts.map +1 -0
  20. package/dist/codegen/ts-syntax.js +24 -0
  21. package/dist/codegen/ts-syntax.js.map +1 -0
  22. package/dist/codegen/validation/emit-elysia.d.ts.map +1 -1
  23. package/dist/codegen/validation/emit-elysia.js +5 -4
  24. package/dist/codegen/validation/emit-elysia.js.map +1 -1
  25. package/dist/codegen/validation/emit-typebox.d.ts.map +1 -1
  26. package/dist/codegen/validation/emit-typebox.js +5 -4
  27. package/dist/codegen/validation/emit-typebox.js.map +1 -1
  28. package/dist/codegen/validation/emit-zod.d.ts.map +1 -1
  29. package/dist/codegen/validation/emit-zod.js +5 -4
  30. package/dist/codegen/validation/emit-zod.js.map +1 -1
  31. package/dist/codegen/validation/from-manifest.d.ts.map +1 -1
  32. package/dist/codegen/validation/from-manifest.js +26 -9
  33. package/dist/codegen/validation/from-manifest.js.map +1 -1
  34. package/dist/config.d.ts.map +1 -1
  35. package/dist/config.js +8 -1
  36. package/dist/config.js.map +1 -1
  37. package/dist/dialect/mariadb.test.js +28 -1
  38. package/dist/dialect/mariadb.test.js.map +1 -1
  39. package/dist/dialect/mysql-family.js +6 -6
  40. package/dist/dialect/mysql-family.js.map +1 -1
  41. package/dist/dialect/mysql.test.js +33 -1
  42. package/dist/dialect/mysql.test.js.map +1 -1
  43. package/dist/dialect/postgres.js +1 -1
  44. package/dist/dialect/postgres.js.map +1 -1
  45. package/dist/dialect/sqlite.js +1 -1
  46. package/dist/dialect/sqlite.js.map +1 -1
  47. package/dist/dialect/types.d.ts +1 -1
  48. package/dist/dialect/types.d.ts.map +1 -1
  49. package/dist/init/prompt.d.ts.map +1 -1
  50. package/dist/init/prompt.js +14 -3
  51. package/dist/init/prompt.js.map +1 -1
  52. package/dist/init/scaffold.d.ts.map +1 -1
  53. package/dist/init/scaffold.js +31 -4
  54. package/dist/init/scaffold.js.map +1 -1
  55. package/dist/init/templates.d.ts +5 -0
  56. package/dist/init/templates.d.ts.map +1 -1
  57. package/dist/init/templates.js +33 -6
  58. package/dist/init/templates.js.map +1 -1
  59. package/dist/init/validate.d.ts +3 -1
  60. package/dist/init/validate.d.ts.map +1 -1
  61. package/dist/init/validate.js +61 -4
  62. package/dist/init/validate.js.map +1 -1
  63. package/dist/introspect/pull.d.ts.map +1 -1
  64. package/dist/introspect/pull.js +27 -14
  65. package/dist/introspect/pull.js.map +1 -1
  66. package/dist/migrate/runner.d.ts +4 -1
  67. package/dist/migrate/runner.d.ts.map +1 -1
  68. package/dist/migrate/runner.js +117 -24
  69. package/dist/migrate/runner.js.map +1 -1
  70. package/dist/runtime/client.d.ts.map +1 -1
  71. package/dist/runtime/client.js +2 -0
  72. package/dist/runtime/client.js.map +1 -1
  73. package/dist/runtime/client.test.js +43 -0
  74. package/dist/runtime/client.test.js.map +1 -1
  75. package/dist/runtime/driver-sqlite.test.js +71 -0
  76. package/dist/runtime/driver-sqlite.test.js.map +1 -1
  77. package/dist/runtime/driver.d.ts.map +1 -1
  78. package/dist/runtime/driver.js +25 -28
  79. package/dist/runtime/driver.js.map +1 -1
  80. package/dist/runtime/error-hints.d.ts.map +1 -1
  81. package/dist/runtime/error-hints.js +19 -15
  82. package/dist/runtime/error-hints.js.map +1 -1
  83. package/dist/runtime/errors.d.ts +6 -0
  84. package/dist/runtime/errors.d.ts.map +1 -1
  85. package/dist/runtime/errors.js +60 -21
  86. package/dist/runtime/errors.js.map +1 -1
  87. package/dist/runtime/executor.d.ts.map +1 -1
  88. package/dist/runtime/executor.js +16 -17
  89. package/dist/runtime/executor.js.map +1 -1
  90. package/dist/runtime/mariadb-driver.d.ts.map +1 -1
  91. package/dist/runtime/mariadb-driver.js +12 -15
  92. package/dist/runtime/mariadb-driver.js.map +1 -1
  93. package/dist/runtime/mysql-driver.d.ts.map +1 -1
  94. package/dist/runtime/mysql-driver.js +12 -15
  95. package/dist/runtime/mysql-driver.js.map +1 -1
  96. package/dist/runtime/mysql-family-pool.test.js +93 -0
  97. package/dist/runtime/mysql-family-pool.test.js.map +1 -1
  98. package/dist/runtime/pg-rollback.test.js +42 -0
  99. package/dist/runtime/pg-rollback.test.js.map +1 -1
  100. package/dist/runtime/query/table-index.d.ts +1 -1
  101. package/dist/runtime/query/table-index.d.ts.map +1 -1
  102. package/dist/runtime/query/table-index.js +2 -1
  103. package/dist/runtime/query/table-index.js.map +1 -1
  104. package/dist/runtime/sqlite-open.d.ts +5 -0
  105. package/dist/runtime/sqlite-open.d.ts.map +1 -1
  106. package/dist/runtime/sqlite-open.js +11 -3
  107. package/dist/runtime/sqlite-open.js.map +1 -1
  108. package/dist/runtime/transaction.d.ts +16 -0
  109. package/dist/runtime/transaction.d.ts.map +1 -1
  110. package/dist/runtime/transaction.js +50 -0
  111. package/dist/runtime/transaction.js.map +1 -1
  112. package/dist/runtime/transaction.test.js +50 -1
  113. package/dist/runtime/transaction.test.js.map +1 -1
  114. package/dist/schema/index.d.ts +1 -1
  115. package/dist/schema/index.d.ts.map +1 -1
  116. package/dist/schema/index.js.map +1 -1
  117. package/dist/schema/relation-types.d.ts +22 -1
  118. package/dist/schema/relation-types.d.ts.map +1 -1
  119. package/dist/studio/server.d.ts.map +1 -1
  120. package/dist/studio/server.js +1 -0
  121. package/dist/studio/server.js.map +1 -1
  122. package/dist/utils/case.js +1 -1
  123. package/dist/utils/case.js.map +1 -1
  124. package/dist/utils/dotenv.d.ts +5 -0
  125. package/dist/utils/dotenv.d.ts.map +1 -1
  126. package/dist/utils/dotenv.js +100 -24
  127. package/dist/utils/dotenv.js.map +1 -1
  128. package/dist/utils/dotenv.test.js +73 -2
  129. package/dist/utils/dotenv.test.js.map +1 -1
  130. package/dist/utils/inflect.d.ts.map +1 -1
  131. package/dist/utils/inflect.js +12 -0
  132. package/dist/utils/inflect.js.map +1 -1
  133. package/dist/utils/load-ts.d.ts.map +1 -1
  134. package/dist/utils/load-ts.js +4 -3
  135. package/dist/utils/load-ts.js.map +1 -1
  136. package/dist/utils/load-ts.test.d.ts +2 -0
  137. package/dist/utils/load-ts.test.d.ts.map +1 -0
  138. package/dist/utils/load-ts.test.js +17 -0
  139. package/dist/utils/load-ts.test.js.map +1 -0
  140. package/docs/cli.md +3 -3
  141. package/docs/configuration.md +2 -2
  142. package/docs/getting-started.md +1 -1
  143. package/docs/mariadb.md +2 -1
  144. package/docs/migrations.md +3 -1
  145. package/docs/mysql.md +2 -1
  146. package/docs/sqlite.md +2 -2
  147. package/docs/transactions.md +1 -1
  148. package/llms-full.txt +16 -12
  149. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dotenv.js","sourceRoot":"","sources":["../../src/utils/dotenv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,kBAAkB,C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AC/B,MAAM,GAAG,CAAC;IACX,CAAC;IACD,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC"}
@@ -1,5 +1,7 @@
1
- import { describe, expect, it } from "vitest";
2
- import { parseDotEnv } from "./dotenv.js";
1
+ import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
4
+ import { loadDotEnvSync, parseDotEnv } from "./dotenv.js";
3
5
  describe("parseDotEnv", () => {
4
6
  it("parses KEY=VALUE, comments, export, and quotes", () => {
5
7
  expect(parseDotEnv(`
@@ -28,5 +30,74 @@ INVALID
28
30
  TAB: "a\tb",
29
31
  });
30
32
  });
33
+ it("keeps an escaped backslash before n as a backslash", () => {
34
+ expect(parseDotEnv('PATH="C:\\\\neoorm\\\\dev.db"\n')).toEqual({
35
+ PATH: "C:\\neoorm\\dev.db",
36
+ });
37
+ expect(parseDotEnv('A="\\\\n"\nB="\\\\t"\nC="\\\\\\\\"\n')).toEqual({
38
+ A: "\\n",
39
+ B: "\\t",
40
+ C: "\\\\",
41
+ });
42
+ });
43
+ it("accepts export separated by a tab", () => {
44
+ expect(parseDotEnv("export\tKEY=value\n")).toEqual({ KEY: "value" });
45
+ expect(parseDotEnv("export=kept\n")).toEqual({ export: "kept" });
46
+ });
47
+ it("strips an inline comment glued to a closing quote", () => {
48
+ expect(parseDotEnv("A='abc'#c\nB=\"abc\"#c\nD='abc' #c\n")).toEqual({
49
+ A: "abc",
50
+ B: "abc",
51
+ D: "abc",
52
+ });
53
+ });
54
+ });
55
+ describe("loadDotEnvSync", () => {
56
+ const tmpRoot = join(process.cwd(), "test", ".tmp");
57
+ let tmpDir;
58
+ beforeEach(async () => {
59
+ await mkdir(tmpRoot, { recursive: true });
60
+ tmpDir = await mkdtemp(join(tmpRoot, "neoorm-dotenv-"));
61
+ });
62
+ afterEach(async () => {
63
+ await rm(tmpDir, { recursive: true, force: true });
64
+ });
65
+ it("loads unset variables from cwd/.env", async () => {
66
+ const previous = process.env.NEOORM_DOTENV_SYNC_TEST;
67
+ delete process.env.NEOORM_DOTENV_SYNC_TEST;
68
+ await writeFile(join(tmpDir, ".env"), "NEOORM_DOTENV_SYNC_TEST=from-file\n");
69
+ try {
70
+ loadDotEnvSync(tmpDir);
71
+ expect(process.env.NEOORM_DOTENV_SYNC_TEST).toBe("from-file");
72
+ }
73
+ finally {
74
+ if (previous === undefined) {
75
+ delete process.env.NEOORM_DOTENV_SYNC_TEST;
76
+ }
77
+ else {
78
+ process.env.NEOORM_DOTENV_SYNC_TEST = previous;
79
+ }
80
+ }
81
+ });
82
+ it("does not overwrite variables already set in the environment", async () => {
83
+ const previous = process.env.NEOORM_DOTENV_SYNC_TEST;
84
+ process.env.NEOORM_DOTENV_SYNC_TEST = "from-shell";
85
+ await writeFile(join(tmpDir, ".env"), "NEOORM_DOTENV_SYNC_TEST=from-file\n");
86
+ try {
87
+ loadDotEnvSync(tmpDir);
88
+ expect(process.env.NEOORM_DOTENV_SYNC_TEST).toBe("from-shell");
89
+ }
90
+ finally {
91
+ if (previous === undefined) {
92
+ delete process.env.NEOORM_DOTENV_SYNC_TEST;
93
+ }
94
+ else {
95
+ process.env.NEOORM_DOTENV_SYNC_TEST = previous;
96
+ }
97
+ }
98
+ });
99
+ it("ignores a missing .env file", () => {
100
+ expect(() => loadDotEnvSync(tmpDir)).not.toThrow();
101
+ });
31
102
  });
32
103
  //# sourceMappingURL=dotenv.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dotenv.test.js","sourceRoot":"","sources":["../../src/utils/dotenv.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACzD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AAI,CAAC,MAAM,EAAE,MAAM,CAAC,EACpB,qCAAqC,CACrC,CAAC;QACF,IAAI,CAAC;YACJ,cAAc,CAAC,MAAM,CAAC,CAAC;YACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAChE,CAAC;gBAAS,CAAC;YACV,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,QAAQ,CAAC;YAChD,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inflect.d.ts","sourceRoot":"","sources":["../../src/utils/inflect.ts"],"names":[],"mappings":"AAkDA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkChD"}
1
+ {"version":3,"file":"inflect.d.ts","sourceRoot":"","sources":["../../src/utils/inflect.ts"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmChD"}
@@ -14,6 +14,7 @@ const UNCOUNTABLE = new Set([
14
14
  "salmon",
15
15
  "trout",
16
16
  ]);
17
+ /** Keep in sync with `IrregularSingular` in `src/schema/relation-types.ts`. */
17
18
  const IRREGULAR_SINGULAR = {
18
19
  people: "person",
19
20
  children: "child",
@@ -23,6 +24,16 @@ const IRREGULAR_SINGULAR = {
23
24
  geese: "goose",
24
25
  teeth: "tooth",
25
26
  feet: "foot",
27
+ // -ie nouns add -s; reversing consonant+ies → y would emit cooky/movy.
28
+ cookies: "cookie",
29
+ movies: "movie",
30
+ zombies: "zombie",
31
+ hoodies: "hoodie",
32
+ calories: "calorie",
33
+ selfies: "selfie",
34
+ rookies: "rookie",
35
+ brownies: "brownie",
36
+ smoothies: "smoothie",
26
37
  };
27
38
  const CONSONANT = "bcdfghjklmnpqrstvwxz";
28
39
  function applyCasing(sample, replacement) {
@@ -56,6 +67,7 @@ export function singularize(word) {
56
67
  const irregular = IRREGULAR_SINGULAR[lower];
57
68
  if (irregular !== undefined)
58
69
  return applyCasing(word, irregular);
70
+ // cities → city (consonant + y). Not cookie/movie — those are irregular.
59
71
  if (word.length > 4 &&
60
72
  isConsonant(word.charAt(word.length - 4)) &&
61
73
  /ies$/i.test(word)) {
@@ -1 +1 @@
1
- {"version":3,"file":"inflect.js","sourceRoot":"","sources":["../../src/utils/inflect.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,cAAc;IACd,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACP,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAA2B;IAClD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,OAAO;IACjB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACZ,CAAC;AAEF,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC,SAAS,WAAW,CAAC,MAAc,EAAE,WAAmB;IACvD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAC5C,IAAI,MAAM,KAAK,MAAM,CAAC,WAA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IAC1B,CAAC;IAED,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAE3C,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"load-ts.d.ts","sourceRoot":"","sources":["../../src/utils/load-ts.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,UAAU,EAAE,MAAM,GAChB,OAAO,CAYT;AAED,wBAAsB,cAAc,CACnC,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAOlC"}
1
+ {"version":3,"file":"load-ts.d.ts","sourceRoot":"","sources":["../../src/utils/load-ts.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,UAAU,EAAE,MAAM,GAChB,OAAO,CAaT;AAED,wBAAsB,cAAc,CACnC,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAOlC"}
@@ -6,9 +6,10 @@ export function resolveModuleExport(mod, exportName) {
6
6
  }
7
7
  const nested = mod.default;
8
8
  if (nested !== null && typeof nested === "object") {
9
- const record = nested;
10
- const fromDefault = record[exportName];
11
- return fromDefault !== undefined ? fromDefault : nested;
9
+ const fromDefault = nested[exportName];
10
+ if (fromDefault !== undefined) {
11
+ return fromDefault;
12
+ }
12
13
  }
13
14
  return undefined;
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"load-ts.js","sourceRoot":"","sources":["../../src/utils/load-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,mBAAmB,CAClC,GAA4B,EAC5B,UAAkB;IAElB,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,MAAiC,CAAC;QACjD,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,OAAO,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;IACzD,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,QAAgB;IAEhB,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IACzC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,GAAG,CAAqC,CAAC;IACxD,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,CAAqC,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"load-ts.js","sourceRoot":"","sources":["../../src/utils/load-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,mBAAmB,CAClC,GAA4B,EAC5B,UAAkB;IAElB,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,WAAW,GAAI,MAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,QAAgB;IAEhB,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IACzC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,GAAG,CAAqC,CAAC;IACxD,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,CAAqC,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=load-ts.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-ts.test.d.ts","sourceRoot":"","sources":["../../src/utils/load-ts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { resolveModuleExport } from "./load-ts.js";
3
+ describe("resolveModuleExport", () => {
4
+ it("returns a direct named export", () => {
5
+ expect(resolveModuleExport({ schema: "direct" }, "schema")).toBe("direct");
6
+ });
7
+ it("reads the named export from the default object", () => {
8
+ expect(resolveModuleExport({ default: { schema: "nested" } }, "schema")).toBe("nested");
9
+ });
10
+ it("returns undefined when the named export is missing", () => {
11
+ const whole = { other: 1, _tables: { users: {} } };
12
+ expect(resolveModuleExport({ default: whole }, "schema")).toBeUndefined();
13
+ expect(resolveModuleExport({}, "schema")).toBeUndefined();
14
+ expect(resolveModuleExport({ default: null }, "schema")).toBeUndefined();
15
+ });
16
+ });
17
+ //# sourceMappingURL=load-ts.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-ts.test.js","sourceRoot":"","sources":["../../src/utils/load-ts.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAC/D,QAAQ,CACR,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACzD,MAAM,CACL,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAChE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC7D,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;QACnD,MAAM,CACL,mBAAmB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CACjD,CAAC,aAAa,EAAE,CAAC;QAClB,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC1D,MAAM,CACL,mBAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAChD,CAAC,aAAa,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/docs/cli.md CHANGED
@@ -16,9 +16,9 @@ On a TTY, `neoorm init` opens a Clack wizard (provider, database URL, schema pat
16
16
 
17
17
  Options:
18
18
  - `--provider <provider>` — `postgresql` (default), `sqlite`, `mysql`, or `mariadb`. `postgres` and `pg` are aliases of `postgresql`. If omitted on a TTY, prompts to choose.
19
- - `--database-url <url>` — override database URL / file path (default: `postgresql://postgres:postgres@localhost:5432/myapp` for postgres, `./dev.db` for sqlite, `mysql://root@localhost:3306/myapp` for mysql, `mariadb://root@localhost:3306/myapp` for mariadb)
20
- - `--schema <path>` — schema file path (default: `./schema.ts`). Must end in `.ts`, `.mts`, or `.cts`.
21
- - `--out <dir>` — generated output directory (default: `./neoorm`). Cannot be the same path as the schema file.
19
+ - `--database-url <url>` — override database URL / file path (default: `postgresql://postgres:postgres@localhost:5432/myapp` for postgres, `./dev.db` for sqlite, `mysql://root@localhost:3306/myapp` for mysql, `mariadb://root@localhost:3306/myapp` for mariadb). Control characters are rejected. Quotes, whitespace, and backslashes are escaped in `neoorm.config.ts` and `.env.example`. When the provider is sqlite, a non-SQLite `scheme://` URL is rejected.
20
+ - `--schema <path>` — schema file path (default: `./schema.ts`). Must end in `.ts`, `.mts`, or `.cts`, stay inside the project directory, and must not be `neoorm.config.ts`.
21
+ - `--out <dir>` — generated output directory (default: `./neoorm`). Must stay inside the project directory, and cannot be the project directory, the schema file, or `neoorm.config.ts`.
22
22
  - `--force` — overwrite existing scaffold files without confirming
23
23
 
24
24
  ## `neoorm generate`
@@ -18,7 +18,7 @@ export default defineConfig({
18
18
  });
19
19
  ```
20
20
 
21
- CLI commands load `.env` from the project directory before evaluating this file, so `process.env.DATABASE_URL` is set after `cp .env.example .env`. Variables already present in the environment are not overwritten. The generated client does not load `.env` at query time — use your runtime or a loader such as `node --env-file=.env`.
21
+ CLI commands load `.env` from the project directory before evaluating this file, so `process.env.DATABASE_URL` is set after `cp .env.example .env`. `createNeoOrmClient` (including the generated `db`) does the same from `process.cwd()` before it picks a connection URL, so a later `.env` edit is used without regenerating. Variables already present in the environment are not overwritten. The URL stored on the manifest / `snapshot.json` is only the fallback when `DATABASE_URL` is unset.
22
22
 
23
23
  ## Options
24
24
 
@@ -42,7 +42,7 @@ Set `generate.zod` to write `out/zod.ts`, `generate.typebox` to write `out/typeb
42
42
 
43
43
  ### SQLite
44
44
 
45
- Set `provider: "sqlite"` and `url` to a file path or `":memory:"`:
45
+ Set `provider: "sqlite"` and `url` to a file path, a `file:` or `sqlite:` URI, or `":memory:"`. A `postgresql://`, `mysql://`, or other connection URL is rejected so it is not opened as a filename or silently dropped:
46
46
 
47
47
  ```ts
48
48
  datasource: {
@@ -14,7 +14,7 @@ cp .env.example .env
14
14
  bunx neoorm migrate dev
15
15
  ```
16
16
 
17
- The CLI loads `.env` automatically. You do not need to export `DATABASE_URL` in the shell first.
17
+ The CLI and the generated client both load `.env` automatically. You do not need to export `DATABASE_URL` in the shell first. Editing `.env` is enough for the next process that creates a client; you do not need to regenerate.
18
18
 
19
19
  Browse and edit data with Studio:
20
20
 
package/docs/mariadb.md CHANGED
@@ -79,7 +79,8 @@ bunx neoorm migrate status
79
79
  bunx neoorm migrate reset --force
80
80
  ```
81
81
 
82
- - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy transaction.
82
+ - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection.
83
+ - InnoDB DDL autocommits. A failed `migrate deploy` can leave tables without a ledger row — use `migrate reset --force` locally or `migrate dev` catch-up. See [Migrations](migrations.md).
83
84
  - `migrate reset` sets `FOREIGN_KEY_CHECKS=0`, drops all tables in the current database, then re-enables checks and re-applies migrations.
84
85
  - `db pull` introspects `information_schema`. MariaDB `JSON` columns are often `LONGTEXT` plus a `json_valid()` CHECK; NeoOrm maps those back to `jsonb()`.
85
86
 
@@ -61,7 +61,9 @@ neoorm migrate diff --json
61
61
  | MySQL | `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection |
62
62
  | MariaDB | `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection |
63
63
 
64
- The ledger table `_neoorm_migrations` stores `name` and `checksum`. Editing an already-applied `migration.sql` is rejected (`migration_guard`) — restore the original file or add a new migration. Pending migrations in one deploy run apply in that locked transaction; if a later statement fails, none of that run's new ledger rows remain.
64
+ The ledger table `_neoorm_migrations` stores `name`, a SHA-256 `checksum` of `migration.sql`, and `down_checksum` for `down.sql`. Deploy refuses a missing `migration.sql`, a null checksum, or a checksum that does not match the file. It also refuses a pending migration that sorts before one already applied, so an earlier file cannot run after a later one. `migrate down` runs `down.sql` only when its checksum matches the value stored at apply time.
65
+
66
+ PostgreSQL and SQLite apply pending files inside the deploy lock transaction: if a later statement fails, none of that run's new ledger rows remain. MySQL and MariaDB cannot roll back InnoDB DDL (`CREATE TABLE`, `ALTER`, `CREATE INDEX`) — each statement autocommits. A failed file can leave tables without a matching `_neoorm_migrations` row. Recover locally with `neoorm migrate reset --force`, or in development with `neoorm migrate dev` catch-up. `GET_LOCK` is session-scoped and still serializes concurrent deploys; migration SQL does not run under a savepoint.
65
67
 
66
68
  ## Status
67
69
 
package/docs/mysql.md CHANGED
@@ -79,7 +79,8 @@ bunx neoorm migrate status
79
79
  bunx neoorm migrate reset --force
80
80
  ```
81
81
 
82
- - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy transaction.
82
+ - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection.
83
+ - InnoDB DDL autocommits. A failed `migrate deploy` can leave tables without a ledger row — use `migrate reset --force` locally or `migrate dev` catch-up. See [Migrations](migrations.md).
83
84
  - `migrate reset` sets `FOREIGN_KEY_CHECKS=0`, drops all tables in the current database, then re-enables checks and re-applies migrations.
84
85
  - `db pull` introspects `information_schema` back into a schema file.
85
86
 
package/docs/sqlite.md CHANGED
@@ -16,7 +16,7 @@ If none is available, creating a client throws: `No SQLite driver available. Pro
16
16
 
17
17
  ## Configuration
18
18
 
19
- Set `provider: "sqlite"` and point `url` at a file path or `:memory:`:
19
+ Set `provider: "sqlite"` and point `url` at a file path, a `file:` or `sqlite:` URI, or `:memory:`. A `postgresql://`, `mysql://`, or other connection URL is rejected:
20
20
 
21
21
  ```ts
22
22
  // neoorm.config.ts
@@ -97,7 +97,7 @@ bunx neoorm migrate status
97
97
  bunx neoorm migrate reset --force
98
98
  ```
99
99
 
100
- - The migration ledger table is `_neoorm_migrations` (`id INTEGER PRIMARY KEY AUTOINCREMENT`, `name`, `checksum`, `applied_at`). `migrate deploy` wraps the run in `BEGIN IMMEDIATE` and refuses an edited `migration.sql` whose checksum no longer matches the ledger.
100
+ - The migration ledger table is `_neoorm_migrations` (`id INTEGER PRIMARY KEY AUTOINCREMENT`, `name`, `checksum`, `down_checksum`, `applied_at`). `migrate deploy` wraps the run in `BEGIN IMMEDIATE` and refuses an edited `migration.sql` or `down.sql` whose checksum no longer matches the ledger.
101
101
  - `migrate reset` drops all non-`sqlite_` tables (there is no schema concept).
102
102
  - `db pull` introspects `sqlite_master` back into a schema file.
103
103
 
@@ -33,7 +33,7 @@ await db.$transaction(fn, {
33
33
 
34
34
  ## Nested transactions
35
35
 
36
- Uses database savepoints on the same connection. A nested failure rolls back only that block; the outer transaction can continue.
36
+ Uses database savepoints on the same connection. A nested failure rolls back only that block; the outer transaction can continue. If that rollback succeeds but `RELEASE SAVEPOINT` fails, the savepoint is still open, so the outer transaction is aborted instead of committing. The nested block's original error is preserved.
37
37
 
38
38
  ```ts
39
39
  await db.$transaction(async (tx) => {
package/llms-full.txt CHANGED
@@ -18,7 +18,7 @@ cp .env.example .env
18
18
  bunx neoorm migrate dev
19
19
  ```
20
20
 
21
- The CLI loads `.env` automatically. You do not need to export `DATABASE_URL` in the shell first.
21
+ The CLI and the generated client both load `.env` automatically. You do not need to export `DATABASE_URL` in the shell first. Editing `.env` is enough for the next process that creates a client; you do not need to regenerate.
22
22
 
23
23
  Browse and edit data with Studio:
24
24
 
@@ -2317,7 +2317,7 @@ await db.$transaction(fn, {
2317
2317
 
2318
2318
  ## Nested transactions
2319
2319
 
2320
- Uses database savepoints on the same connection. A nested failure rolls back only that block; the outer transaction can continue.
2320
+ Uses database savepoints on the same connection. A nested failure rolls back only that block; the outer transaction can continue. If that rollback succeeds but `RELEASE SAVEPOINT` fails, the savepoint is still open, so the outer transaction is aborted instead of committing. The nested block's original error is preserved.
2321
2321
 
2322
2322
  ```ts
2323
2323
  await db.$transaction(async (tx) => {
@@ -2411,7 +2411,9 @@ neoorm migrate diff --json
2411
2411
  | MySQL | `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection |
2412
2412
  | MariaDB | `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection |
2413
2413
 
2414
- The ledger table `_neoorm_migrations` stores `name` and `checksum`. Editing an already-applied `migration.sql` is rejected (`migration_guard`) — restore the original file or add a new migration. Pending migrations in one deploy run apply in that locked transaction; if a later statement fails, none of that run's new ledger rows remain.
2414
+ The ledger table `_neoorm_migrations` stores `name`, a SHA-256 `checksum` of `migration.sql`, and `down_checksum` for `down.sql`. Deploy refuses a missing `migration.sql`, a null checksum, or a checksum that does not match the file. It also refuses a pending migration that sorts before one already applied, so an earlier file cannot run after a later one. `migrate down` runs `down.sql` only when its checksum matches the value stored at apply time.
2415
+
2416
+ PostgreSQL and SQLite apply pending files inside the deploy lock transaction: if a later statement fails, none of that run's new ledger rows remain. MySQL and MariaDB cannot roll back InnoDB DDL (`CREATE TABLE`, `ALTER`, `CREATE INDEX`) — each statement autocommits. A failed file can leave tables without a matching `_neoorm_migrations` row. Recover locally with `neoorm migrate reset --force`, or in development with `neoorm migrate dev` catch-up. `GET_LOCK` is session-scoped and still serializes concurrent deploys; migration SQL does not run under a savepoint.
2415
2417
 
2416
2418
  ## Status
2417
2419
 
@@ -2596,9 +2598,9 @@ On a TTY, `neoorm init` opens a Clack wizard (provider, database URL, schema pat
2596
2598
 
2597
2599
  Options:
2598
2600
  - `--provider <provider>` — `postgresql` (default), `sqlite`, `mysql`, or `mariadb`. `postgres` and `pg` are aliases of `postgresql`. If omitted on a TTY, prompts to choose.
2599
- - `--database-url <url>` — override database URL / file path (default: `postgresql://postgres:postgres@localhost:5432/myapp` for postgres, `./dev.db` for sqlite, `mysql://root@localhost:3306/myapp` for mysql, `mariadb://root@localhost:3306/myapp` for mariadb)
2600
- - `--schema <path>` — schema file path (default: `./schema.ts`). Must end in `.ts`, `.mts`, or `.cts`.
2601
- - `--out <dir>` — generated output directory (default: `./neoorm`). Cannot be the same path as the schema file.
2601
+ - `--database-url <url>` — override database URL / file path (default: `postgresql://postgres:postgres@localhost:5432/myapp` for postgres, `./dev.db` for sqlite, `mysql://root@localhost:3306/myapp` for mysql, `mariadb://root@localhost:3306/myapp` for mariadb). Control characters are rejected. Quotes, whitespace, and backslashes are escaped in `neoorm.config.ts` and `.env.example`. When the provider is sqlite, a non-SQLite `scheme://` URL is rejected.
2602
+ - `--schema <path>` — schema file path (default: `./schema.ts`). Must end in `.ts`, `.mts`, or `.cts`, stay inside the project directory, and must not be `neoorm.config.ts`.
2603
+ - `--out <dir>` — generated output directory (default: `./neoorm`). Must stay inside the project directory, and cannot be the project directory, the schema file, or `neoorm.config.ts`.
2602
2604
  - `--force` — overwrite existing scaffold files without confirming
2603
2605
 
2604
2606
  ## `neoorm generate`
@@ -2818,7 +2820,7 @@ export default defineConfig({
2818
2820
  });
2819
2821
  ```
2820
2822
 
2821
- CLI commands load `.env` from the project directory before evaluating this file, so `process.env.DATABASE_URL` is set after `cp .env.example .env`. Variables already present in the environment are not overwritten. The generated client does not load `.env` at query time — use your runtime or a loader such as `node --env-file=.env`.
2823
+ CLI commands load `.env` from the project directory before evaluating this file, so `process.env.DATABASE_URL` is set after `cp .env.example .env`. `createNeoOrmClient` (including the generated `db`) does the same from `process.cwd()` before it picks a connection URL, so a later `.env` edit is used without regenerating. Variables already present in the environment are not overwritten. The URL stored on the manifest / `snapshot.json` is only the fallback when `DATABASE_URL` is unset.
2822
2824
 
2823
2825
  ## Options
2824
2826
 
@@ -2842,7 +2844,7 @@ Set `generate.zod` to write `out/zod.ts`, `generate.typebox` to write `out/typeb
2842
2844
 
2843
2845
  ### SQLite
2844
2846
 
2845
- Set `provider: "sqlite"` and `url` to a file path or `":memory:"`:
2847
+ Set `provider: "sqlite"` and `url` to a file path, a `file:` or `sqlite:` URI, or `":memory:"`. A `postgresql://`, `mysql://`, or other connection URL is rejected so it is not opened as a filename or silently dropped:
2846
2848
 
2847
2849
  ```ts
2848
2850
  datasource: {
@@ -2879,7 +2881,7 @@ If none is available, creating a client throws: `No SQLite driver available. Pro
2879
2881
 
2880
2882
  ## Configuration
2881
2883
 
2882
- Set `provider: "sqlite"` and point `url` at a file path or `:memory:`:
2884
+ Set `provider: "sqlite"` and point `url` at a file path, a `file:` or `sqlite:` URI, or `:memory:`. A `postgresql://`, `mysql://`, or other connection URL is rejected:
2883
2885
 
2884
2886
  ```ts
2885
2887
  // neoorm.config.ts
@@ -2960,7 +2962,7 @@ bunx neoorm migrate status
2960
2962
  bunx neoorm migrate reset --force
2961
2963
  ```
2962
2964
 
2963
- - The migration ledger table is `_neoorm_migrations` (`id INTEGER PRIMARY KEY AUTOINCREMENT`, `name`, `checksum`, `applied_at`). `migrate deploy` wraps the run in `BEGIN IMMEDIATE` and refuses an edited `migration.sql` whose checksum no longer matches the ledger.
2965
+ - The migration ledger table is `_neoorm_migrations` (`id INTEGER PRIMARY KEY AUTOINCREMENT`, `name`, `checksum`, `down_checksum`, `applied_at`). `migrate deploy` wraps the run in `BEGIN IMMEDIATE` and refuses an edited `migration.sql` or `down.sql` whose checksum no longer matches the ledger.
2964
2966
  - `migrate reset` drops all non-`sqlite_` tables (there is no schema concept).
2965
2967
  - `db pull` introspects `sqlite_master` back into a schema file.
2966
2968
 
@@ -3076,7 +3078,8 @@ bunx neoorm migrate status
3076
3078
  bunx neoorm migrate reset --force
3077
3079
  ```
3078
3080
 
3079
- - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy transaction.
3081
+ - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection.
3082
+ - InnoDB DDL autocommits. A failed `migrate deploy` can leave tables without a ledger row — use `migrate reset --force` locally or `migrate dev` catch-up. See [Migrations](migrations.md).
3080
3083
  - `migrate reset` sets `FOREIGN_KEY_CHECKS=0`, drops all tables in the current database, then re-enables checks and re-applies migrations.
3081
3084
  - `db pull` introspects `information_schema` back into a schema file.
3082
3085
 
@@ -3213,7 +3216,8 @@ bunx neoorm migrate status
3213
3216
  bunx neoorm migrate reset --force
3214
3217
  ```
3215
3218
 
3216
- - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy transaction.
3219
+ - Deploy lock is `GET_LOCK('neoorm.migrate.<db>', timeout)` / `RELEASE_LOCK` on the deploy connection.
3220
+ - InnoDB DDL autocommits. A failed `migrate deploy` can leave tables without a ledger row — use `migrate reset --force` locally or `migrate dev` catch-up. See [Migrations](migrations.md).
3217
3221
  - `migrate reset` sets `FOREIGN_KEY_CHECKS=0`, drops all tables in the current database, then re-enables checks and re-applies migrations.
3218
3222
  - `db pull` introspects `information_schema`. MariaDB `JSON` columns are often `LONGTEXT` plus a `json_valid()` CHECK; NeoOrm maps those back to `jsonb()`.
3219
3223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neoorm",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "TypeScript-first PostgreSQL, SQLite, MySQL, and MariaDB ORM with schema DSL, codegen, and typed relations",
5
5
  "license": "MIT",
6
6
  "repository": {