@databricks/appkit 0.64.0 → 0.66.0

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 (173) hide show
  1. package/CLAUDE.md +19 -0
  2. package/dist/appkit/package.js +1 -1
  3. package/dist/beta.d.ts +9 -1
  4. package/dist/beta.js +6 -1
  5. package/dist/cli/commands/doctor/resolve-targets.js +1 -1
  6. package/dist/cli/commands/generate-types.js +12 -3
  7. package/dist/cli/commands/generate-types.js.map +1 -1
  8. package/dist/cli/commands/plugin/create/scaffold.js +2 -2
  9. package/dist/cli/commands/plugin/create/scaffold.js.map +1 -1
  10. package/dist/core/appkit.js +1 -1
  11. package/dist/database/contract/index.js +3 -0
  12. package/dist/database/contract/registry.d.ts +26 -0
  13. package/dist/database/contract/registry.d.ts.map +1 -0
  14. package/dist/database/contract/wire.d.ts +8 -0
  15. package/dist/database/contract/wire.d.ts.map +1 -0
  16. package/dist/database/contract/wire.js +37 -0
  17. package/dist/database/contract/wire.js.map +1 -0
  18. package/dist/database/errors.js +71 -0
  19. package/dist/database/errors.js.map +1 -0
  20. package/dist/database/runtime/data-path.js +39 -0
  21. package/dist/database/runtime/data-path.js.map +1 -0
  22. package/dist/database/runtime/engine/drizzle-data-path.js +194 -0
  23. package/dist/database/runtime/engine/drizzle-data-path.js.map +1 -0
  24. package/dist/database/runtime/engine/translate.js +176 -0
  25. package/dist/database/runtime/engine/translate.js.map +1 -0
  26. package/dist/database/schema-builder/columns.d.ts +39 -0
  27. package/dist/database/schema-builder/columns.d.ts.map +1 -0
  28. package/dist/database/schema-builder/columns.js +162 -0
  29. package/dist/database/schema-builder/columns.js.map +1 -0
  30. package/dist/database/schema-builder/define-schema.d.ts +12 -0
  31. package/dist/database/schema-builder/define-schema.d.ts.map +1 -0
  32. package/dist/database/schema-builder/define-schema.js +207 -0
  33. package/dist/database/schema-builder/define-schema.js.map +1 -0
  34. package/dist/database/schema-builder/engine/relations.js +37 -0
  35. package/dist/database/schema-builder/engine/relations.js.map +1 -0
  36. package/dist/database/schema-builder/engine/tables.js +124 -0
  37. package/dist/database/schema-builder/engine/tables.js.map +1 -0
  38. package/dist/database/schema-builder/fk.d.ts +9 -0
  39. package/dist/database/schema-builder/fk.d.ts.map +1 -0
  40. package/dist/database/schema-builder/fk.js +71 -0
  41. package/dist/database/schema-builder/fk.js.map +1 -0
  42. package/dist/database/schema-builder/index.js +6 -0
  43. package/dist/database/schema-builder/relations.js +51 -0
  44. package/dist/database/schema-builder/relations.js.map +1 -0
  45. package/dist/database/schema-builder/types.d.ts +121 -0
  46. package/dist/database/schema-builder/types.d.ts.map +1 -0
  47. package/dist/database/schema-builder/types.js +43 -0
  48. package/dist/database/schema-builder/types.js.map +1 -0
  49. package/dist/database/schema-builder/validators.js +53 -0
  50. package/dist/database/schema-builder/validators.js.map +1 -0
  51. package/dist/index.d.ts +13 -12
  52. package/dist/index.js +2 -2
  53. package/dist/plugin/plugin.d.ts +2 -2
  54. package/dist/plugins/agents/agents.d.ts +3 -3
  55. package/dist/plugins/agents/agents.d.ts.map +1 -1
  56. package/dist/plugins/agents/agents.js +3 -1
  57. package/dist/plugins/agents/agents.js.map +1 -1
  58. package/dist/plugins/ai-search/ai-search.d.ts +1 -1
  59. package/dist/plugins/ai-search/ai-search.d.ts.map +1 -1
  60. package/dist/plugins/ai-search/ai-search.js +3 -1
  61. package/dist/plugins/ai-search/ai-search.js.map +1 -1
  62. package/dist/plugins/analytics/analytics.d.ts +2 -2
  63. package/dist/plugins/analytics/analytics.d.ts.map +1 -1
  64. package/dist/plugins/analytics/analytics.js +3 -1
  65. package/dist/plugins/analytics/analytics.js.map +1 -1
  66. package/dist/plugins/beta-exports.generated.d.ts +3 -1
  67. package/dist/plugins/beta-exports.generated.js +2 -0
  68. package/dist/plugins/database/database.d.ts +37 -0
  69. package/dist/plugins/database/database.d.ts.map +1 -0
  70. package/dist/plugins/database/database.js +68 -0
  71. package/dist/plugins/database/database.js.map +1 -0
  72. package/dist/plugins/database/defaults.js +12 -0
  73. package/dist/plugins/database/defaults.js.map +1 -0
  74. package/dist/plugins/database/entity-client.js +148 -0
  75. package/dist/plugins/database/entity-client.js.map +1 -0
  76. package/dist/plugins/database/entity-types.d.ts +76 -0
  77. package/dist/plugins/database/entity-types.d.ts.map +1 -0
  78. package/dist/plugins/database/index.d.ts +3 -0
  79. package/dist/plugins/database/index.js +3 -0
  80. package/dist/plugins/database/lifecycle.js +107 -0
  81. package/dist/plugins/database/lifecycle.js.map +1 -0
  82. package/dist/plugins/database/manifest.js +84 -0
  83. package/dist/plugins/database/manifest.js.map +1 -0
  84. package/dist/plugins/database/types.d.ts +10 -0
  85. package/dist/plugins/database/types.d.ts.map +1 -0
  86. package/dist/plugins/files/plugin.d.ts +5 -4
  87. package/dist/plugins/files/plugin.d.ts.map +1 -1
  88. package/dist/plugins/files/plugin.js +2 -1
  89. package/dist/plugins/files/plugin.js.map +1 -1
  90. package/dist/plugins/genie/genie.d.ts +2 -2
  91. package/dist/plugins/genie/genie.d.ts.map +1 -1
  92. package/dist/plugins/genie/genie.js +3 -1
  93. package/dist/plugins/genie/genie.js.map +1 -1
  94. package/dist/plugins/jobs/plugin.d.ts +3 -2
  95. package/dist/plugins/jobs/plugin.d.ts.map +1 -1
  96. package/dist/plugins/jobs/plugin.js +2 -1
  97. package/dist/plugins/jobs/plugin.js.map +1 -1
  98. package/dist/plugins/lakebase/lakebase.d.ts +4 -4
  99. package/dist/plugins/lakebase/lakebase.d.ts.map +1 -1
  100. package/dist/plugins/lakebase/lakebase.js +3 -1
  101. package/dist/plugins/lakebase/lakebase.js.map +1 -1
  102. package/dist/plugins/server/index.d.ts +1 -1
  103. package/dist/plugins/server/index.d.ts.map +1 -1
  104. package/dist/plugins/server/index.js +3 -1
  105. package/dist/plugins/server/index.js.map +1 -1
  106. package/dist/plugins/serving/serving.d.ts +1 -0
  107. package/dist/plugins/serving/serving.d.ts.map +1 -1
  108. package/dist/plugins/serving/serving.js +2 -1
  109. package/dist/plugins/serving/serving.js.map +1 -1
  110. package/dist/plugins/ui-variants/index.js +3 -1
  111. package/dist/plugins/ui-variants/index.js.map +1 -1
  112. package/dist/registry/index.d.ts +1 -1
  113. package/dist/registry/index.js +1 -1
  114. package/dist/registry/manifest-loader.d.ts +20 -1
  115. package/dist/registry/manifest-loader.d.ts.map +1 -1
  116. package/dist/registry/manifest-loader.js +23 -1
  117. package/dist/registry/manifest-loader.js.map +1 -1
  118. package/dist/schemas/manifest.d.ts +1 -1
  119. package/dist/shared/src/index.d.ts +1 -1
  120. package/dist/shared/src/naming.js +13 -1
  121. package/dist/shared/src/naming.js.map +1 -1
  122. package/dist/shared/src/schemas/manifest.d.ts +1 -1
  123. package/dist/shared/src/schemas/manifest.js +463 -0
  124. package/dist/shared/src/schemas/manifest.js.map +1 -0
  125. package/dist/testing/fixtures.d.ts +1 -1
  126. package/dist/type-generator/database/generate.d.ts +15 -0
  127. package/dist/type-generator/database/generate.d.ts.map +1 -0
  128. package/dist/type-generator/database/generate.js +104 -0
  129. package/dist/type-generator/database/generate.js.map +1 -0
  130. package/dist/type-generator/database/index.js +3 -0
  131. package/dist/type-generator/database/walk-schema.js +65 -0
  132. package/dist/type-generator/database/walk-schema.js.map +1 -0
  133. package/dist/type-generator/index.d.ts +148 -0
  134. package/dist/type-generator/index.d.ts.map +1 -0
  135. package/dist/type-generator/index.js +3 -1
  136. package/dist/type-generator/index.js.map +1 -1
  137. package/dist/type-generator/mv-registry/types.d.ts +99 -0
  138. package/dist/type-generator/mv-registry/types.d.ts.map +1 -0
  139. package/dist/type-generator/preflight.d.ts +16 -0
  140. package/dist/type-generator/preflight.d.ts.map +1 -0
  141. package/dist/type-generator/serving/generator.d.ts +20 -0
  142. package/dist/type-generator/serving/generator.d.ts.map +1 -0
  143. package/dist/type-generator/types.d.ts +72 -0
  144. package/dist/type-generator/types.d.ts.map +1 -0
  145. package/dist/type-generator/vite-plugin.d.ts +1 -0
  146. package/dist/type-generator/vite-plugin.d.ts.map +1 -1
  147. package/dist/type-generator/vite-plugin.js +41 -8
  148. package/dist/type-generator/vite-plugin.js.map +1 -1
  149. package/dist/type-generator/warehouse-status.d.ts +1 -0
  150. package/docs/api/appkit/Function.bigid.md +10 -0
  151. package/docs/api/appkit/Function.bigint.md +10 -0
  152. package/docs/api/appkit/Function.boolean.md +10 -0
  153. package/docs/api/appkit/Function.database.md +56 -0
  154. package/docs/api/appkit/Function.defineManifest.md +32 -0
  155. package/docs/api/appkit/Function.defineSchema.md +17 -0
  156. package/docs/api/appkit/Function.enumColumn.md +17 -0
  157. package/docs/api/appkit/Function.fk.md +18 -0
  158. package/docs/api/appkit/Function.id.md +10 -0
  159. package/docs/api/appkit/Function.integer.md +10 -0
  160. package/docs/api/appkit/Function.jsonb.md +10 -0
  161. package/docs/api/appkit/Function.text.md +10 -0
  162. package/docs/api/appkit/Function.timestamp.md +19 -0
  163. package/docs/api/appkit/Function.uuid.md +10 -0
  164. package/docs/api/appkit/Function.varchar.md +16 -0
  165. package/docs/api/appkit/Interface.DatabaseRegistry.md +3 -0
  166. package/docs/api/appkit/Interface.Schema.md +28 -0
  167. package/docs/api/appkit/TypeAlias.DatabaseExports.md +35 -0
  168. package/docs/api/appkit/TypeAlias.IDatabaseConfig.md +25 -0
  169. package/docs/api/appkit/Variable.agents.md +1 -1
  170. package/docs/api/appkit.md +19 -0
  171. package/llms.txt +19 -0
  172. package/package.json +4 -3
  173. package/sbom.cdx.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { FkRef } from "./types.js";
