@superpanel-sdk/runtime 0.2.3 → 0.7.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 (319) hide show
  1. package/README.md +30 -10
  2. package/dist/builder/codegen/emit.d.ts +25 -12
  3. package/dist/builder/codegen/emit.js +339 -78
  4. package/dist/builder/codegen/generate.d.ts +21 -2
  5. package/dist/builder/codegen/generate.js +147 -34
  6. package/dist/builder/company-import-graph.d.ts +2 -0
  7. package/dist/builder/company-import-graph.js +40 -8
  8. package/dist/builder/company-imports.d.ts +29 -0
  9. package/dist/builder/company-imports.js +122 -0
  10. package/dist/builder/compile/compile-sequence.d.ts +61 -8
  11. package/dist/builder/compile/compile-sequence.js +334 -80
  12. package/dist/builder/compile/function-code.d.ts +19 -3
  13. package/dist/builder/compile/function-code.js +123 -45
  14. package/dist/builder/compile/registry.d.ts +7 -3
  15. package/dist/builder/compile/registry.js +30 -27
  16. package/dist/builder/errors.d.ts +9 -0
  17. package/dist/builder/errors.js +17 -0
  18. package/dist/builder/function-params.d.ts +10 -0
  19. package/dist/builder/function-params.js +203 -0
  20. package/dist/builder/load.d.ts +70 -10
  21. package/dist/builder/load.js +258 -67
  22. package/dist/builder/paths.d.ts +9 -1
  23. package/dist/builder/paths.js +32 -2
  24. package/dist/builder/schedules.d.ts +25 -0
  25. package/dist/builder/schedules.js +101 -0
  26. package/dist/builder/slot-schema-validation.d.ts +4 -0
  27. package/dist/builder/slot-schema-validation.js +10 -0
  28. package/dist/builder/typecheck.d.ts +8 -0
  29. package/dist/builder/typecheck.js +102 -0
  30. package/dist/builder/types.d.ts +127 -19
  31. package/dist/builder/types.js +21 -1
  32. package/dist/cli/auth/auth.d.ts +37 -0
  33. package/dist/cli/auth/auth.js +211 -0
  34. package/dist/cli/auth/backend-url.d.ts +5 -0
  35. package/dist/cli/auth/backend-url.js +25 -0
  36. package/dist/cli/auth/clipboard.d.ts +9 -0
  37. package/dist/cli/auth/clipboard.js +38 -0
  38. package/dist/cli/auth/http.d.ts +20 -0
  39. package/dist/cli/auth/http.js +27 -0
  40. package/dist/cli/auth/index.d.ts +10 -0
  41. package/dist/cli/auth/index.js +27 -0
  42. package/dist/cli/auth/progress.d.ts +12 -0
  43. package/dist/cli/auth/progress.js +15 -0
  44. package/dist/cli/auth/serve-login.d.ts +8 -0
  45. package/dist/cli/auth/serve-login.js +24 -0
  46. package/dist/cli/calls/index.d.ts +177 -0
  47. package/dist/cli/calls/index.js +96 -0
  48. package/dist/cli/compile/index.js +3 -0
  49. package/dist/cli/config.d.ts +10 -0
  50. package/dist/cli/config.js +52 -0
  51. package/dist/cli/debug/index.d.ts +31 -0
  52. package/dist/cli/debug/index.js +119 -0
  53. package/dist/cli/exec/index.d.ts +39 -0
  54. package/dist/cli/exec/index.js +138 -0
  55. package/dist/cli/exec/session.d.ts +48 -0
  56. package/dist/cli/exec/session.js +82 -0
  57. package/dist/cli/exec/trace.d.ts +18 -0
  58. package/dist/cli/exec/trace.js +52 -0
  59. package/dist/cli/index.js +112 -9
  60. package/dist/cli/logs/index.d.ts +47 -0
  61. package/dist/cli/logs/index.js +113 -0
  62. package/dist/cli/mobile/index.d.ts +12 -0
  63. package/dist/cli/mobile/index.js +405 -0
  64. package/dist/cli/serve/index.d.ts +109 -3
  65. package/dist/cli/serve/index.js +506 -118
  66. package/dist/cli/turns/index.d.ts +105 -0
  67. package/dist/cli/turns/index.js +128 -0
  68. package/dist/cli/turns/run.d.ts +13 -0
  69. package/dist/cli/turns/run.js +57 -0
  70. package/dist/cli/turns/shadow.d.ts +112 -0
  71. package/dist/cli/turns/shadow.js +54 -0
  72. package/dist/cli/type-gen/index.js +9 -9
  73. package/dist/compiler.d.ts +7 -0
  74. package/dist/compiler.js +7 -0
  75. package/dist/compute-host/compute-host.d.ts +14 -23
  76. package/dist/compute-host/compute-host.js +18 -30
  77. package/dist/compute-host/index.d.ts +2 -4
  78. package/dist/compute-host/index.js +1 -2
  79. package/dist/compute-host/source-compute-host.d.ts +10 -10
  80. package/dist/compute-host/source-compute-host.js +33 -40
  81. package/dist/core/case-orchestrator/contact-hours.d.ts +70 -0
  82. package/dist/core/case-orchestrator/contact-hours.js +127 -0
  83. package/dist/core/case-orchestrator/index.d.ts +3 -0
  84. package/dist/core/case-orchestrator/index.js +3 -0
  85. package/dist/core/case-orchestrator/render.d.ts +75 -0
  86. package/dist/core/case-orchestrator/render.js +244 -0
  87. package/dist/core/case-orchestrator/time.d.ts +11 -0
  88. package/dist/core/case-orchestrator/time.js +29 -0
  89. package/dist/core/case-orchestrator/types.d.ts +708 -0
  90. package/dist/core/case-orchestrator/types.js +42 -0
  91. package/dist/core/context/call.d.ts +291 -0
  92. package/dist/core/context/call.js +94 -0
  93. package/dist/core/context/channels.d.ts +60 -0
  94. package/dist/core/context/channels.js +35 -0
  95. package/dist/core/context/contact.d.ts +96 -6
  96. package/dist/core/context/contact.js +48 -2
  97. package/dist/core/context/email-message.d.ts +198 -0
  98. package/dist/core/context/email-message.js +86 -0
  99. package/dist/core/context/email.d.ts +109 -0
  100. package/dist/core/context/email.js +90 -0
  101. package/dist/core/context/exchanges.d.ts +167 -0
  102. package/dist/core/context/exchanges.js +81 -0
  103. package/dist/core/context/instances.d.ts +307 -0
  104. package/dist/core/context/instances.js +137 -0
  105. package/dist/core/context/kv.d.ts +113 -0
  106. package/dist/core/context/kv.js +60 -0
  107. package/dist/core/context/platform-registry.d.ts +544 -4
  108. package/dist/core/context/platform-registry.js +14 -2
  109. package/dist/core/context/platform.d.ts +2 -1
  110. package/dist/core/context/sms.d.ts +177 -0
  111. package/dist/core/context/sms.js +77 -0
  112. package/dist/core/context/types.d.ts +79 -48
  113. package/dist/core/context/types.js +1 -7
  114. package/dist/core/conversation/index.d.ts +85 -0
  115. package/dist/core/conversation/index.js +133 -0
  116. package/dist/core/functions/errors.d.ts +74 -0
  117. package/dist/core/functions/errors.js +26 -0
  118. package/dist/core/functions/events.d.ts +192 -0
  119. package/dist/core/functions/events.js +23 -0
  120. package/dist/core/functions/schedules.d.ts +50 -0
  121. package/dist/core/functions/schedules.js +20 -0
  122. package/dist/core/functions/types.d.ts +29 -73
  123. package/dist/core/functions/types.js +1 -4
  124. package/dist/core/office-hours/index.d.ts +39 -0
  125. package/dist/core/office-hours/index.js +187 -0
  126. package/dist/core/page/define.d.ts +904 -0
  127. package/dist/core/page/define.js +518 -0
  128. package/dist/core/page/envelope.d.ts +55 -0
  129. package/dist/core/page/envelope.js +4 -0
  130. package/dist/core/page/fns.d.ts +448 -0
  131. package/dist/core/page/fns.js +539 -0
  132. package/dist/core/page/memory-reader.d.ts +27 -0
  133. package/dist/core/page/memory-reader.js +299 -0
  134. package/dist/core/page/ops.d.ts +58 -0
  135. package/dist/core/page/ops.js +220 -0
  136. package/dist/core/page/page-host.d.ts +20 -0
  137. package/dist/core/page/page-host.js +57 -0
  138. package/dist/core/page/records-query.d.ts +234 -0
  139. package/dist/core/page/records-query.js +780 -0
  140. package/dist/core/page/render.d.ts +295 -0
  141. package/dist/core/page/render.js +1060 -0
  142. package/dist/core/page/sandbox.d.ts +85 -0
  143. package/dist/core/page/sandbox.js +357 -0
  144. package/dist/core/page/time-format.d.ts +46 -0
  145. package/dist/core/page/time-format.js +125 -0
  146. package/dist/core/page/timeline.d.ts +40 -0
  147. package/dist/core/page/timeline.js +2 -0
  148. package/dist/core/page/typed.d.ts +648 -0
  149. package/dist/core/page/typed.js +2 -0
  150. package/dist/core/page/workspace.d.ts +57 -0
  151. package/dist/core/page/workspace.js +266 -0
  152. package/dist/core/party/index.d.ts +3 -0
  153. package/dist/core/party/index.js +3 -0
  154. package/dist/core/party/schema.d.ts +208 -0
  155. package/dist/core/party/schema.js +113 -0
  156. package/dist/core/party/types.d.ts +35 -0
  157. package/dist/core/party/types.js +15 -0
  158. package/dist/core/sequence/define.d.ts +56 -0
  159. package/dist/core/sequence/define.js +10 -0
  160. package/dist/core/sequence/index.d.ts +63 -0
  161. package/dist/core/sequence/index.js +231 -0
  162. package/dist/core/slot/binding.d.ts +40 -0
  163. package/dist/core/slot/binding.js +2 -0
  164. package/dist/core/slot/company-metadata.d.ts +102 -0
  165. package/dist/core/slot/company-metadata.js +536 -0
  166. package/dist/core/slot/compile-schema.d.ts +19 -13
  167. package/dist/core/slot/compile-schema.js +51 -248
  168. package/dist/core/slot/contact-timezone.d.ts +110 -0
  169. package/dist/core/slot/contact-timezone.js +186 -0
  170. package/dist/core/slot/field.d.ts +2 -25
  171. package/dist/core/slot/field.js +0 -71
  172. package/dist/core/slot/id-ref.d.ts +17 -2
  173. package/dist/core/slot/id-ref.js +16 -8
  174. package/dist/core/slot/index.d.ts +12 -13
  175. package/dist/core/slot/index.js +11 -12
  176. package/dist/core/slot/naming.d.ts +15 -0
  177. package/dist/core/slot/naming.js +96 -0
  178. package/dist/core/slot/platform-fields.d.ts +119 -0
  179. package/dist/core/slot/platform-fields.js +121 -0
  180. package/dist/core/slot/ref.d.ts +16 -0
  181. package/dist/core/slot/ref.js +14 -0
  182. package/dist/core/slot/row.d.ts +2 -9
  183. package/dist/core/slot/row.js +13 -23
  184. package/dist/core/slot/schema-compat.d.ts +17 -0
  185. package/dist/core/slot/schema-compat.js +103 -0
  186. package/dist/core/slot/schema.d.ts +353 -76
  187. package/dist/core/slot/schema.js +163 -10
  188. package/dist/core/slot/types.d.ts +30 -103
  189. package/dist/core/slot/value.d.ts +28 -3
  190. package/dist/core/slot/value.js +93 -57
  191. package/dist/dev-overlay/protocol.d.ts +74 -8
  192. package/dist/fn-context/build-context.d.ts +3 -1
  193. package/dist/fn-context/build-context.js +26 -10
  194. package/dist/fn-context/fake/empty-api.js +9 -28
  195. package/dist/fn-context/fake/index.d.ts +13 -4
  196. package/dist/fn-context/fake/index.js +29 -2
  197. package/dist/fn-context/fn-params.d.ts +3 -0
  198. package/dist/fn-context/fn-params.js +10 -0
  199. package/dist/fn-context/index.d.ts +5 -5
  200. package/dist/fn-context/index.js +4 -4
  201. package/dist/fn-context/log.js +2 -2
  202. package/dist/fn-context/make-ctx.d.ts +11 -0
  203. package/dist/fn-context/make-ctx.js +20 -9
  204. package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +32 -0
  205. package/dist/fn-context/rpc/case-orchestrator-tools.js +12 -0
  206. package/dist/fn-context/rpc/errors.d.ts +13 -0
  207. package/dist/fn-context/rpc/errors.js +22 -0
  208. package/dist/fn-context/rpc/index.d.ts +4 -2
  209. package/dist/fn-context/rpc/index.js +4 -2
  210. package/dist/fn-context/rpc/integration/index.d.ts +15 -5
  211. package/dist/fn-context/rpc/integration/index.js +1 -1
  212. package/dist/fn-context/rpc/integration/list-surfaces.d.ts +21 -0
  213. package/dist/fn-context/rpc/integration/{list-bindings.js → list-surfaces.js} +4 -4
  214. package/dist/fn-context/rpc/log.d.ts +11 -1
  215. package/dist/fn-context/rpc/platform.d.ts +13 -3
  216. package/dist/fn-context/rpc/platform.js +1 -1
  217. package/dist/fn-context/rpc/records.d.ts +85 -0
  218. package/dist/fn-context/rpc/records.js +24 -0
  219. package/dist/fn-context/rpc/trpc-client.d.ts +44 -2
  220. package/dist/fn-context/rpc/trpc-client.js +222 -12
  221. package/dist/fn-context/rpc/trpc-init.d.ts +21 -3
  222. package/dist/fn-context/rpc/trpc-init.js +10 -4
  223. package/dist/fn-context/rpc/trpc-router-factory.d.ts +111 -7
  224. package/dist/fn-context/rpc/trpc-router-factory.js +2 -0
  225. package/dist/fn-context/run-scope.d.ts +4 -0
  226. package/dist/fn-context/run-scope.js +9 -0
  227. package/dist/fn-context/types.d.ts +52 -5
  228. package/dist/index.d.ts +36 -46
  229. package/dist/index.js +30 -33
  230. package/dist/logger.d.ts +11 -0
  231. package/dist/logger.js +49 -0
  232. package/dist/platform.d.ts +75 -0
  233. package/dist/platform.js +57 -0
  234. package/dist/testing-compile-child.d.ts +2 -0
  235. package/dist/testing-compile-child.js +20 -0
  236. package/dist/testing.d.ts +368 -0
  237. package/dist/testing.js +439 -0
  238. package/dist/voice-service/actions.d.ts +50 -6
  239. package/dist/voice-service/index.d.ts +2 -0
  240. package/dist/voice-service/index.js +2 -0
  241. package/dist/voice-service/protocol.d.ts +604 -0
  242. package/dist/voice-service/protocol.js +67 -0
  243. package/dist/voice-service/types.d.ts +55 -8
  244. package/dist/worker.d.ts +11 -0
  245. package/dist/worker.js +11 -0
  246. package/package.json +38 -15
  247. package/dist/builder/compile/compile-agenda.d.ts +0 -15
  248. package/dist/builder/compile/compile-agenda.js +0 -64
  249. package/dist/builder/merge.d.ts +0 -4
  250. package/dist/builder/merge.js +0 -19
  251. package/dist/compute-host/read-only-cache.d.ts +0 -20
  252. package/dist/compute-host/read-only-cache.js +0 -61
  253. package/dist/core/context/db.d.ts +0 -69
  254. package/dist/core/context/db.js +0 -44
  255. package/dist/core/context/docusign.d.ts +0 -134
  256. package/dist/core/context/docusign.js +0 -108
  257. package/dist/core/context/filevine.d.ts +0 -323
  258. package/dist/core/context/filevine.js +0 -254
  259. package/dist/core/context/http.d.ts +0 -9
  260. package/dist/core/context/http.js +0 -4
  261. package/dist/core/context/hubspot.d.ts +0 -250
  262. package/dist/core/context/hubspot.js +0 -191
  263. package/dist/core/context/twilio.d.ts +0 -50
  264. package/dist/core/context/twilio.js +0 -42
  265. package/dist/core/functions/define/case-context.d.ts +0 -14
  266. package/dist/core/functions/define/case-context.js +0 -15
  267. package/dist/core/functions/define/compute.d.ts +0 -7
  268. package/dist/core/functions/define/compute.js +0 -17
  269. package/dist/core/functions/define/custom.d.ts +0 -4
  270. package/dist/core/functions/define/custom.js +0 -8
  271. package/dist/core/functions/define/system.d.ts +0 -7
  272. package/dist/core/functions/define/system.js +0 -12
  273. package/dist/core/functions/func-ref.d.ts +0 -16
  274. package/dist/core/functions/func-ref.js +0 -20
  275. package/dist/core/slot/deps.d.ts +0 -15
  276. package/dist/core/slot/deps.js +0 -88
  277. package/dist/core/slot/derived.d.ts +0 -32
  278. package/dist/core/slot/derived.js +0 -115
  279. package/dist/core/slot/platform-session-fields.d.ts +0 -38
  280. package/dist/core/slot/platform-session-fields.js +0 -48
  281. package/dist/core/slot/sf-schema.d.ts +0 -23
  282. package/dist/core/slot/sf-schema.js +0 -125
  283. package/dist/core/slot/sf-validate.d.ts +0 -14
  284. package/dist/core/slot/sf-validate.js +0 -132
  285. package/dist/core/slot/snapshot.d.ts +0 -18
  286. package/dist/core/slot/snapshot.js +0 -138
  287. package/dist/core/slot/write.d.ts +0 -48
  288. package/dist/core/slot/write.js +0 -426
  289. package/dist/core/stage/builders.d.ts +0 -54
  290. package/dist/core/stage/builders.js +0 -31
  291. package/dist/core/stage/condition.d.ts +0 -17
  292. package/dist/core/stage/condition.js +0 -198
  293. package/dist/core/stage/drive.d.ts +0 -43
  294. package/dist/core/stage/drive.js +0 -78
  295. package/dist/core/stage/finish-when.d.ts +0 -20
  296. package/dist/core/stage/finish-when.js +0 -82
  297. package/dist/core/stage/flatten.d.ts +0 -27
  298. package/dist/core/stage/flatten.js +0 -466
  299. package/dist/core/stage/index.d.ts +0 -15
  300. package/dist/core/stage/index.js +0 -13
  301. package/dist/core/stage/interrupts.d.ts +0 -28
  302. package/dist/core/stage/interrupts.js +0 -120
  303. package/dist/core/stage/ivr-fields.d.ts +0 -9
  304. package/dist/core/stage/ivr-fields.js +0 -75
  305. package/dist/core/stage/simulate.d.ts +0 -24
  306. package/dist/core/stage/simulate.js +0 -33
  307. package/dist/core/stage/transfer-fields.d.ts +0 -19
  308. package/dist/core/stage/transfer-fields.js +0 -129
  309. package/dist/core/stage/transfer-spec.d.ts +0 -48
  310. package/dist/core/stage/transfer-spec.js +0 -113
  311. package/dist/core/stage/types.d.ts +0 -208
  312. package/dist/core/stage/types.js +0 -2
  313. package/dist/core/stage/validate.d.ts +0 -11
  314. package/dist/core/stage/validate.js +0 -330
  315. package/dist/core/stage/walk.d.ts +0 -39
  316. package/dist/core/stage/walk.js +0 -119
  317. package/dist/fn-context/rpc/integration/list-bindings.d.ts +0 -21
  318. package/dist/fn-context/system-args.d.ts +0 -6
  319. package/dist/fn-context/system-args.js +0 -14
