@superpanel-sdk/runtime 0.2.2 → 0.5.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 (274) hide show
  1. package/README.md +28 -8
  2. package/dist/builder/codegen/emit.d.ts +29 -11
  3. package/dist/builder/codegen/emit.js +328 -61
  4. package/dist/builder/codegen/generate.d.ts +21 -0
  5. package/dist/builder/codegen/generate.js +152 -20
  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 +24 -0
  9. package/dist/builder/company-imports.js +114 -0
  10. package/dist/builder/compile/compile-sequence.d.ts +59 -8
  11. package/dist/builder/compile/compile-sequence.js +279 -77
  12. package/dist/builder/compile/function-code.d.ts +12 -2
  13. package/dist/builder/compile/function-code.js +87 -39
  14. package/dist/builder/compile/registry.d.ts +7 -3
  15. package/dist/builder/compile/registry.js +24 -23
  16. package/dist/builder/load.d.ts +70 -10
  17. package/dist/builder/load.js +250 -61
  18. package/dist/builder/paths.d.ts +3 -0
  19. package/dist/builder/paths.js +16 -0
  20. package/dist/builder/schedules.d.ts +23 -0
  21. package/dist/builder/schedules.js +102 -0
  22. package/dist/builder/slot-schema-validation.d.ts +4 -0
  23. package/dist/builder/slot-schema-validation.js +10 -0
  24. package/dist/builder/typecheck.d.ts +8 -0
  25. package/dist/builder/typecheck.js +105 -0
  26. package/dist/builder/types.d.ts +91 -19
  27. package/dist/builder/types.js +2 -1
  28. package/dist/cli/auth/auth.d.ts +37 -0
  29. package/dist/cli/auth/auth.js +211 -0
  30. package/dist/cli/auth/backend-url.d.ts +5 -0
  31. package/dist/cli/auth/backend-url.js +25 -0
  32. package/dist/cli/auth/clipboard.d.ts +9 -0
  33. package/dist/cli/auth/clipboard.js +38 -0
  34. package/dist/cli/auth/http.d.ts +20 -0
  35. package/dist/cli/auth/http.js +27 -0
  36. package/dist/cli/auth/index.d.ts +10 -0
  37. package/dist/cli/auth/index.js +27 -0
  38. package/dist/cli/auth/progress.d.ts +12 -0
  39. package/dist/cli/auth/progress.js +15 -0
  40. package/dist/cli/auth/serve-login.d.ts +8 -0
  41. package/dist/cli/auth/serve-login.js +24 -0
  42. package/dist/cli/compile/index.js +3 -0
  43. package/dist/cli/config.d.ts +10 -0
  44. package/dist/cli/config.js +52 -0
  45. package/dist/cli/index.js +28 -8
  46. package/dist/cli/serve/index.d.ts +73 -3
  47. package/dist/cli/serve/index.js +410 -113
  48. package/dist/cli/type-gen/index.js +9 -8
  49. package/dist/compiler.d.ts +7 -0
  50. package/dist/compiler.js +7 -0
  51. package/dist/compute-host/compute-host.d.ts +15 -23
  52. package/dist/compute-host/compute-host.js +25 -28
  53. package/dist/compute-host/index.d.ts +2 -2
  54. package/dist/compute-host/index.js +1 -1
  55. package/dist/compute-host/source-compute-host.d.ts +11 -9
  56. package/dist/compute-host/source-compute-host.js +50 -31
  57. package/dist/core/case-orchestrator/contact-hours.d.ts +50 -0
  58. package/dist/core/case-orchestrator/contact-hours.js +108 -0
  59. package/dist/core/case-orchestrator/follow-ups.d.ts +31 -0
  60. package/dist/core/case-orchestrator/follow-ups.js +103 -0
  61. package/dist/core/case-orchestrator/index.d.ts +6 -0
  62. package/dist/core/case-orchestrator/index.js +6 -0
  63. package/dist/core/case-orchestrator/render.d.ts +75 -0
  64. package/dist/core/case-orchestrator/render.js +239 -0
  65. package/dist/core/case-orchestrator/time.d.ts +11 -0
  66. package/dist/core/case-orchestrator/time.js +29 -0
  67. package/dist/core/case-orchestrator/tools.d.ts +29 -0
  68. package/dist/core/case-orchestrator/tools.js +31 -0
  69. package/dist/core/case-orchestrator/types.d.ts +753 -0
  70. package/dist/core/case-orchestrator/types.js +46 -0
  71. package/dist/core/case-orchestrator/validate.d.ts +11 -0
  72. package/dist/core/case-orchestrator/validate.js +63 -0
  73. package/dist/core/context/call.d.ts +291 -0
  74. package/dist/core/context/call.js +94 -0
  75. package/dist/core/context/channels.d.ts +60 -0
  76. package/dist/core/context/channels.js +35 -0
  77. package/dist/core/context/contact.d.ts +96 -6
  78. package/dist/core/context/contact.js +48 -2
  79. package/dist/core/context/email-message.d.ts +159 -0
  80. package/dist/core/context/email-message.js +59 -0
  81. package/dist/core/context/email.d.ts +97 -0
  82. package/dist/core/context/email.js +91 -0
  83. package/dist/core/context/exchanges.d.ts +142 -0
  84. package/dist/core/context/exchanges.js +63 -0
  85. package/dist/core/context/instances.d.ts +278 -0
  86. package/dist/core/context/instances.js +123 -0
  87. package/dist/core/context/kv.d.ts +113 -0
  88. package/dist/core/context/kv.js +60 -0
  89. package/dist/core/context/platform-registry.d.ts +509 -4
  90. package/dist/core/context/platform-registry.js +14 -2
  91. package/dist/core/context/platform.d.ts +2 -1
  92. package/dist/core/context/sms.d.ts +147 -0
  93. package/dist/core/context/sms.js +57 -0
  94. package/dist/core/context/types.d.ts +51 -30
  95. package/dist/core/context/types.js +1 -7
  96. package/dist/core/conversation/index.d.ts +31 -0
  97. package/dist/core/conversation/index.js +14 -0
  98. package/dist/core/functions/define/bind.d.ts +25 -0
  99. package/dist/core/functions/define/bind.js +14 -0
  100. package/dist/core/functions/define/case.d.ts +9 -0
  101. package/dist/core/functions/define/case.js +13 -0
  102. package/dist/core/functions/define/events.d.ts +20 -0
  103. package/dist/core/functions/define/events.js +21 -0
  104. package/dist/core/functions/define/no-case.d.ts +4 -0
  105. package/dist/core/functions/define/no-case.js +9 -0
  106. package/dist/core/functions/events.d.ts +247 -0
  107. package/dist/core/functions/events.js +32 -0
  108. package/dist/core/functions/func-ref.d.ts +11 -2
  109. package/dist/core/functions/schedules.d.ts +51 -0
  110. package/dist/core/functions/schedules.js +20 -0
  111. package/dist/core/functions/types.d.ts +62 -51
  112. package/dist/core/functions/types.js +6 -1
  113. package/dist/core/office-hours/index.d.ts +39 -0
  114. package/dist/core/office-hours/index.js +187 -0
  115. package/dist/core/page/define.d.ts +834 -0
  116. package/dist/core/page/define.js +477 -0
  117. package/dist/core/page/ops.d.ts +58 -0
  118. package/dist/core/page/ops.js +220 -0
  119. package/dist/core/page/render.d.ts +253 -0
  120. package/dist/core/page/render.js +840 -0
  121. package/dist/core/page/time-format.d.ts +19 -0
  122. package/dist/core/page/time-format.js +41 -0
  123. package/dist/core/page/timeline.d.ts +40 -0
  124. package/dist/core/page/timeline.js +2 -0
  125. package/dist/core/page/typed.d.ts +642 -0
  126. package/dist/core/page/typed.js +2 -0
  127. package/dist/core/page/workspace.d.ts +33 -0
  128. package/dist/core/page/workspace.js +231 -0
  129. package/dist/core/party/index.d.ts +3 -0
  130. package/dist/core/party/index.js +3 -0
  131. package/dist/core/party/schema.d.ts +137 -0
  132. package/dist/core/party/schema.js +80 -0
  133. package/dist/core/party/types.d.ts +40 -0
  134. package/dist/core/party/types.js +15 -0
  135. package/dist/core/sequence/define.d.ts +57 -0
  136. package/dist/core/sequence/define.js +10 -0
  137. package/dist/core/sequence/index.d.ts +63 -0
  138. package/dist/core/sequence/index.js +231 -0
  139. package/dist/core/slot/binding.d.ts +40 -0
  140. package/dist/core/slot/binding.js +2 -0
  141. package/dist/core/slot/company-metadata.d.ts +113 -0
  142. package/dist/core/slot/company-metadata.js +563 -0
  143. package/dist/core/slot/compile-schema.d.ts +19 -13
  144. package/dist/core/slot/compile-schema.js +51 -248
  145. package/dist/core/slot/contact-timezone.d.ts +110 -0
  146. package/dist/core/slot/contact-timezone.js +186 -0
  147. package/dist/core/slot/field.d.ts +2 -24
  148. package/dist/core/slot/field.js +0 -69
  149. package/dist/core/slot/id-ref.d.ts +17 -2
  150. package/dist/core/slot/id-ref.js +16 -8
  151. package/dist/core/slot/index.d.ts +12 -13
  152. package/dist/core/slot/index.js +11 -12
  153. package/dist/core/slot/naming.d.ts +15 -0
  154. package/dist/core/slot/naming.js +96 -0
  155. package/dist/core/slot/platform-fields.d.ts +119 -0
  156. package/dist/core/slot/platform-fields.js +121 -0
  157. package/dist/core/slot/ref.d.ts +16 -0
  158. package/dist/core/slot/ref.js +14 -0
  159. package/dist/core/slot/row.d.ts +2 -9
  160. package/dist/core/slot/row.js +13 -23
  161. package/dist/core/slot/schema-compat.d.ts +16 -0
  162. package/dist/core/slot/schema-compat.js +112 -0
  163. package/dist/core/slot/schema.d.ts +409 -76
  164. package/dist/core/slot/schema.js +178 -10
  165. package/dist/core/slot/types.d.ts +27 -92
  166. package/dist/core/slot/value.d.ts +26 -3
  167. package/dist/core/slot/value.js +89 -57
  168. package/dist/dev-overlay/protocol.d.ts +41 -8
  169. package/dist/fn-context/build-context.d.ts +3 -1
  170. package/dist/fn-context/build-context.js +20 -10
  171. package/dist/fn-context/fake/empty-api.js +9 -28
  172. package/dist/fn-context/fake/index.d.ts +11 -4
  173. package/dist/fn-context/fake/index.js +27 -2
  174. package/dist/fn-context/fn-params.d.ts +6 -0
  175. package/dist/fn-context/fn-params.js +13 -0
  176. package/dist/fn-context/index.d.ts +5 -5
  177. package/dist/fn-context/index.js +4 -4
  178. package/dist/fn-context/log.js +2 -2
  179. package/dist/fn-context/make-ctx.d.ts +11 -0
  180. package/dist/fn-context/make-ctx.js +18 -8
  181. package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +24 -0
  182. package/dist/fn-context/rpc/case-orchestrator-tools.js +13 -0
  183. package/dist/fn-context/rpc/index.d.ts +3 -1
  184. package/dist/fn-context/rpc/index.js +3 -1
  185. package/dist/fn-context/rpc/integration/index.d.ts +4 -4
  186. package/dist/fn-context/rpc/integration/index.js +1 -1
  187. package/dist/fn-context/rpc/integration/list-surfaces.d.ts +21 -0
  188. package/dist/fn-context/rpc/integration/{list-bindings.js → list-surfaces.js} +4 -4
  189. package/dist/fn-context/rpc/platform.d.ts +2 -2
  190. package/dist/fn-context/rpc/platform.js +1 -1
  191. package/dist/fn-context/rpc/records.d.ts +78 -0
  192. package/dist/fn-context/rpc/records.js +26 -0
  193. package/dist/fn-context/rpc/trpc-client.d.ts +2 -2
  194. package/dist/fn-context/rpc/trpc-client.js +89 -5
  195. package/dist/fn-context/rpc/trpc-init.d.ts +2 -2
  196. package/dist/fn-context/rpc/trpc-router-factory.d.ts +49 -3
  197. package/dist/fn-context/rpc/trpc-router-factory.js +2 -0
  198. package/dist/fn-context/run-scope.d.ts +4 -0
  199. package/dist/fn-context/run-scope.js +9 -0
  200. package/dist/fn-context/types.d.ts +36 -3
  201. package/dist/index.d.ts +37 -46
  202. package/dist/index.js +33 -33
  203. package/dist/logger.d.ts +7 -0
  204. package/dist/logger.js +41 -0
  205. package/dist/platform.d.ts +76 -0
  206. package/dist/platform.js +56 -0
  207. package/dist/voice-service/actions.d.ts +71 -4
  208. package/dist/voice-service/types.d.ts +42 -2
  209. package/dist/worker.d.ts +10 -0
  210. package/dist/worker.js +10 -0
  211. package/package.json +38 -19
  212. package/dist/builder/compile/compile-agenda.d.ts +0 -15
  213. package/dist/builder/compile/compile-agenda.js +0 -59
  214. package/dist/builder/merge.d.ts +0 -4
  215. package/dist/builder/merge.js +0 -19
  216. package/dist/core/context/db.d.ts +0 -69
  217. package/dist/core/context/db.js +0 -44
  218. package/dist/core/context/docusign.d.ts +0 -134
  219. package/dist/core/context/docusign.js +0 -108
  220. package/dist/core/context/filevine.d.ts +0 -323
  221. package/dist/core/context/filevine.js +0 -254
  222. package/dist/core/context/http.d.ts +0 -9
  223. package/dist/core/context/http.js +0 -4
  224. package/dist/core/context/hubspot.d.ts +0 -250
  225. package/dist/core/context/hubspot.js +0 -191
  226. package/dist/core/context/twilio.d.ts +0 -50
  227. package/dist/core/context/twilio.js +0 -42
  228. package/dist/core/functions/define/case-context.d.ts +0 -14
  229. package/dist/core/functions/define/case-context.js +0 -15
  230. package/dist/core/functions/define/compute.d.ts +0 -7
  231. package/dist/core/functions/define/compute.js +0 -17
  232. package/dist/core/functions/define/custom.d.ts +0 -4
  233. package/dist/core/functions/define/custom.js +0 -8
  234. package/dist/core/functions/define/system.d.ts +0 -7
  235. package/dist/core/functions/define/system.js +0 -12
  236. package/dist/core/slot/deps.d.ts +0 -15
  237. package/dist/core/slot/deps.js +0 -88
  238. package/dist/core/slot/derived.d.ts +0 -32
  239. package/dist/core/slot/derived.js +0 -115
  240. package/dist/core/slot/platform-session-fields.d.ts +0 -38
  241. package/dist/core/slot/platform-session-fields.js +0 -48
  242. package/dist/core/slot/sf-schema.d.ts +0 -23
  243. package/dist/core/slot/sf-schema.js +0 -125
  244. package/dist/core/slot/sf-validate.d.ts +0 -14
  245. package/dist/core/slot/sf-validate.js +0 -132
  246. package/dist/core/slot/snapshot.d.ts +0 -18
  247. package/dist/core/slot/snapshot.js +0 -138
  248. package/dist/core/slot/write.d.ts +0 -41
  249. package/dist/core/slot/write.js +0 -319
  250. package/dist/core/stage/builders.d.ts +0 -36
  251. package/dist/core/stage/builders.js +0 -28
  252. package/dist/core/stage/condition.d.ts +0 -17
  253. package/dist/core/stage/condition.js +0 -198
  254. package/dist/core/stage/drive.d.ts +0 -43
  255. package/dist/core/stage/drive.js +0 -77
  256. package/dist/core/stage/finish-when.d.ts +0 -20
  257. package/dist/core/stage/finish-when.js +0 -82
  258. package/dist/core/stage/flatten.d.ts +0 -27
  259. package/dist/core/stage/flatten.js +0 -464
  260. package/dist/core/stage/index.d.ts +0 -11
  261. package/dist/core/stage/index.js +0 -10
  262. package/dist/core/stage/simulate.d.ts +0 -24
  263. package/dist/core/stage/simulate.js +0 -33
  264. package/dist/core/stage/transfer-fields.d.ts +0 -14
  265. package/dist/core/stage/transfer-fields.js +0 -88
  266. package/dist/core/stage/types.d.ts +0 -177
  267. package/dist/core/stage/types.js +0 -2
  268. package/dist/core/stage/validate.d.ts +0 -11
  269. package/dist/core/stage/validate.js +0 -226
  270. package/dist/core/stage/walk.d.ts +0 -34
  271. package/dist/core/stage/walk.js +0 -96
  272. package/dist/fn-context/rpc/integration/list-bindings.d.ts +0 -21
  273. package/dist/fn-context/system-args.d.ts +0 -6
  274. package/dist/fn-context/system-args.js +0 -14