2
+ import { ColumnBuilder } from "./columns.js";
3
+
4
+ //#region src/database/schema-builder/fk.d.ts
5
+ /** Declare foreign-key to another column. */
6
+ declare function fk(ref: FkRef): ColumnBuilder;
7
+ //#endregion
8
+ export { fk };
9
+ //# sourceMappingURL=fk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fk.d.ts","names":[],"sources":["../../../src/database/schema-builder/fk.ts"],"mappings":";;;;;iBAUgB,EAAA,CAAG,GAAA,EAAK,KAAA,GAAQ,aAAA"}
@@ -0,0 +1,71 @@
1
+ import { SchemaBuildError } from "./types.js";
2
+ import { ColumnBuilder } from "./columns.js";
3
+
4
+ //#region src/database/schema-builder/fk.ts
5
+ /** Declare foreign-key to another column. */
6
+ function fk(ref) {
7
+ const builder = new ColumnBuilder({ kind: "fk" }, "number");
8
+ builder._meta.fkRef = ref;
9
+ return builder;
10
+ }
11
+ function resolveFkRef(ref) {
12
+ const resolved = typeof ref === "function" ? ref() : ref;
13
+ if (!resolved || typeof resolved !== "object" || resolved.__isColumnRef !== true) throw new SchemaBuildError("fk() must reference a column created by table()");
14
+ return resolved;
15
+ }
16
+ /** A serial PK target stores as its plain integer type on the FK side. */
17
+ function mirrorStorageKind(targetStorage) {
18
+ if (targetStorage === "id") return "integer";
19
+ if (targetStorage === "bigid") return "bigint";
20
+ return targetStorage;
21
+ }
22
+ /** Resolve FK identity, inherited storage, and action invariants in one pass. */
23
+ function resolveForeignKeys(tables) {
24
+ const references = /* @__PURE__ */ new Map();
25
+ for (const table of tables.values()) for (const [columnName, reference] of Object.entries(table.handle)) {
26
+ const meta = table.metas[columnName];
27
+ if (!meta) throw new SchemaBuildError(`Column reference "${table.name}.${columnName}" has no metadata`);
28
+ references.set(reference, {
29
+ table,
30
+ meta
31
+ });
32
+ }
33
+ const resolving = /* @__PURE__ */ new Set();
34
+ const resolved = /* @__PURE__ */ new Set();
35
+ const resolveForeignKey = (table, meta) => {
36
+ if (!meta.fkRef || resolved.has(meta)) return;
37
+ if (resolving.has(meta)) throw new SchemaBuildError(`Foreign key "${table.name}.${meta.columnName}" has a cyclic storage dependency`);
38
+ resolving.add(meta);
39
+ try {
40
+ const reference = resolveFkRef(meta.fkRef);
41
+ const targetIdentity = references.get(reference);
42
+ if (!targetIdentity) throw new SchemaBuildError(`fk() on "${table.name}.${meta.columnName}" targets a column outside the returned schema`);
43
+ const { table: targetTable, meta: target } = targetIdentity;
44
+ resolveForeignKey(targetTable, target);
45
+ if (!target.primaryKey && !target.unique) throw new SchemaBuildError(`fk() on "${table.name}.${meta.columnName}" must target a primary-key or unique column`);
46
+ meta.storageKind = mirrorStorageKind(target.storageKind);
47
+ meta.kind = target.kind;
48
+ meta.withTimezone = target.withTimezone;
49
+ meta.varcharLength = target.varcharLength;
50
+ meta.enumName = target.enumName;
51
+ meta.enumValues = target.enumValues ? Object.freeze([...target.enumValues]) : void 0;
52
+ meta.fk = {
53
+ targetTable: targetTable.name,
54
+ targetColumn: target.columnName,
55
+ onDelete: meta.onDelete,
56
+ onUpdate: meta.onUpdate
57
+ };
58
+ const actions = [meta.onDelete, meta.onUpdate];
59
+ if (actions.includes("set null") && meta.notNull) throw new SchemaBuildError(`Foreign key "${table.name}.${meta.columnName}" uses SET NULL but is not-null`);
60
+ if (actions.includes("set default") && !meta.hasDefault) throw new SchemaBuildError(`Foreign key "${table.name}.${meta.columnName}" uses SET DEFAULT without a local default`);
61
+ resolved.add(meta);
62
+ } finally {
63
+ resolving.delete(meta);
64
+ }
65
+ };
66
+ for (const table of tables.values()) for (const meta of Object.values(table.metas)) resolveForeignKey(table, meta);
67
+ }
68
+
69
+ //#endregion
70
+ export { fk, resolveForeignKeys };
71
+ //# sourceMappingURL=fk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fk.js","names":[],"sources":["../../../src/database/schema-builder/fk.ts"],"sourcesContent":["import { ColumnBuilder } from \"./columns\";\nimport {\n type ColumnRef,\n type FkRef,\n type MutableColumnMeta,\n SchemaBuildError,\n type StorageKind,\n} from \"./types\";\n\n/** Declare foreign-key to another column. */\nexport function fk(ref: FkRef): ColumnBuilder {\n const builder = new ColumnBuilder({ kind: \"fk\" }, \"number\");\n builder._meta.fkRef = ref;\n return builder;\n}\n\nexport function resolveFkRef(ref: FkRef): ColumnRef {\n const resolved = typeof ref === \"function\" ? ref() : ref;\n if (\n !resolved ||\n typeof resolved !== \"object\" ||\n resolved.__isColumnRef !== true\n ) {\n throw new SchemaBuildError(\n \"fk() must reference a column created by table()\",\n );\n }\n return resolved;\n}\n\n/** A serial PK target stores as its plain integer type on the FK side. */\nexport function mirrorStorageKind(targetStorage: StorageKind): StorageKind {\n if (targetStorage === \"id\") return \"integer\";\n if (targetStorage === \"bigid\") return \"bigint\";\n return targetStorage;\n}\n\ninterface ForeignKeyTable {\n readonly name: string;\n readonly metas: Readonly<Record<string, MutableColumnMeta>>;\n readonly handle: Readonly<Record<string, ColumnRef>>;\n}\n\n/** Resolve FK identity, inherited storage, and action invariants in one pass. */\nexport function resolveForeignKeys(\n tables: ReadonlyMap<string, ForeignKeyTable>,\n): void {\n const references = new Map<\n ColumnRef,\n { readonly table: ForeignKeyTable; readonly meta: MutableColumnMeta }\n >();\n for (const table of tables.values()) {\n for (const [columnName, reference] of Object.entries(table.handle)) {\n const meta = table.metas[columnName];\n if (!meta) {\n throw new SchemaBuildError(\n `Column reference \"${table.name}.${columnName}\" has no metadata`,\n );\n }\n references.set(reference, { table, meta });\n }\n }\n\n const resolving = new Set<MutableColumnMeta>();\n const resolved = new Set<MutableColumnMeta>();\n\n const resolveForeignKey = (\n table: ForeignKeyTable,\n meta: MutableColumnMeta,\n ): void => {\n if (!meta.fkRef || resolved.has(meta)) return;\n if (resolving.has(meta)) {\n throw new SchemaBuildError(\n `Foreign key \"${table.name}.${meta.columnName}\" has a cyclic storage dependency`,\n );\n }\n\n resolving.add(meta);\n try {\n const reference = resolveFkRef(meta.fkRef);\n const targetIdentity = references.get(reference);\n if (!targetIdentity) {\n throw new SchemaBuildError(\n `fk() on \"${table.name}.${meta.columnName}\" targets a column outside the returned schema`,\n );\n }\n\n const { table: targetTable, meta: target } = targetIdentity;\n resolveForeignKey(targetTable, target);\n if (!target.primaryKey && !target.unique) {\n throw new SchemaBuildError(\n `fk() on \"${table.name}.${meta.columnName}\" must target a primary-key or unique column`,\n );\n }\n\n meta.storageKind = mirrorStorageKind(target.storageKind);\n meta.kind = target.kind;\n meta.withTimezone = target.withTimezone;\n meta.varcharLength = target.varcharLength;\n meta.enumName = target.enumName;\n meta.enumValues = target.enumValues\n ? Object.freeze([...target.enumValues])\n : undefined;\n meta.fk = {\n targetTable: targetTable.name,\n targetColumn: target.columnName,\n onDelete: meta.onDelete,\n onUpdate: meta.onUpdate,\n };\n\n const actions = [meta.onDelete, meta.onUpdate];\n if (actions.includes(\"set null\") && meta.notNull) {\n throw new SchemaBuildError(\n `Foreign key \"${table.name}.${meta.columnName}\" uses SET NULL but is not-null`,\n );\n }\n if (actions.includes(\"set default\") && !meta.hasDefault) {\n throw new SchemaBuildError(\n `Foreign key \"${table.name}.${meta.columnName}\" uses SET DEFAULT without a local default`,\n );\n }\n resolved.add(meta);\n } finally {\n resolving.delete(meta);\n }\n };\n\n for (const table of tables.values()) {\n for (const meta of Object.values(table.metas)) {\n resolveForeignKey(table, meta);\n }\n }\n}\n"],"mappings":";;;;;AAUA,SAAgB,GAAG,KAA2B;CAC5C,MAAM,UAAU,IAAI,cAAc,EAAE,MAAM,MAAM,EAAE,SAAS;AAC3D,SAAQ,MAAM,QAAQ;AACtB,QAAO;;AAGT,SAAgB,aAAa,KAAuB;CAClD,MAAM,WAAW,OAAO,QAAQ,aAAa,KAAK,GAAG;AACrD,KACE,CAAC,YACD,OAAO,aAAa,YACpB,SAAS,kBAAkB,KAE3B,OAAM,IAAI,iBACR,kDACD;AAEH,QAAO;;;AAIT,SAAgB,kBAAkB,eAAyC;AACzE,KAAI,kBAAkB,KAAM,QAAO;AACnC,KAAI,kBAAkB,QAAS,QAAO;AACtC,QAAO;;;AAUT,SAAgB,mBACd,QACM;CACN,MAAM,6BAAa,IAAI,KAGpB;AACH,MAAK,MAAM,SAAS,OAAO,QAAQ,CACjC,MAAK,MAAM,CAAC,YAAY,cAAc,OAAO,QAAQ,MAAM,OAAO,EAAE;EAClE,MAAM,OAAO,MAAM,MAAM;AACzB,MAAI,CAAC,KACH,OAAM,IAAI,iBACR,qBAAqB,MAAM,KAAK,GAAG,WAAW,mBAC/C;AAEH,aAAW,IAAI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AG,KAAK,WAAW,4CAC/C;AAEH,YAAS,IAAI,KAAK;YACV;AACR,aAAU,OAAO,KAAK;;;AAI1B,MAAK,MAAM,SAAS,OAAO,QAAQ,CACjC,MAAK,MAAM,QAAQ,OAAO,OAAO,MAAM,MAAM,CAC3C,mBAAkB,OAAO,KAAK"}
@@ -0,0 +1,6 @@
1
+ import { SchemaBuildError } from "./types.js";
2
+ import { ColumnBuilder, bigid, bigint, boolean, enumColumn, id, integer, jsonb, text, timestamp, uuid, varchar } from "./columns.js";
3
+ import { fk } from "./fk.js";
4
+ import { defineSchema } from "./define-schema.js";
5
+
6
+ export { };
@@ -0,0 +1,51 @@
1
+ import { SchemaBuildError } from "./types.js";
2
+
3
+ //#region src/database/schema-builder/relations.ts
4
+ /** @internal Build the canonical relation metadata before tables are published. */
5
+ function buildRelations(tables) {
6
+ const result = /* @__PURE__ */ new Map();
7
+ for (const name of tables.keys()) result.set(name, []);
8
+ for (const table of tables.values()) {
9
+ const relations = result.get(table.name);
10
+ if (!relations) throw new SchemaBuildError("Relation table is not registered");
11
+ const columnNames = new Set(Object.keys(table.metas));
12
+ const seenTargets = /* @__PURE__ */ new Set();
13
+ for (const meta of Object.values(table.metas)) {
14
+ if (!meta.fk) continue;
15
+ const relationName = meta.fk.targetTable;
16
+ if (columnNames.has(relationName)) throw new SchemaBuildError(`Forward relation "${table.name}.${relationName}" collides with a column of the same name`);
17
+ if (seenTargets.has(relationName)) throw new SchemaBuildError(`Ambiguous forward relation "${table.name}.${relationName}": multiple foreign keys target "${relationName}"`);
18
+ seenTargets.add(relationName);
19
+ relations.push({
20
+ name: relationName,
21
+ cardinality: "toOne",
22
+ localColumn: meta.columnName,
23
+ targetTable: relationName,
24
+ targetColumn: meta.fk.targetColumn,
25
+ inferred: false
26
+ });
27
+ }
28
+ }
29
+ for (const table of tables.values()) for (const meta of Object.values(table.metas)) {
30
+ if (!meta.fk || meta.fk.targetTable === table.name) continue;
31
+ const target = tables.get(meta.fk.targetTable);
32
+ const targetRelations = result.get(meta.fk.targetTable);
33
+ if (!target || !targetRelations) throw new SchemaBuildError(`Relation target "${meta.fk.targetTable}" is not part of the schema`);
34
+ const relationName = table.name;
35
+ if (Object.hasOwn(target.metas, relationName)) throw new SchemaBuildError(`Reverse relation "${target.name}.${relationName}" collides with a column of the same name`);
36
+ if (targetRelations.some((relation) => relation.name === relationName)) throw new SchemaBuildError(`Reverse relation "${target.name}.${relationName}" is ambiguous`);
37
+ targetRelations.push({
38
+ name: relationName,
39
+ cardinality: "toMany",
40
+ localColumn: meta.fk.targetColumn,
41
+ targetTable: table.name,
42
+ targetColumn: meta.columnName,
43
+ inferred: true
44
+ });
45
+ }
46
+ return result;
47
+ }
48
+
49
+ //#endregion
50
+ export { buildRelations };
51
+ //# sourceMappingURL=relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.js","names":[],"sources":["../../../src/database/schema-builder/relations.ts"],"sourcesContent":["import type { MutableColumnMeta, ResolvedRelation } from \"./types\";\nimport { SchemaBuildError } from \"./types\";\n\ninterface RelationSourceTable {\n readonly name: string;\n readonly metas: Readonly<Record<string, MutableColumnMeta>>;\n}\n\n/** @internal Build the canonical relation metadata before tables are published. */\nexport function buildRelations(\n tables: ReadonlyMap<string, RelationSourceTable>,\n): Map<string, ResolvedRelation[]> {\n const result = new Map<string, ResolvedRelation[]>();\n for (const name of tables.keys()) result.set(name, []);\n\n // Forward pass: each FK adds a to-one edge to its source table.\n for (const table of tables.values()) {\n const relations = result.get(table.name);\n if (!relations)\n throw new SchemaBuildError(\"Relation table is not registered\");\n const columnNames = new Set(Object.keys(table.metas));\n const seenTargets = new Set<string>();\n\n for (const meta of Object.values(table.metas)) {\n if (!meta.fk) continue;\n const relationName = meta.fk.targetTable;\n if (columnNames.has(relationName)) {\n throw new SchemaBuildError(\n `Forward relation \"${table.name}.${relationName}\" collides with a column of the same name`,\n );\n }\n if (seenTargets.has(relationName)) {\n throw new SchemaBuildError(\n `Ambiguous forward relation \"${table.name}.${relationName}\": multiple foreign keys target \"${relationName}\"`,\n );\n }\n seenTargets.add(relationName);\n relations.push({\n name: relationName,\n cardinality: \"toOne\",\n localColumn: meta.columnName,\n targetTable: relationName,\n targetColumn: meta.fk.targetColumn,\n inferred: false,\n });\n }\n }\n\n // Reverse pass: each non-self FK adds a to-many edge to its target table.\n for (const table of tables.values()) {\n for (const meta of Object.values(table.metas)) {\n if (!meta.fk || meta.fk.targetTable === table.name) continue;\n const target = tables.get(meta.fk.targetTable);\n const targetRelations = result.get(meta.fk.targetTable);\n if (!target || !targetRelations) {\n throw new SchemaBuildError(\n `Relation target \"${meta.fk.targetTable}\" is not part of the schema`,\n );\n }\n\n const relationName = table.name;\n if (Object.hasOwn(target.metas, relationName)) {\n throw new SchemaBuildError(\n `Reverse relation \"${target.name}.${relationName}\" collides with a column of the same name`,\n );\n }\n if (targetRelations.some((relation) => relation.name === relationName)) {\n throw new SchemaBuildError(\n `Reverse relation \"${target.name}.${relationName}\" is ambiguous`,\n );\n }\n // Reverse edges deliberately retain their stable to-many result shape.\n targetRelations.push({\n name: relationName,\n cardinality: \"toMany\",\n localColumn: meta.fk.targetColumn,\n targetTable: table.name,\n targetColumn: meta.columnName,\n inferred: true,\n });\n }\n }\n\n return result;\n}\n"],"mappings":";;;;AASA,SAAgB,eACd,QACiC;CACjC,MAAM,yBAAS,IAAI,KAAiC;AACpD,MAAK,MAAM,QAAQ,OAAO,MAAM,CAAE,QAAO,IAAI,MAAM,EAAE,CAAC;AAGtD,MAAK,MAAM,SAAS,OAAO,QAAQ,EAAE;EACnC,MAAM,YAAY,OAAO,IAAI,MAAM,KAAK;AACxC,MAAI,CAAC,UACH,OAAM,IAAI,iBAAiB,mCAAmC;EAChE,MAAM,cAAc,IAAI,IAAI,OAAO,KAAK,MAAM,MAAM,CAAC;EACrD,MAAM,8BAAc,IAAI,KAAa;AAErC,OAAK,MAAM,QAAQ,OAAO,OAAO,MAAM,MAAM,EAAE;AAC7C,OAAI,CAAC,KAAK,GAAI;GACd,MAAM,eAAe,KAAK,GAAG;AAC7B,OAAI,YAAY,IAAI,aAAa,CAC/B,OAAM,IAAI,iBACR,qBAAqB,MAAM,KAAK,GAAG,aAAa,2CACjD;AAEH,OAAI,YAAY,IAAI,aAAa,CAC/B,OAAM,IAAI,iBACR,+BAA+B,MAAM,KAAK,GAAG,aAAa,mCAAmC,aAAa,GAC3G;AAEH,eAAY,IAAI,aAAa;AAC7B,aAAU,KAAK;IACb,MAAM;IACN,aAAa;IACb,aAAa,KAAK;IAClB,aAAa;IACb,cAAc,KAAK,GAAG;IACtB,UAAU;IACX,CAAC;;;AAKN,MAAK,MAAM,SAAS,OAAO,QAAQ,CACjC,MAAK,MAAM,QAAQ,OAAO,OAAO,MAAM,MAAM,EAAE;AAC7C,MAAI,CAAC,KAAK,MAAM,KAAK,GAAG,gBAAgB,MAAM,KAAM;EACpD,MAAM,SAAS,OAAO,IAAI,KAAK,GAAG,YAAY;EAC9C,MAAM,kBAAkB,OAAO,IAAI,KAAK,GAAG,YAAY;AACvD,MAAI,CAAC,UAAU,CAAC,gBACd,OAAM,IAAI,iBACR,oBAAoB,KAAK,GAAG,YAAY,6BACzC;EAGH,MAAM,eAAe,MAAM;AAC3B,MAAI,OAAO,OAAO,OAAO,OAAO,aAAa,CAC3C,OAAM,IAAI,iBACR,qBAAqB,OAAO,KAAK,GAAG,aAAa,2CAClD;AAEH,MAAI,gBAAgB,MAAM,aAAa,SAAS,SAAS,aAAa,CACpE,OAAM,IAAI,iBACR,qBAAqB,OAAO,KAAK,GAAG,aAAa,gBAClD;AAGH,kBAAgB,KAAK;GACnB,MAAM;GACN,aAAa;GACb,aAAa,KAAK,GAAG;GACrB,aAAa,MAAM;GACnB,cAAc,KAAK;GACnB,UAAU;GACX,CAAC;;AAIN,QAAO"}
@@ -0,0 +1,121 @@
1
+ //#region src/database/schema-builder/types.d.ts
2
+ declare const ENGINE_TABLE: unique symbol;
3
+ declare const ENGINE_COLUMN: unique symbol;
4
+ /** Opaque handles keep Drizzle types behind the schema/runtime boundary. */
5
+ type EngineTable = {
6
+ readonly [ENGINE_TABLE]: true;
7
+ };
8
+ type EngineColumn = {
9
+ readonly [ENGINE_COLUMN]: true;
10
+ };
11
+ /** JavaScript value category exposed by a column, independent of its storage. */
12
+ type ColumnValueKind = "string" | "number" | "bigint" | "boolean" | "date" | "json" | "uuid" | "enum" | "unknown";
13
+ /** PostgreSQL action applied when a referenced row changes or is deleted. */
14
+ type ReferentialAction = "cascade" | "set null" | "set default" | "restrict" | "no action";
15
+ /** DSL declaration kind, including identity shorthand and unresolved FKs. */
16
+ type ColumnTypeSpec = {
17
+ readonly kind: "id";
18
+ } | {
19
+ readonly kind: "bigid";
20
+ } | {
21
+ readonly kind: "text";
22
+ } | {
23
+ readonly kind: "varchar";
24
+ readonly length: number;
25
+ } | {
26
+ readonly kind: "integer";
27
+ } | {
28
+ readonly kind: "bigint";
29
+ } | {
30
+ readonly kind: "boolean";
31
+ } | {
32
+ readonly kind: "uuid";
33
+ } | {
34
+ readonly kind: "timestamp";
35
+ readonly withTimezone: boolean;
36
+ } | {
37
+ readonly kind: "jsonb";
38
+ } | {
39
+ readonly kind: "enum";
40
+ readonly enumName: string;
41
+ readonly values: readonly string[];
42
+ } | {
43
+ readonly kind: "fk";
44
+ };
45
+ /** Resolved PostgreSQL storage used to construct the engine column. */
46
+ type StorageKind = "id" | "bigid" | "text" | "varchar" | "integer" | "bigint" | "boolean" | "uuid" | "timestamp" | "jsonb" | "enum";
47
+ interface ColumnRef {
48
+ readonly __isColumnRef: true;
49
+ readonly tableName: string;
50
+ readonly columnName: string;
51
+ }
52
+ type FkRef = ColumnRef | (() => ColumnRef);
53
+ interface ResolvedForeignKey {
54
+ readonly targetTable: string;
55
+ readonly targetColumn: string;
56
+ readonly onDelete?: ReferentialAction;
57
+ readonly onUpdate?: ReferentialAction;
58
+ }
59
+ /** Mutable declaration state. It is cloned per table and never published. */
60
+ interface MutableColumnMeta {
61
+ name: string;
62
+ columnName: string;
63
+ kind: ColumnValueKind;
64
+ storageKind: StorageKind;
65
+ notNull: boolean;
66
+ primaryKey: boolean;
67
+ unique: boolean;
68
+ isPrivate: boolean;
69
+ serverGenerated: boolean;
70
+ hasDefault: boolean;
71
+ defaultValue?: string | number | boolean;
72
+ defaultNow?: boolean;
73
+ defaultRandom?: boolean;
74
+ withTimezone?: boolean;
75
+ varcharLength?: number;
76
+ enumName?: string;
77
+ enumValues?: readonly string[];
78
+ fkRef?: FkRef;
79
+ onDelete?: ReferentialAction;
80
+ onUpdate?: ReferentialAction;
81
+ fk?: ResolvedForeignKey;
82
+ engineColumn?: EngineColumn;
83
+ }
84
+ /** Immutable column metadata published by a finalized schema. */
85
+ type ColumnMeta = Readonly<Omit<MutableColumnMeta, "enumValues" | "fk" | "fkRef" | "engineColumn"> & {
86
+ readonly enumValues?: readonly string[];
87
+ readonly fk?: Readonly<ResolvedForeignKey>;
88
+ readonly engineColumn: EngineColumn;
89
+ }>;
90
+ interface ResolvedRelation {
91
+ readonly name: string;
92
+ readonly cardinality: "toOne" | "toMany";
93
+ readonly localColumn: string;
94
+ readonly targetTable: string;
95
+ readonly targetColumn: string;
96
+ readonly inferred: boolean;
97
+ }
98
+ interface AppKitTable {
99
+ readonly $name: string;
100
+ readonly $schemaName: string;
101
+ readonly $columns: Readonly<Record<string, ColumnMeta>>;
102
+ readonly $engine: EngineTable;
103
+ readonly $relations: readonly ResolvedRelation[];
104
+ /** @internal insert schema retained from the current-main foundation. */
105
+ readonly $insertSchema: unknown;
106
+ /** @internal update schema retained from the current-main foundation. */
107
+ readonly $updateSchema: unknown;
108
+ }
109
+ /** A declaration handle gains finalized table metadata only at publication. */
110
+ type TableHandle<C extends Record<string, unknown>> = AppKitTable & { readonly [K in keyof C]: ColumnRef };
111
+ interface DefineSchemaOptions {
112
+ readonly schemaName?: string;
113
+ }
114
+ interface Schema {
115
+ readonly $schemaName: string;
116
+ readonly $tables: Readonly<Record<string, AppKitTable>>;
117
+ readonly $engine: Readonly<Record<string, EngineTable>>;
118
+ }
119
+ //#endregion
120
+ export { AppKitTable, ColumnTypeSpec, ColumnValueKind, DefineSchemaOptions, FkRef, MutableColumnMeta, ReferentialAction, Schema, TableHandle };
121
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/database/schema-builder/types.ts"],"mappings":";cAEc,YAAA;AAAA,cACA,aAAA;;KAEF,WAAA;EAAA,UAA0B,YAAA;AAAA;AAAA,KAC1B,YAAA;EAAA,UAA2B,aAAA;AAAA;;KAG3B,eAAA;;KAiCA,iBAAA;AApCZ;AAAA,KA4CY,cAAA;EAAA,SACG,IAAA;AAAA;EAAA,SACA,IAAA;AAAA;EAAA,SACA,IAAA;AAAA;EAAA,SACA,IAAA;EAAA,SAA0B,MAAA;AAAA;EAAA,SAC1B,IAAA;AAAA;EAAA,SACA,IAAA;AAAA;EAAA,SACA,IAAA;AAAA;EAAA,SACA,IAAA;AAAA;EAAA,SACA,IAAA;EAAA,SAA4B,YAAA;AAAA;EAAA,SAC5B,IAAA;AAAA;EAAA,SAEA,IAAA;EAAA,SACA,QAAA;EAAA,SACA,MAAA;AAAA;EAAA,SAEA,IAAA;AAAA;;KAGH,WAAA;AAAA,UAaK,SAAA;EAAA,SACN,aAAA;EAAA,SACA,SAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGC,KAAA,GAAQ,SAAA,UAAmB,SAAA;AAAA,UAEtB,kBAAA;EAAA,SACN,WAAA;EAAA,SACA,YAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;AAAA;;UAIL,iBAAA;EACf,IAAA;EACA,UAAA;EACA,IAAA,EAAM,eAAA;EACN,WAAA,EAAa,WAAA;EACb,OAAA;EACA,UAAA;EACA,MAAA;EACA,SAAA;EACA,eAAA;EACA,UAAA;EACA,YAAA;EACA,UAAA;EACA,aAAA;EACA,YAAA;EACA,aAAA;EACA,QAAA;EACA,UAAA;EACA,KAAA,GAAQ,KAAA;EACR,QAAA,GAAW,iBAAA;EACX,QAAA,GAAW,iBAAA;EACX,EAAA,GAAK,kBAAA;EACL,YAAA,GAAe,YAAA;AAAA;;KAIL,UAAA,GAAa,QAAA,CACvB,IAAA,CAAK,iBAAA;EAAA,SACM,UAAA;EAAA,SACA,EAAA,GAAK,QAAA,CAAS,kBAAA;EAAA,SACd,YAAA,EAAc,YAAA;AAAA;AAAA,UAIV,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,WAAA;EAAA,SACN,KAAA;EAAA,SACA,WAAA;EAAA,SACA,QAAA,EAAU,QAAA,CAAS,MAAA,SAAe,UAAA;EAAA,SAClC,OAAA,EAAS,WAAA;EAAA,SACT,UAAA,WAAqB,gBAAA;EAxC9B;EAAA,SA0CS,aAAA;EAxCT;EAAA,SA0CS,aAAA;AAAA;;KAIC,WAAA,WAAsB,MAAA,qBAA2B,WAAA,0BACtC,CAAA,GAAI,SAAA;AAAA,UAGV,mBAAA;EAAA,SACN,UAAA;AAAA;AAAA,UAGM,MAAA;EAAA,SACN,WAAA;EAAA,SACA,OAAA,EAAS,QAAA,CAAS,MAAA,SAAe,WAAA;EAAA,SACjC,OAAA,EAAS,QAAA,CAAS,MAAA,SAAe,WAAA;AAAA"}
@@ -0,0 +1,43 @@
1
+ //#region src/database/schema-builder/types.ts
2
+ /** The filter subset shared by runtime translation and later typed surfaces. */
3
+ function filterOperatorsForKind(kind) {
4
+ switch (kind) {
5
+ case "string": return [
6
+ "eq",
7
+ "neq",
8
+ "in",
9
+ "like",
10
+ "ilike"
11
+ ];
12
+ case "number":
13
+ case "bigint":
14
+ case "date": return [
15
+ "eq",
16
+ "neq",
17
+ "in",
18
+ "gt",
19
+ "gte",
20
+ "lt",
21
+ "lte"
22
+ ];
23
+ case "enum":
24
+ case "boolean":
25
+ case "uuid": return [
26
+ "eq",
27
+ "neq",
28
+ "in"
29
+ ];
30
+ case "json":
31
+ case "unknown": return [];
32
+ }
33
+ }
34
+ var SchemaBuildError = class extends Error {
35
+ constructor(message) {
36
+ super(message);
37
+ this.name = "SchemaBuildError";
38
+ }
39
+ };
40
+
41
+ //#endregion
42
+ export { SchemaBuildError, filterOperatorsForKind };
43
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/database/schema-builder/types.ts"],"sourcesContent":["import type { FilterOperator } from \"../contract\";\n\ndeclare const ENGINE_TABLE: unique symbol;\ndeclare const ENGINE_COLUMN: unique symbol;\n/** Opaque handles keep Drizzle types behind the schema/runtime boundary. */\nexport type EngineTable = { readonly [ENGINE_TABLE]: true };\nexport type EngineColumn = { readonly [ENGINE_COLUMN]: true };\n\n/** JavaScript value category exposed by a column, independent of its storage. */\nexport type ColumnValueKind =\n | \"string\"\n | \"number\"\n | \"bigint\"\n | \"boolean\"\n | \"date\"\n | \"json\"\n | \"uuid\"\n | \"enum\"\n | \"unknown\";\n\n/** The filter subset shared by runtime translation and later typed surfaces. */\nexport function filterOperatorsForKind(\n kind: ColumnValueKind,\n): readonly FilterOperator[] {\n switch (kind) {\n case \"string\":\n return [\"eq\", \"neq\", \"in\", \"like\", \"ilike\"];\n case \"number\":\n case \"bigint\":\n case \"date\":\n return [\"eq\", \"neq\", \"in\", \"gt\", \"gte\", \"lt\", \"lte\"];\n case \"enum\":\n case \"boolean\":\n case \"uuid\":\n return [\"eq\", \"neq\", \"in\"];\n case \"json\":\n case \"unknown\":\n return [];\n }\n}\n\n/** PostgreSQL action applied when a referenced row changes or is deleted. */\nexport type ReferentialAction =\n | \"cascade\"\n | \"set null\"\n | \"set default\"\n | \"restrict\"\n | \"no action\";\n\n/** DSL declaration kind, including identity shorthand and unresolved FKs. */\nexport type ColumnTypeSpec =\n | { readonly kind: \"id\" }\n | { readonly kind: \"bigid\" }\n | { readonly kind: \"text\" }\n | { readonly kind: \"varchar\"; readonly length: number }\n | { readonly kind: \"integer\" }\n | { readonly kind: \"bigint\" }\n | { readonly kind: \"boolean\" }\n | { readonly kind: \"uuid\" }\n | { readonly kind: \"timestamp\"; readonly withTimezone: boolean }\n | { readonly kind: \"jsonb\" }\n | {\n readonly kind: \"enum\";\n readonly enumName: string;\n readonly values: readonly string[];\n }\n | { readonly kind: \"fk\" };\n\n/** Resolved PostgreSQL storage used to construct the engine column. */\nexport type StorageKind =\n | \"id\"\n | \"bigid\"\n | \"text\"\n | \"varchar\"\n | \"integer\"\n | \"bigint\"\n | \"boolean\"\n | \"uuid\"\n | \"timestamp\"\n | \"jsonb\"\n | \"enum\";\n\nexport interface ColumnRef {\n readonly __isColumnRef: true;\n readonly tableName: string;\n readonly columnName: string;\n}\n\nexport type FkRef = ColumnRef | (() => ColumnRef);\n\nexport interface ResolvedForeignKey {\n readonly targetTable: string;\n readonly targetColumn: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n}\n\n/** Mutable declaration state. It is cloned per table and never published. */\nexport interface MutableColumnMeta {\n name: string;\n columnName: string;\n kind: ColumnValueKind;\n storageKind: StorageKind;\n notNull: boolean;\n primaryKey: boolean;\n unique: boolean;\n isPrivate: boolean;\n serverGenerated: boolean;\n hasDefault: boolean;\n defaultValue?: string | number | boolean;\n defaultNow?: boolean;\n defaultRandom?: boolean;\n withTimezone?: boolean;\n varcharLength?: number;\n enumName?: string;\n enumValues?: readonly string[];\n fkRef?: FkRef;\n onDelete?: ReferentialAction;\n onUpdate?: ReferentialAction;\n fk?: ResolvedForeignKey;\n engineColumn?: EngineColumn;\n}\n\n/** Immutable column metadata published by a finalized schema. */\nexport type ColumnMeta = Readonly<\n Omit<MutableColumnMeta, \"enumValues\" | \"fk\" | \"fkRef\" | \"engineColumn\"> & {\n readonly enumValues?: readonly string[];\n readonly fk?: Readonly<ResolvedForeignKey>;\n readonly engineColumn: EngineColumn;\n }\n>;\n\nexport interface ResolvedRelation {\n readonly name: string;\n readonly cardinality: \"toOne\" | \"toMany\";\n readonly localColumn: string;\n readonly targetTable: string;\n readonly targetColumn: string;\n readonly inferred: boolean;\n}\n\nexport interface AppKitTable {\n readonly $name: string;\n readonly $schemaName: string;\n readonly $columns: Readonly<Record<string, ColumnMeta>>;\n readonly $engine: EngineTable;\n readonly $relations: readonly ResolvedRelation[];\n /** @internal insert schema retained from the current-main foundation. */\n readonly $insertSchema: unknown;\n /** @internal update schema retained from the current-main foundation. */\n readonly $updateSchema: unknown;\n}\n\n/** A declaration handle gains finalized table metadata only at publication. */\nexport type TableHandle<C extends Record<string, unknown>> = AppKitTable & {\n readonly [K in keyof C]: ColumnRef;\n};\n\nexport interface DefineSchemaOptions {\n readonly schemaName?: string;\n}\n\nexport interface Schema {\n readonly $schemaName: string;\n readonly $tables: Readonly<Record<string, AppKitTable>>;\n readonly $engine: Readonly<Record<string, EngineTable>>;\n}\n\nexport class SchemaBuildError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SchemaBuildError\";\n }\n}\n"],"mappings":";;AAqBA,SAAgB,uBACd,MAC2B;AAC3B,SAAQ,MAAR;EACE,KAAK,SACH,QAAO;GAAC;GAAM;GAAO;GAAM;GAAQ;GAAQ;EAC7C,KAAK;EACL,KAAK;EACL,KAAK,OACH,QAAO;GAAC;GAAM;GAAO;GAAM;GAAM;GAAO;GAAM;GAAM;EACtD,KAAK;EACL,KAAK;EACL,KAAK,OACH,QAAO;GAAC;GAAM;GAAO;GAAK;EAC5B,KAAK;EACL,KAAK,UACH,QAAO,EAAE;;;AAmIf,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO"}
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/database/schema-builder/validators.ts
4
+ const PG_INTEGER_MIN = -2147483648;
5
+ const PG_INTEGER_MAX = 2147483647;
6
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7
+ /** Validate the canonical value shape accepted by the configured Drizzle column. */
8
+ function columnValueSchema(meta) {
9
+ switch (meta.kind) {
10
+ case "string": {
11
+ const value = z.string();
12
+ return meta.storageKind === "varchar" ? value.max(meta.varcharLength ?? 255) : value;
13
+ }
14
+ case "number": return z.number().int().min(PG_INTEGER_MIN).max(PG_INTEGER_MAX);
15
+ case "bigint": return z.bigint();
16
+ case "boolean": return z.boolean();
17
+ case "date": return z.iso.datetime({
18
+ local: true,
19
+ offset: true
20
+ });
21
+ case "json": return z.json();
22
+ case "uuid": return z.string().regex(UUID_RE);
23
+ case "enum": return meta.enumValues && meta.enumValues.length > 0 ? z.enum([...meta.enumValues]) : z.never();
24
+ default: return z.never();
25
+ }
26
+ }
27
+ /** Trusted insert payload: private fields are allowed; identities are not. */
28
+ function deriveInsertSchema(tables) {
29
+ const shape = {};
30
+ for (const meta of Object.values(tables.$columns)) {
31
+ if (meta.serverGenerated) continue;
32
+ let field = columnValueSchema(meta);
33
+ if (!meta.notNull) field = field.nullable();
34
+ if (!meta.notNull || meta.hasDefault) field = field.optional();
35
+ shape[meta.columnName] = field;
36
+ }
37
+ return z.strictObject(shape);
38
+ }
39
+ /** Trusted update payload: private fields are allowed; keys and identities are not. */
40
+ function deriveUpdateSchema(tables) {
41
+ const shape = {};
42
+ for (const meta of Object.values(tables.$columns)) {
43
+ if (meta.serverGenerated || meta.primaryKey) continue;
44
+ let field = columnValueSchema(meta);
45
+ if (!meta.notNull) field = field.nullable();
46
+ shape[meta.columnName] = field.optional();
47
+ }
48
+ return z.strictObject(shape);
49
+ }
50
+
51
+ //#endregion
52
+ export { columnValueSchema, deriveInsertSchema, deriveUpdateSchema };
53
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","names":[],"sources":["../../../src/database/schema-builder/validators.ts"],"sourcesContent":["import type { ZodType } from \"zod\";\nimport { z } from \"zod\";\n\nimport type { AppKitTable, ColumnMeta } from \"./types\";\n\nconst PG_INTEGER_MIN = -2_147_483_648;\nconst PG_INTEGER_MAX = 2_147_483_647;\nconst UUID_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** Validate the canonical value shape accepted by the configured Drizzle column. */\nexport function columnValueSchema(\n meta: Pick<\n ColumnMeta,\n \"kind\" | \"storageKind\" | \"varcharLength\" | \"enumValues\"\n >,\n): ZodType {\n switch (meta.kind) {\n case \"string\": {\n const value = z.string();\n return meta.storageKind === \"varchar\"\n ? value.max(meta.varcharLength ?? 255)\n : value;\n }\n case \"number\":\n return z.number().int().min(PG_INTEGER_MIN).max(PG_INTEGER_MAX);\n case \"bigint\":\n return z.bigint();\n case \"boolean\":\n return z.boolean();\n case \"date\":\n return z.iso.datetime({ local: true, offset: true });\n case \"json\":\n return z.json();\n case \"uuid\":\n return z.string().regex(UUID_RE);\n case \"enum\":\n return meta.enumValues && meta.enumValues.length > 0\n ? z.enum([...meta.enumValues] as [string, ...string[]])\n : z.never();\n default:\n return z.never();\n }\n}\n\n/** Trusted insert payload: private fields are allowed; identities are not. */\nexport function deriveInsertSchema(tables: AppKitTable): ZodType {\n const shape: Record<string, ZodType> = {};\n\n for (const meta of Object.values(tables.$columns)) {\n if (meta.serverGenerated) continue;\n let field = columnValueSchema(meta);\n\n if (!meta.notNull) field = field.nullable();\n if (!meta.notNull || meta.hasDefault) field = field.optional();\n shape[meta.columnName] = field;\n }\n\n return z.strictObject(shape);\n}\n\n/** Trusted update payload: private fields are allowed; keys and identities are not. */\nexport function deriveUpdateSchema(tables: AppKitTable): ZodType {\n const shape: Record<string, ZodType> = {};\n for (const meta of Object.values(tables.$columns)) {\n if (meta.serverGenerated || meta.primaryKey) continue;\n let field = columnValueSchema(meta);\n if (!meta.notNull) field = field.nullable();\n shape[meta.columnName] = field.optional();\n }\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AAY;EAC7C,IAAI,QAAQ,kBAAkB,KAAK;AACnC,MAAI,CAAC,KAAK,QAAS,SAAQ,MAAM,UAAU;AAC3C,QAAM,KAAK,cAAc,MAAM,UAAU;;AAE3C,QAAO,EAAE,aAAa,MAAM"}
package/dist/index.d.ts CHANGED
@@ -7,18 +7,8 @@ import { ApiError } from "./shared/src/workspace-client/errors.js";
7
7
  import { createWorkspaceClient } from "./shared/src/workspace-client/factory.js";
