@superpanel-sdk/runtime 0.2.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -10
- package/dist/builder/codegen/emit.d.ts +25 -12
- package/dist/builder/codegen/emit.js +339 -78
- package/dist/builder/codegen/generate.d.ts +21 -2
- package/dist/builder/codegen/generate.js +147 -34
- 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 +29 -0
- package/dist/builder/company-imports.js +122 -0
- package/dist/builder/compile/compile-sequence.d.ts +61 -8
- package/dist/builder/compile/compile-sequence.js +334 -80
- package/dist/builder/compile/function-code.d.ts +19 -3
- package/dist/builder/compile/function-code.js +123 -45
- package/dist/builder/compile/registry.d.ts +7 -3
- package/dist/builder/compile/registry.js +30 -27
- 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 +70 -10
- package/dist/builder/load.js +258 -67
- package/dist/builder/paths.d.ts +9 -1
- package/dist/builder/paths.js +32 -2
- package/dist/builder/schedules.d.ts +25 -0
- package/dist/builder/schedules.js +101 -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 +102 -0
- package/dist/builder/types.d.ts +127 -19
- package/dist/builder/types.js +21 -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/calls/index.d.ts +177 -0
- package/dist/cli/calls/index.js +96 -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/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 +112 -9
- 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 +109 -3
- package/dist/cli/serve/index.js +506 -118
- 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 +9 -9
- package/dist/compiler.d.ts +7 -0
- package/dist/compiler.js +7 -0
- package/dist/compute-host/compute-host.d.ts +14 -23
- package/dist/compute-host/compute-host.js +18 -30
- package/dist/compute-host/index.d.ts +2 -4
- package/dist/compute-host/index.js +1 -2
- package/dist/compute-host/source-compute-host.d.ts +10 -10
- package/dist/compute-host/source-compute-host.js +33 -40
- package/dist/core/case-orchestrator/contact-hours.d.ts +70 -0
- package/dist/core/case-orchestrator/contact-hours.js +127 -0
- package/dist/core/case-orchestrator/index.d.ts +3 -0
- package/dist/core/case-orchestrator/index.js +3 -0
- package/dist/core/case-orchestrator/render.d.ts +75 -0
- package/dist/core/case-orchestrator/render.js +244 -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/types.d.ts +708 -0
- package/dist/core/case-orchestrator/types.js +42 -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 +198 -0
- package/dist/core/context/email-message.js +86 -0
- package/dist/core/context/email.d.ts +109 -0
- package/dist/core/context/email.js +90 -0
- package/dist/core/context/exchanges.d.ts +167 -0
- package/dist/core/context/exchanges.js +81 -0
- package/dist/core/context/instances.d.ts +307 -0
- package/dist/core/context/instances.js +137 -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 +544 -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 +177 -0
- package/dist/core/context/sms.js +77 -0
- package/dist/core/context/types.d.ts +79 -48
- package/dist/core/context/types.js +1 -7
- package/dist/core/conversation/index.d.ts +85 -0
- package/dist/core/conversation/index.js +133 -0
- package/dist/core/functions/errors.d.ts +74 -0
- package/dist/core/functions/errors.js +26 -0
- package/dist/core/functions/events.d.ts +192 -0
- package/dist/core/functions/events.js +23 -0
- package/dist/core/functions/schedules.d.ts +50 -0
- package/dist/core/functions/schedules.js +20 -0
- package/dist/core/functions/types.d.ts +29 -73
- package/dist/core/functions/types.js +1 -4
- 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 +904 -0
- package/dist/core/page/define.js +518 -0
- 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/ops.d.ts +58 -0
- package/dist/core/page/ops.js +220 -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 +295 -0
- package/dist/core/page/render.js +1060 -0
- 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 +46 -0
- package/dist/core/page/time-format.js +125 -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 +648 -0
- package/dist/core/page/typed.js +2 -0
- package/dist/core/page/workspace.d.ts +57 -0
- package/dist/core/page/workspace.js +266 -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 +208 -0
- package/dist/core/party/schema.js +113 -0
- package/dist/core/party/types.d.ts +35 -0
- package/dist/core/party/types.js +15 -0
- package/dist/core/sequence/define.d.ts +56 -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 +102 -0
- package/dist/core/slot/company-metadata.js +536 -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 -25
- package/dist/core/slot/field.js +0 -71
- 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 +17 -0
- package/dist/core/slot/schema-compat.js +103 -0
- package/dist/core/slot/schema.d.ts +353 -76
- package/dist/core/slot/schema.js +163 -10
- package/dist/core/slot/types.d.ts +30 -103
- package/dist/core/slot/value.d.ts +28 -3
- package/dist/core/slot/value.js +93 -57
- package/dist/dev-overlay/protocol.d.ts +74 -8
- package/dist/fn-context/build-context.d.ts +3 -1
- package/dist/fn-context/build-context.js +26 -10
- package/dist/fn-context/fake/empty-api.js +9 -28
- package/dist/fn-context/fake/index.d.ts +13 -4
- package/dist/fn-context/fake/index.js +29 -2
- package/dist/fn-context/fn-params.d.ts +3 -0
- package/dist/fn-context/fn-params.js +10 -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 +20 -9
- package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +32 -0
- package/dist/fn-context/rpc/case-orchestrator-tools.js +12 -0
- 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 +4 -2
- package/dist/fn-context/rpc/index.js +4 -2
- package/dist/fn-context/rpc/integration/index.d.ts +15 -5
- 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/log.d.ts +11 -1
- package/dist/fn-context/rpc/platform.d.ts +13 -3
- package/dist/fn-context/rpc/platform.js +1 -1
- package/dist/fn-context/rpc/records.d.ts +85 -0
- package/dist/fn-context/rpc/records.js +24 -0
- package/dist/fn-context/rpc/trpc-client.d.ts +44 -2
- package/dist/fn-context/rpc/trpc-client.js +222 -12
- package/dist/fn-context/rpc/trpc-init.d.ts +21 -3
- package/dist/fn-context/rpc/trpc-init.js +10 -4
- package/dist/fn-context/rpc/trpc-router-factory.d.ts +111 -7
- 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 +52 -5
- package/dist/index.d.ts +36 -46
- package/dist/index.js +30 -33
- package/dist/logger.d.ts +11 -0
- package/dist/logger.js +49 -0
- package/dist/platform.d.ts +75 -0
- package/dist/platform.js +57 -0
- 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 +50 -6
- 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 +55 -8
- package/dist/worker.d.ts +11 -0
- package/dist/worker.js +11 -0
- package/package.json +38 -15
- package/dist/builder/compile/compile-agenda.d.ts +0 -15
- package/dist/builder/compile/compile-agenda.js +0 -64
- package/dist/builder/merge.d.ts +0 -4
- package/dist/builder/merge.js +0 -19
- package/dist/compute-host/read-only-cache.d.ts +0 -20
- package/dist/compute-host/read-only-cache.js +0 -61
- 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/functions/func-ref.d.ts +0 -16
- package/dist/core/functions/func-ref.js +0 -20
- 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 -48
- package/dist/core/slot/write.js +0 -426
- package/dist/core/stage/builders.d.ts +0 -54
- package/dist/core/stage/builders.js +0 -31
- 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 -78
- 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 -466
- package/dist/core/stage/index.d.ts +0 -15
- package/dist/core/stage/index.js +0 -13
- package/dist/core/stage/interrupts.d.ts +0 -28
- package/dist/core/stage/interrupts.js +0 -120
- package/dist/core/stage/ivr-fields.d.ts +0 -9
- package/dist/core/stage/ivr-fields.js +0 -75
- 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 -19
- package/dist/core/stage/transfer-fields.js +0 -129
- package/dist/core/stage/transfer-spec.d.ts +0 -48
- package/dist/core/stage/transfer-spec.js +0 -113
- package/dist/core/stage/types.d.ts +0 -208
- package/dist/core/stage/types.js +0 -2
- package/dist/core/stage/validate.d.ts +0 -11
- package/dist/core/stage/validate.js +0 -330
- package/dist/core/stage/walk.d.ts +0 -39
- package/dist/core/stage/walk.js +0 -119
- 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
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
import { createIntegrationRouter } from './integration/index.js';
|
|
2
2
|
import { createLogRouter } from './log.js';
|
|
3
3
|
import { createPlatformRouter } from './platform.js';
|
|
4
|
+
import { createRecordsRouter } from './records.js';
|
|
5
|
+
import { createCaseOrchestratorToolsRouter } from './case-orchestrator-tools.js';
|
|
4
6
|
export declare function createAppRouter(modules: {
|
|
5
7
|
integration: ReturnType<typeof createIntegrationRouter>;
|
|
6
8
|
platform: ReturnType<typeof createPlatformRouter>;
|
|
7
9
|
log: ReturnType<typeof createLogRouter>;
|
|
10
|
+
caseOrchestratorTools: ReturnType<typeof createCaseOrchestratorToolsRouter>;
|
|
11
|
+
records: ReturnType<typeof createRecordsRouter>;
|
|
8
12
|
}): import("@trpc/server").TRPCBuiltRouter<{
|
|
9
13
|
ctx: import("./trpc-init.js").RpcContext;
|
|
10
14
|
meta: object;
|
|
11
|
-
errorShape: import("@trpc/server").TRPCDefaultErrorShape
|
|
15
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
16
|
+
message: string;
|
|
17
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
18
|
+
data: {
|
|
19
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
20
|
+
httpStatus: number;
|
|
21
|
+
path?: string;
|
|
22
|
+
stack?: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
12
26
|
transformer: false;
|
|
13
27
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
14
28
|
integration: import("@trpc/server").TRPCBuiltRouter<{
|
|
15
29
|
ctx: import("./trpc-init.js").RpcContext;
|
|
16
30
|
meta: object;
|
|
17
|
-
errorShape: import("@trpc/server").TRPCDefaultErrorShape
|
|
31
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
32
|
+
message: string;
|
|
33
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
34
|
+
data: {
|
|
35
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
36
|
+
httpStatus: number;
|
|
37
|
+
path?: string;
|
|
38
|
+
stack?: string;
|
|
39
|
+
reason: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
18
42
|
transformer: false;
|
|
19
43
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
20
|
-
|
|
44
|
+
listSurfaces: import("@trpc/server").TRPCQueryProcedure<{
|
|
21
45
|
input: void;
|
|
22
46
|
output: {
|
|
23
|
-
surfaceKey: "
|
|
47
|
+
surfaceKey: "emails" | "envs";
|
|
24
48
|
target: {
|
|
25
49
|
kind: "account" | "resource";
|
|
26
50
|
id: string;
|
|
@@ -48,14 +72,24 @@ export declare function createAppRouter(modules: {
|
|
|
48
72
|
platform: import("@trpc/server").TRPCBuiltRouter<{
|
|
49
73
|
ctx: import("./trpc-init.js").RpcContext;
|
|
50
74
|
meta: object;
|
|
51
|
-
errorShape: import("@trpc/server").TRPCDefaultErrorShape
|
|
75
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
76
|
+
message: string;
|
|
77
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
78
|
+
data: {
|
|
79
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
80
|
+
httpStatus: number;
|
|
81
|
+
path?: string;
|
|
82
|
+
stack?: string;
|
|
83
|
+
reason: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
52
86
|
transformer: false;
|
|
53
87
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
54
88
|
invoke: import("@trpc/server").TRPCMutationProcedure<{
|
|
55
89
|
input: {
|
|
56
90
|
surface: string;
|
|
57
91
|
method: string;
|
|
58
|
-
params?:
|
|
92
|
+
params?: unknown;
|
|
59
93
|
};
|
|
60
94
|
output: unknown;
|
|
61
95
|
meta: object;
|
|
@@ -64,7 +98,17 @@ export declare function createAppRouter(modules: {
|
|
|
64
98
|
log: import("@trpc/server").TRPCBuiltRouter<{
|
|
65
99
|
ctx: import("./trpc-init.js").RpcContext;
|
|
66
100
|
meta: object;
|
|
67
|
-
errorShape: import("@trpc/server").TRPCDefaultErrorShape
|
|
101
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
102
|
+
message: string;
|
|
103
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
104
|
+
data: {
|
|
105
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
106
|
+
httpStatus: number;
|
|
107
|
+
path?: string;
|
|
108
|
+
stack?: string;
|
|
109
|
+
reason: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
68
112
|
transformer: false;
|
|
69
113
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
70
114
|
emit: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -80,6 +124,66 @@ export declare function createAppRouter(modules: {
|
|
|
80
124
|
meta: object;
|
|
81
125
|
}>;
|
|
82
126
|
}>>;
|
|
127
|
+
caseOrchestratorTools: import("@trpc/server").TRPCBuiltRouter<{
|
|
128
|
+
ctx: import("./trpc-init.js").RpcContext;
|
|
129
|
+
meta: object;
|
|
130
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
131
|
+
message: string;
|
|
132
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
133
|
+
data: {
|
|
134
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
135
|
+
httpStatus: number;
|
|
136
|
+
path?: string;
|
|
137
|
+
stack?: string;
|
|
138
|
+
reason: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
transformer: false;
|
|
142
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
143
|
+
invoke: import("@trpc/server").TRPCMutationProcedure<{
|
|
144
|
+
input: {
|
|
145
|
+
tool: string;
|
|
146
|
+
input: unknown;
|
|
147
|
+
};
|
|
148
|
+
output: unknown;
|
|
149
|
+
meta: object;
|
|
150
|
+
}>;
|
|
151
|
+
}>>;
|
|
152
|
+
records: import("@trpc/server").TRPCBuiltRouter<{
|
|
153
|
+
ctx: import("./trpc-init.js").RpcContext;
|
|
154
|
+
meta: object;
|
|
155
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
|
|
156
|
+
message: string;
|
|
157
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
158
|
+
data: {
|
|
159
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
160
|
+
httpStatus: number;
|
|
161
|
+
path?: string;
|
|
162
|
+
stack?: string;
|
|
163
|
+
reason: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
transformer: false;
|
|
167
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
168
|
+
read: import("@trpc/server").TRPCMutationProcedure<{
|
|
169
|
+
input: {
|
|
170
|
+
table: string;
|
|
171
|
+
method: "count" | "findFirst" | "findMany" | "findUnique";
|
|
172
|
+
args: unknown;
|
|
173
|
+
};
|
|
174
|
+
output: import("./records.js").RecordsResult;
|
|
175
|
+
meta: object;
|
|
176
|
+
}>;
|
|
177
|
+
write: import("@trpc/server").TRPCMutationProcedure<{
|
|
178
|
+
input: {
|
|
179
|
+
table: string;
|
|
180
|
+
method: "create" | "delete" | "update" | "upsert";
|
|
181
|
+
args: unknown;
|
|
182
|
+
};
|
|
183
|
+
output: import("./records.js").RecordsResult;
|
|
184
|
+
meta: object;
|
|
185
|
+
}>;
|
|
186
|
+
}>>;
|
|
83
187
|
}>>;
|
|
84
188
|
export type AppRouter = ReturnType<typeof createAppRouter>;
|
|
85
189
|
//# sourceMappingURL=trpc-router-factory.d.ts.map
|
|
@@ -4,6 +4,8 @@ export function createAppRouter(modules) {
|
|
|
4
4
|
integration: modules.integration,
|
|
5
5
|
platform: modules.platform,
|
|
6
6
|
log: modules.log,
|
|
7
|
+
caseOrchestratorTools: modules.caseOrchestratorTools,
|
|
8
|
+
records: modules.records,
|
|
7
9
|
});
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=trpc-router-factory.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CaseOrchestratorRunScope, RunClaims } from './types.js';
|
|
2
|
+
/** The Case Orchestrator scope of a run, or null when it is not a complete Case Orchestrator run. */
|
|
3
|
+
export declare function asCaseOrchestratorRun(run: RunClaims): CaseOrchestratorRunScope | null;
|
|
4
|
+
//# sourceMappingURL=run-scope.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ORCHESTRATOR_ENTRY } from '../core/case-orchestrator/types.js';
|
|
2
|
+
/** The Case Orchestrator scope of a run, or null when it is not a complete Case Orchestrator run. */
|
|
3
|
+
export function asCaseOrchestratorRun(run) {
|
|
4
|
+
const scoped = run;
|
|
5
|
+
if (run.entry !== ORCHESTRATOR_ENTRY || !scoped.instanceId || !scoped.orchestratorTaskId)
|
|
6
|
+
return null;
|
|
7
|
+
return run;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=run-scope.js.map
|
|
@@ -1,17 +1,64 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ORCHESTRATOR_ENTRY, CaseOrchestratorApi, CaseOrchestratorContext } from '../core/case-orchestrator/types.js';
|
|
2
|
+
import type { IntegrationSurfaceMeta, SystemContext } from '../core/context/types.js';
|
|
2
3
|
/** Alias for {@link SystemContext} (08 ActionContext shape). */
|
|
3
4
|
export type ActionContext = SystemContext;
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* JSON-serializable data slice of ActionContext (no `api`, no `time.format` / `time.day`: added where the
|
|
7
|
+
* function runs). Its ids are plain strings on the wire; the function's `ctx.meta` types them.
|
|
8
|
+
*/
|
|
9
|
+
export type ActionDataSlice = Pick<ActionContext, 'config'> & {
|
|
10
|
+
/** `ignore` absent (a platform before 68 §6.2): nothing is ignored. */
|
|
11
|
+
time: Omit<ActionContext['time'], 'format' | 'day' | 'at' | 'parts' | 'ignore'> & Partial<Pick<ActionContext['time'], 'ignore'>>;
|
|
12
|
+
meta: ActionContext['meta'];
|
|
13
|
+
/**
|
|
14
|
+
* What `ctx.api.integration` offers this run (its connections and mailboxes, with their credentials),
|
|
15
|
+
* listed by the platform as it calls the function: the host builds the api from it instead of asking
|
|
16
|
+
* the backend first. Not part of `ctx` itself.
|
|
17
|
+
*/
|
|
18
|
+
surfaces?: IntegrationSurfaceMeta[];
|
|
19
|
+
};
|
|
20
|
+
/** What the call brought for the api ({@link ActionDataSlice.surfaces}): a host lists what is left out. */
|
|
21
|
+
export type ApiGiven = {
|
|
22
|
+
surfaces?: IntegrationSurfaceMeta[];
|
|
23
|
+
};
|
|
6
24
|
/** Identity / scope for a single function invocation (ApiHost may key caches on this). */
|
|
7
25
|
export type RunScope = {
|
|
8
26
|
companyId: string;
|
|
9
27
|
environmentId: string;
|
|
10
|
-
sequenceId: string;
|
|
11
28
|
entry: string;
|
|
29
|
+
/** The instance a case-bound run works on; absent on nocase runs. */
|
|
30
|
+
instanceId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The AI run (`AgentRun`) that called the function, with `instanceId` the case it is on (21 §6.5): what
|
|
33
|
+
* the function writes back through the platform is that run's. Set by the platform only.
|
|
34
|
+
*/
|
|
35
|
+
agentRunId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The published company build (`ReleaseBuildBatch`) the run started on: one run uses one build (22 §5),
|
|
38
|
+
* so `ctx.api` reads the schema from it, not from whatever release is live by then. Absent on the serve
|
|
39
|
+
* overlay, which is not pinned. Set by the platform only.
|
|
40
|
+
*/
|
|
41
|
+
buildId?: string;
|
|
12
42
|
};
|
|
13
43
|
/** Who fulfills `ctx.api` (Fake local vs Rpc remote). */
|
|
14
44
|
export type ApiHost = {
|
|
15
|
-
buildApi(run: RunScope): Promise<ActionContext['api']>;
|
|
45
|
+
buildApi(run: RunScope, given?: ApiGiven): Promise<ActionContext['api']>;
|
|
46
|
+
};
|
|
47
|
+
/** `ctx` of `orchestrator` before the host adds `params`. */
|
|
48
|
+
export type CaseOrchestratorActionContext = Omit<CaseOrchestratorContext, 'params'>;
|
|
49
|
+
/** Who fulfills the Case Orchestrator's `ctx.api` (Fake local vs Rpc remote). */
|
|
50
|
+
export type CaseOrchestratorApiHost = {
|
|
51
|
+
buildCaseOrchestratorApi(run: RunScope, given?: ApiGiven): Promise<CaseOrchestratorApi>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Run scope of an Orchestrator call: the instance it is limited to and the `OrchestratorTask` it runs
|
|
55
|
+
* for (40 §2.3: no `AgentRun`), refused once that task stops running.
|
|
56
|
+
*/
|
|
57
|
+
export type CaseOrchestratorRunScope = RunScope & {
|
|
58
|
+
entry: typeof ORCHESTRATOR_ENTRY;
|
|
59
|
+
instanceId: string;
|
|
60
|
+
orchestratorTaskId: string;
|
|
16
61
|
};
|
|
62
|
+
/** A verified run token's scope; narrow with {@link asCaseOrchestratorRun}. */
|
|
63
|
+
export type RunClaims = RunScope | CaseOrchestratorRunScope;
|
|
17
64
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
export type
|
|
23
|
-
export type {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export
|
|
32
|
-
export {
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export {
|
|
37
|
-
export { defineCaseContext, resolveCaseContextViewFn, type CaseContextOf, type CaseContextViewFn, type DefinedCaseContextView, } from './core/functions/define/case-context.js';
|
|
38
|
-
export { defineCustomFunc } from './core/functions/define/custom.js';
|
|
39
|
-
export { defineSystemFunc } from './core/functions/define/system.js';
|
|
40
|
-
export { mergeEffectiveSchema } from './builder/merge.js';
|
|
41
|
-
export { emitCaseContextSource, emitSlotsSource } from './builder/codegen/emit.js';
|
|
42
|
-
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, isRowWrite, isStructuredWrites, normalizeWrites, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
43
|
-
export type { ApplySlotFillingOptions, DependencyGraphResult, FieldPatchInput, FieldPath, ParsedFieldPath, RecomputeOptions, SfSchemaOptions, SlotRow, SnapshotSeed, ValidateSlotFillingOptions, } from './core/slot/index.js';
|
|
44
|
-
export type { ActionBlock, ActionNode, AgendaBlock, AgendaConfig, AgendaHeader, AgendaTree, ApplyWhen, AuthoringNode, AuthoringWhen, BranchNode, Channel, CompiledActionBlock, CompiledAgenda, CompiledAgendaBlock, CompiledTopicBlock, CompiledIvrBlock, CompiledTransferBlock, CompiledWhen, Condition, ConditionEval, FirstMessage, FinishWhen, FinishWhenEval, FlatActionItem, FlatAgendaItem, FlatIvrItem, FlatNodePlacement, FlatTopicItem, FlatTransferItem, DtmfResult, IvrAttemptResult, IvrBlock, IvrDigit, IvrFallbackAction, IvrNode, FlattenOptions, FlattenResult, Interrupt, SpokenLanguage, SequenceAgendas, JsonRulesCondition, NodePlacement, OnNoProgress, OtherwiseSentinel, Placement, SectionNode, SectionPlacement, SimulateResult, SimulatedItem, SimulatedItemStatus, SwitchOnNode, TopicBlock, TopicNode, TransferArguments, TransferBlock, TransferCallerIdShown, TransferConfirmKey, TransferConfirmMethod, TransferDial, TransferFallbackAction, TransferInterruptAction, TransferMode, TransferNode, TransferSay, ValidateAgendaOptions, WalkDecision, WalkHitReason, WalkOptions, WalkResult, WalkSkip, WalkStats, WalkSkipReason, When, WhenEval, AdvanceResult, StageDriveHooks, StageDriveResult, StageDriveState, } from './core/stage/index.js';
|
|
45
|
-
export { DEFAULT_MAX_ACTIONS_PER_TURN, CASE_LAST_TRANSFER_AT, CASE_LAST_TRANSFER_RESULT, CASE_TRANSFER_ATTEMPT_COUNT, E164_NUMBER, LAST_TRANSFER_RESULT_FIELD, CONTACT_LANGUAGE_FIELD, getContactLang, inboundIvrCollect, ivrAttempted, ivrOf, ivrResultField, languageFieldOf, RESERVED_INTERRUPT_TOOL_NAMES, SIP_URI, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, collectTransferInterruptHeaders, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, headerHasTransferInterrupt, ivr, interpolateFromSnapshot, interpolateTemplate, isTransferDestinationLiteral, isAgendaTree, isSequenceAgendas, isOtherwise, isSpokenLanguage, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerIvrSessionFields, collectIvrBlocks, registerTransferSessionFields, resolveTransferArguments, resolveTransferDestinations, resolveTransferSay, section, simulateAgenda, switchOn, topic, transfer, transferArgumentsJson, transferFieldKey, transferResultField, transferWrites, validateTransferDestinations, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, validateInterrupts, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
46
|
-
export * from './voice-service/index.js';
|
|
1
|
+
/**
|
|
2
|
+
* The company API: everything company code may import from `@superpanel-sdk/runtime`, and nothing else
|
|
3
|
+
* (09-runtime-compat §6). Company code runs in three places: the compile's Node, the Worker, and the
|
|
4
|
+
* page's QuickJS sandbox. So what is here behaves the same in all three: it imports no package and no
|
|
5
|
+
* Node module, and no module it reaches does work at load. The compile bundles it into each code string
|
|
6
|
+
* as it is; there is no stand-in.
|
|
7
|
+
*
|
|
8
|
+
* Named exports only, from the module that defines each: an `export *` lets whatever a module adds
|
|
9
|
+
* reach company code. `company-api.test.ts` holds the list and checks the entry stays pure. The
|
|
10
|
+
* platform imports `./platform` (`platform.ts`), which this package resolves only under the
|
|
11
|
+
* `superpanel-platform` condition.
|
|
12
|
+
*/
|
|
13
|
+
export { defineSequence, defineVariables, json, type JsonVariableType, type SequenceDefinition, type VariableDecl, type VariableDecls, type VariablesOf, } from './core/sequence/define.js';
|
|
14
|
+
export { defineSchedules, type Schedules } from './core/functions/schedules.js';
|
|
15
|
+
export type { Ctx } from './core/functions/types.js';
|
|
16
|
+
export type { EventHandlers, WebhookHandler } from './core/functions/events.js';
|
|
17
|
+
export type { CodeErrorEvent, OnError } from './core/functions/errors.js';
|
|
18
|
+
export { PlatformUnavailableError } from './core/functions/errors.js';
|
|
19
|
+
export { choose, definePage, lastActionRun, tried, type PageChannel, type PageFaqEntry, type PageRuns, } from './core/page/define.js';
|
|
20
|
+
/** A fixed line said to the customer, per language (66 §2). */
|
|
21
|
+
export type { Spoken, SpokenTag } from './core/conversation/index.js';
|
|
22
|
+
export { announce, backgroundTransfer, block, button, cancelFollowUp, coldTransfer, convertTime, createRow, data, deleteRow, doNow, end, field, functionHandles, actionHandles, keypad, list, page, pressKeypad, refField, run, scheduleFollowUp, text, toolbox, voicemail, warmTransfer, type Action, type BlockNode, type ButtonNode, type DataNode, type DoNode, type FieldNode, type FunctionHandle, type ListNode, type PageActionHandle, type PageContent, type PageItem, type PageNode, type TextNode, type Tool, type ToolboxNode, } from './core/page/fns.js';
|
|
23
|
+
export type { Email, Id, IsoDate, IsoDateTime, Phone, TimeOfDay, RowOf, TypedActionContext, TypedDb, TypedPageContext, TypedPageModule, TypedPageFns, FunctionHandles, ActionHandles, PageResult, TypedReadDb, } from './core/page/typed.js';
|
|
24
|
+
export { render } from './core/case-orchestrator/render.js';
|
|
25
|
+
export type { CaseActivity, CaseOrchestrator, CaseOrchestratorArgs, ContactActionView, RunTrigger, ScheduledActionView, } from './core/case-orchestrator/types.js';
|
|
26
|
+
export type { CompanyResolve, Resolve } from './core/party/types.js';
|
|
27
|
+
export { contactScheduleHours, everyDay, nextContactTime, withinContactHours, type ContactHours, type ContactHoursIgnore, type ContactHoursRange, type ContactHoursWeekday, } from './core/case-orchestrator/contact-hours.js';
|
|
28
|
+
export { randomTimeBetween } from './core/case-orchestrator/time.js';
|
|
29
|
+
export { contactTimezone } from './core/slot/contact-timezone.js';
|
|
30
|
+
export type { OfficeHours } from './core/office-hours/index.js';
|
|
31
|
+
export { PLATFORM_CONTACT_FIELDS, PLATFORM_SESSION_FIELDS } from './core/slot/platform-fields.js';
|
|
32
|
+
export { lookupRef, parentRef } from './core/slot/id-ref.js';
|
|
33
|
+
export type { CompanySchema, ContactSchedule, SessionSchema } from './core/slot/schema.js';
|
|
34
|
+
export type { CellBinding, RowRef } from './core/slot/binding.js';
|
|
35
|
+
export type { FieldValue } from './core/slot/types.js';
|
|
36
|
+
export type { EnvApi } from './core/context/env.js';
|
|
47
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, isRowWrite, isStructuredWrites, normalizeWrites, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
32
|
-
export { DEFAULT_MAX_ACTIONS_PER_TURN, CASE_LAST_TRANSFER_AT, CASE_LAST_TRANSFER_RESULT, CASE_TRANSFER_ATTEMPT_COUNT, E164_NUMBER, LAST_TRANSFER_RESULT_FIELD, CONTACT_LANGUAGE_FIELD, getContactLang, inboundIvrCollect, ivrAttempted, ivrOf, ivrResultField, languageFieldOf, RESERVED_INTERRUPT_TOOL_NAMES, SIP_URI, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, collectTransferInterruptHeaders, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, headerHasTransferInterrupt, ivr, interpolateFromSnapshot, interpolateTemplate, isTransferDestinationLiteral, isAgendaTree, isSequenceAgendas, isOtherwise, isSpokenLanguage, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerIvrSessionFields, collectIvrBlocks, registerTransferSessionFields, resolveTransferArguments, resolveTransferDestinations, resolveTransferSay, section, simulateAgenda, switchOn, topic, transfer, transferArgumentsJson, transferFieldKey, transferResultField, transferWrites, validateTransferDestinations, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, validateInterrupts, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
33
|
-
export * from './voice-service/index.js';
|
|
1
|
+
/**
|
|
2
|
+
* The company API: everything company code may import from `@superpanel-sdk/runtime`, and nothing else
|
|
3
|
+
* (09-runtime-compat §6). Company code runs in three places: the compile's Node, the Worker, and the
|
|
4
|
+
* page's QuickJS sandbox. So what is here behaves the same in all three: it imports no package and no
|
|
5
|
+
* Node module, and no module it reaches does work at load. The compile bundles it into each code string
|
|
6
|
+
* as it is; there is no stand-in.
|
|
7
|
+
*
|
|
8
|
+
* Named exports only, from the module that defines each: an `export *` lets whatever a module adds
|
|
9
|
+
* reach company code. `company-api.test.ts` holds the list and checks the entry stays pure. The
|
|
10
|
+
* platform imports `./platform` (`platform.ts`), which this package resolves only under the
|
|
11
|
+
* `superpanel-platform` condition.
|
|
12
|
+
*/
|
|
13
|
+
// Sequence declarations: `index.ts`, `variables.ts`.
|
|
14
|
+
export { defineSequence, defineVariables, json, } from './core/sequence/define.js';
|
|
15
|
+
// Functions, events, the webhook and schedules (`__gen` binds them to the company's tables).
|
|
16
|
+
export { defineSchedules } from './core/functions/schedules.js';
|
|
17
|
+
export { PlatformUnavailableError } from './core/functions/errors.js';
|
|
18
|
+
// The page (the sequence's `__gen` binds them to its tables).
|
|
19
|
+
export { choose, definePage, lastActionRun, tried, } from './core/page/define.js';
|
|
20
|
+
// The page in functions (76): nodes, actions, page actions, tools (`__gen` binds the table-bound ones).
|
|
21
|
+
export { announce, backgroundTransfer, block, button, cancelFollowUp, coldTransfer, convertTime, createRow, data, deleteRow, doNow, end, field, functionHandles, actionHandles, keypad, list, page, pressKeypad, refField, run, scheduleFollowUp, text, toolbox, voicemail, warmTransfer, } from './core/page/fns.js';
|
|
22
|
+
// The Orchestrator.
|
|
23
|
+
export { render } from './core/case-orchestrator/render.js';
|
|
24
|
+
// When a contact may be reached, and in which time zone.
|
|
25
|
+
export { contactScheduleHours, everyDay, nextContactTime, withinContactHours, } from './core/case-orchestrator/contact-hours.js';
|
|
26
|
+
export { randomTimeBetween } from './core/case-orchestrator/time.js';
|
|
27
|
+
export { contactTimezone } from './core/slot/contact-timezone.js';
|
|
28
|
+
// The company schema: `schema/`.
|
|
29
|
+
export { PLATFORM_CONTACT_FIELDS, PLATFORM_SESSION_FIELDS } from './core/slot/platform-fields.js';
|
|
30
|
+
export { lookupRef, parentRef } from './core/slot/id-ref.js';
|
|
34
31
|
//# sourceMappingURL=index.js.map
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type LogLevel = 'INFO' | 'WARN' | 'ERROR';
|
|
2
|
+
/** The least level the runtime's own lines are written at: `exec` keeps the RPC's routine lines out of a snippet's output. */
|
|
3
|
+
export declare function setRuntimeLogLevel(level: LogLevel): void;
|
|
4
|
+
export declare function getLogger(tags?: readonly string[]): {
|
|
5
|
+
log(...args: unknown[]): void;
|
|
6
|
+
info(...args: unknown[]): void;
|
|
7
|
+
warn(...args: unknown[]): void;
|
|
8
|
+
error(...args: unknown[]): void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function formatArgument(value) {
|
|
2
|
+
if (value instanceof Error)
|
|
3
|
+
return value.stack ?? value.message;
|
|
4
|
+
if (typeof value === 'string')
|
|
5
|
+
return value;
|
|
6
|
+
if (typeof value !== 'object' || value === null)
|
|
7
|
+
return String(value);
|
|
8
|
+
try {
|
|
9
|
+
return JSON.stringify(value);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return '[unserializable]';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const RANK = { INFO: 0, WARN: 1, ERROR: 2 };
|
|
16
|
+
let least = 'INFO';
|
|
17
|
+
/** The least level the runtime's own lines are written at: `exec` keeps the RPC's routine lines out of a snippet's output. */
|
|
18
|
+
export function setRuntimeLogLevel(level) {
|
|
19
|
+
least = level;
|
|
20
|
+
}
|
|
21
|
+
function write(level, tags, args) {
|
|
22
|
+
if (RANK[level] < RANK[least])
|
|
23
|
+
return;
|
|
24
|
+
const label = tags.length > 0 ? `[${tags.join(',')}] ` : '';
|
|
25
|
+
const line = `${new Date().toISOString()} ${level.padEnd(5)} ${label}${args.map(formatArgument).join(' ')}`;
|
|
26
|
+
if (level === 'ERROR')
|
|
27
|
+
console.error(line);
|
|
28
|
+
else if (level === 'WARN')
|
|
29
|
+
console.warn(line);
|
|
30
|
+
else
|
|
31
|
+
console.info(line);
|
|
32
|
+
}
|
|
33
|
+
export function getLogger(tags = []) {
|
|
34
|
+
return {
|
|
35
|
+
log(...args) {
|
|
36
|
+
write('INFO', tags, args);
|
|
37
|
+
},
|
|
38
|
+
info(...args) {
|
|
39
|
+
write('INFO', tags, args);
|
|
40
|
+
},
|
|
41
|
+
warn(...args) {
|
|
42
|
+
write('WARN', tags, args);
|
|
43
|
+
},
|
|
44
|
+
error(...args) {
|
|
45
|
+
write('ERROR', tags, args);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=logger.js.map
|