@@ -1,102 +1,435 @@
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 short value (at most 255 characters,
4
+ * `LIMITS.stringChars`), `text` a long one (notes, descriptions; not indexed); `phone` is stored in
5
+ * E.164 and `email` lower-cased, both checked on write. `select` is one of the field's `options`,
6
+ * `multi_select` a list of them, `time` a time of day `HH:mm` (27-field-types-and-history).
7
+ */
8
+ export type ScalarDataType = 'string' | 'text' | 'phone' | 'email' | 'number' | 'boolean' | 'date' | 'datetime' | 'time' | 'select' | 'multi_select';
9
+ export type DataType = ScalarDataType | 'contact_schedule';
10
+ export declare const SCALAR_DATA_TYPES: readonly ["string", "text", "phone", "email", "number", "boolean", "date", "datetime", "time", "select", "multi_select"];
11
+ /** The types that take `options` (27 §2–§3). */
12
+ export declare const OPTION_DATA_TYPES: ReadonlySet<DataType>;
13
+ /** Time window within a local day (`HH:mm`; only `end` may be `'24:00'`; `start < end`). */
14
+ export type LocalTimeRange = {
15
+ start: string;
16
+ end: string;
17
+ };
18
+ export type ContactWeekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
19
+ /**
20
+ * A contact's allowed-contact schedule (`contact.contact_schedule`), in their local timezone.
21
+ * - `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).
22
+ * - `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).
23
+ * Every window list is sorted by `start` and non-overlapping.
24
+ */
25
+ export type ContactSchedule = {
26
+ weekly: Record<ContactWeekday, LocalTimeRange[]> | null;
27
+ dateOverrides: Array<{
28
+ dates: string[];
29
+ windows: LocalTimeRange[];
30
+ }>;
31
+ };
32
+ /**
33
+ * Shared core for fields — company + session. Who may write a field is not the schema's to say: the
34
+ * AI writes only the cells a page opens with `field(...)` (19-page-writable-cells).
35
+ */
5
36
  export type NormalFieldCore = {
6
- derived: false;
7
37
  label: string;
8
38
  dataType: DataType;
9
- source: 'conversation' | 'system';
39
+ /** How to fill this field (on a cell the page opens), or what it means (on one it shows read-only). */
10
40
  extraction: string;
11
- enum: Array<string | number> | null;
12
- nullable: boolean;
41
+ /** A `select` / `multi_select` field's choices: short codes, their meaning in `extraction` (27 §2). */
42
+ options?: string[];
13
43
  };