8
8
  import "./shared/src/index.js";
9
9
  import { WorkspaceClient, WorkspaceClientOptions } from "./workspace-client/index.js";
10
- import { ExecutionResult } from "./plugin/execution-result.js";
10
+ import { DatabaseRegistry } from "./database/contract/registry.js";
11
11
  import { CacheManager } from "./cache/index.js";
12
- import { ITelemetry, TelemetryConfig } from "./telemetry/types.js";
13
- import { Counter, Histogram, SeverityNumber, Span, SpanStatusCode } from "./telemetry/index.js";
14
- import { Plugin } from "./plugin/plugin.js";
15
- import { toPlugin } from "./plugin/to-plugin.js";
16
- import "./plugin/index.js";
17
- import { ResourcePermission, ResourceType } from "./registry/types.generated.js";
18
- import { ConfigSchema, PluginManifest, ResourceEntry, ResourceRequirement, ValidationResult } from "./registry/types.js";
19
- import { getPluginManifest, getResourceRequirements } from "./registry/manifest-loader.js";
20
- import { ResourceRegistry } from "./registry/resource-registry.js";
21
- import "./registry/index.js";
22
12
  import { JobsConnectorConfig } from "./connectors/jobs/types.js";
23
13
  import "./connectors/jobs/index.js";
