@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.
- package/README.md +28 -8
- package/dist/builder/codegen/emit.d.ts +29 -11
- package/dist/builder/codegen/emit.js +328 -61
- package/dist/builder/codegen/generate.d.ts +21 -0
- package/dist/builder/codegen/generate.js +152 -20
- package/dist/builder/company-import-graph.d.ts +2 -0
- package/dist/builder/company-import-graph.js +40 -8
- package/dist/builder/company-imports.d.ts +24 -0
- package/dist/builder/company-imports.js +114 -0
- package/dist/builder/compile/compile-sequence.d.ts +59 -8
- package/dist/builder/compile/compile-sequence.js +279 -77
- package/dist/builder/compile/function-code.d.ts +12 -2
- package/dist/builder/compile/function-code.js +87 -39
- package/dist/builder/compile/registry.d.ts +7 -3
- package/dist/builder/compile/registry.js +24 -23
- package/dist/builder/load.d.ts +70 -10
- package/dist/builder/load.js +250 -61
- package/dist/builder/paths.d.ts +3 -0
- package/dist/builder/paths.js +16 -0
- package/dist/builder/schedules.d.ts +23 -0
- package/dist/builder/schedules.js +102 -0
- package/dist/builder/slot-schema-validation.d.ts +4 -0
- package/dist/builder/slot-schema-validation.js +10 -0
- package/dist/builder/typecheck.d.ts +8 -0
- package/dist/builder/typecheck.js +105 -0
- package/dist/builder/types.d.ts +91 -19
- package/dist/builder/types.js +2 -1
- package/dist/cli/auth/auth.d.ts +37 -0
- package/dist/cli/auth/auth.js +211 -0
- package/dist/cli/auth/backend-url.d.ts +5 -0
- package/dist/cli/auth/backend-url.js +25 -0
- package/dist/cli/auth/clipboard.d.ts +9 -0
- package/dist/cli/auth/clipboard.js +38 -0
- package/dist/cli/auth/http.d.ts +20 -0
- package/dist/cli/auth/http.js +27 -0
- package/dist/cli/auth/index.d.ts +10 -0
- package/dist/cli/auth/index.js +27 -0
- package/dist/cli/auth/progress.d.ts +12 -0
- package/dist/cli/auth/progress.js +15 -0
- package/dist/cli/auth/serve-login.d.ts +8 -0
- package/dist/cli/auth/serve-login.js +24 -0
- package/dist/cli/compile/index.js +3 -0
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.js +52 -0
- package/dist/cli/index.js +28 -8
- package/dist/cli/serve/index.d.ts +73 -3
- package/dist/cli/serve/index.js +410 -113
- package/dist/cli/type-gen/index.js +9 -8
- package/dist/compiler.d.ts +7 -0
- package/dist/compiler.js +7 -0
- package/dist/compute-host/compute-host.d.ts +15 -23
- package/dist/compute-host/compute-host.js +25 -28
- package/dist/compute-host/index.d.ts +2 -2
- package/dist/compute-host/index.js +1 -1
- package/dist/compute-host/source-compute-host.d.ts +11 -9
- package/dist/compute-host/source-compute-host.js +50 -31
- package/dist/core/case-orchestrator/contact-hours.d.ts +50 -0
- package/dist/core/case-orchestrator/contact-hours.js +108 -0
- package/dist/core/case-orchestrator/follow-ups.d.ts +31 -0
- package/dist/core/case-orchestrator/follow-ups.js +103 -0
- package/dist/core/case-orchestrator/index.d.ts +6 -0
- package/dist/core/case-orchestrator/index.js +6 -0
- package/dist/core/case-orchestrator/render.d.ts +75 -0
- package/dist/core/case-orchestrator/render.js +239 -0
- package/dist/core/case-orchestrator/time.d.ts +11 -0
- package/dist/core/case-orchestrator/time.js +29 -0
- package/dist/core/case-orchestrator/tools.d.ts +29 -0
- package/dist/core/case-orchestrator/tools.js +31 -0
- package/dist/core/case-orchestrator/types.d.ts +753 -0
- package/dist/core/case-orchestrator/types.js +46 -0
- package/dist/core/case-orchestrator/validate.d.ts +11 -0
- package/dist/core/case-orchestrator/validate.js +63 -0
- package/dist/core/context/call.d.ts +291 -0
- package/dist/core/context/call.js +94 -0
- package/dist/core/context/channels.d.ts +60 -0
- package/dist/core/context/channels.js +35 -0
- package/dist/core/context/contact.d.ts +96 -6
- package/dist/core/context/contact.js +48 -2
- package/dist/core/context/email-message.d.ts +159 -0
- package/dist/core/context/email-message.js +59 -0
- package/dist/core/context/email.d.ts +97 -0
- package/dist/core/context/email.js +91 -0
- package/dist/core/context/exchanges.d.ts +142 -0
- package/dist/core/context/exchanges.js +63 -0
- package/dist/core/context/instances.d.ts +278 -0
- package/dist/core/context/instances.js +123 -0
- package/dist/core/context/kv.d.ts +113 -0
- package/dist/core/context/kv.js +60 -0
- package/dist/core/context/platform-registry.d.ts +509 -4
- package/dist/core/context/platform-registry.js +14 -2
- package/dist/core/context/platform.d.ts +2 -1
- package/dist/core/context/sms.d.ts +147 -0
- package/dist/core/context/sms.js +57 -0
- package/dist/core/context/types.d.ts +51 -30
- package/dist/core/context/types.js +1 -7
- package/dist/core/conversation/index.d.ts +31 -0
- package/dist/core/conversation/index.js +14 -0
- package/dist/core/functions/define/bind.d.ts +25 -0
- package/dist/core/functions/define/bind.js +14 -0
- package/dist/core/functions/define/case.d.ts +9 -0
- package/dist/core/functions/define/case.js +13 -0
- package/dist/core/functions/define/events.d.ts +20 -0
- package/dist/core/functions/define/events.js +21 -0
- package/dist/core/functions/define/no-case.d.ts +4 -0
- package/dist/core/functions/define/no-case.js +9 -0
- package/dist/core/functions/events.d.ts +247 -0
- package/dist/core/functions/events.js +32 -0
- package/dist/core/functions/func-ref.d.ts +11 -2
- package/dist/core/functions/schedules.d.ts +51 -0
- package/dist/core/functions/schedules.js +20 -0
- package/dist/core/functions/types.d.ts +62 -51
- package/dist/core/functions/types.js +6 -1
- package/dist/core/office-hours/index.d.ts +39 -0
- package/dist/core/office-hours/index.js +187 -0
- package/dist/core/page/define.d.ts +834 -0
- package/dist/core/page/define.js +477 -0
- package/dist/core/page/ops.d.ts +58 -0
- package/dist/core/page/ops.js +220 -0
- package/dist/core/page/render.d.ts +253 -0
- package/dist/core/page/render.js +840 -0
- package/dist/core/page/time-format.d.ts +19 -0
- package/dist/core/page/time-format.js +41 -0
- package/dist/core/page/timeline.d.ts +40 -0
- package/dist/core/page/timeline.js +2 -0
- package/dist/core/page/typed.d.ts +642 -0
- package/dist/core/page/typed.js +2 -0
- package/dist/core/page/workspace.d.ts +33 -0
- package/dist/core/page/workspace.js +231 -0
- package/dist/core/party/index.d.ts +3 -0
- package/dist/core/party/index.js +3 -0
- package/dist/core/party/schema.d.ts +137 -0
- package/dist/core/party/schema.js +80 -0
- package/dist/core/party/types.d.ts +40 -0
- package/dist/core/party/types.js +15 -0
- package/dist/core/sequence/define.d.ts +57 -0
- package/dist/core/sequence/define.js +10 -0
- package/dist/core/sequence/index.d.ts +63 -0
- package/dist/core/sequence/index.js +231 -0
- package/dist/core/slot/binding.d.ts +40 -0
- package/dist/core/slot/binding.js +2 -0
- package/dist/core/slot/company-metadata.d.ts +113 -0
- package/dist/core/slot/company-metadata.js +563 -0
- package/dist/core/slot/compile-schema.d.ts +19 -13
- package/dist/core/slot/compile-schema.js +51 -248
- package/dist/core/slot/contact-timezone.d.ts +110 -0
- package/dist/core/slot/contact-timezone.js +186 -0
- package/dist/core/slot/field.d.ts +2 -24
- package/dist/core/slot/field.js +0 -69
- package/dist/core/slot/id-ref.d.ts +17 -2
- package/dist/core/slot/id-ref.js +16 -8
- package/dist/core/slot/index.d.ts +12 -13
- package/dist/core/slot/index.js +11 -12
- package/dist/core/slot/naming.d.ts +15 -0
- package/dist/core/slot/naming.js +96 -0
- package/dist/core/slot/platform-fields.d.ts +119 -0
- package/dist/core/slot/platform-fields.js +121 -0
- package/dist/core/slot/ref.d.ts +16 -0
- package/dist/core/slot/ref.js +14 -0
- package/dist/core/slot/row.d.ts +2 -9
- package/dist/core/slot/row.js +13 -23
- package/dist/core/slot/schema-compat.d.ts +16 -0
- package/dist/core/slot/schema-compat.js +112 -0
- package/dist/core/slot/schema.d.ts +409 -76
- package/dist/core/slot/schema.js +178 -10
- package/dist/core/slot/types.d.ts +27 -92
- package/dist/core/slot/value.d.ts +26 -3
- package/dist/core/slot/value.js +89 -57
- package/dist/dev-overlay/protocol.d.ts +41 -8
- package/dist/fn-context/build-context.d.ts +3 -1
- package/dist/fn-context/build-context.js +20 -10
- package/dist/fn-context/fake/empty-api.js +9 -28
- package/dist/fn-context/fake/index.d.ts +11 -4
- package/dist/fn-context/fake/index.js +27 -2
- package/dist/fn-context/fn-params.d.ts +6 -0
- package/dist/fn-context/fn-params.js +13 -0
- package/dist/fn-context/index.d.ts +5 -5
- package/dist/fn-context/index.js +4 -4
- package/dist/fn-context/log.js +2 -2
- package/dist/fn-context/make-ctx.d.ts +11 -0
- package/dist/fn-context/make-ctx.js +18 -8
- package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +24 -0
- package/dist/fn-context/rpc/case-orchestrator-tools.js +13 -0
- package/dist/fn-context/rpc/index.d.ts +3 -1
- package/dist/fn-context/rpc/index.js +3 -1
- package/dist/fn-context/rpc/integration/index.d.ts +4 -4
- package/dist/fn-context/rpc/integration/index.js +1 -1
- package/dist/fn-context/rpc/integration/list-surfaces.d.ts +21 -0
- package/dist/fn-context/rpc/integration/{list-bindings.js → list-surfaces.js} +4 -4
- package/dist/fn-context/rpc/platform.d.ts +2 -2
- package/dist/fn-context/rpc/platform.js +1 -1
- package/dist/fn-context/rpc/records.d.ts +78 -0
- package/dist/fn-context/rpc/records.js +26 -0
- package/dist/fn-context/rpc/trpc-client.d.ts +2 -2
- package/dist/fn-context/rpc/trpc-client.js +89 -5
- package/dist/fn-context/rpc/trpc-init.d.ts +2 -2
- package/dist/fn-context/rpc/trpc-router-factory.d.ts +49 -3
- package/dist/fn-context/rpc/trpc-router-factory.js +2 -0
- package/dist/fn-context/run-scope.d.ts +4 -0
- package/dist/fn-context/run-scope.js +9 -0
- package/dist/fn-context/types.d.ts +36 -3
- package/dist/index.d.ts +37 -46
- package/dist/index.js +33 -33
- package/dist/logger.d.ts +7 -0
- package/dist/logger.js +41 -0
- package/dist/platform.d.ts +76 -0
- package/dist/platform.js +56 -0
- package/dist/voice-service/actions.d.ts +71 -4
- package/dist/voice-service/types.d.ts +42 -2
- package/dist/worker.d.ts +10 -0
- package/dist/worker.js +10 -0
- package/package.json +38 -19
- package/dist/builder/compile/compile-agenda.d.ts +0 -15
- package/dist/builder/compile/compile-agenda.js +0 -59
- package/dist/builder/merge.d.ts +0 -4
- package/dist/builder/merge.js +0 -19
- package/dist/core/context/db.d.ts +0 -69
- package/dist/core/context/db.js +0 -44
- package/dist/core/context/docusign.d.ts +0 -134
- package/dist/core/context/docusign.js +0 -108
- package/dist/core/context/filevine.d.ts +0 -323
- package/dist/core/context/filevine.js +0 -254
- package/dist/core/context/http.d.ts +0 -9
- package/dist/core/context/http.js +0 -4
- package/dist/core/context/hubspot.d.ts +0 -250
- package/dist/core/context/hubspot.js +0 -191
- package/dist/core/context/twilio.d.ts +0 -50
- package/dist/core/context/twilio.js +0 -42
- package/dist/core/functions/define/case-context.d.ts +0 -14
- package/dist/core/functions/define/case-context.js +0 -15
- package/dist/core/functions/define/compute.d.ts +0 -7
- package/dist/core/functions/define/compute.js +0 -17
- package/dist/core/functions/define/custom.d.ts +0 -4
- package/dist/core/functions/define/custom.js +0 -8
- package/dist/core/functions/define/system.d.ts +0 -7
- package/dist/core/functions/define/system.js +0 -12
- package/dist/core/slot/deps.d.ts +0 -15
- package/dist/core/slot/deps.js +0 -88
- package/dist/core/slot/derived.d.ts +0 -32
- package/dist/core/slot/derived.js +0 -115
- package/dist/core/slot/platform-session-fields.d.ts +0 -38
- package/dist/core/slot/platform-session-fields.js +0 -48
- package/dist/core/slot/sf-schema.d.ts +0 -23
- package/dist/core/slot/sf-schema.js +0 -125
- package/dist/core/slot/sf-validate.d.ts +0 -14
- package/dist/core/slot/sf-validate.js +0 -132
- package/dist/core/slot/snapshot.d.ts +0 -18
- package/dist/core/slot/snapshot.js +0 -138
- package/dist/core/slot/write.d.ts +0 -41
- package/dist/core/slot/write.js +0 -319
- package/dist/core/stage/builders.d.ts +0 -36
- package/dist/core/stage/builders.js +0 -28
- package/dist/core/stage/condition.d.ts +0 -17
- package/dist/core/stage/condition.js +0 -198
- package/dist/core/stage/drive.d.ts +0 -43
- package/dist/core/stage/drive.js +0 -77
- package/dist/core/stage/finish-when.d.ts +0 -20
- package/dist/core/stage/finish-when.js +0 -82
- package/dist/core/stage/flatten.d.ts +0 -27
- package/dist/core/stage/flatten.js +0 -464
- package/dist/core/stage/index.d.ts +0 -11
- package/dist/core/stage/index.js +0 -10
- package/dist/core/stage/simulate.d.ts +0 -24
- package/dist/core/stage/simulate.js +0 -33
- package/dist/core/stage/transfer-fields.d.ts +0 -14
- package/dist/core/stage/transfer-fields.js +0 -88
- package/dist/core/stage/types.d.ts +0 -177
- package/dist/core/stage/types.js +0 -2
- package/dist/core/stage/validate.d.ts +0 -11
- package/dist/core/stage/validate.js +0 -226
- package/dist/core/stage/walk.d.ts +0 -34
- package/dist/core/stage/walk.js +0 -96
- package/dist/fn-context/rpc/integration/list-bindings.d.ts +0 -21
- package/dist/fn-context/system-args.d.ts +0 -6
- package/dist/fn-context/system-args.js +0 -14
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SMS_PAGE_LIMIT_MAX = 100;
|
|
3
|
+
export declare const smsDirection: z.ZodEnum<{
|
|
4
|
+
inbound: "inbound";
|
|
5
|
+
outbound: "outbound";
|
|
6
|
+
}>;
|
|
7
|
+
export type SmsDirection = z.infer<typeof smsDirection>;
|
|
8
|
+
/**
|
|
9
|
+
* Script-facing SMS projection (21 §5.10). A text line is our number and theirs: `from` / `to` are the
|
|
10
|
+
* message's own. Provider metadata stays private.
|
|
11
|
+
*/
|
|
12
|
+
export declare const smsRecord: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
15
|
+
contactId: z.ZodNullable<z.ZodString>;
|
|
16
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
17
|
+
direction: z.ZodEnum<{
|
|
18
|
+
inbound: "inbound";
|
|
19
|
+
outbound: "outbound";
|
|
20
|
+
}>;
|
|
21
|
+
from: z.ZodString;
|
|
22
|
+
to: z.ZodString;
|
|
23
|
+
body: z.ZodNullable<z.ZodString>;
|
|
24
|
+
processing: z.ZodNullable<z.ZodString>;
|
|
25
|
+
delivery: z.ZodNullable<z.ZodString>;
|
|
26
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
27
|
+
occurredAt: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type SmsRecord = z.infer<typeof smsRecord>;
|
|
30
|
+
export declare const smsListInput: z.ZodObject<{
|
|
31
|
+
offset: z.ZodNumber;
|
|
32
|
+
limit: z.ZodNumber;
|
|
33
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
contactId: z.ZodOptional<z.ZodString>;
|
|
35
|
+
counterpart: z.ZodOptional<z.ZodString>;
|
|
36
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
inbound: "inbound";
|
|
38
|
+
outbound: "outbound";
|
|
39
|
+
}>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type SmsListParams = z.infer<typeof smsListInput>;
|
|
42
|
+
export declare const smsListOutput: z.ZodObject<{
|
|
43
|
+
sms: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
46
|
+
contactId: z.ZodNullable<z.ZodString>;
|
|
47
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
48
|
+
direction: z.ZodEnum<{
|
|
49
|
+
inbound: "inbound";
|
|
50
|
+
outbound: "outbound";
|
|
51
|
+
}>;
|
|
52
|
+
from: z.ZodString;
|
|
53
|
+
to: z.ZodString;
|
|
54
|
+
body: z.ZodNullable<z.ZodString>;
|
|
55
|
+
processing: z.ZodNullable<z.ZodString>;
|
|
56
|
+
delivery: z.ZodNullable<z.ZodString>;
|
|
57
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
58
|
+
occurredAt: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
offset: z.ZodNumber;
|
|
61
|
+
limit: z.ZodNumber;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type SmsListResult = z.infer<typeof smsListOutput>;
|
|
64
|
+
export declare const smsGetInput: z.ZodString;
|
|
65
|
+
export declare const smsGetOutput: z.ZodNullable<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
68
|
+
contactId: z.ZodNullable<z.ZodString>;
|
|
69
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
70
|
+
direction: z.ZodEnum<{
|
|
71
|
+
inbound: "inbound";
|
|
72
|
+
outbound: "outbound";
|
|
73
|
+
}>;
|
|
74
|
+
from: z.ZodString;
|
|
75
|
+
to: z.ZodString;
|
|
76
|
+
body: z.ZodNullable<z.ZodString>;
|
|
77
|
+
processing: z.ZodNullable<z.ZodString>;
|
|
78
|
+
delivery: z.ZodNullable<z.ZodString>;
|
|
79
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
80
|
+
occurredAt: z.ZodString;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
/** Platform SMS capability, reached from scripts as `ctx.api.sms`. */
|
|
83
|
+
export type SmsApi = {
|
|
84
|
+
list(input: SmsListParams): Promise<SmsListResult>;
|
|
85
|
+
get(id: string): Promise<SmsRecord | null>;
|
|
86
|
+
};
|
|
87
|
+
export declare const smsMockService: SmsApi;
|
|
88
|
+
export declare const smsSurface: {
|
|
89
|
+
methods: {
|
|
90
|
+
list: {
|
|
91
|
+
input: z.ZodObject<{
|
|
92
|
+
offset: z.ZodNumber;
|
|
93
|
+
limit: z.ZodNumber;
|
|
94
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
95
|
+
contactId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
counterpart: z.ZodOptional<z.ZodString>;
|
|
97
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
inbound: "inbound";
|
|
99
|
+
outbound: "outbound";
|
|
100
|
+
}>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
output: z.ZodObject<{
|
|
103
|
+
sms: z.ZodArray<z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
106
|
+
contactId: z.ZodNullable<z.ZodString>;
|
|
107
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
108
|
+
direction: z.ZodEnum<{
|
|
109
|
+
inbound: "inbound";
|
|
110
|
+
outbound: "outbound";
|
|
111
|
+
}>;
|
|
112
|
+
from: z.ZodString;
|
|
113
|
+
to: z.ZodString;
|
|
114
|
+
body: z.ZodNullable<z.ZodString>;
|
|
115
|
+
processing: z.ZodNullable<z.ZodString>;
|
|
116
|
+
delivery: z.ZodNullable<z.ZodString>;
|
|
117
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
118
|
+
occurredAt: z.ZodString;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
offset: z.ZodNumber;
|
|
121
|
+
limit: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
};
|
|
124
|
+
get: {
|
|
125
|
+
input: z.ZodString;
|
|
126
|
+
output: z.ZodNullable<z.ZodObject<{
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
129
|
+
contactId: z.ZodNullable<z.ZodString>;
|
|
130
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
131
|
+
direction: z.ZodEnum<{
|
|
132
|
+
inbound: "inbound";
|
|
133
|
+
outbound: "outbound";
|
|
134
|
+
}>;
|
|
135
|
+
from: z.ZodString;
|
|
136
|
+
to: z.ZodString;
|
|
137
|
+
body: z.ZodNullable<z.ZodString>;
|
|
138
|
+
processing: z.ZodNullable<z.ZodString>;
|
|
139
|
+
delivery: z.ZodNullable<z.ZodString>;
|
|
140
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
141
|
+
occurredAt: z.ZodString;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
mock: SmsApi;
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=sms.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const SMS_PAGE_LIMIT_MAX = 100;
|
|
3
|
+
export const smsDirection = z.enum(['inbound', 'outbound']);
|
|
4
|
+
/**
|
|
5
|
+
* Script-facing SMS projection (21 §5.10). A text line is our number and theirs: `from` / `to` are the
|
|
6
|
+
* message's own. Provider metadata stays private.
|
|
7
|
+
*/
|
|
8
|
+
export const smsRecord = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
instanceId: z.string().nullable(),
|
|
11
|
+
contactId: z.string().nullable(),
|
|
12
|
+
/** Inbound: the run that handled it; outbound: the run that sent it (null: the platform did). */
|
|
13
|
+
runId: z.string().nullable(),
|
|
14
|
+
direction: smsDirection,
|
|
15
|
+
from: z.string(),
|
|
16
|
+
to: z.string(),
|
|
17
|
+
body: z.string().nullable(),
|
|
18
|
+
/** Inbound: pending | claimed | processed | skipped | declined | failed. */
|
|
19
|
+
processing: z.string().nullable(),
|
|
20
|
+
/** Outbound: pending | submitting | the provider's status (queued, sent, delivered, undelivered, failed …). */
|
|
21
|
+
delivery: z.string().nullable(),
|
|
22
|
+
/** The provider's error code, as given. */
|
|
23
|
+
errorCode: z.string().nullable(),
|
|
24
|
+
occurredAt: z.string(),
|
|
25
|
+
});
|
|
26
|
+
export const smsListInput = z.object({
|
|
27
|
+
offset: z.number().int().min(0),
|
|
28
|
+
limit: z.number().int().min(1).max(SMS_PAGE_LIMIT_MAX),
|
|
29
|
+
instanceId: z.string().optional(),
|
|
30
|
+
contactId: z.string().optional(),
|
|
31
|
+
/** Their number: one text line with them (on any of our numbers). */
|
|
32
|
+
counterpart: z.string().optional(),
|
|
33
|
+
direction: smsDirection.optional(),
|
|
34
|
+
});
|
|
35
|
+
export const smsListOutput = z.object({
|
|
36
|
+
sms: z.array(smsRecord),
|
|
37
|
+
offset: z.number().int(),
|
|
38
|
+
limit: z.number().int(),
|
|
39
|
+
});
|
|
40
|
+
export const smsGetInput = z.string().min(1);
|
|
41
|
+
export const smsGetOutput = smsRecord.nullable();
|
|
42
|
+
export const smsMockService = {
|
|
43
|
+
async list(input) {
|
|
44
|
+
return { sms: [], offset: input.offset, limit: input.limit };
|
|
45
|
+
},
|
|
46
|
+
async get() {
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const smsSurface = {
|
|
51
|
+
methods: {
|
|
52
|
+
list: { input: smsListInput, output: smsListOutput },
|
|
53
|
+
get: { input: smsGetInput, output: smsGetOutput },
|
|
54
|
+
},
|
|
55
|
+
mock: smsMockService,
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=sms.js.map
|
|
@@ -1,79 +1,100 @@
|
|
|
1
|
-
import type { FieldPath } from '../slot/path.js';
|
|
2
1
|
import type { PlatformApis } from './platform-registry.js';
|
|
3
|
-
import type {
|
|
2
|
+
import type { Db } from '../page/define.js';
|
|
3
|
+
import type { EmailApi } from './email.js';
|
|
4
4
|
import type { EnvApi } from './env.js';
|
|
5
|
-
import type { FilevineApi } from './filevine.js';
|
|
6
|
-
import type { HubspotApi } from './hubspot.js';
|
|
7
|
-
import type { TwilioApi } from './twilio.js';
|
|
8
|
-
import type { HttpApi } from './http.js';
|
|
9
5
|
import type { IntegrationAccountFields } from './account-fields.js';
|
|
10
6
|
export type { IntegrationAccountFields, IntegrationTarget } from './account-fields.js';
|
|
11
|
-
export type FieldState = 'empty' | 'filled' | 'asked_unknown' | 'declined';
|
|
12
|
-
/**
|
|
13
|
-
* Fallback Slots. Sequence `__gen/slots.type.ts` provides the narrowed shape;
|
|
14
|
-
* `view.ts` selectors import that type.
|
|
15
|
-
*/
|
|
16
|
-
export type Slots = Record<string, unknown>;
|
|
17
7
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
8
|
+
* Lifecycle state of a slot field (`01-slot-design §2`):
|
|
9
|
+
* - `'empty'`: Not yet asked or set (`value` is `null`). Not `resolved`.
|
|
10
|
+
* - `'filled'`: Has an answer (`value` is non-null). Counts as `resolved`.
|
|
11
|
+
* - `'asked_unknown'`: Asked, and the contact does not know / cannot remember (`value` is `null` or a coarse value). Counts as `resolved`.
|
|
12
|
+
* - `'declined'`: Asked, and the contact refused to answer (`value` is `null`). Counts as `resolved`.
|
|
20
13
|
*/
|
|
21
|
-
export type
|
|
22
|
-
|
|
14
|
+
export type FieldState = 'empty' | 'filled' | 'asked_unknown' | 'declined';
|
|
15
|
+
/** Field states a write can set without a value; the platform stores `value: null`. */
|
|
16
|
+
export type SlotWriteClearState = 'empty' | 'asked_unknown' | 'declined';
|
|
23
17
|
export type Logger = {
|
|
24
18
|
info: (message: string, extra?: Record<string, unknown>) => void;
|
|
25
19
|
warn: (message: string, extra?: Record<string, unknown>) => void;
|
|
26
20
|
error: (message: string, extra?: Record<string, unknown>) => void;
|
|
27
21
|
};
|
|
28
|
-
export type {
|
|
22
|
+
export type { EmailApi, EmailAttachment, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetMessageInput, EmailGetMessageOutput, EmailListMessagesInput, EmailListMessagesOutput, EmailProvider, EmailSendEmailInput, EmailSendEmailOutput, EmailService, } from './email.js';
|
|
29
23
|
export type { EnvApi, EnvService } from './env.js';
|
|
30
|
-
export type { FilevineApi, FilevineService } from './filevine.js';
|
|
31
|
-
export type { HubspotApi, HubspotService } from './hubspot.js';
|
|
32
|
-
export type { TwilioApi, TwilioCreateCallInput, TwilioCreateCallOutput, TwilioIncomingNumber, TwilioListIncomingNumbersOutput, TwilioSendSmsInput, TwilioSendSmsOutput, TwilioService, } from './twilio.js';
|
|
33
24
|
export type { ContactApi, ContactListParams, ContactListResult, ContactSummary } from './contact.js';
|
|
34
|
-
export type { HttpApi } from './http.js';
|
|
35
25
|
/**
|
|
36
26
|
* Integration API: surfaceKey → array of bound stubs.
|
|
37
27
|
* Add a key here when the platform adds a script surface; the provider table must implement it.
|
|
38
28
|
*/
|
|
39
29
|
export type IntegrationApi = {
|
|
40
|
-
hubspots?: HubspotApi[];
|
|
41
|
-
twilios?: TwilioApi[];
|
|
42
|
-
filevines?: FilevineApi[];
|
|
43
|
-
docusigns?: DocusignApi[];
|
|
44
30
|
envs?: EnvApi[];
|
|
31
|
+
emails?: EmailApi[];
|
|
45
32
|
};
|
|
46
33
|
export type IntegrationSurfaceKey = keyof IntegrationApi;
|
|
47
34
|
type SurfaceItem<K extends IntegrationSurfaceKey> = NonNullable<IntegrationApi[K]>[number];
|
|
48
35
|
export type IntegrationStub = SurfaceItem<IntegrationSurfaceKey>;
|
|
49
|
-
export declare const integrationSurfaceKeys: readonly ["
|
|
50
|
-
export type
|
|
36
|
+
export declare const integrationSurfaceKeys: readonly ["envs", "emails"];
|
|
37
|
+
export type IntegrationSurfaceMeta = IntegrationAccountFields & {
|
|
51
38
|
surfaceKey: IntegrationSurfaceKey;
|
|
52
39
|
methods: string[];
|
|
53
40
|
};
|
|
54
41
|
/** Context injected into custom and system functions. */
|
|
55
42
|
export type SystemContext = {
|
|
56
43
|
time: Readonly<{
|
|
44
|
+
/** Current wall-clock timestamp in epoch milliseconds (use instead of `Date.now()`). */
|
|
57
45
|
now: number;
|
|
46
|
+
/** IANA timezone of `today`; currently always `'UTC'` (not the contact's or office's timezone). */
|
|
58
47
|
timezone: string;
|
|
48
|
+
/** Current calendar date (`YYYY-MM-DD`) in `time.timezone`, i.e. the UTC date. */
|
|
59
49
|
today: string;
|
|
50
|
+
/**
|
|
51
|
+
* `at` as people read it, in `timeZone` (25 §11): "Tue, Nov 3, 3:00 PM EST" (`style` `'date'` or
|
|
52
|
+
* `'time'` for one part). A contact's zone is `contactTimezone(…)`.
|
|
53
|
+
*/
|
|
54
|
+
format(at: string | number, options: {
|
|
55
|
+
timeZone: string;
|
|
56
|
+
style?: 'datetime' | 'date' | 'time';
|
|
57
|
+
}): string;
|
|
58
|
+
/** The calendar day (`YYYY-MM-DD`) at `at` in `timeZone` (25 §11), to compare days or key a rule by date. */
|
|
59
|
+
day(at: string | number, timeZone: string): string;
|
|
60
60
|
}>;
|
|
61
61
|
meta: Readonly<{
|
|
62
62
|
companyId: string;
|
|
63
63
|
environmentId: string;
|
|
64
64
|
sequenceId: string;
|
|
65
|
+
/**
|
|
66
|
+
* What the function runs under: `'voice'` / `'sms'` / `'email'` in a conversation,
|
|
67
|
+
* `'orchestrator'` in an Orchestrator Run, `'resolve'` when resolving a conversation.
|
|
68
|
+
*/
|
|
65
69
|
entry: string;
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The instance the function runs on; null when none (`resolve`, a webhook, a handler without one).
|
|
72
|
+
* Who the conversation is with, and its session, are not here (28 §4): a page passes them as the
|
|
73
|
+
* function's params (`runFunction(name, { prefill: { contactId: ctx.caller.id, sessionId: ctx.session.id } })`).
|
|
74
|
+
*/
|
|
75
|
+
instanceId: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* A function pressed as a button (25 §11): this press's key, the same when the AI presses it again with
|
|
78
|
+
* the same arguments in the same run. Send it to another system as its idempotency key, so a second
|
|
79
|
+
* press does not do the work twice. Absent outside a button.
|
|
80
|
+
*/
|
|
81
|
+
idempotencyKey?: string;
|
|
68
82
|
}>;
|
|
69
83
|
config: Readonly<{
|
|
84
|
+
/** Base URL of the frontend app. */
|
|
70
85
|
frontendUrl: string;
|
|
86
|
+
/** Base URL of the backend RPC endpoint. */
|
|
71
87
|
backendUrl: string;
|
|
72
88
|
}>;
|
|
73
89
|
api: PlatformApis & {
|
|
74
90
|
integration: IntegrationApi;
|
|
75
91
|
log: Logger;
|
|
76
|
-
|
|
92
|
+
/**
|
|
93
|
+
* The company's records, Prisma-shaped (`db.<table>.findMany(…)`, `db.<table>.update(…)`): reads
|
|
94
|
+
* like a page script's (every `where` anchored), writes like a page action's, through the explicit
|
|
95
|
+
* write entry, each call its own transaction. Any row of the company and environment.
|
|
96
|
+
*/
|
|
97
|
+
db: Db;
|
|
77
98
|
};
|
|
78
99
|
};
|
|
79
100
|
export type MakeCtxOverrides = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the platform knows of a conversation's channel, shared by the page, the engine and the pipeline.
|
|
3
|
+
*/
|
|
4
|
+
export type Direction = 'inbound' | 'outbound';
|
|
5
|
+
/** The channels a conversation runs on. A conversation engine runs on calls and SMS (17b §9.0); email routes and stores only. */
|
|
6
|
+
export declare const CHANNELS: readonly ['call', 'sms', 'email'];
|
|
7
|
+
export type Channel = (typeof CHANNELS)[number];
|
|
8
|
+
/**
|
|
9
|
+
* The languages the platform speaks: the values of the contact's `language` field. Each needs a voice
|
|
10
|
+
* (the default voice profile's settings for it) and the platform's fixed lines in it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SPOKEN_LANGUAGES: readonly ['english', 'spanish'];
|
|
13
|
+
/** A spoken language as the contact's `language` field holds it (`english`, `spanish`). */
|
|
14
|
+
export type SpokenLanguage = string;
|
|
15
|
+
export declare function isSpokenLanguage(value: unknown): value is SpokenLanguage;
|
|
16
|
+
/**
|
|
17
|
+
* The scheduled action that started an outbound conversation (a scheduled call or message), fixed for
|
|
18
|
+
* the session. An agreed follow-up has `agreedInExchangeId`; `note` says why it happens
|
|
19
|
+
* (docs/design/09-agreed-follow-up.md).
|
|
20
|
+
*/
|
|
21
|
+
export type ScheduledContactContext = {
|
|
22
|
+
scheduledActionId: string;
|
|
23
|
+
/** Set for an agreed follow-up: the exchange the party asked for or agreed to it in. */
|
|
24
|
+
agreedInExchangeId: string | null;
|
|
25
|
+
/** An agreed follow-up: the party's own words agreeing to it; null otherwise. */
|
|
26
|
+
customerQuote: string | null;
|
|
27
|
+
note: string | null;
|
|
28
|
+
/** When it was due, ISO 8601. */
|
|
29
|
+
scheduledFor: string;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the platform knows of a conversation's channel, shared by the page, the engine and the pipeline.
|
|
3
|
+
*/
|
|
4
|
+
/** The channels a conversation runs on. A conversation engine runs on calls and SMS (17b §9.0); email routes and stores only. */
|
|
5
|
+
export const CHANNELS = ['call', 'sms', 'email'];
|
|
6
|
+
/**
|
|
7
|
+
* The languages the platform speaks: the values of the contact's `language` field. Each needs a voice
|
|
8
|
+
* (the default voice profile's settings for it) and the platform's fixed lines in it.
|
|
9
|
+
*/
|
|
10
|
+
export const SPOKEN_LANGUAGES = ['english', 'spanish'];
|
|
11
|
+
export function isSpokenLanguage(value) {
|
|
12
|
+
return typeof value === 'string' && SPOKEN_LANGUAGES.includes(value.trim());
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CaseInput } from '../../case-orchestrator/types.js';
|
|
2
|
+
import type { PageTablesDesc } from '../../page/typed.js';
|
|
3
|
+
import type { EventHandlers } from '../events.js';
|
|
4
|
+
import type { CaseFn, DefinedCaseFunc, DefinedNoCaseFunc, FuncOptions, NoCaseFn } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The define helpers bound to one sequence: functions' and event handlers' `c` to its case (`C`: the
|
|
7
|
+
* instance and its business root's id), `ctx.api.db` to its `PageTables` (`D`).
|
|
8
|
+
*/
|
|
9
|
+
export type BoundDefines<D extends PageTablesDesc | undefined = undefined, C = CaseInput> = {
|
|
10
|
+
defineCaseFunc: {
|
|
11
|
+
/** A function that writes with `ctx.api.db` and returns nothing. */
|
|
12
|
+
<P extends object = object>(main: CaseFn<C, P, void, D>, options?: FuncOptions): DefinedCaseFunc<C, P, void, D>;
|
|
13
|
+
/** Any other return type, spelled out: `defineCaseFunc<object, string>(…)` (`R` is never inferred). */
|
|
14
|
+
<P extends object = object, R = never>(main: CaseFn<C, P, NoInfer<R>, D>, options?: FuncOptions): DefinedCaseFunc<C, P, R, D>;
|
|
15
|
+
};
|
|
16
|
+
/** Nocase function: no `c`; reads and writes with `ctx.api.db`. */
|
|
17
|
+
defineNoCaseFunc: <P extends object = object, R = unknown>(main: NoCaseFn<P, R, D>, options?: FuncOptions) => DefinedNoCaseFunc<P, R, D>;
|
|
18
|
+
defineEvents: (handlers: EventHandlers<C, D>) => EventHandlers<C, D>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Bind the define helpers to a sequence. `type:gen` emits `__gen/index.ts` calling this, so company
|
|
22
|
+
* code never spells the types: `defineCaseFunc(async (c, ctx) => …)`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function bindDefines<D extends PageTablesDesc | undefined = undefined, C = CaseInput>(): BoundDefines<D, C>;
|
|
25
|
+
//# sourceMappingURL=bind.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineCaseFunc } from './case.js';
|
|
2
|
+
import { defineNoCaseFunc } from './no-case.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bind the define helpers to a sequence. `type:gen` emits `__gen/index.ts` calling this, so company
|
|
5
|
+
* code never spells the types: `defineCaseFunc(async (c, ctx) => …)`.
|
|
6
|
+
*/
|
|
7
|
+
export function bindDefines() {
|
|
8
|
+
return {
|
|
9
|
+
defineCaseFunc: defineCaseFunc,
|
|
10
|
+
defineNoCaseFunc: defineNoCaseFunc,
|
|
11
|
+
defineEvents: (handlers) => handlers,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=bind.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CaseFn, DefinedCaseFunc, FuncOptions } from '../types.js';
|
|
2
|
+
import type { CaseInput } from '../../case-orchestrator/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Worker function bound to a case: `(c, ctx) => R`, `c` the instance and its business root's id.
|
|
5
|
+
* `R` defaults to `void` (a function that writes with `ctx.api.db`); other callers
|
|
6
|
+
* pass their own. Company code normally uses the bound version from `__gen/index.ts` so `S` is never spelled.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defineCaseFunc<S = CaseInput, P extends object = object, R = void>(main: CaseFn<S, P, R>, options?: FuncOptions): DefinedCaseFunc<S, P, R>;
|
|
9
|
+
//# sourceMappingURL=case.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker function bound to a case: `(c, ctx) => R`, `c` the instance and its business root's id.
|
|
3
|
+
* `R` defaults to `void` (a function that writes with `ctx.api.db`); other callers
|
|
4
|
+
* pass their own. Company code normally uses the bound version from `__gen/index.ts` so `S` is never spelled.
|
|
5
|
+
*/
|
|
6
|
+
export function defineCaseFunc(main, options) {
|
|
7
|
+
return {
|
|
8
|
+
kind: 'case',
|
|
9
|
+
main,
|
|
10
|
+
...options,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=case.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CaseInput } from '../../case-orchestrator/types.js';
|
|
2
|
+
import type { PageTablesDesc } from '../../page/typed.js';
|
|
3
|
+
import type { EventHandlers, WebhookHandler } from '../events.js';
|
|
4
|
+
/**
|
|
5
|
+
* Author-side helper for the `events` export. The parameter type is fully known,
|
|
6
|
+
* so handler arguments are contextually typed and unknown event names are
|
|
7
|
+
* rejected as excess properties.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* export const events = defineEvents({
|
|
11
|
+
* 'call.ended': async (c, ctx) => {
|
|
12
|
+
* await ctx.api.db.matter.update({ where: { id: c.subject }, data: { last_call: ctx.params.event.outcome } });
|
|
13
|
+
* },
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function defineEvents<C = CaseInput, D extends PageTablesDesc | undefined = undefined>(handlers: EventHandlers<C, D>): EventHandlers<C, D>;
|
|
18
|
+
/** Author-side helper for `webhook.ts`'s `received`: types `ctx.params.event` and the return. */
|
|
19
|
+
export declare function defineWebhook<D extends PageTablesDesc | undefined = undefined>(handler: WebhookHandler<D>): WebhookHandler<D>;
|
|
20
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author-side helper for the `events` export. The parameter type is fully known,
|
|
3
|
+
* so handler arguments are contextually typed and unknown event names are
|
|
4
|
+
* rejected as excess properties.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* export const events = defineEvents({
|
|
8
|
+
* 'call.ended': async (c, ctx) => {
|
|
9
|
+
* await ctx.api.db.matter.update({ where: { id: c.subject }, data: { last_call: ctx.params.event.outcome } });
|
|
10
|
+
* },
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export function defineEvents(handlers) {
|
|
15
|
+
return handlers;
|
|
16
|
+
}
|
|
17
|
+
/** Author-side helper for `webhook.ts`'s `received`: types `ctx.params.event` and the return. */
|
|
18
|
+
export function defineWebhook(handler) {
|
|
19
|
+
return handler;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DefinedNoCaseFunc, FuncOptions, NoCaseFn } from '../types.js';
|
|
2
|
+
/** Worker function not bound to a case: `(ctx) => R`. No case (`c`) is passed. */
|
|
3
|
+
export declare function defineNoCaseFunc<P extends object = object, R = unknown>(main: NoCaseFn<P, R>, options?: FuncOptions): DefinedNoCaseFunc<P, R>;
|
|
4
|
+
//# sourceMappingURL=no-case.d.ts.map
|