14
- /** Reserved row-identity field name. Authors should not invent another. */
44
+ /** Field keys derived fields used; they were removed (13-data-model-v1 §21) and are reported when found. */
45
+ export declare const REMOVED_DERIVED_KEYS: readonly ['derived', 'dependsOn', 'computeFn'];
46
+ /** A field's `source`, removed (19-page-writable-cells): a page decides what the AI may write. */
47
+ export declare const REMOVED_SOURCE_KEY = "source";
48
+ /**
49
+ * A field's `nullable`, removed: no write ever checked it. Every field starts empty and can be
50
+ * cleared; a page's `required` says when one must be filled, and the platform keeps a row's id and
51
+ * parent itself.
52
+ */
53
+ export declare const REMOVED_NULLABLE_KEY = "nullable";
54
+ /**
55
+ * A field's `enum`, removed (27 §2): a field of a known set of values is a `select` (or `multi_select`)
56
+ * with `options`.
57
+ */
58
+ export declare const REMOVED_ENUM_KEY = "enum";
59
+ /**
60
+ * A field's `identifier`, removed: nothing found a contact by it. Who a conversation is with is the
61
+ * repo's `resolve` to decide; `ctx.api.contact.find` and clearing a contact use `phone` and `email`.
62
+ */
63
+ export declare const REMOVED_IDENTIFIER_KEY = "identifier";
64
+ /** Every row's id: the platform's, on every table; a schema does not write it. */
15
65
  export declare const ROW_ID_FIELD = "id";