24
14
  import { LakebasePoolManager, createLakebasePoolManager } from "./connectors/lakebase/pool-manager.js";
@@ -26,6 +16,8 @@ import { LakebasePool } from "./connectors/lakebase/routing-pool.js";
26
16
  import { DatabaseCredential, GenerateDatabaseCredentialRequest, LakebasePoolConfig, RequestedClaims, RequestedClaimsPermissionSet, RequestedResource, createLakebasePool, generateDatabaseCredential, getLakebaseOrmConfig, getLakebasePgConfig, getUsernameWithApiLookup, getWorkspaceClient } from "./connectors/lakebase/index.js";
27
17
  import { getExecutionContext } from "./context/execution-context.js";
28
18
  import "./context/index.js";
19
+ import { ITelemetry, TelemetryConfig } from "./telemetry/types.js";
20
+ import { Counter, Histogram, SeverityNumber, Span, SpanStatusCode } from "./telemetry/index.js";
29
21
  import { createApp } from "./core/appkit.js";
30
22
  import "./core/index.js";
31
23
  import { AppKitError } from "./errors/base.js";
@@ -37,8 +29,17 @@ import { InitializationError } from "./errors/initialization.js";
37
29
  import { ServerError } from "./errors/server.js";
38
30
  import { TunnelError } from "./errors/tunnel.js";
