@superpanel-sdk/runtime 0.5.0 → 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.
- package/README.md +3 -3
- package/dist/builder/codegen/emit.d.ts +5 -10
- package/dist/builder/codegen/emit.js +100 -106
- package/dist/builder/codegen/generate.d.ts +3 -5
- package/dist/builder/codegen/generate.js +13 -32
- package/dist/builder/company-imports.d.ts +5 -0
- package/dist/builder/company-imports.js +9 -1
- package/dist/builder/compile/compile-sequence.d.ts +13 -11
- package/dist/builder/compile/compile-sequence.js +135 -83
- package/dist/builder/compile/function-code.d.ts +15 -9
- package/dist/builder/compile/function-code.js +59 -29
- package/dist/builder/compile/registry.d.ts +4 -4
- package/dist/builder/compile/registry.js +14 -12
- package/dist/builder/errors.d.ts +9 -0
- package/dist/builder/errors.js +17 -0
- package/dist/builder/function-params.d.ts +10 -0
- package/dist/builder/function-params.js +203 -0
- package/dist/builder/load.d.ts +17 -17
- package/dist/builder/load.js +27 -25
- package/dist/builder/paths.d.ts +6 -1
- package/dist/builder/paths.js +16 -2
- package/dist/builder/schedules.d.ts +9 -7
- package/dist/builder/schedules.js +20 -21
- package/dist/builder/typecheck.d.ts +1 -1
- package/dist/builder/typecheck.js +3 -6
- package/dist/builder/types.d.ts +41 -5
- package/dist/builder/types.js +19 -0
- package/dist/cli/calls/index.d.ts +177 -0
- package/dist/cli/calls/index.js +96 -0
- package/dist/cli/debug/index.d.ts +31 -0
- package/dist/cli/debug/index.js +119 -0
- package/dist/cli/exec/index.d.ts +39 -0
- package/dist/cli/exec/index.js +138 -0
- package/dist/cli/exec/session.d.ts +48 -0
- package/dist/cli/exec/session.js +82 -0
- package/dist/cli/exec/trace.d.ts +18 -0
- package/dist/cli/exec/trace.js +52 -0
- package/dist/cli/index.js +84 -1
- package/dist/cli/logs/index.d.ts +47 -0
- package/dist/cli/logs/index.js +113 -0
- package/dist/cli/mobile/index.d.ts +12 -0
- package/dist/cli/mobile/index.js +405 -0
- package/dist/cli/serve/index.d.ts +40 -4
- package/dist/cli/serve/index.js +167 -28
- package/dist/cli/turns/index.d.ts +105 -0
- package/dist/cli/turns/index.js +128 -0
- package/dist/cli/turns/run.d.ts +13 -0
- package/dist/cli/turns/run.js +57 -0
- package/dist/cli/turns/shadow.d.ts +112 -0
- package/dist/cli/turns/shadow.js +54 -0
- package/dist/cli/type-gen/index.js +0 -1
- package/dist/compute-host/compute-host.d.ts +5 -6
- package/dist/compute-host/compute-host.js +4 -13
- package/dist/compute-host/source-compute-host.d.ts +5 -7
- package/dist/compute-host/source-compute-host.js +12 -33
- package/dist/core/case-orchestrator/contact-hours.d.ts +26 -6
- package/dist/core/case-orchestrator/contact-hours.js +27 -8
- package/dist/core/case-orchestrator/index.d.ts +1 -4
- package/dist/core/case-orchestrator/index.js +1 -4
- package/dist/core/case-orchestrator/render.d.ts +1 -1
- package/dist/core/case-orchestrator/render.js +15 -10
- package/dist/core/case-orchestrator/types.d.ts +83 -128
- package/dist/core/case-orchestrator/types.js +0 -4
- package/dist/core/context/email-message.d.ts +40 -1
- package/dist/core/context/email-message.js +27 -0
- package/dist/core/context/email.d.ts +13 -1
- package/dist/core/context/email.js +2 -3
- package/dist/core/context/exchanges.d.ts +25 -0
- package/dist/core/context/exchanges.js +25 -7
- package/dist/core/context/instances.d.ts +31 -2
- package/dist/core/context/instances.js +18 -4
- package/dist/core/context/platform-registry.d.ts +35 -0
- package/dist/core/context/sms.d.ts +30 -0
- package/dist/core/context/sms.js +20 -0
- package/dist/core/context/types.d.ts +29 -1
- package/dist/core/conversation/index.d.ts +58 -4
- package/dist/core/conversation/index.js +123 -4
- package/dist/core/functions/errors.d.ts +74 -0
- package/dist/core/functions/errors.js +26 -0
- package/dist/core/functions/events.d.ts +23 -78
- package/dist/core/functions/events.js +8 -17
- package/dist/core/functions/schedules.d.ts +9 -10
- package/dist/core/functions/schedules.js +2 -2
- package/dist/core/functions/types.d.ts +17 -72
- package/dist/core/functions/types.js +1 -9
- package/dist/core/page/define.d.ts +230 -160
- package/dist/core/page/define.js +145 -104
- package/dist/core/page/envelope.d.ts +55 -0
- package/dist/core/page/envelope.js +4 -0
- package/dist/core/page/fns.d.ts +448 -0
- package/dist/core/page/fns.js +539 -0
- package/dist/core/page/memory-reader.d.ts +27 -0
- package/dist/core/page/memory-reader.js +299 -0
- package/dist/core/page/page-host.d.ts +20 -0
- package/dist/core/page/page-host.js +57 -0
- package/dist/core/page/records-query.d.ts +234 -0
- package/dist/core/page/records-query.js +780 -0
- package/dist/core/page/render.d.ts +67 -25
- package/dist/core/page/render.js +492 -272
- package/dist/core/page/sandbox.d.ts +85 -0
- package/dist/core/page/sandbox.js +357 -0
- package/dist/core/page/time-format.d.ts +27 -0
- package/dist/core/page/time-format.js +84 -0
- package/dist/core/page/typed.d.ts +165 -159
- package/dist/core/page/workspace.d.ts +25 -1
- package/dist/core/page/workspace.js +48 -13
- package/dist/core/party/schema.d.ts +74 -3
- package/dist/core/party/schema.js +39 -6
- package/dist/core/party/types.d.ts +8 -13
- package/dist/core/sequence/define.d.ts +1 -2
- package/dist/core/slot/company-metadata.d.ts +11 -22
- package/dist/core/slot/company-metadata.js +12 -39
- package/dist/core/slot/compile-schema.js +6 -6
- package/dist/core/slot/field.d.ts +1 -2
- package/dist/core/slot/field.js +0 -2
- package/dist/core/slot/index.d.ts +3 -3
- package/dist/core/slot/index.js +3 -3
- package/dist/core/slot/naming.d.ts +1 -1
- package/dist/core/slot/naming.js +1 -1
- package/dist/core/slot/platform-fields.d.ts +4 -4
- package/dist/core/slot/platform-fields.js +5 -5
- package/dist/core/slot/schema-compat.d.ts +8 -7
- package/dist/core/slot/schema-compat.js +22 -31
- package/dist/core/slot/schema.d.ts +3 -59
- package/dist/core/slot/schema.js +0 -15
- package/dist/core/slot/types.d.ts +4 -10
- package/dist/core/slot/value.d.ts +2 -0
- package/dist/core/slot/value.js +6 -2
- package/dist/dev-overlay/protocol.d.ts +38 -5
- package/dist/fn-context/build-context.js +10 -4
- package/dist/fn-context/fake/index.d.ts +2 -0
- package/dist/fn-context/fake/index.js +5 -3
- package/dist/fn-context/fn-params.d.ts +2 -5
- package/dist/fn-context/fn-params.js +6 -9
- package/dist/fn-context/index.d.ts +1 -1
- package/dist/fn-context/make-ctx.js +5 -4
- package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +11 -3
- package/dist/fn-context/rpc/case-orchestrator-tools.js +0 -1
- package/dist/fn-context/rpc/errors.d.ts +13 -0
- package/dist/fn-context/rpc/errors.js +22 -0
- package/dist/fn-context/rpc/index.d.ts +1 -1
- package/dist/fn-context/rpc/index.js +1 -1
- package/dist/fn-context/rpc/integration/index.d.ts +11 -1
- package/dist/fn-context/rpc/log.d.ts +11 -1
- package/dist/fn-context/rpc/platform.d.ts +11 -1
- package/dist/fn-context/rpc/records.d.ts +13 -6
- package/dist/fn-context/rpc/records.js +2 -4
- package/dist/fn-context/rpc/trpc-client.d.ts +42 -0
- package/dist/fn-context/rpc/trpc-client.js +151 -22
- package/dist/fn-context/rpc/trpc-init.d.ts +19 -1
- package/dist/fn-context/rpc/trpc-init.js +10 -4
- package/dist/fn-context/rpc/trpc-router-factory.d.ts +66 -8
- package/dist/fn-context/run-scope.js +1 -1
- package/dist/fn-context/types.d.ts +20 -6
- package/dist/index.d.ts +11 -12
- package/dist/index.js +5 -8
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +8 -0
- package/dist/platform.d.ts +32 -33
- package/dist/platform.js +23 -22
- package/dist/testing-compile-child.d.ts +2 -0
- package/dist/testing-compile-child.js +20 -0
- package/dist/testing.d.ts +368 -0
- package/dist/testing.js +439 -0
- package/dist/voice-service/actions.d.ts +12 -35
- package/dist/voice-service/index.d.ts +2 -0
- package/dist/voice-service/index.js +2 -0
- package/dist/voice-service/protocol.d.ts +604 -0
- package/dist/voice-service/protocol.js +67 -0
- package/dist/voice-service/types.d.ts +16 -6
- package/dist/worker.d.ts +2 -1
- package/dist/worker.js +2 -1
- package/package.json +20 -16
- package/dist/core/case-orchestrator/follow-ups.d.ts +0 -31
- package/dist/core/case-orchestrator/follow-ups.js +0 -103
- package/dist/core/case-orchestrator/tools.d.ts +0 -29
- package/dist/core/case-orchestrator/tools.js +0 -31
- package/dist/core/case-orchestrator/validate.d.ts +0 -11
- package/dist/core/case-orchestrator/validate.js +0 -63
- package/dist/core/functions/define/bind.d.ts +0 -25
- package/dist/core/functions/define/bind.js +0 -14
- package/dist/core/functions/define/case.d.ts +0 -9
- package/dist/core/functions/define/case.js +0 -13
- package/dist/core/functions/define/events.d.ts +0 -20
- package/dist/core/functions/define/events.js +0 -21
- package/dist/core/functions/define/no-case.d.ts +0 -4
- package/dist/core/functions/define/no-case.js +0 -9
- package/dist/core/functions/func-ref.d.ts +0 -25
- package/dist/core/functions/func-ref.js +0 -20
|
@@ -35,8 +35,37 @@ export declare const sipArrival: z.ZodObject<{
|
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export type SipArrival = z.infer<typeof sipArrival>;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* What both resolves get (14-sequence-instance §18): the conversation as it arrives, no facts looked
|
|
39
|
+
* up. They look up what they need (`ctx.api.contact.find`, `ctx.api.instances.findForContact`,
|
|
40
|
+
* `ctx.api.exchanges`).
|
|
41
|
+
*/
|
|
42
|
+
/** A text of the batch the resolve decides for (64 §9), as the page gets it (`ctx.sms.inbound`), with the provider's id. */
|
|
43
|
+
export declare const arrivalSmsMessage: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
body: z.ZodString;
|
|
46
|
+
at: z.ZodString;
|
|
47
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type ArrivalSmsMessage = z.infer<typeof arrivalSmsMessage>;
|
|
50
|
+
/** An email of the batch the resolve decides for (64 §9), as the page gets it (`ctx.email.inbound`), with the provider's id. */
|
|
51
|
+
export declare const arrivalEmailMessage: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
from: z.ZodString;
|
|
54
|
+
to: z.ZodArray<z.ZodString>;
|
|
55
|
+
cc: z.ZodArray<z.ZodString>;
|
|
56
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
57
|
+
body: z.ZodString;
|
|
58
|
+
at: z.ZodString;
|
|
59
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export type ArrivalEmailMessage = z.infer<typeof arrivalEmailMessage>;
|
|
66
|
+
/**
|
|
67
|
+
* What the company `resolve` is called with (§18.2, its `args`): an inbound conversation, before its sequence is known.
|
|
68
|
+
* `to.name` is our number's, SIP address's or mailbox's name in the environment (22 §7), the same in test and prod.
|
|
40
69
|
*/
|
|
41
70
|
export declare const companyResolveInput: z.ZodObject<{
|
|
42
71
|
channel: z.ZodEnum<{
|
|
@@ -59,10 +88,31 @@ export declare const companyResolveInput: z.ZodObject<{
|
|
|
59
88
|
domain: z.ZodNullable<z.ZodString>;
|
|
60
89
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
61
90
|
}, z.core.$strip>>;
|
|
91
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
messages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
93
|
+
id: z.ZodString;
|
|
94
|
+
body: z.ZodString;
|
|
95
|
+
at: z.ZodString;
|
|
96
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
98
|
+
id: z.ZodString;
|
|
99
|
+
from: z.ZodString;
|
|
100
|
+
to: z.ZodArray<z.ZodString>;
|
|
101
|
+
cc: z.ZodArray<z.ZodString>;
|
|
102
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
103
|
+
body: z.ZodString;
|
|
104
|
+
at: z.ZodString;
|
|
105
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>]>>;
|
|
62
111
|
to: z.ZodObject<{
|
|
63
112
|
kind: z.ZodEnum<{
|
|
64
113
|
email: "email";
|
|
65
114
|
phone: "phone";
|
|
115
|
+
sip: "sip";
|
|
66
116
|
}>;
|
|
67
117
|
value: z.ZodString;
|
|
68
118
|
name: z.ZodNullable<z.ZodString>;
|
|
@@ -82,7 +132,7 @@ export declare const companyResolveResult: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
82
132
|
}, z.core.$strict>;
|
|
83
133
|
}, z.core.$strict>]>;
|
|
84
134
|
export type CompanyResolveResult = z.infer<typeof companyResolveResult>;
|
|
85
|
-
/**
|
|
135
|
+
/** What a sequence's `resolve` is called with (§18.3, its `args`): the conversation, on this sequence. */
|
|
86
136
|
export declare const resolveInput: z.ZodObject<{
|
|
87
137
|
channel: z.ZodEnum<{
|
|
88
138
|
call: "call";
|
|
@@ -101,6 +151,7 @@ export declare const resolveInput: z.ZodObject<{
|
|
|
101
151
|
kind: z.ZodEnum<{
|
|
102
152
|
email: "email";
|
|
103
153
|
phone: "phone";
|
|
154
|
+
sip: "sip";
|
|
104
155
|
}>;
|
|
105
156
|
value: z.ZodString;
|
|
106
157
|
}, z.core.$strip>;
|
|
@@ -111,6 +162,26 @@ export declare const resolveInput: z.ZodObject<{
|
|
|
111
162
|
domain: z.ZodNullable<z.ZodString>;
|
|
112
163
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
113
164
|
}, z.core.$strip>>;
|
|
165
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
166
|
+
messages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
167
|
+
id: z.ZodString;
|
|
168
|
+
body: z.ZodString;
|
|
169
|
+
at: z.ZodString;
|
|
170
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
171
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
from: z.ZodString;
|
|
174
|
+
to: z.ZodArray<z.ZodString>;
|
|
175
|
+
cc: z.ZodArray<z.ZodString>;
|
|
176
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
177
|
+
body: z.ZodString;
|
|
178
|
+
at: z.ZodString;
|
|
179
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, z.core.$strip>>;
|
|
183
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>>]>>;
|
|
114
185
|
direction: z.ZodEnum<{
|
|
115
186
|
inbound: "inbound";
|
|
116
187
|
outbound: "outbound";
|
|
@@ -29,23 +29,56 @@ export const sipArrival = z.object({
|
|
|
29
29
|
* up. They look up what they need (`ctx.api.contact.find`, `ctx.api.instances.findForContact`,
|
|
30
30
|
* `ctx.api.exchanges`).
|
|
31
31
|
*/
|
|
32
|
+
/** A text of the batch the resolve decides for (64 §9), as the page gets it (`ctx.sms.inbound`), with the provider's id. */
|
|
33
|
+
export const arrivalSmsMessage = z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
body: z.string(),
|
|
36
|
+
at: z.string(),
|
|
37
|
+
/** The provider's id of the text (Twilio's MessageSid). */
|
|
38
|
+
externalId: z.string().nullable(),
|
|
39
|
+
});
|
|
40
|
+
/** An email of the batch the resolve decides for (64 §9), as the page gets it (`ctx.email.inbound`), with the provider's id. */
|
|
41
|
+
export const arrivalEmailMessage = z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
from: z.string(),
|
|
44
|
+
to: z.array(z.string()),
|
|
45
|
+
cc: z.array(z.string()),
|
|
46
|
+
subject: z.string().nullable(),
|
|
47
|
+
/** Quoted history and signature taken out. */
|
|
48
|
+
body: z.string(),
|
|
49
|
+
at: z.string(),
|
|
50
|
+
/** Listed only: their contents are not read here. */
|
|
51
|
+
attachments: z.array(z.object({ name: z.string(), contentType: z.string().optional() })),
|
|
52
|
+
/** The provider's id of the email. */
|
|
53
|
+
externalId: z.string().nullable(),
|
|
54
|
+
});
|
|
32
55
|
const conversationArrival = z.object({
|
|
33
56
|
channel: z.enum(['call', 'sms', 'email']),
|
|
34
57
|
/** The other side: the caller or sender on inbound, the one called on outbound. Normalized. */
|
|
35
58
|
from: arrivalAddress,
|
|
36
|
-
/**
|
|
37
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Our side: the number or mailbox the conversation came in on (inbound) or goes out from; on a call
|
|
61
|
+
* through our SIP Domain to one of our SIP addresses, the SIP URI it dialed (`sip:sales@acme.sip.twilio.com`).
|
|
62
|
+
*/
|
|
63
|
+
to: arrivalAddress,
|
|
38
64
|
/** Email: the provider thread id, when the message belongs to one. */
|
|
39
65
|
threadId: z.string().nullable(),
|
|
40
66
|
/** A call through our SIP Domain; absent on any other conversation. */
|
|
41
67
|
sip: sipArrival.optional(),
|
|
68
|
+
/** A call: the provider's id of the call (Twilio's CallSid, 62), what a record written here can name it by. Null on a text or an email. */
|
|
69
|
+
externalId: z.string().nullable(),
|
|
70
|
+
/**
|
|
71
|
+
* Texts and emails: the batch this resolve decides for (64 §9), oldest first; each carries its own
|
|
72
|
+
* `externalId`. Absent on a call, which has said nothing yet, and on an outbound conversation.
|
|
73
|
+
*/
|
|
74
|
+
messages: z.union([z.array(arrivalSmsMessage), z.array(arrivalEmailMessage)]).optional(),
|
|
42
75
|
});
|
|
43
76
|
/**
|
|
44
|
-
*
|
|
45
|
-
* `to.name` is our number's or mailbox's name in the environment (22 §7), the same in test and prod.
|
|
77
|
+
* What the company `resolve` is called with (§18.2, its `args`): an inbound conversation, before its sequence is known.
|
|
78
|
+
* `to.name` is our number's, SIP address's or mailbox's name in the environment (22 §7), the same in test and prod.
|
|
46
79
|
*/
|
|
47
80
|
export const companyResolveInput = conversationArrival.extend({
|
|
48
|
-
to:
|
|
81
|
+
to: arrivalAddress.extend({ name: z.string().nullable() }),
|
|
49
82
|
});
|
|
50
83
|
/**
|
|
51
84
|
* What the company `resolve` returns: the sequence (its name) the conversation goes to, or `decline`
|
|
@@ -56,7 +89,7 @@ export const companyResolveResult = z.union([
|
|
|
56
89
|
z.strictObject({ sequence: z.string().min(1) }),
|
|
57
90
|
z.strictObject({ decline: z.strictObject({ reply: z.string().min(1).optional() }) }),
|
|
58
91
|
]);
|
|
59
|
-
/**
|
|
92
|
+
/** What a sequence's `resolve` is called with (§18.3, its `args`): the conversation, on this sequence. */
|
|
60
93
|
export const resolveInput = conversationArrival.extend({
|
|
61
94
|
direction: z.enum(['inbound', 'outbound']),
|
|
62
95
|
/** This sequence (its name): the only one whose instances `resolve` may return or start. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ctx } from '../functions/types.js';
|
|
2
2
|
import type { PageTablesDesc } from '../page/typed.js';
|
|
3
3
|
import type { CompanyResolveInput, CompanyResolveResult, ResolveInput, ResolveResult } from './schema.js';
|
|
4
4
|
/**
|
|
@@ -16,25 +16,20 @@ export declare const COMPANY_RESOLVE_FUNCTION = "companyResolve";
|
|
|
16
16
|
/** `ctx.meta.entry` / RunScope entry of a company `resolve` call. */
|
|
17
17
|
export declare const COMPANY_RESOLVE_ENTRY = "companyResolve";
|
|
18
18
|
/**
|
|
19
|
-
* The company `resolve.ts` (§18.2): `export const resolve: CompanyResolve = async (ctx) => …`. Runs for
|
|
19
|
+
* The company `resolve.ts` (§18.2): `export const resolve: CompanyResolve = async (ctx, conversation) => …`. Runs for
|
|
20
20
|
* inbound calls, texts and emails only, before the sequence is known: returns `{ sequence }` (a name)
|
|
21
21
|
* or `{ decline: { reply? } }`. It reads with `ctx.api` like any function; the repository root's
|
|
22
22
|
* `__gen/` binds `D` to the company's tables, so `ctx.api.db` is typed.
|
|
23
23
|
*/
|
|
24
|
-
export type CompanyResolve<D extends PageTablesDesc | undefined = undefined> =
|
|
24
|
+
export type CompanyResolve<D extends PageTablesDesc | undefined = undefined> = (ctx: Ctx<D>, conversation: CompanyResolveInput) => Promise<CompanyResolveResult>;
|
|
25
25
|
/**
|
|
26
|
-
* `
|
|
27
|
-
* `
|
|
28
|
-
* `ctx.api.
|
|
29
|
-
* `
|
|
30
|
-
*/
|
|
31
|
-
export type ResolveContext<D extends PageTablesDesc | undefined = undefined> = FunctionCtx<ResolveInput, D>;
|
|
32
|
-
/**
|
|
33
|
-
* `sequences/<id>/resolve.ts`: `export const resolve: Resolve = async (ctx) => …`, with `Resolve`
|
|
34
|
-
* imported from the sequence's `__gen`. A `noCase` function: the conversation in, `{ contactId,
|
|
26
|
+
* `sequences/<id>/resolve.ts`: `export const resolve: Resolve = async (ctx, conversation) => …`, with
|
|
27
|
+
* `Resolve` imported from the sequence's `__gen`. It finds and creates through `ctx.api.contact`, reads
|
|
28
|
+
* and writes records through `ctx.api.db`, finds instances through `ctx.api.instances` and exchanges
|
|
29
|
+
* through `ctx.api.exchanges`. The conversation in, `{ contactId,
|
|
35
30
|
* instanceId }` or `{ contactId, start }` out, on this sequence only. The platform gives it what is
|
|
36
31
|
* left of the time limit, checks the ids (an active instance of this sequence, a contact, a row of
|
|
37
32
|
* its subject table, all of this company and environment), and fails the conversation when not.
|
|
38
33
|
*/
|
|
39
|
-
export type Resolve<D extends PageTablesDesc | undefined = undefined> =
|
|
34
|
+
export type Resolve<D extends PageTablesDesc | undefined = undefined> = (ctx: Ctx<D>, conversation: ResolveInput) => Promise<ResolveResult>;
|
|
40
35
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** `sequences/<id>/index.ts` default export. */
|
|
6
6
|
export type SequenceDefinition<S extends string = string> = {
|
|
7
|
+
/** `label`: the name people see; without it, the directory name, which is the sequence's name. */
|
|
7
8
|
meta?: {
|
|
8
|
-
name?: string;
|
|
9
9
|
label?: string;
|
|
10
|
-
description?: string;
|
|
11
10
|
};
|
|
12
11
|
/** The company table each run is about: one row of it is the instance's business root. */
|
|
13
12
|
subject: S;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompanyFieldDef, CompanySchema,
|
|
1
|
+
import type { CompanyFieldDef, CompanySchema, SessionSchema, TableRef } from './schema.js';
|
|
2
2
|
import type { ValidationIssue, ValidationResult } from './types.js';
|
|
3
3
|
export { PLATFORM_CONTACT_FIELDS, PLATFORM_SESSION_FIELDS } from './platform-fields.js';
|
|
4
4
|
/** The one table every company has: the only thing the platform contacts (14-sequence-instance §5). */
|
|
@@ -10,12 +10,6 @@ export declare const CONTACT_OPT_OUT_FIELDS: readonly ['opted_out', 'call_opted_
|
|
|
10
10
|
export declare const LIMITS: {
|
|
11
11
|
/** Longest parent chain: a table's parent's parent … at most this many hops to a table without one. */
|
|
12
12
|
readonly parentDepth: 5;
|
|
13
|
-
/** Rows one load step (one table) may read. */
|
|
14
|
-
readonly loadRowsPerStep: 500;
|
|
15
|
-
/** `follow` hops chained in one load expression. */
|
|
16
|
-
readonly followDepth: 3;
|
|
17
|
-
/** A load's time budget, ms. */
|
|
18
|
-
readonly loadTimeoutMs: 2000;
|
|
19
13
|
/** An instance's `variables`, serialized, bytes. */
|
|
20
14
|
readonly variablesBytes: number;
|
|
21
15
|
/** Company tables per company and environment (18-record-search-index §4.7). */
|
|
@@ -26,9 +20,12 @@ export declare const LIMITS: {
|
|
|
26
20
|
readonly options: 200;
|
|
27
21
|
/** Characters of one option: a short code, not a sentence (its meaning goes in `extraction`). */
|
|
28
22
|
readonly optionChars: 60;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A `string` value, UTF-8 bytes, as written and lower-cased: its index entries keep it whole, and a
|
|
25
|
+
* B-tree entry holds at most 2688 bytes of it; the rest is room for the entry's other columns (34 §2).
|
|
26
|
+
*/
|
|
27
|
+
readonly stringBytes: 2500;
|
|
28
|
+
/** A `text` value, UTF-8 bytes: the storage's bound, not a business one (34 §2). */
|
|
32
29
|
readonly textBytes: number;
|
|
33
30
|
/** One row's stored data, serialized, UTF-8 bytes. */
|
|
34
31
|
readonly rowDataBytes: number;
|
|
@@ -76,25 +73,17 @@ export declare function parentOf(table: FieldsOf | undefined): {
|
|
|
76
73
|
* in its data.
|
|
77
74
|
*/
|
|
78
75
|
export declare function isParentField(table: FieldsOf | undefined, fieldName: string): boolean;
|
|
79
|
-
export type CompileCompanyMetadataResult = {
|
|
80
|
-
metadata: CompiledCompanyMetadata | null;
|
|
81
|
-
validation: ValidationResult;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* The company schema as authored, without the reserved names (as `compileSlotSchema` leaves them
|
|
85
|
-
* out). It is plain data.
|
|
86
|
-
*/
|
|
87
|
-
export declare function compileCompanySchema(company: CompanySchema): CompanySchema;
|
|
88
76
|
/**
|
|
89
77
|
* Why `schema/session.ts` is not a session schema (11-remove-sequence-schema §3.1): its fields are
|
|
90
78
|
* simple values, with no `ref` (the session is related to no other table).
|
|
91
79
|
*/
|
|
92
80
|
export declare function sessionSchemaIssues(session: SessionSchema): ValidationIssue[];
|
|
93
81
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
82
|
+
* Whether the company schema is one: its tables (`schema/index.ts`) and its session fields
|
|
83
|
+
* (`schema/session.ts`, the platform's only when the file is missing). `session` is reserved: no
|
|
84
|
+
* company table has the name. What a build stores is `compileSlotSchema`'s output.
|
|
96
85
|
*/
|
|
97
|
-
export declare function
|
|
86
|
+
export declare function validateCompanySchema(company: CompanySchema, session?: SessionSchema): ValidationResult;
|
|
98
87
|
/** The issue for a field that still names its `source` (19-page-writable-cells). */
|
|
99
88
|
export declare function sourceRemovedIssue(path: string, prefix?: string): ValidationIssue;
|
|
100
89
|
/** The issue for a field that still names `nullable`, which no write checked. */
|
|
@@ -13,12 +13,6 @@ export const CONTACT_OPT_OUT_FIELDS = ['opted_out', 'call_opted_out', 'sms_opted
|
|
|
13
13
|
export const LIMITS = {
|
|
14
14
|
/** Longest parent chain: a table's parent's parent … at most this many hops to a table without one. */
|
|
15
15
|
parentDepth: 5,
|
|
16
|
-
/** Rows one load step (one table) may read. */
|
|
17
|
-
loadRowsPerStep: 500,
|
|
18
|
-
/** `follow` hops chained in one load expression. */
|
|
19
|
-
followDepth: 3,
|
|
20
|
-
/** A load's time budget, ms. */
|
|
21
|
-
loadTimeoutMs: 2000,
|
|
22
16
|
/** An instance's `variables`, serialized, bytes. */
|
|
23
17
|
variablesBytes: 64 * 1024,
|
|
24
18
|
/** Company tables per company and environment (18-record-search-index §4.7). */
|
|
@@ -29,9 +23,12 @@ export const LIMITS = {
|
|
|
29
23
|
options: 200,
|
|
30
24
|
/** Characters of one option: a short code, not a sentence (its meaning goes in `extraction`). */
|
|
31
25
|
optionChars: 60,
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
/**
|
|
27
|
+
* A `string` value, UTF-8 bytes, as written and lower-cased: its index entries keep it whole, and a
|
|
28
|
+
* B-tree entry holds at most 2688 bytes of it; the rest is room for the entry's other columns (34 §2).
|
|
29
|
+
*/
|
|
30
|
+
stringBytes: 2500,
|
|
31
|
+
/** A `text` value, UTF-8 bytes: the storage's bound, not a business one (34 §2). */
|
|
35
32
|
textBytes: 64 * 1024,
|
|
36
33
|
/** One row's stored data, serialized, UTF-8 bytes. */
|
|
37
34
|
rowDataBytes: 256 * 1024,
|
|
@@ -82,30 +79,6 @@ export function parentOf(table) {
|
|
|
82
79
|
export function isParentField(table, fieldName) {
|
|
83
80
|
return parentOf(table)?.field === fieldName;
|
|
84
81
|
}
|
|
85
|
-
/** A field as stored: a copy of it. */
|
|
86
|
-
function storedField(field) {
|
|
87
|
-
return structuredClone(field);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* The company schema as authored, without the reserved names (as `compileSlotSchema` leaves them
|
|
91
|
-
* out). It is plain data.
|
|
92
|
-
*/
|
|
93
|
-
export function compileCompanySchema(company) {
|
|
94
|
-
const compiled = {};
|
|
95
|
-
for (const [tableName, table] of Object.entries(company)) {
|
|
96
|
-
if (tableName === SESSION_TABLE || isReservedTableName(tableName))
|
|
97
|
-
continue;
|
|
98
|
-
compiled[tableName] = {
|
|
99
|
-
...structuredClone(table),
|
|
100
|
-
fields: Object.fromEntries(Object.entries(table.fields).map(([name, field]) => [name, storedField(field)])),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return compiled;
|
|
104
|
-
}
|
|
105
|
-
/** The session schema as stored. */
|
|
106
|
-
function compileSessionSchema(session) {
|
|
107
|
-
return { fields: Object.fromEntries(Object.entries(session.fields).map(([name, field]) => [name, storedField(field)])) };
|
|
108
|
-
}
|
|
109
82
|
/**
|
|
110
83
|
* Why `schema/session.ts` is not a session schema (11-remove-sequence-schema §3.1): its fields are
|
|
111
84
|
* simple values, with no `ref` (the session is related to no other table).
|
|
@@ -242,10 +215,11 @@ function schemaNameIssues(company, session) {
|
|
|
242
215
|
return issues;
|
|
243
216
|
}
|
|
244
217
|
/**
|
|
245
|
-
*
|
|
246
|
-
*
|
|
218
|
+
* Whether the company schema is one: its tables (`schema/index.ts`) and its session fields
|
|
219
|
+
* (`schema/session.ts`, the platform's only when the file is missing). `session` is reserved: no
|
|
220
|
+
* company table has the name. What a build stores is `compileSlotSchema`'s output.
|
|
247
221
|
*/
|
|
248
|
-
export function
|
|
222
|
+
export function validateCompanySchema(company, session = PLATFORM_SESSION_SCHEMA) {
|
|
249
223
|
const issues = [];
|
|
250
224
|
if (Object.hasOwn(company, SESSION_TABLE)) {
|
|
251
225
|
issues.push({
|
|
@@ -267,14 +241,13 @@ export function compileCompanyMetadata(company, session = PLATFORM_SESSION_SCHEM
|
|
|
267
241
|
message: 'the company schema must define the contact table (spread PLATFORM_CONTACT_FIELDS into it)',
|
|
268
242
|
path: CONTACT_TABLE,
|
|
269
243
|
});
|
|
270
|
-
return {
|
|
244
|
+
return { ok: false, issues };
|
|
271
245
|
}
|
|
272
246
|
validatePlatformFields(company, CONTACT_TABLE, issues);
|
|
273
247
|
validatePlatformSessionFields(session, issues);
|
|
274
248
|
validateRelationships(company, issues);
|
|
275
249
|
issues.push(...fieldRuleIssues(company));
|
|
276
|
-
|
|
277
|
-
return { metadata, validation: issues.length === 0 ? { ok: true } : { ok: false, issues } };
|
|
250
|
+
return issues.length === 0 ? { ok: true } : { ok: false, issues };
|
|
278
251
|
}
|
|
279
252
|
/**
|
|
280
253
|
* Relationship rules (14-sequence-instance §16.1): a table has at most one parent, a required system
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { idFieldCore, ROW_ID_FIELD } from './schema.js';
|
|
2
2
|
import { isReservedTableName } from './row.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PLATFORM_SESSION_SCHEMA, SESSION_TABLE, validateCompanySchema } from './company-metadata.js';
|
|
4
4
|
import { formatFieldPath, parseFieldPath } from './path.js';
|
|
5
5
|
function toRuntimeField(field) {
|
|
6
6
|
return {
|
|
@@ -49,15 +49,15 @@ function validateCompanyRefs(company, issues) {
|
|
|
49
49
|
export function compileSlotSchema(company, options = {}) {
|
|
50
50
|
const issues = [];
|
|
51
51
|
const session = options.session ?? PLATFORM_SESSION_SCHEMA;
|
|
52
|
-
const companyCheck =
|
|
53
|
-
if (!companyCheck.
|
|
54
|
-
issues.push(...companyCheck.
|
|
52
|
+
const companyCheck = validateCompanySchema(company, session);
|
|
53
|
+
if (!companyCheck.ok)
|
|
54
|
+
issues.push(...companyCheck.issues);
|
|
55
55
|
const tables = {};
|
|
56
56
|
for (const [tableName, companyTable] of Object.entries(company)) {
|
|
57
|
-
// Reserved table names are the company schema's to report (
|
|
57
|
+
// Reserved table names are the company schema's to report (validateCompanySchema).
|
|
58
58
|
if (tableName === SESSION_TABLE || isReservedTableName(tableName))
|
|
59
59
|
continue;
|
|
60
|
-
// The row id is the platform's: a schema that writes one is refused (
|
|
60
|
+
// The row id is the platform's: a schema that writes one is refused (validateCompanySchema).
|
|
61
61
|
const fields = { [ROW_ID_FIELD]: { ...ROW_ID } };
|
|
62
62
|
for (const [fieldName, field] of Object.entries(companyTable.fields)) {
|
|
63
63
|
if (fieldName !== ROW_ID_FIELD)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FieldState } from '../context/types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldValue, SlotValue, UpdatedBy } from './types.js';
|
|
3
3
|
/** Stage done checks use resolved, not "has a value". */
|
|
4
4
|
export declare function isResolved(field: FieldValue | null | undefined): boolean;
|
|
5
5
|
export declare function emptyFieldValue(now?: number): FieldValue;
|
|
@@ -9,6 +9,5 @@ export declare function makeFieldValue(partial: {
|
|
|
9
9
|
reason?: string | null;
|
|
10
10
|
updatedBy?: UpdatedBy;
|
|
11
11
|
updatedAt?: number;
|
|
12
|
-
history?: FieldHistoryEntry[];
|
|
13
12
|
}): FieldValue;
|
|
14
13
|
//# sourceMappingURL=field.d.ts.map
|
package/dist/core/slot/field.js
CHANGED
|
@@ -12,7 +12,6 @@ export function emptyFieldValue(now = 0) {
|
|
|
12
12
|
state: 'empty',
|
|
13
13
|
updatedAt: now,
|
|
14
14
|
updatedBy: 'platform',
|
|
15
|
-
history: [],
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
17
|
export function makeFieldValue(partial) {
|
|
@@ -22,7 +21,6 @@ export function makeFieldValue(partial) {
|
|
|
22
21
|
state: partial.state,
|
|
23
22
|
updatedAt: partial.updatedAt ?? 0,
|
|
24
23
|
updatedBy: partial.updatedBy ?? 'platform',
|
|
25
|
-
history: partial.history ?? [],
|
|
26
24
|
};
|
|
27
25
|
}
|
|
28
26
|
//# sourceMappingURL=field.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, type RowSystemKey, type RowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema,
|
|
2
|
-
export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, PLATFORM_CONTACT_FIELDS, POLICY_IDS, SESSION_TABLE,
|
|
1
|
+
export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, type RowSystemKey, type RowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema, companyFieldDefSchema, companyTableDefSchema, companySchemaSchema, contactScheduleValueSchema, localTimeRangeSchema, isCompanySchema, } from './schema.js';
|
|
2
|
+
export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, PLATFORM_CONTACT_FIELDS, POLICY_IDS, SESSION_TABLE, validateCompanySchema, isCustomTable, isParentField, isRecordTable, parentOf, subjectTableIssues, type ResponsePolicyId, type SlotFillingPolicyId, type VoiceProfileId, } from './company-metadata.js';
|
|
3
3
|
export { lookupRef, parentRef } from './id-ref.js';
|
|
4
4
|
export { isFieldValue, isReservedTableName, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, slotFieldEntries, slotFieldNames, type SlotRow, } from './row.js';
|
|
5
5
|
export { parseFieldPath, requireFieldPath, formatFieldPath, type FieldPath, type ParsedFieldPath } from './path.js';
|
|
6
6
|
export { isResolved, emptyFieldValue, makeFieldValue, } from './field.js';
|
|
7
7
|
export { compileSlotSchema, compiledTableEntries, getCompiledTable, getTableField, relationsOf, type TableRelation, validateFieldRefs, companyFieldToRuntime, } from './compile-schema.js';
|
|
8
|
-
export {
|
|
8
|
+
export { companySchemaCompatibilityIssues } from './schema-compat.js';
|
|
9
9
|
export { DATE_VALUE_FORMAT, DATE_VALUE_PATTERN, DATETIME_VALUE_FORMAT, DATETIME_VALUE_PATTERN, isValidDataTypeValue, validateBareValue, } from './value.js';
|
|
10
10
|
export { refKind, refValueIssues, type RefKind } from './ref.js';
|
|
11
11
|
export type { ComputeFnMap, ComputeHost, ComputeHostOrFns } from '../../compute-host/compute-host.js';
|
package/dist/core/slot/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema,
|
|
2
|
-
export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, PLATFORM_CONTACT_FIELDS, POLICY_IDS, SESSION_TABLE,
|
|
1
|
+
export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema, companyFieldDefSchema, companyTableDefSchema, companySchemaSchema, contactScheduleValueSchema, localTimeRangeSchema, isCompanySchema, } from './schema.js';
|
|
2
|
+
export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, PLATFORM_CONTACT_FIELDS, POLICY_IDS, SESSION_TABLE, validateCompanySchema, isCustomTable, isParentField, isRecordTable, parentOf, subjectTableIssues, } from './company-metadata.js';
|
|
3
3
|
export { lookupRef, parentRef } from './id-ref.js';
|
|
4
4
|
export { isFieldValue, isReservedTableName, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, slotFieldEntries, slotFieldNames, } from './row.js';
|
|
5
5
|
export { parseFieldPath, requireFieldPath, formatFieldPath } from './path.js';
|
|
6
6
|
export { isResolved, emptyFieldValue, makeFieldValue, } from './field.js';
|
|
7
7
|
export { compileSlotSchema, compiledTableEntries, getCompiledTable, getTableField, relationsOf, validateFieldRefs, companyFieldToRuntime, } from './compile-schema.js';
|
|
8
|
-
export {
|
|
8
|
+
export { companySchemaCompatibilityIssues } from './schema-compat.js';
|
|
9
9
|
export { DATE_VALUE_FORMAT, DATE_VALUE_PATTERN, DATETIME_VALUE_FORMAT, DATETIME_VALUE_PATTERN, isValidDataTypeValue, validateBareValue, } from './value.js';
|
|
10
10
|
export { refKind, refValueIssues } from './ref.js';
|
|
11
11
|
export { createLocalComputeHost, resolveComputeHost } from '../../compute-host/compute-host.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Naming rules for the company schema (13-data-model-v1 §23.4 item 6): table names, field names
|
|
3
3
|
* (session fields included) and relation names. A name ends up as a path segment (`table.field`,
|
|
4
|
-
* `injury
|
|
4
|
+
* `injury:3f9a2c1d7e04.severity`), an object key at runtime and a property in generated TypeScript, so it is
|
|
5
5
|
* kept to what is safe in all three.
|
|
6
6
|
*/
|
|
7
7
|
/** Postgres's identifier limit: a field can become a real column without a rename. */
|
package/dist/core/slot/naming.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Naming rules for the company schema (13-data-model-v1 §23.4 item 6): table names, field names
|
|
3
3
|
* (session fields included) and relation names. A name ends up as a path segment (`table.field`,
|
|
4
|
-
* `injury
|
|
4
|
+
* `injury:3f9a2c1d7e04.severity`), an object key at runtime and a property in generated TypeScript, so it is
|
|
5
5
|
* kept to what is safe in all three.
|
|
6
6
|
*/
|
|
7
7
|
/** Lowercase letters, digits and `_`, starting with a letter: never `.`, `-`, `#`, `*`, `$` or a space. */
|
|
@@ -65,8 +65,8 @@ export declare const PLATFORM_CONTACT_FIELDS: {
|
|
|
65
65
|
readonly language: {
|
|
66
66
|
readonly label: 'Language';
|
|
67
67
|
readonly dataType: 'select';
|
|
68
|
-
readonly extraction: 'The language they
|
|
69
|
-
readonly options: ["
|
|
68
|
+
readonly extraction: 'The language they want us to use with them, one of these (BCP-47): when they ask for one. The platform also sets it once they clearly speak or write one of them with us.';
|
|
69
|
+
readonly options: ["en", "fr", "de", "es", "pt", "zh", "ja", "hi", "it", "ko", "nl", "pl", "ru", "sv", "tr", "tl", "bg", "ro", "ar", "cs", "el", "fi", "hr", "ms", "sk", "da", "ta", "uk", "hu", "no", "vi", "bn", "th", "he", "ka", "id", "te", "gu", "kn", "ml", "mr", "pa"];
|
|
70
70
|
};
|
|
71
71
|
readonly opted_out: {
|
|
72
72
|
readonly label: 'Opted out';
|
|
@@ -106,8 +106,8 @@ export declare const PLATFORM_CONTACT_FIELDS: {
|
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
108
|
* The session's platform fields (24 §5.2): `schema/session.ts` spreads them into its fields, checked
|
|
109
|
-
* like the contact's. `
|
|
110
|
-
* decides what to do, and clears it.
|
|
109
|
+
* like the contact's. `language`: the language the call is in (48 §3). `stuck`: the AI marked the call
|
|
110
|
+
* stuck (its `stuck` action); the page reads it, decides what to do, and clears it.
|
|
111
111
|
*/
|
|
112
112
|
export declare const PLATFORM_SESSION_FIELDS: {
|
|
113
113
|
readonly stuck: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CONTACT_LANGUAGES } from '../conversation/index.js';
|
|
2
2
|
import { STATE_CODES } from './contact-timezone.js';
|
|
3
3
|
/**
|
|
4
4
|
* The contact table's platform fields. The company schema spreads them into `contact` and the runtime
|
|
@@ -67,8 +67,8 @@ export const PLATFORM_CONTACT_FIELDS = {
|
|
|
67
67
|
language: {
|
|
68
68
|
label: 'Language',
|
|
69
69
|
dataType: 'select',
|
|
70
|
-
extraction: 'The language they
|
|
71
|
-
options: [...
|
|
70
|
+
extraction: 'The language they want us to use with them, one of these (BCP-47): when they ask for one. The platform also sets it once they clearly speak or write one of them with us.',
|
|
71
|
+
options: [...CONTACT_LANGUAGES],
|
|
72
72
|
},
|
|
73
73
|
opted_out: {
|
|
74
74
|
label: 'Opted out',
|
|
@@ -108,8 +108,8 @@ export const PLATFORM_CONTACT_FIELDS = {
|
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* The session's platform fields (24 §5.2): `schema/session.ts` spreads them into its fields, checked
|
|
111
|
-
* like the contact's. `
|
|
112
|
-
* decides what to do, and clears it.
|
|
111
|
+
* like the contact's. `language`: the language the call is in (48 §3). `stuck`: the AI marked the call
|
|
112
|
+
* stuck (its `stuck` action); the page reads it, decides what to do, and clears it.
|
|
113
113
|
*/
|
|
114
114
|
export const PLATFORM_SESSION_FIELDS = {
|
|
115
115
|
stuck: {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CompiledSlotSchema } from './types.js';
|
|
2
2
|
/**
|
|
3
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.
|
|
5
|
-
*
|
|
6
|
-
* `Session.data` keeps
|
|
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.
|
|
7
8
|
*
|
|
8
9
|
* Compatible: new tables (with their parent), fields (lookups included), more options, a widened
|
|
9
|
-
* type (`
|
|
10
|
+
* type (`select` / `time` → `string`), and presentation changes (label,
|
|
10
11
|
* description, extraction, deprecated); a new field may be `unique`. Incompatible: removing a table or
|
|
11
|
-
* field (mark it `deprecated` instead); any other change of a field's dataType, `unique` added to or
|
|
12
|
+
* field (mark it `deprecated` instead); any other change of a field's dataType (to `text` included), `unique` added to or
|
|
12
13
|
* dropped from a field (18-record-search-index §4.5), any ref change (added, removed, retargeted, parent ↔ lookup), a parent added to a
|
|
13
14
|
* table `before` has (its stored rows have no parent edge, 13-data-model-v1 §22.5), a removed option.
|
|
14
15
|
*/
|
|
15
|
-
export declare function
|
|
16
|
+
export declare function companySchemaCompatibilityIssues(before: CompiledSlotSchema, after: CompiledSlotSchema): string[];
|
|
16
17
|
//# sourceMappingURL=schema-compat.d.ts.map
|