66
+ /**
67
+ * What every row has besides its fields, the platform's (never a field of a schema): its `id`, when
68
+ * it was created and when it was last written (ISO 8601). A read can filter and order by them.
69
+ */
70
+ export declare const ROW_SYSTEM_KEYS: readonly ['id', 'createdAt', 'updatedAt'];
71
+ export type RowSystemKey = (typeof ROW_SYSTEM_KEYS)[number];
72
+ /** The row's times: `createdAt`, `updatedAt`. */
73
+ export declare const ROW_TIME_KEYS: readonly ['createdAt', 'updatedAt'];
74
+ export type RowTimeKey = (typeof ROW_TIME_KEYS)[number];
75
+ export declare function isRowTimeKey(key: string): key is RowTimeKey;
76
+ /** The definition of every row's `id` (added by the platform to every table and the session). */
16
77
  export declare const idFieldCore: {
17
- readonly derived: false;
18
78
  readonly label: 'Id';
19
79
  readonly dataType: 'string';
20
- readonly source: 'system';
21
80
  readonly extraction: 'Row identity';
22
- readonly enum: null;
23
- readonly nullable: false;
24
81
  };
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;
82
+ /**
83
+ * A ref to a table's row (13-data-model-v1 §11, 14-sequence-instance §16.1): `parent` is the row's
84
+ * owner (required, set once, decides loading and cascade delete; a parent row has any number of rows
85
+ * under it, 13-data-model-v1 §22.4); `lookup` is any other link. Write it with `parentRef(table)` /
86
+ * `lookupRef(table)`. `relatedName` names the way back, from the target row to the rows that point at
87
+ * it (`case_file.injuries`, 13-data-model-v1 §23.4 item 3); without it there is none.
88
+ */
89
+ export type TableRef = {
90
+ table: string;
91
+ kind: 'parent' | 'lookup';
92
+ relatedName?: string;
35
93
  };