39
31
  import { ValidationError } from "./errors/validation.js";
32
+ import { ExecutionResult } from "./plugin/execution-result.js";
33
+ import { Plugin } from "./plugin/plugin.js";
34
+ import { toPlugin } from "./plugin/to-plugin.js";
35
+ import "./plugin/index.js";
40
36
  import { FileAction, FilePolicy, FilePolicyUser, FileResource, PolicyDeniedError, READ_ACTIONS, WRITE_ACTIONS } from "./plugins/files/policy.js";
41
37
  import { analytics } from "./plugins/analytics/analytics.js";
38
+ import { ResourcePermission, ResourceType } from "./registry/types.generated.js";
39
+ import { ConfigSchema, PluginManifest, ResourceEntry, ResourceRequirement, ValidationResult } from "./registry/types.js";
40
+ import { defineManifest, getPluginManifest, getResourceRequirements } from "./registry/manifest-loader.js";
41
+ import { ResourceRegistry } from "./registry/resource-registry.js";
42
+ import "./registry/index.js";
42
43
  import { files } from "./plugins/files/plugin.js";
43
44
  import { genie } from "./plugins/genie/genie.js";
44
45
  import { IJobsConfig, JobAPI, JobConfig, JobsExport } from "./plugins/jobs/types.js";