@@ -2,11 +2,23 @@ import { emptyFieldValue } from './field.js';
2
2
  import { ROW_ID_FIELD } from './schema.js';
3
3
  /** Reserved snapshot key; cannot be a company / sequence table name. */
4
4
  export const SNAPSHOT_CURRENT_KEY = 'current';
5
+ /**
6
+ * `derivedOrder` / `reverseDeps`: keys a compiled schema carried before derived fields were removed
7
+ * (13-data-model-v1 §21); older builds still have them, so they stay reserved and are skipped.
8
+ */
5
9
  const RESERVED_TABLE_NAMES = new Set([SNAPSHOT_CURRENT_KEY, 'derivedOrder', 'reverseDeps']);
6
10
  export function isReservedTableName(tableName) {
7
11
  return RESERVED_TABLE_NAMES.has(tableName);
8
12
  }
9
- /** App-minted row id for jsonb-hosted tables. */
13
+ /**
14
+ * Multi-row tables with a bound row (the conversation's contact): a write without `rowId`
15
+ * goes to it. Contacts are created through `ctx.api.contact`, never inserted by a write.
16
+ */
17
+ const BOUND_ROW_TABLES = new Set(['contact']);
18
+ export function hasBoundRow(tableName) {
19
+ return BOUND_ROW_TABLES.has(tableName);
20
+ }
21
+ /** App-minted row id for multi-row tables (the Record's id). */
10
22
  export function mintRowId() {
11
23
  return crypto.randomUUID();
12
24
  }