36
94
  export type CompanyNormalFieldDef = NormalFieldCore & {
95
+ /** Present only on reference fields. Always points at `{table}.id`. */
96
+ ref?: TableRef;
37
97
  /**
38
- * Whether this field can reverse-look up a party.
39
- * Sequence configs must not override this.
98
+ * No two rows of the table hold the same value (18-record-search-index §4.5); empty values do not
99
+ * count. `string` compares as written, `phone` / `email` as stored (E.164, lower-cased). The field
100
+ * can be an `upsert`'s `where`. Set when the field is added: once released it cannot be added or
101
+ * dropped (the compatibility check refuses it).
40
102
  */
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
- };
103
+ unique?: true;
48
104
  deprecated?: boolean;
49
105
  };
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;
106
+ export declare const normalFieldCoreSchema: z.ZodObject<{
107
+ label: z.ZodString;
108
+ dataType: z.ZodEnum<{
109
+ boolean: "boolean";
110
+ contact_schedule: "contact_schedule";
111
+ date: "date";
112
+ datetime: "datetime";
113
+ email: "email";
114
+ multi_select: "multi_select";
115
+ number: "number";
116
+ phone: "phone";
117
+ select: "select";
118
+ string: "string";
119
+ text: "text";
120
+ time: "time";
121
+ }>;
122
+ extraction: z.ZodString;
123
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ }, z.core.$strict>;
125
+ export declare const tableRefSchema: z.ZodObject<{
126
+ table: z.ZodString;
127
+ kind: z.ZodEnum<{
128
+ lookup: "lookup";
129
+ parent: "parent";
130
+ }>;
131
+ relatedName: z.ZodOptional<z.ZodString>;
132
+ }, z.core.$strict>;
133
+ export declare const companyNormalFieldDefSchema: z.ZodObject<{
134
+ label: z.ZodString;
135
+ dataType: z.ZodEnum<{
136
+ boolean: "boolean";
137
+ contact_schedule: "contact_schedule";
138
+ date: "date";
139
+ datetime: "datetime";
140
+ email: "email";
141
+ multi_select: "multi_select";
142
+ number: "number";
143
+ phone: "phone";
144
+ select: "select";
145
+ string: "string";
146
+ text: "text";
147
+ time: "time";
148
+ }>;
149
+ extraction: z.ZodString;
150
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ ref: z.ZodOptional<z.ZodObject<{
152
+ table: z.ZodString;
153
+ kind: z.ZodEnum<{
154
+ lookup: "lookup";
155
+ parent: "parent";
156
+ }>;
157
+ relatedName: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strict>>;
159
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
160
+ deprecated: z.ZodOptional<z.ZodBoolean>;
161
+ }, z.core.$strict>;
162
+ export declare const localTimeRangeSchema: z.ZodObject<{
163
+ start: z.ZodString;
164
+ end: z.ZodString;
165
+ }, z.core.$strict>;
166
+ export declare const weekdaySchema: z.ZodEnum<{
167
+ fri: "fri";
168
+ mon: "mon";
169
+ sat: "sat";
170
+ sun: "sun";
171
+ thu: "thu";
172
+ tue: "tue";
173
+ wed: "wed";
174
+ }>;
175
+ export declare const contactScheduleValueSchema: z.ZodObject<{
176
+ weekly: z.ZodNullable<z.ZodObject<{
177
+ mon: z.ZodArray<z.ZodObject<{
178
+ start: z.ZodString;
179
+ end: z.ZodString;
180
+ }, z.core.$strict>>;
181
+ tue: z.ZodArray<z.ZodObject<{
182
+ start: z.ZodString;
183
+ end: z.ZodString;
184
+ }, z.core.$strict>>;
185
+ wed: z.ZodArray<z.ZodObject<{
186
+ start: z.ZodString;
187
+ end: z.ZodString;
188
+ }, z.core.$strict>>;
189
+ thu: z.ZodArray<z.ZodObject<{
190
+ start: z.ZodString;
191
+ end: z.ZodString;
192
+ }, z.core.$strict>>;
193
+ fri: z.ZodArray<z.ZodObject<{
194
+ start: z.ZodString;
195
+ end: z.ZodString;
196
+ }, z.core.$strict>>;
197
+ sat: z.ZodArray<z.ZodObject<{
198
+ start: z.ZodString;
199
+ end: z.ZodString;
200
+ }, z.core.$strict>>;
201
+ sun: z.ZodArray<z.ZodObject<{
202
+ start: z.ZodString;
203
+ end: z.ZodString;
204
+ }, z.core.$strict>>;
205
+ }, z.core.$strict>>;
206
+ dateOverrides: z.ZodArray<z.ZodObject<{
207
+ dates: z.ZodArray<z.ZodString>;
208
+ windows: z.ZodArray<z.ZodObject<{
209
+ start: z.ZodString;
210
+ end: z.ZodString;
211
+ }, z.core.$strict>>;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>;
214
+ export type CompanyFieldDef = CompanyNormalFieldDef;
215
+ /**
216
+ * A company table. Its rows are a list in a sequence's snapshot, except the sequence's business
217
+ * root, which is one row there.
218
+ */
60
219
  export type CompanyTableDef = {
61
220
  label: string;
62
- rows: 'single' | 'multi';
63
221
  description: string;
64
222
  fields: Record<string, CompanyFieldDef>;
65
223
  };
66
224
  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
- };
225
+ export declare const companyFieldDefSchema: z.ZodObject<{
226
+ label: z.ZodString;
227
+ dataType: z.ZodEnum<{
228
+ boolean: "boolean";
229
+ contact_schedule: "contact_schedule";
230
+ date: "date";
231
+ datetime: "datetime";
232
+ email: "email";
233
+ multi_select: "multi_select";
234
+ number: "number";
235
+ phone: "phone";
236
+ select: "select";
237
+ string: "string";
238
+ text: "text";
239
+ time: "time";
240
+ }>;
241
+ extraction: z.ZodString;
242
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
+ ref: z.ZodOptional<z.ZodObject<{
244
+ table: z.ZodString;
245
+ kind: z.ZodEnum<{
246
+ lookup: "lookup";
247
+ parent: "parent";
248
+ }>;
249
+ relatedName: z.ZodOptional<z.ZodString>;
250
+ }, z.core.$strict>>;
251
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
252
+ deprecated: z.ZodOptional<z.ZodBoolean>;
253
+ }, z.core.$strict>;
254
+ export declare const companyTableDefSchema: z.ZodObject<{
255
+ label: z.ZodString;
256
+ description: z.ZodString;
257
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
258
+ label: z.ZodString;
259
+ dataType: z.ZodEnum<{
260
+ boolean: "boolean";
261
+ contact_schedule: "contact_schedule";
262
+ date: "date";
263
+ datetime: "datetime";
264
+ email: "email";
265
+ multi_select: "multi_select";
266
+ number: "number";
267
+ phone: "phone";
268
+ select: "select";
269
+ string: "string";
270
+ text: "text";
271
+ time: "time";
272
+ }>;
273
+ extraction: z.ZodString;
274
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
275
+ ref: z.ZodOptional<z.ZodObject<{
276
+ table: z.ZodString;
277
+ kind: z.ZodEnum<{
278
+ lookup: "lookup";
279
+ parent: "parent";
280
+ }>;
281
+ relatedName: z.ZodOptional<z.ZodString>;
282
+ }, z.core.$strict>>;
283
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
284
+ deprecated: z.ZodOptional<z.ZodBoolean>;
285
+ }, z.core.$strict>>;
286
+ }, z.core.$strict>;
287
+ export declare const companySchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
288
+ label: z.ZodString;
289
+ description: z.ZodString;
290
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
291
+ label: z.ZodString;
292
+ dataType: z.ZodEnum<{
293
+ boolean: "boolean";
294
+ contact_schedule: "contact_schedule";
295
+ date: "date";
296
+ datetime: "datetime";
297
+ email: "email";
298
+ multi_select: "multi_select";
299
+ number: "number";
300
+ phone: "phone";
301
+ select: "select";
302
+ string: "string";
303
+ text: "text";
304
+ time: "time";
305
+ }>;
306
+ extraction: z.ZodString;
307
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
308
+ ref: z.ZodOptional<z.ZodObject<{
309
+ table: z.ZodString;
310
+ kind: z.ZodEnum<{
311
+ lookup: "lookup";
312
+ parent: "parent";
313
+ }>;
314
+ relatedName: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strict>>;
316
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
317
+ deprecated: z.ZodOptional<z.ZodBoolean>;
318
+ }, z.core.$strict>>;
319
+ }, z.core.$strict>>;
320
+ /** A session field's types: simple values only, never `contact_schedule`. */
321
+ export type SessionDataType = ScalarDataType;
322
+ /**
323
+ * A session field (`schema/session.ts`, 11-remove-sequence-schema §3.1): what this conversation's
324
+ * talk filled or a function or action wrote. No `ref`, no `unique`: the session is
325
+ * related to no other table.
326
+ */
327
+ export type SessionFieldDef = Omit<NormalFieldCore, 'dataType'> & {
328
+ dataType: SessionDataType;
329
+ deprecated?: boolean;
96
330
  };