@@ -52,4 +53,4 @@ import "./plugins/ga-exports.generated.js";
52
53
  import { extractServingEndpoints, findServerFile } from "./type-generator/serving/server-file-extractor.js";
53
54
  import { appKitServingTypesPlugin } from "./type-generator/serving/vite-plugin.js";
54
55
  import { appKitTypesPlugin } from "./type-generator/vite-plugin.js";
55
- export { ApiError, AppKitError, AuthenticationError, type BasePluginConfig, type CacheConfig, CacheManager, type ConfigSchema, ConfigurationError, ConnectionError, type Counter, type DatabaseCredential, type EndpointConfig, ExecutionError, type ExecutionResult, type FileAction, type FilePolicy, type FilePolicyUser, type FileResource, type GenerateDatabaseCredentialRequest, type Histogram, type IAppRouter, type IJobsConfig, type ITelemetry, InitializationError, type JobAPI, type JobConfig, type JobsConnectorConfig, type JobsExport, type LakebasePool, type LakebasePoolConfig, type LakebasePoolManager, Plugin, type PluginData, type PluginManifest, PolicyDeniedError, READ_ACTIONS, type RequestedClaims, RequestedClaimsPermissionSet, type RequestedResource, type ResourceEntry, type ResourceFieldEntry, type ResourcePermission, ResourceRegistry, type ResourceRequirement, ResourceType, ServerError, type ServingEndpointEntry, type ServingEndpointRegistry, type ServingFactory, SeverityNumber, type Span, SpanStatusCode, type StreamExecutionSettings, type TelemetryConfig, type ToPlugin, TunnelError, ValidationError, type ValidationResult, WRITE_ACTIONS, type WorkspaceClient, type WorkspaceClientOptions, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, createWorkspaceClient, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
56
+ export { ApiError, AppKitError, AuthenticationError, type BasePluginConfig, type CacheConfig, CacheManager, type ConfigSchema, ConfigurationError, ConnectionError, type Counter, type DatabaseCredential, type DatabaseRegistry, type EndpointConfig, ExecutionError, type ExecutionResult, type FileAction, type FilePolicy, type FilePolicyUser, type FileResource, type GenerateDatabaseCredentialRequest, type Histogram, type IAppRouter, type IJobsConfig, type ITelemetry, InitializationError, type JobAPI, type JobConfig, type JobsConnectorConfig, type JobsExport, type LakebasePool, type LakebasePoolConfig, type LakebasePoolManager, Plugin, type PluginData, type PluginManifest, PolicyDeniedError, READ_ACTIONS, type RequestedClaims, RequestedClaimsPermissionSet, type RequestedResource, type ResourceEntry, type ResourceFieldEntry, type ResourcePermission, ResourceRegistry, type ResourceRequirement, ResourceType, ServerError, type ServingEndpointEntry, type ServingEndpointRegistry, type ServingFactory, SeverityNumber, type Span, SpanStatusCode, type StreamExecutionSettings, type TelemetryConfig, type ToPlugin, TunnelError, ValidationError, type ValidationResult, WRITE_ACTIONS, type WorkspaceClient, type WorkspaceClientOptions, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, createWorkspaceClient, defineManifest, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import { Plugin } from "./plugin/plugin.js";
21
21
  import { toPlugin } from "./plugin/to-plugin.js";
22
22
  import "./plugin/index.js";
23
23
  import { ResourceType } from "./registry/types.generated.js";
24
- import { getPluginManifest, getResourceRequirements } from "./registry/manifest-loader.js";
24
+ import { defineManifest, getPluginManifest, getResourceRequirements } from "./registry/manifest-loader.js";
25
25
  import { ResourceRegistry } from "./registry/resource-registry.js";
26
26
  import "./registry/index.js";
27
27
  import { createApp } from "./core/appkit.js";
@@ -39,4 +39,4 @@ import { server } from "./plugins/server/index.js";
39
39
  import { serving } from "./plugins/serving/serving.js";
40
40
  import "./plugins/ga-exports.generated.js";
41
41
 
42
- export { ApiError, AppKitError, AuthenticationError, CacheManager, ConfigurationError, ConnectionError, ExecutionError, InitializationError, Plugin, PolicyDeniedError, READ_ACTIONS, RequestedClaimsPermissionSet, ResourceRegistry, ResourceType, ServerError, SeverityNumber, SpanStatusCode, TunnelError, ValidationError, WRITE_ACTIONS, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, createWorkspaceClient, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
42
+ export { ApiError, AppKitError, AuthenticationError, CacheManager, ConfigurationError, ConnectionError, ExecutionError, InitializationError, Plugin, PolicyDeniedError, READ_ACTIONS, RequestedClaimsPermissionSet, ResourceRegistry, ResourceType, ServerError, SeverityNumber, SpanStatusCode, TunnelError, ValidationError, WRITE_ACTIONS, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, createWorkspaceClient, defineManifest, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
@@ -1,11 +1,11 @@
1
1
  import { BasePlugin, BasePluginConfig, IAppResponse, PluginEndpointMap, PluginPhase, RouteConfig } from "../shared/src/plugin.js";
2
2
  import { PluginExecutionSettings, StreamExecuteHandler, StreamExecutionSettings } from "../shared/src/execute.js";
3
3
  import "../shared/src/index.js";
4
- import { ExecutionResult } from "./execution-result.js";
5
- import { AppManager } from "../app/index.js";
6
4
  import { CacheManager } from "../cache/index.js";
7
5
  import { ITelemetry } from "../telemetry/types.js";
8
6
  import "../telemetry/index.js";
7
+ import { ExecutionResult } from "./execution-result.js";
8
+ import { AppManager } from "../app/index.js";
9
9
  import { PluginContext } from "../core/plugin-context.js";
10
10
  import { StreamManager } from "../stream/stream-manager.js";
11
11
  import "../stream/index.js";
@@ -5,11 +5,11 @@ import { AgentDefinition, AgentsPluginConfig, RegisteredAgent } from "../../core
5
5
  import { Plugin } from "../../plugin/plugin.js";
6
6
  import "../../plugin/index.js";
7
7
  import { PluginManifest } from "../../registry/types.js";
8
- import "../../registry/index.js";
8
+ import "../../index.js";
9
9
 
10
10
  //#region src/plugins/agents/agents.d.ts
11
11
  declare class AgentsPlugin extends Plugin implements ToolProvider {
12
- static manifest: PluginManifest;
12
+ static manifest: PluginManifest<"agents">;
13
13
  static phase: PluginPhase;
14
14
  protected config: AgentsPluginConfig;
15
15
  private agents;
@@ -264,7 +264,7 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
264
264
  * });
265
265
  * ```
266
266
  */
267
- declare const agents: ToPlugin<typeof AgentsPlugin, AgentsPluginConfig, string>;
267
+ declare const agents: ToPlugin<typeof AgentsPlugin, AgentsPluginConfig, "agents">;
268
268
  //#endregion
269
269
  export { AgentsPlugin, agents };
270
270
  //# sourceMappingURL=agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","names":[],"sources":["../../../src/plugins/agents/agents.ts"],"mappings":";;;;;;;;;;cAsJa,YAAA,SAAqB,MAAA,YAAkB,YAAA;EAAA,OAK3C,QAAA,EAAkC,cAAA;EAAA,OAClC,KAAA,EAAO,WAAA;EAAA,UAEI,MAAA,EAAQ,kBAAA;EAAA,QAElB,MAAA;EAAA,QACA,gBAAA;EAAA,QACA,aAAA;EAZgB;;;;;;EAAA,QAsBhB,gBAAA;EAAA,QACA,SAAA;EAAA,QACA,WAAA;EAAA,QACA,YAAA;EAqzBa;EAAA,QAnzBb,0BAAA;EA+wDU;EAAA,QA7wDV,6BAAA;cAEI,MAAA,EAAQ,kBAAA;EAwxDE;;;;;;;;;;EAAA,QAzvDd,oBAAA;EAAA,YAKI,sBAAA,CAAA;EA7DL;EAAA,YAuFK,cAAA,CAAA;EArFM;EAAA,QAwGV,gBAAA;EAtGA;;;;;;EAAA,QAgHA,WAAA;EA/FA;;;;;EAAA,QAgHA,aAAA;EAYF,KAAA,CAAA,GAAK,OAAA;EA1DC;;;;;;EAyEN,MAAA,CAAA,GAAU,OAAA;EAAA;;;;;EAAA,QA0BF,kBAAA;EAsKA;;;;;EAAA,QAjEN,mBAAA;EAsPM;;;;EAAA,QAxNN,uBAAA;EAifR;;;;EAAA,QAleQ,0BAAA;EAAA,QAUA,iBAAA;EAkfa;;;;;;EAAA,QA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;;;;;;;;;;;;;;;UA2NA,qBAAA;;;;;;;;;;;;UA0KA,gBAAA;;;;;;;;;;;;;;;UAmIA,WAAA;EAAA,QAiGA,aAAA;EAAA,QA2BA,cAAA;EAAA,QAuCA,kBAAA;EAAA,QASA,gBAAA;EAAA,QAUA,mBAAA;EAAA,QAaN,YAAA;EAAA,QASA,aAAA;EAgBF,QAAA,CAAA,GAAY,OAAA;EAQlB,OAAA,CAAA;6BAE2B,GAAA,EAAO,eAAA,KAAe,OAAA;;2BAG3B,eAAA;;;oCAGS,OAAA,CAAA,MAAA;EAAA;EAAA,QAIjB,iBAAA;AAAA;;;;;;;;;;;;;;;;;;cAwJH,MAAA,EAAM,QAAA,QAAA,YAAA,EAAA,kBAAA"}
@@ -2,6 +2,8 @@ import { createLogger } from "../../logging/logger.js";
2
2
  import { Plugin } from "../../plugin/plugin.js";
3
3
  import { toPlugin } from "../../plugin/to-plugin.js";
4
4
  import "../../plugin/index.js";
5
+ import { defineManifest } from "../../registry/manifest-loader.js";
6
+ import "../../registry/index.js";
5
7
  import { buildMcpHostPolicy } from "../../connectors/mcp/host-policy.js";
6
8
  import { AppKitMcpClient } from "../../connectors/mcp/client.js";
7
9
  import "../../connectors/mcp/index.js";
@@ -58,7 +60,7 @@ function requiresApproval(annotations) {
58
60
  }
59
61
  }
60
62
  var AgentsPlugin = class extends Plugin {
61
- static manifest = manifest_default;
63
+ static manifest = defineManifest(manifest_default);
62
64
  static phase = "deferred";
63
65
  agents = /* @__PURE__ */ new Map();
64
66
  defaultAgentName = null;