@@ -16,12 +28,6 @@ export function isRowIdField(name) {
16
28
  export function isFieldValue(value) {
17
29
  return typeof value === 'object' && value !== null && 'state' in value && 'value' in value;
18
30
  }
19
- export function getRowField(row, fieldName) {
20
- if (isRowIdField(fieldName))
21
- return undefined;
22
- const value = row[fieldName];
23
- return isFieldValue(value) ? value : undefined;
24
- }
25
31
  /** Schema fields that store envelopes — excludes row `id`. */
26
32
  export function slotFieldEntries(fields) {
27
33
  return Object.entries(fields).filter(([name]) => !isRowIdField(name));
@@ -29,22 +35,6 @@ export function slotFieldEntries(fields) {
29
35
  export function slotFieldNames(fields) {
30
36
  return slotFieldEntries(fields).map(([name]) => name);
31
37
  }
32
- /** Envelope cells on a runtime row — excludes `id`. */
33
- export function rowValueEntries(row) {
34
- const out = [];
35
- for (const [name, value] of Object.entries(row)) {
36
- if (isRowIdField(name) || !isFieldValue(value))
37
- continue;
38
- out.push([name, value]);
39
- }
40
- return out;
41
- }
42
- export function emptySlotRow(fields, options = {}) {
43
- return fillRowFields({ id: options.id ?? '' }, fields, options.now ?? 0);
44
- }
45
- export function emptyMultiRow(fields, id, now = 0) {
46
- return fillRowFields({ id }, fields, now);
47
- }
48
38
  function fillRowFields(row, fields, now) {
49
39
  for (const name of slotFieldNames(fields)) {
50
40
  row[name] = emptyFieldValue(now);
@@ -0,0 +1,17 @@
1
+ import type { CompiledSlotSchema } from './types.js';
2
+ /**
3
+ * Why `after`'s company schema cannot replace `before`'s without breaking slot data stored under
4
+ * it; empty for an additive (01-slot-db §2.3) evolution. Both are a build's compiled schema
5
+ * (`CompanyPart.schema`): one for the whole repo, sequences have none of their own. The session
6
+ * table (`schema/session.ts`) follows the same rules, since `Session.data` keeps its values
7
+ * (11-remove-sequence-schema §3.1); a session field has no ref, so the ref rules never apply to it.
8
+ *
9
+ * Compatible: new tables (with their parent), fields (lookups included), more options, a widened
10
+ * type (`select` / `time` → `string`), and presentation changes (label,
11
+ * description, extraction, deprecated); a new field may be `unique`. Incompatible: removing a table or
12
+ * field (mark it `deprecated` instead); any other change of a field's dataType (to `text` included), `unique` added to or
13
+ * dropped from a field (18-record-search-index §4.5), any ref change (added, removed, retargeted, parent ↔ lookup), a parent added to a
14
+ * table `before` has (its stored rows have no parent edge, 13-data-model-v1 §22.5), a removed option.
15
+ */
16
+ export declare function companySchemaCompatibilityIssues(before: CompiledSlotSchema, after: CompiledSlotSchema): string[];
17
+ //# sourceMappingURL=schema-compat.d.ts.map
@@ -0,0 +1,103 @@
1
+ import { ROW_ID_FIELD } from './schema.js';
2
+ function formatValues(values) {
3
+ return values.join(', ');
4
+ }
5
+ /**
6
+ * Type changes that only widen: every stored value of `before` is a valid value of `after`
7
+ * (18-record-search-index §5, 27 §2.3): an option or a time of day as a short value. Nothing becomes
8
+ * `text`: a `text` field is not in the field index, so the change would drop every stored entry of the
9
+ * field at once, in the release's go-live (2026-11-10).
10
+ */
11
+ const WIDENINGS = new Set(['select>string', 'time>string']);
12
+ const NOT_TO_TEXT = 'a released field does not become text: add a text field and mark this one deprecated';
13
+ function fieldIssues(path, before, after) {
14
+ const issues = [];
15
+ if (before.dataType !== after.dataType && !WIDENINGS.has(`${before.dataType}>${after.dataType}`)) {
16
+ issues.push(`field '${path}' dataType: ${before.dataType} → ${after.dataType}${after.dataType === 'text' ? ` (${NOT_TO_TEXT})` : ''}`);
17
+ }
18
+ // More options only widen; a dropped one may be stored.
19
+ if (before.dataType === after.dataType && before.options && after.options) {
20
+ const kept = new Set(after.options);
21
+ const removed = before.options.filter((value) => !kept.has(value));
22
+ if (removed.length > 0)
23
+ issues.push(`field '${path}' removed options: ${formatValues(removed)}`);
24
+ }
25
+ issues.push(...refIssues(path, before, after));
26
+ // `unique` is the field's from its first release (18-record-search-index §4.5): adding it would need
27
+ // stored values checked and the index marked, dropping it the marks cleared, both racing writes.
28
+ if (Boolean(before.unique) !== Boolean(after.unique)) {
29
+ issues.push(`field '${path}' unique: ${before.unique ? 'yes' : 'no'} → ${after.unique ? 'yes' : 'no'} (unique is set when a field is added; add a new field instead)`);
30
+ }
31
+ return issues;
32
+ }
33
+ /**
34
+ * What to do instead of changing a parent (13-data-model-v1 §22.5): which row a row belongs to is
35
+ * data, set once when the row is created, so no schema change can move or add it for stored rows.
36
+ */
37
+ const PARENT_FIXED = 'a parent is fixed once released: create a new table and move the data instead';
38
+ /**
39
+ * A ref only ever stays as it is (13-data-model-v1 §11.9). Adding or retargeting one invalidates
40
+ * stored ids. Dropping one leaves its `RecordRef` projections behind (nothing deletes them once the
41
+ * field is no longer a ref), blocking the target's delete. A parent and a lookup are stored apart
42
+ * (a lookup in the row's data, a parent only in `RecordRef`). To change a lookup, mark the field
43
+ * deprecated and add a new one; a parent cannot change at all (§22.5).
44
+ */
45
+ function refIssues(path, before, after) {
46
+ if (!before.ref && !after.ref)
47
+ return [];
48
+ const parentInvolved = before.ref?.kind === 'parent' || after.ref?.kind === 'parent';
49
+ const instead = parentInvolved ? PARENT_FIXED : 'mark it deprecated instead';
50
+ if (!after.ref)
51
+ return [`field '${path}' ref to ${before.ref.table} was removed (${instead})`];
52
+ if (after.ref.table !== before.ref?.table) {
53
+ return [`field '${path}' ref: ${before.ref?.table ?? 'none'} → ${after.ref.table}${parentInvolved ? ` (${PARENT_FIXED})` : ''}`];
54
+ }
55
+ if (after.ref.kind !== before.ref.kind) {
56
+ return [`field '${path}' ref kind: ${before.ref.kind} → ${after.ref.kind}${parentInvolved ? ` (${PARENT_FIXED})` : ''}`];
57
+ }
58
+ return [];
59
+ }
60
+ /**
61
+ * Why `after`'s company schema cannot replace `before`'s without breaking slot data stored under
62
+ * it; empty for an additive (01-slot-db §2.3) evolution. Both are a build's compiled schema
63
+ * (`CompanyPart.schema`): one for the whole repo, sequences have none of their own. The session
64
+ * table (`schema/session.ts`) follows the same rules, since `Session.data` keeps its values
65
+ * (11-remove-sequence-schema §3.1); a session field has no ref, so the ref rules never apply to it.
66
+ *
67
+ * Compatible: new tables (with their parent), fields (lookups included), more options, a widened
68
+ * type (`select` / `time` → `string`), and presentation changes (label,
69
+ * description, extraction, deprecated); a new field may be `unique`. Incompatible: removing a table or
70
+ * field (mark it `deprecated` instead); any other change of a field's dataType (to `text` included), `unique` added to or
71
+ * dropped from a field (18-record-search-index §4.5), any ref change (added, removed, retargeted, parent ↔ lookup), a parent added to a
72
+ * table `before` has (its stored rows have no parent edge, 13-data-model-v1 §22.5), a removed option.
73
+ */
74
+ export function companySchemaCompatibilityIssues(before, after) {
75
+ const issues = [];
76
+ for (const [tableName, beforeTable] of Object.entries(before)) {
77
+ const afterTable = Object.hasOwn(after, tableName) ? after[tableName] : undefined;
78
+ if (!afterTable) {
79
+ issues.push(`table '${tableName}' was removed`);
80
+ continue;
81
+ }
82
+ for (const [fieldName, beforeField] of Object.entries(beforeTable.fields)) {
83
+ // The row id is the platform's, the same on every table.
84
+ if (fieldName === ROW_ID_FIELD)
85
+ continue;
86
+ const path = `${tableName}.${fieldName}`;
87
+ const afterField = Object.hasOwn(afterTable.fields, fieldName) ? afterTable.fields[fieldName] : undefined;
88
+ if (!afterField) {
89
+ const instead = beforeField.ref?.kind === 'parent' ? PARENT_FIXED : 'mark it deprecated instead';
90
+ issues.push(`field '${path}' was removed (${instead})`);
91
+ continue;
92
+ }
93
+ issues.push(...fieldIssues(path, beforeField, afterField));
94
+ }
95
+ for (const [fieldName, afterField] of Object.entries(afterTable.fields)) {
96
+ if (Object.hasOwn(beforeTable.fields, fieldName) || afterField.ref?.kind !== 'parent')
97
+ continue;
98
+ issues.push(`table '${tableName}' gained a parent '${fieldName}': its stored rows have none (${PARENT_FIXED})`);
99
+ }
100
+ }
101
+ return issues;
102
+ }
103
+ //# sourceMappingURL=schema-compat.js.map
@@ -1,102 +1,379 @@
1
- import type { FuncRef } from '../functions/func-ref.js';
2
- import type { FieldPath } from './path.js';
3
- export type DataType = 'string' | 'number' | 'boolean' | 'date' | 'datetime';
4
- /** Shared core for normal (non-derived) fields — company + session. */
1
+ import { z } from 'zod';
2
+ /**
3
+ * A field's type (18-record-search-index §4.2): `string` is a value to find and sort by, `text` one
4
+ * only kept (notes, descriptions; not indexed); a `string` holds up to `LIMITS.stringBytes` (its index
5
+ * entries keep it whole), a `text` up to `LIMITS.textBytes` (34-string-length); `phone` is stored in
6
+ * E.164 and `email` lower-cased, both checked on write. `select` is one of the field's `options`,
7
+ * `multi_select` a list of them, `time` a time of day `HH:mm` (27-field-types-and-history).
8
+ */
9
+ export type ScalarDataType = 'string' | 'text' | 'phone' | 'email' | 'number' | 'boolean' | 'date' | 'datetime' | 'time' | 'select' | 'multi_select';
10
+ export type DataType = ScalarDataType | 'contact_schedule';
11
+ export declare const SCALAR_DATA_TYPES: readonly ["string", "text", "phone", "email", "number", "boolean", "date", "datetime", "time", "select", "multi_select"];
12
+ /** The types that take `options` (27 §2–§3). */
13
+ export declare const OPTION_DATA_TYPES: ReadonlySet<DataType>;
14
+ /** Time window within a local day (`HH:mm`; only `end` may be `'24:00'`; `start < end`). */
15
+ export type LocalTimeRange = {
16
+ start: string;
17
+ end: string;
18
+ };
19
+ export type ContactWeekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
20
+ /**
21
+ * A contact's allowed-contact schedule (`contact.contact_schedule`), in their local timezone.
22
+ * - `weekly`: recurring allowed windows for all seven weekdays (`[]` on a weekday means no contact that day); `null` means no weekly restriction (all day, still clipped to the platform window).
23
+ * - `dateOverrides`: specific calendar dates (`YYYY-MM-DD`, each at most once) whose `windows` completely replace `weekly` on those dates (`windows: []` means no contact on those dates).
24
+ * Every window list is sorted by `start` and non-overlapping.
25
+ */
26
+ export type ContactSchedule = {
27
+ weekly: Record<ContactWeekday, LocalTimeRange[]> | null;
28
+ dateOverrides: Array<{
29
+ dates: string[];
30
+ windows: LocalTimeRange[];
31
+ }>;
32
+ };
33
+ /**
34
+ * Shared core for fields — company + session. Who may write a field is not the schema's to say: the
35
+ * AI writes only the cells a page opens with `field(...)` (19-page-writable-cells).
36
+ */
5
37
  export type NormalFieldCore = {
6
- derived: false;
7
38
  label: string;
8
39
  dataType: DataType;
9
- source: 'conversation' | 'system';
40
+ /** How to fill this field (on a cell the page opens), or what it means (on one it shows read-only). */
10
41
  extraction: string;
11
- enum: Array<string | number> | null;
12
- nullable: boolean;
42
+ /** A `select` / `multi_select` field's choices: short codes, their meaning in `extraction` (27 §2). */
43
+ options?: string[];
13
44
  };
14
- /** Reserved row-identity field name. Authors should not invent another. */
45
+ /** Field keys derived fields used; they were removed (13-data-model-v1 §21) and are reported when found. */
46
+ export declare const REMOVED_DERIVED_KEYS: readonly ['derived', 'dependsOn', 'computeFn'];
47
+ /** A field's `source`, removed (19-page-writable-cells): a page decides what the AI may write. */
48
+ export declare const REMOVED_SOURCE_KEY = "source";
49
+ /**
50
+ * A field's `nullable`, removed: no write ever checked it. Every field starts empty and can be
51
+ * cleared; a page's `required` says when one must be filled, and the platform keeps a row's id and
52
+ * parent itself.
53
+ */
54
+ export declare const REMOVED_NULLABLE_KEY = "nullable";
55
+ /**
56
+ * A field's `enum`, removed (27 §2): a field of a known set of values is a `select` (or `multi_select`)
57
+ * with `options`.
58
+ */
59
+ export declare const REMOVED_ENUM_KEY = "enum";
60
+ /**
61
+ * A field's `identifier`, removed: nothing found a contact by it. Who a conversation is with is the
62
+ * repo's `resolve` to decide; `ctx.api.contact.find` and clearing a contact use `phone` and `email`.
63
+ */
64
+ export declare const REMOVED_IDENTIFIER_KEY = "identifier";
65
+ /** Every row's id: the platform's, on every table; a schema does not write it. */
15
66
  export declare const ROW_ID_FIELD = "id";
67
+ /**
68
+ * What every row has besides its fields, the platform's (never a field of a schema): its `id`, when
69
+ * it was created and when it was last written (ISO 8601). A read can filter and order by them.
70
+ */
71
+ export declare const ROW_SYSTEM_KEYS: readonly ['id', 'createdAt', 'updatedAt'];
72
+ export type RowSystemKey = (typeof ROW_SYSTEM_KEYS)[number];
73
+ /** The row's times: `createdAt`, `updatedAt`. */
74
+ export declare const ROW_TIME_KEYS: readonly ['createdAt', 'updatedAt'];
75
+ export type RowTimeKey = (typeof ROW_TIME_KEYS)[number];
76
+ export declare function isRowTimeKey(key: string): key is RowTimeKey;
77
+ /** The definition of every row's `id` (added by the platform to every table and the session). */
16
78
  export declare const idFieldCore: {
17
- readonly derived: false;
18
79
  readonly label: 'Id';
19
80
  readonly dataType: 'string';
20
- readonly source: 'system';
21
81
  readonly extraction: 'Row identity';
22
- readonly enum: null;
23
- readonly nullable: false;
24
82
  };
25
- /** Unified row id. Write `id: idField` on every table. */
26
- export declare const idField: {
27
- readonly derived: false;
28
- readonly label: 'Id';
29
- readonly dataType: 'string';
30
- readonly source: 'system';
31
- readonly extraction: 'Row identity';
32
- readonly enum: null;
33
- readonly nullable: false;
34
- readonly identifier: null;
83
+ /**
84
+ * A ref to a table's row (13-data-model-v1 §11, 14-sequence-instance §16.1): `parent` is the row's
85
+ * owner (required, set once, decides loading and cascade delete; a parent row has any number of rows
86
+ * under it, 13-data-model-v1 §22.4); `lookup` is any other link. Write it with `parentRef(table)` /
87
+ * `lookupRef(table)`. `relatedName` names the way back, from the target row to the rows that point at
88
+ * it (`case_file.injuries`, 13-data-model-v1 §23.4 item 3); without it there is none.
89
+ */
90
+ export type TableRef = {
91
+ table: string;
92
+ kind: 'parent' | 'lookup';
93
+ relatedName?: string;
35
94
  };
36
95
  export type CompanyNormalFieldDef = NormalFieldCore & {
96
+ /** Present only on reference fields. Always points at `{table}.id`. */
97
+ ref?: TableRef;
37
98
  /**
38
- * Whether this field can reverse-look up a party.
39
- * Sequence configs must not override this.
99
+ * No two rows of the table hold the same value (18-record-search-index §4.5); empty values do not
100
+ * count. `string` compares as written, `phone` / `email` as stored (E.164, lower-cased). The field
101
+ * can be an `upsert`'s `where`. Set when the field is added: once released it cannot be added or
102
+ * dropped (the compatibility check refuses it).
40
103
  */
41
- identifier: null | {
42
- kind: 'phone' | 'email';
43
- };
44
- /** Present only on reference fields. Always points at `{table}.id`. */
45
- ref?: {
46
- table: string;
47
- };
104
+ unique?: true;
48
105
  deprecated?: boolean;
49
106
  };
50
- export type CompanyDerivedFieldDef = {
51
- derived: true;
52
- label: string;
53
- dataType: DataType;
54
- dependsOn: FieldPath[];
55
- /** String name or `functions.<key>` registration object. */
56
- computeFn: FuncRef;
57
- deprecated?: boolean;
58
- };
59
- export type CompanyFieldDef = CompanyNormalFieldDef | CompanyDerivedFieldDef;
107
+ export declare const normalFieldCoreSchema: z.ZodObject<{
108
+ label: z.ZodString;
109
+ dataType: z.ZodEnum<{
110
+ boolean: "boolean";
111
+ contact_schedule: "contact_schedule";
112
+ date: "date";
113
+ datetime: "datetime";
114
+ email: "email";
115
+ multi_select: "multi_select";
116
+ number: "number";
117
+ phone: "phone";
118
+ select: "select";
119
+ string: "string";
120
+ text: "text";
121
+ time: "time";
122
+ }>;
123
+ extraction: z.ZodString;
124
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
+ }, z.core.$strict>;
126
+ export declare const tableRefSchema: z.ZodObject<{
127
+ table: z.ZodString;
128
+ kind: z.ZodEnum<{
129
+ lookup: "lookup";
130
+ parent: "parent";
131
+ }>;
132
+ relatedName: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strict>;
134
+ export declare const companyNormalFieldDefSchema: z.ZodObject<{
135
+ label: z.ZodString;
136
+ dataType: z.ZodEnum<{
137
+ boolean: "boolean";
138
+ contact_schedule: "contact_schedule";
139
+ date: "date";
140
+ datetime: "datetime";
141
+ email: "email";
142
+ multi_select: "multi_select";
143
+ number: "number";
144
+ phone: "phone";
145
+ select: "select";
146
+ string: "string";
147
+ text: "text";
148
+ time: "time";
149
+ }>;
150
+ extraction: z.ZodString;
151
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
152
+ ref: z.ZodOptional<z.ZodObject<{
153
+ table: z.ZodString;
154
+ kind: z.ZodEnum<{
155
+ lookup: "lookup";
156
+ parent: "parent";
157
+ }>;
158
+ relatedName: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strict>>;
160
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
161
+ deprecated: z.ZodOptional<z.ZodBoolean>;
162
+ }, z.core.$strict>;
163
+ export declare const localTimeRangeSchema: z.ZodObject<{
164
+ start: z.ZodString;
165
+ end: z.ZodString;
166
+ }, z.core.$strict>;
167
+ export declare const weekdaySchema: z.ZodEnum<{
168
+ fri: "fri";
169
+ mon: "mon";
170
+ sat: "sat";
171
+ sun: "sun";
172
+ thu: "thu";
173
+ tue: "tue";
174
+ wed: "wed";
175
+ }>;
176
+ export declare const contactScheduleValueSchema: z.ZodObject<{
177
+ weekly: z.ZodNullable<z.ZodObject<{
178
+ mon: z.ZodArray<z.ZodObject<{
179
+ start: z.ZodString;
180
+ end: z.ZodString;
181
+ }, z.core.$strict>>;
182
+ tue: z.ZodArray<z.ZodObject<{
183
+ start: z.ZodString;
184
+ end: z.ZodString;
185
+ }, z.core.$strict>>;
186
+ wed: z.ZodArray<z.ZodObject<{
187
+ start: z.ZodString;
188
+ end: z.ZodString;
189
+ }, z.core.$strict>>;
190
+ thu: z.ZodArray<z.ZodObject<{
191
+ start: z.ZodString;
192
+ end: z.ZodString;
193
+ }, z.core.$strict>>;
194
+ fri: z.ZodArray<z.ZodObject<{
195
+ start: z.ZodString;
196
+ end: z.ZodString;
197
+ }, z.core.$strict>>;
198
+ sat: z.ZodArray<z.ZodObject<{
199
+ start: z.ZodString;
200
+ end: z.ZodString;
201
+ }, z.core.$strict>>;
202
+ sun: z.ZodArray<z.ZodObject<{
203
+ start: z.ZodString;
204
+ end: z.ZodString;
205
+ }, z.core.$strict>>;
206
+ }, z.core.$strict>>;
207
+ dateOverrides: z.ZodArray<z.ZodObject<{
208
+ dates: z.ZodArray<z.ZodString>;
209
+ windows: z.ZodArray<z.ZodObject<{
210
+ start: z.ZodString;
211
+ end: z.ZodString;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>>;
214
+ }, z.core.$strict>;
215
+ export type CompanyFieldDef = CompanyNormalFieldDef;
216
+ /**
217
+ * A company table. Its rows are a list in a sequence's snapshot, except the sequence's business
218
+ * root, which is one row there.
219
+ */
60
220
  export type CompanyTableDef = {
61
221
  label: string;
62
- rows: 'single' | 'multi';
63
222
  description: string;
64
223
  fields: Record<string, CompanyFieldDef>;
65
224
  };
66
225
  export type CompanySchema = Record<string, CompanyTableDef>;
67
- /** Usage-only overrides; structural keys are forbidden. */
68
- export type FieldOverride = {
69
- label?: string;
70
- description?: string;
71
- extraction?: string;
72
- };
73
- /** Overlay on an inherited company table. Keys here override usage; other company fields stay as-is. */
74
- export type SequenceCompanyTableView = {
75
- fields: Record<string, FieldOverride>;
76
- };
77
- /** Session is sequence-owned; always single-row; no derived / identifier. */
78
- export type SessionTableDef = {
79
- label: string;
80
- rows: 'single';
81
- description: string;
82
- fields: Record<string, NormalFieldCore>;
83
- };
84
- export type SequenceSlots = {
85
- [table: string]: SequenceCompanyTableView | SessionTableDef | undefined;
86
- session?: SessionTableDef;
87
- };
88
- /** Effective field shape used for Slots codegen. */
89
- export type EffectiveFieldDef = {
90
- dataType: DataType;
91
- enum: Array<string | number> | null;
92
- nullable: boolean;
93
- ref: null | {
94
- table: string;
95
- };
226
+ export declare const companyFieldDefSchema: z.ZodObject<{
227
+ label: z.ZodString;
228
+ dataType: z.ZodEnum<{
229
+ boolean: "boolean";
230
+ contact_schedule: "contact_schedule";
231
+ date: "date";
232
+ datetime: "datetime";
233
+ email: "email";
234
+ multi_select: "multi_select";
235
+ number: "number";
236
+ phone: "phone";
237
+ select: "select";
238
+ string: "string";
239
+ text: "text";
240
+ time: "time";
241
+ }>;
242
+ extraction: z.ZodString;
243
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
+ ref: z.ZodOptional<z.ZodObject<{
245
+ table: z.ZodString;
246
+ kind: z.ZodEnum<{
247
+ lookup: "lookup";
248
+ parent: "parent";
249
+ }>;
250
+ relatedName: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strict>>;
252
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
253
+ deprecated: z.ZodOptional<z.ZodBoolean>;
254
+ }, z.core.$strict>;
255
+ export declare const companyTableDefSchema: z.ZodObject<{
256
+ label: z.ZodString;
257
+ description: z.ZodString;
258
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
259
+ label: z.ZodString;
260
+ dataType: z.ZodEnum<{
261
+ boolean: "boolean";
262
+ contact_schedule: "contact_schedule";
263
+ date: "date";
264
+ datetime: "datetime";
265
+ email: "email";
266
+ multi_select: "multi_select";
267
+ number: "number";
268
+ phone: "phone";
269
+ select: "select";
270
+ string: "string";
271
+ text: "text";
272
+ time: "time";
273
+ }>;
274
+ extraction: z.ZodString;
275
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
+ ref: z.ZodOptional<z.ZodObject<{
277
+ table: z.ZodString;
278
+ kind: z.ZodEnum<{
279
+ lookup: "lookup";
280
+ parent: "parent";
281
+ }>;
282
+ relatedName: z.ZodOptional<z.ZodString>;
283
+ }, z.core.$strict>>;
284
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
285
+ deprecated: z.ZodOptional<z.ZodBoolean>;
286
+ }, z.core.$strict>>;
287
+ }, z.core.$strict>;
288
+ export declare const companySchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
289
+ label: z.ZodString;
290
+ description: z.ZodString;
291
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
292
+ label: z.ZodString;
293
+ dataType: z.ZodEnum<{
294
+ boolean: "boolean";
295
+ contact_schedule: "contact_schedule";
296
+ date: "date";
297
+ datetime: "datetime";
298
+ email: "email";
299
+ multi_select: "multi_select";
300
+ number: "number";
301
+ phone: "phone";
302
+ select: "select";
303
+ string: "string";
304
+ text: "text";
305
+ time: "time";
306
+ }>;
307
+ extraction: z.ZodString;
308
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
309
+ ref: z.ZodOptional<z.ZodObject<{
310
+ table: z.ZodString;
311
+ kind: z.ZodEnum<{
312
+ lookup: "lookup";
313
+ parent: "parent";
314
+ }>;
315
+ relatedName: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$strict>>;
317
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
318
+ deprecated: z.ZodOptional<z.ZodBoolean>;
319
+ }, z.core.$strict>>;
320
+ }, z.core.$strict>>;
321
+ /** A session field's types: simple values only, never `contact_schedule`. */
322
+ export type SessionDataType = ScalarDataType;
323
+ /**
324
+ * A session field (`schema/session.ts`, 11-remove-sequence-schema §3.1): what this conversation's
325
+ * talk filled or a function or action wrote. No `ref`, no `unique`: the session is
326
+ * related to no other table.
327
+ */
328
+ export type SessionFieldDef = Omit<NormalFieldCore, 'dataType'> & {
329
+ dataType: SessionDataType;
330
+ deprecated?: boolean;
96
331
  };
97
- export type EffectiveTableDef = {
98
- rows: 'single' | 'multi';
99
- fields: Record<string, EffectiveFieldDef>;
332
+ /** `schema/session.ts`: the conversation's own fields, for every sequence. */
333
+ export type SessionSchema = {
334
+ fields: Record<string, SessionFieldDef>;
100
335
  };
101
- export type EffectiveSchema = Record<string, EffectiveTableDef>;
336
+ /** A company with no `schema/session.ts`: sessions have no fields. */
337
+ export declare const EMPTY_SESSION_SCHEMA: SessionSchema;
338
+ export declare const sessionFieldDefSchema: z.ZodObject<{
339
+ label: z.ZodString;
340
+ extraction: z.ZodString;
341
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
342
+ dataType: z.ZodEnum<{
343
+ boolean: "boolean";
344
+ date: "date";
345
+ datetime: "datetime";
346
+ email: "email";
347
+ multi_select: "multi_select";
348
+ number: "number";
349
+ phone: "phone";
350
+ select: "select";
351
+ string: "string";
352
+ text: "text";
353
+ time: "time";
354
+ }>;
355
+ deprecated: z.ZodOptional<z.ZodBoolean>;
356
+ }, z.core.$strict>;
357
+ export declare const sessionSchemaSchema: z.ZodObject<{
358
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
359
+ label: z.ZodString;
360
+ extraction: z.ZodString;
361
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
362
+ dataType: z.ZodEnum<{
363
+ boolean: "boolean";
364
+ date: "date";
365
+ datetime: "datetime";
366
+ email: "email";
367
+ multi_select: "multi_select";
368
+ number: "number";
369
+ phone: "phone";
370
+ select: "select";
371
+ string: "string";
372
+ text: "text";
373
+ time: "time";
374
+ }>;
375
+ deprecated: z.ZodOptional<z.ZodBoolean>;
376
+ }, z.core.$strict>>;
377
+ }, z.core.$strict>;
378
+ export declare function isCompanySchema(value: unknown): value is CompanySchema;
102
379
  //# sourceMappingURL=schema.d.ts.map