97
- export type EffectiveTableDef = {
98
- rows: 'single' | 'multi';
99
- fields: Record<string, EffectiveFieldDef>;
331
+ /** `schema/session.ts`: the conversation's own fields, for every sequence. */
332
+ export type SessionSchema = {
333
+ fields: Record<string, SessionFieldDef>;
100
334
  };
101
- export type EffectiveSchema = Record<string, EffectiveTableDef>;
335
+ /** A company with no `schema/session.ts`: sessions have no fields. */
336
+ export declare const EMPTY_SESSION_SCHEMA: SessionSchema;
337
+ export declare const sessionFieldDefSchema: z.ZodObject<{
338
+ label: z.ZodString;
339
+ extraction: z.ZodString;
340
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
341
+ dataType: z.ZodEnum<{
342
+ boolean: "boolean";
343
+ date: "date";
344
+ datetime: "datetime";
345
+ email: "email";
346
+ multi_select: "multi_select";
347
+ number: "number";
348
+ phone: "phone";
349
+ select: "select";
350
+ string: "string";
351
+ text: "text";
352
+ time: "time";
353
+ }>;
354
+ deprecated: z.ZodOptional<z.ZodBoolean>;
355
+ }, z.core.$strict>;
356
+ export declare const sessionSchemaSchema: z.ZodObject<{
357
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
358
+ label: z.ZodString;
359
+ extraction: z.ZodString;
360
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
361
+ dataType: z.ZodEnum<{
362
+ boolean: "boolean";
363
+ date: "date";
364
+ datetime: "datetime";
365
+ email: "email";
366
+ multi_select: "multi_select";
367
+ number: "number";
368
+ phone: "phone";
369
+ select: "select";
370
+ string: "string";
371
+ text: "text";
372
+ time: "time";
373
+ }>;
374
+ deprecated: z.ZodOptional<z.ZodBoolean>;
375
+ }, z.core.$strict>>;
376
+ }, z.core.$strict>;
377
+ export declare const compiledCompanyMetadataSchema: z.ZodObject<{
378
+ tables: z.ZodRecord<z.ZodString, z.ZodObject<{
379
+ label: z.ZodString;
380
+ description: z.ZodString;
381
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
382
+ label: z.ZodString;
383
+ dataType: z.ZodEnum<{
384
+ boolean: "boolean";
385
+ contact_schedule: "contact_schedule";
386
+ date: "date";
387
+ datetime: "datetime";
388
+ email: "email";
389
+ multi_select: "multi_select";
390
+ number: "number";
391
+ phone: "phone";
392
+ select: "select";
393
+ string: "string";
394
+ text: "text";
395
+ time: "time";
396
+ }>;
397
+ extraction: z.ZodString;
398
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
399
+ ref: z.ZodOptional<z.ZodObject<{
400
+ table: z.ZodString;
401
+ kind: z.ZodEnum<{
402
+ lookup: "lookup";
403
+ parent: "parent";
404
+ }>;
405
+ relatedName: z.ZodOptional<z.ZodString>;
406
+ }, z.core.$strict>>;
407
+ unique: z.ZodOptional<z.ZodLiteral<true>>;
408
+ deprecated: z.ZodOptional<z.ZodBoolean>;
409
+ }, z.core.$strict>>;
410
+ }, z.core.$strict>>;
411
+ session: z.ZodObject<{
412
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
413
+ label: z.ZodString;
414
+ extraction: z.ZodString;
415
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
416
+ dataType: z.ZodEnum<{
417
+ boolean: "boolean";
418
+ date: "date";
419
+ datetime: "datetime";
420
+ email: "email";
421
+ multi_select: "multi_select";
422
+ number: "number";
423
+ phone: "phone";
424
+ select: "select";
425
+ string: "string";
426
+ text: "text";
427
+ time: "time";
428
+ }>;
429
+ deprecated: z.ZodOptional<z.ZodBoolean>;
430
+ }, z.core.$strict>>;
431
+ }, z.core.$strict>;
432
+ }, z.core.$strict>;
433
+ export type CompiledCompanyMetadata = z.infer<typeof compiledCompanyMetadataSchema>;
434
+ export declare function isCompanySchema(value: unknown): value is CompanySchema;
102
435
  //# sourceMappingURL=schema.d.ts.map