@salsita-ai/contracts 0.50.0-develop.42cf9563b0 → 0.50.0-develop.4c59c65881
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 +14 -4
- package/dist/api/cli-login-approval.d.ts +15 -0
- package/dist/api/cli-login-approval.js +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +1 -1
- package/dist/api/session-token.d.ts +1 -1
- package/dist/api/studio-session.d.ts +57 -0
- package/dist/api/studio-session.js +1 -0
- package/dist/assistant/ban-tool.d.ts +17 -0
- package/dist/assistant/ban-tool.js +1 -0
- package/dist/assistant/deployment-assistant.d.ts +116 -6
- package/dist/assistant/deployment-assistant.js +1 -1
- package/dist/assistant/graphql-tools.d.ts +14 -1
- package/dist/assistant/graphql-tools.js +1 -1
- package/dist/assistant/image-reference.d.ts +10 -0
- package/dist/assistant/image-reference.js +1 -0
- package/dist/assistant/index.d.ts +11 -4
- package/dist/assistant/index.js +1 -1
- package/dist/assistant/message-metadata.d.ts +144 -7
- package/dist/assistant/message-metadata.js +1 -1
- package/dist/assistant/speech-text.d.ts +15 -0
- package/dist/assistant/speech-text.js +1 -0
- package/dist/assistant/tool-error.d.ts +30 -0
- package/dist/assistant/tool-error.js +1 -0
- package/dist/assistant/transcript-event.d.ts +25 -0
- package/dist/assistant/transcript-event.js +1 -0
- package/dist/assistant/voice-recording.d.ts +13 -0
- package/dist/assistant/voice-recording.js +1 -0
- package/dist/chat/api.d.ts +0 -41
- package/dist/chat/api.js +1 -1
- package/dist/chat/completions/types.d.ts +0 -3
- package/dist/chat/completions/types.js +1 -1
- package/dist/chat/functions/process.d.ts +1 -2
- package/dist/chat/functions/process.js +1 -1
- package/dist/chat/index.d.ts +3 -6
- package/dist/chat/index.js +1 -1
- package/dist/domain/account-status.d.ts +6 -0
- package/dist/domain/account-status.js +1 -0
- package/dist/domain/deployments/api-token-domain.d.ts +5 -0
- package/dist/domain/deployments/api-token-domain.js +1 -1
- package/dist/domain/deployments/api-tokens/index.d.ts +1 -0
- package/dist/domain/deployments/api-tokens/index.js +1 -0
- package/dist/domain/deployments/api-tokens/limits.d.ts +13 -0
- package/dist/domain/deployments/api-tokens/limits.js +1 -0
- package/dist/domain/deployments/assistant-limit-domain.d.ts +13 -0
- package/dist/domain/deployments/assistant-limit-domain.js +1 -0
- package/dist/domain/deployments/customer-domain.d.ts +2 -0
- package/dist/domain/deployments/deployment-build-domain.d.ts +10 -0
- package/dist/domain/deployments/deployment-domain.d.ts +4 -0
- package/dist/domain/deployments/environment-domain.d.ts +3 -0
- package/dist/domain/deployments/index.d.ts +4 -2
- package/dist/domain/deployments/index.js +1 -1
- package/dist/domain/deployments/oauth-connection-domain.d.ts +0 -7
- package/dist/domain/deployments/oauth-connection-domain.js +1 -1
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.js +1 -1
- package/dist/domain/password-policy.d.ts +22 -0
- package/dist/domain/password-policy.js +1 -0
- package/dist/domain/product-configurations/configurations-domain.d.ts +2 -7
- package/dist/domain/product-configurations/configurations-domain.js +1 -1
- package/dist/domain/product-configurations/index.d.ts +1 -1
- package/dist/domain/product-configurations/index.js +1 -1
- package/dist/domain/workspace-invitation-role.d.ts +7 -0
- package/dist/domain/workspace-invitation-role.js +1 -0
- package/dist/domain/workspace-invitation.d.ts +7 -0
- package/dist/domain/workspace-invitation.js +1 -0
- package/dist/domain/workspace-membership-status.d.ts +6 -0
- package/dist/domain/workspace-membership-status.js +1 -0
- package/dist/webhook/implementation/backend-data-response.d.ts +3 -0
- package/dist/webhook/implementation/backend-data-response.js +1 -0
- package/dist/webhook/implementation/index.d.ts +1 -2
- package/dist/webhook/implementation/index.js +1 -1
- package/dist/webhook/implementation/webhook-api-types.d.ts +260 -5
- package/dist/webhook/implementation/webhook-api-types.js +1 -1
- package/dist/webhook/implementation/webhook-routing.d.ts +2 -6
- package/dist/webhook/implementation/webhook-routing.js +1 -1
- package/dist/webhook/implementation/webhook-tunnel-types.d.ts +9 -0
- package/dist/webhook/implementation/webhook-tunnel-types.js +1 -1
- package/package.json +5 -6
- package/dist/assistant/browser-details-tool.d.ts +0 -16
- package/dist/assistant/browser-details-tool.js +0 -1
- package/dist/chat/completions/messages.d.ts +0 -3
- package/dist/chat/completions/messages.js +0 -1
- package/dist/chat/functions/augmentations.d.ts +0 -3
- package/dist/chat/functions/augmentations.js +0 -1
- package/dist/chat/functions/create.d.ts +0 -5
- package/dist/chat/functions/create.js +0 -1
- package/dist/webhook/implementation/webhook-client.d.ts +0 -85
- package/dist/webhook/implementation/webhook-client.js +0 -1
|
@@ -19,7 +19,7 @@ export interface CallbackResponse<RESULT extends Record<string, unknown>> {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const CallbackResponse: z.ZodType<CallbackResponse<Record<string, unknown>>>;
|
|
21
21
|
/** The identity provider of a user id an auth handler returns; it becomes the prefix of the session `sub`. */
|
|
22
|
-
export declare const AuthUserIdSource: z.ZodEnum<["clerk", "custom"]>;
|
|
22
|
+
export declare const AuthUserIdSource: z.ZodEnum<["clerk", "custom", "phoenix"]>;
|
|
23
23
|
export type AuthUserIdSource = z.infer<typeof AuthUserIdSource>;
|
|
24
24
|
export declare const AuthHandlerResponse: z.ZodDiscriminatedUnion<"success", [z.ZodObject<{
|
|
25
25
|
success: z.ZodLiteral<true>;
|
|
@@ -34,7 +34,7 @@ export declare const AuthHandlerResponse: z.ZodDiscriminatedUnion<"success", [z.
|
|
|
34
34
|
expirationTime: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
36
36
|
userId: z.ZodOptional<z.ZodString>;
|
|
37
|
-
userIdSource: z.ZodOptional<z.ZodEnum<["clerk", "custom"]>>;
|
|
37
|
+
userIdSource: z.ZodOptional<z.ZodEnum<["clerk", "custom", "phoenix"]>>;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
39
|
success: true;
|
|
40
40
|
data: Record<string, unknown>;
|
|
@@ -43,7 +43,7 @@ export declare const AuthHandlerResponse: z.ZodDiscriminatedUnion<"success", [z.
|
|
|
43
43
|
expirationTime?: number | undefined;
|
|
44
44
|
scopes?: string[] | undefined;
|
|
45
45
|
userId?: string | undefined;
|
|
46
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
46
|
+
userIdSource?: "clerk" | "custom" | "phoenix" | undefined;
|
|
47
47
|
}, {
|
|
48
48
|
success: true;
|
|
49
49
|
data: Record<string, unknown>;
|
|
@@ -52,7 +52,7 @@ export declare const AuthHandlerResponse: z.ZodDiscriminatedUnion<"success", [z.
|
|
|
52
52
|
expirationTime?: number | undefined;
|
|
53
53
|
scopes?: string[] | undefined;
|
|
54
54
|
userId?: string | undefined;
|
|
55
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
55
|
+
userIdSource?: "clerk" | "custom" | "phoenix" | undefined;
|
|
56
56
|
}>, z.ZodObject<{
|
|
57
57
|
success: z.ZodLiteral<false>;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -78,7 +78,7 @@ export interface AuthHandlerSuccessResponse<SESSION_DATA extends Record<string,
|
|
|
78
78
|
userId?: string;
|
|
79
79
|
/**
|
|
80
80
|
* Which identity provider {@link userId} comes from. Defaults to `custom`. The SDK's auth handler builder
|
|
81
|
-
* sets it: `clerk` for
|
|
81
|
+
* sets it: `clerk` for Clerk, `phoenix` for server-resolved Cognito identities, and `custom` for custom handlers.
|
|
82
82
|
*/
|
|
83
83
|
userIdSource?: AuthUserIdSource;
|
|
84
84
|
}
|
|
@@ -122,6 +122,57 @@ export declare const AnonymousPayload: z.ZodObject<{
|
|
|
122
122
|
type: "anonymous";
|
|
123
123
|
}>;
|
|
124
124
|
export type AnonymousPayload = z.infer<typeof AnonymousPayload>;
|
|
125
|
+
/** Server-resolved identity, sent only through the authenticated Phoenix webhook transport. */
|
|
126
|
+
export declare const PhoenixAuthPayload: z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"phoenix">;
|
|
128
|
+
userId: z.ZodString;
|
|
129
|
+
role: z.ZodEnum<["user", "admin", "superadmin"]>;
|
|
130
|
+
data: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
emailAddress: z.ZodString;
|
|
133
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
134
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
135
|
+
accessToken: z.ZodLiteral<"">;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
id: string;
|
|
138
|
+
emailAddress: string;
|
|
139
|
+
fullName: string | null;
|
|
140
|
+
tags: string[];
|
|
141
|
+
accessToken: "";
|
|
142
|
+
}, {
|
|
143
|
+
id: string;
|
|
144
|
+
emailAddress: string;
|
|
145
|
+
fullName: string | null;
|
|
146
|
+
tags: string[];
|
|
147
|
+
accessToken: "";
|
|
148
|
+
}>;
|
|
149
|
+
expirationTime: z.ZodNumber;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
type: "phoenix";
|
|
152
|
+
userId: string;
|
|
153
|
+
role: "admin" | "superadmin" | "user";
|
|
154
|
+
data: {
|
|
155
|
+
id: string;
|
|
156
|
+
emailAddress: string;
|
|
157
|
+
fullName: string | null;
|
|
158
|
+
tags: string[];
|
|
159
|
+
accessToken: "";
|
|
160
|
+
};
|
|
161
|
+
expirationTime: number;
|
|
162
|
+
}, {
|
|
163
|
+
type: "phoenix";
|
|
164
|
+
userId: string;
|
|
165
|
+
role: "admin" | "superadmin" | "user";
|
|
166
|
+
data: {
|
|
167
|
+
id: string;
|
|
168
|
+
emailAddress: string;
|
|
169
|
+
fullName: string | null;
|
|
170
|
+
tags: string[];
|
|
171
|
+
accessToken: "";
|
|
172
|
+
};
|
|
173
|
+
expirationTime: number;
|
|
174
|
+
}>;
|
|
175
|
+
export type PhoenixAuthPayload = z.infer<typeof PhoenixAuthPayload>;
|
|
125
176
|
export declare const AuthPayload: z.ZodUnion<[z.ZodObject<{
|
|
126
177
|
type: z.ZodLiteral<"refresh">;
|
|
127
178
|
refreshToken: z.ZodString;
|
|
@@ -152,6 +203,54 @@ export declare const AuthPayload: z.ZodUnion<[z.ZodObject<{
|
|
|
152
203
|
type: "anonymous";
|
|
153
204
|
}, {
|
|
154
205
|
type: "anonymous";
|
|
206
|
+
}>, z.ZodObject<{
|
|
207
|
+
type: z.ZodLiteral<"phoenix">;
|
|
208
|
+
userId: z.ZodString;
|
|
209
|
+
role: z.ZodEnum<["user", "admin", "superadmin"]>;
|
|
210
|
+
data: z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
emailAddress: z.ZodString;
|
|
213
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
214
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
215
|
+
accessToken: z.ZodLiteral<"">;
|
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
|
217
|
+
id: string;
|
|
218
|
+
emailAddress: string;
|
|
219
|
+
fullName: string | null;
|
|
220
|
+
tags: string[];
|
|
221
|
+
accessToken: "";
|
|
222
|
+
}, {
|
|
223
|
+
id: string;
|
|
224
|
+
emailAddress: string;
|
|
225
|
+
fullName: string | null;
|
|
226
|
+
tags: string[];
|
|
227
|
+
accessToken: "";
|
|
228
|
+
}>;
|
|
229
|
+
expirationTime: z.ZodNumber;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
type: "phoenix";
|
|
232
|
+
userId: string;
|
|
233
|
+
role: "admin" | "superadmin" | "user";
|
|
234
|
+
data: {
|
|
235
|
+
id: string;
|
|
236
|
+
emailAddress: string;
|
|
237
|
+
fullName: string | null;
|
|
238
|
+
tags: string[];
|
|
239
|
+
accessToken: "";
|
|
240
|
+
};
|
|
241
|
+
expirationTime: number;
|
|
242
|
+
}, {
|
|
243
|
+
type: "phoenix";
|
|
244
|
+
userId: string;
|
|
245
|
+
role: "admin" | "superadmin" | "user";
|
|
246
|
+
data: {
|
|
247
|
+
id: string;
|
|
248
|
+
emailAddress: string;
|
|
249
|
+
fullName: string | null;
|
|
250
|
+
tags: string[];
|
|
251
|
+
accessToken: "";
|
|
252
|
+
};
|
|
253
|
+
expirationTime: number;
|
|
155
254
|
}>]>;
|
|
156
255
|
export type AuthPayload = z.infer<typeof AuthPayload>;
|
|
157
256
|
export interface FinalizeWebhookPayload<FINALIZE_DATA extends Record<string, unknown>, ENTITIES extends {
|
|
@@ -300,3 +399,159 @@ export declare const FetchBackendDataHandlerResponse: z.ZodObject<{
|
|
|
300
399
|
}, {
|
|
301
400
|
backendData: Record<string, unknown>;
|
|
302
401
|
}>;
|
|
402
|
+
/** Session inputs used by the lambda to resolve the assistant setup. */
|
|
403
|
+
export declare const AssistantSetupPayload: z.ZodObject<{
|
|
404
|
+
deploymentId: z.ZodEffects<z.ZodString, DeploymentId, string>;
|
|
405
|
+
sessionRole: z.ZodNativeEnum<{
|
|
406
|
+
readonly Anonymous: 'anonymous';
|
|
407
|
+
readonly User: 'user';
|
|
408
|
+
readonly Admin: 'admin';
|
|
409
|
+
readonly SuperAdmin: 'superadmin';
|
|
410
|
+
}>;
|
|
411
|
+
sessionPayload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
412
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
413
|
+
access: z.ZodNativeEnum<{
|
|
414
|
+
readonly Owner: 'o';
|
|
415
|
+
readonly ReadRevision: 'rr';
|
|
416
|
+
readonly Read: 'r';
|
|
417
|
+
}>;
|
|
418
|
+
}, "strip", z.ZodTypeAny, {
|
|
419
|
+
deploymentId: string & import("@salsita-ai/common/utils").Brand<"DeploymentId">;
|
|
420
|
+
sessionRole: "admin" | "anonymous" | "superadmin" | "user";
|
|
421
|
+
sessionPayload: Record<string, unknown>;
|
|
422
|
+
sub?: string | undefined;
|
|
423
|
+
access: "o" | "r" | "rr";
|
|
424
|
+
}, {
|
|
425
|
+
deploymentId: string;
|
|
426
|
+
sessionRole: "admin" | "anonymous" | "superadmin" | "user";
|
|
427
|
+
sessionPayload: Record<string, unknown>;
|
|
428
|
+
sub?: string | undefined;
|
|
429
|
+
access: "o" | "r" | "rr";
|
|
430
|
+
}>;
|
|
431
|
+
export type AssistantSetupPayload = z.infer<typeof AssistantSetupPayload>;
|
|
432
|
+
/**
|
|
433
|
+
* A deployment's assistant setup, or a session for which no assistant is available. `threadLock`
|
|
434
|
+
* is outside the setup a thread is bound to: `'strict'` asks a development environment to lock a
|
|
435
|
+
* thread when the setup changes, as every other environment always does.
|
|
436
|
+
*/
|
|
437
|
+
export declare const AssistantSetupResponse: z.ZodObject<{
|
|
438
|
+
setup: z.ZodNullable<z.ZodObject<{
|
|
439
|
+
sdl: z.ZodString;
|
|
440
|
+
prompt: z.ZodString;
|
|
441
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
442
|
+
ai: z.ZodObject<{
|
|
443
|
+
provider: z.ZodEnum<["openai"]>;
|
|
444
|
+
model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
|
|
445
|
+
reasoning: z.ZodEnum<["low", "medium", "high"]>;
|
|
446
|
+
maxThreadSize: z.ZodOptional<z.ZodNumber>;
|
|
447
|
+
hourlyLimits: z.ZodOptional<z.ZodObject<{
|
|
448
|
+
sub: z.ZodOptional<z.ZodNumber>;
|
|
449
|
+
ip: z.ZodOptional<z.ZodNumber>;
|
|
450
|
+
project: z.ZodOptional<z.ZodNumber>;
|
|
451
|
+
}, "strict", z.ZodTypeAny, {
|
|
452
|
+
sub?: number | undefined;
|
|
453
|
+
ip?: number | undefined;
|
|
454
|
+
project?: number | undefined;
|
|
455
|
+
}, {
|
|
456
|
+
sub?: number | undefined;
|
|
457
|
+
ip?: number | undefined;
|
|
458
|
+
project?: number | undefined;
|
|
459
|
+
}>>;
|
|
460
|
+
voice: z.ZodOptional<z.ZodBoolean>;
|
|
461
|
+
}, "strict", z.ZodTypeAny, {
|
|
462
|
+
provider: "openai";
|
|
463
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
464
|
+
reasoning: "high" | "low" | "medium";
|
|
465
|
+
maxThreadSize?: number | undefined;
|
|
466
|
+
hourlyLimits?: {
|
|
467
|
+
sub?: number | undefined;
|
|
468
|
+
ip?: number | undefined;
|
|
469
|
+
project?: number | undefined;
|
|
470
|
+
} | undefined;
|
|
471
|
+
voice?: boolean | undefined;
|
|
472
|
+
}, {
|
|
473
|
+
provider: "openai";
|
|
474
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
475
|
+
reasoning: "high" | "low" | "medium";
|
|
476
|
+
maxThreadSize?: number | undefined;
|
|
477
|
+
hourlyLimits?: {
|
|
478
|
+
sub?: number | undefined;
|
|
479
|
+
ip?: number | undefined;
|
|
480
|
+
project?: number | undefined;
|
|
481
|
+
} | undefined;
|
|
482
|
+
voice?: boolean | undefined;
|
|
483
|
+
}>;
|
|
484
|
+
}, "strict", z.ZodTypeAny, {
|
|
485
|
+
sdl: string;
|
|
486
|
+
prompt: string;
|
|
487
|
+
instructions?: string | undefined;
|
|
488
|
+
ai: {
|
|
489
|
+
provider: "openai";
|
|
490
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
491
|
+
reasoning: "high" | "low" | "medium";
|
|
492
|
+
maxThreadSize?: number | undefined;
|
|
493
|
+
hourlyLimits?: {
|
|
494
|
+
sub?: number | undefined;
|
|
495
|
+
ip?: number | undefined;
|
|
496
|
+
project?: number | undefined;
|
|
497
|
+
} | undefined;
|
|
498
|
+
voice?: boolean | undefined;
|
|
499
|
+
};
|
|
500
|
+
}, {
|
|
501
|
+
sdl: string;
|
|
502
|
+
prompt: string;
|
|
503
|
+
instructions?: string | undefined;
|
|
504
|
+
ai: {
|
|
505
|
+
provider: "openai";
|
|
506
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
507
|
+
reasoning: "high" | "low" | "medium";
|
|
508
|
+
maxThreadSize?: number | undefined;
|
|
509
|
+
hourlyLimits?: {
|
|
510
|
+
sub?: number | undefined;
|
|
511
|
+
ip?: number | undefined;
|
|
512
|
+
project?: number | undefined;
|
|
513
|
+
} | undefined;
|
|
514
|
+
voice?: boolean | undefined;
|
|
515
|
+
};
|
|
516
|
+
}>>;
|
|
517
|
+
threadLock: z.ZodOptional<z.ZodLiteral<"strict">>;
|
|
518
|
+
}, "strict", z.ZodTypeAny, {
|
|
519
|
+
setup: {
|
|
520
|
+
sdl: string;
|
|
521
|
+
prompt: string;
|
|
522
|
+
instructions?: string | undefined;
|
|
523
|
+
ai: {
|
|
524
|
+
provider: "openai";
|
|
525
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
526
|
+
reasoning: "high" | "low" | "medium";
|
|
527
|
+
maxThreadSize?: number | undefined;
|
|
528
|
+
hourlyLimits?: {
|
|
529
|
+
sub?: number | undefined;
|
|
530
|
+
ip?: number | undefined;
|
|
531
|
+
project?: number | undefined;
|
|
532
|
+
} | undefined;
|
|
533
|
+
voice?: boolean | undefined;
|
|
534
|
+
};
|
|
535
|
+
} | null;
|
|
536
|
+
threadLock?: "strict" | undefined;
|
|
537
|
+
}, {
|
|
538
|
+
setup: {
|
|
539
|
+
sdl: string;
|
|
540
|
+
prompt: string;
|
|
541
|
+
instructions?: string | undefined;
|
|
542
|
+
ai: {
|
|
543
|
+
provider: "openai";
|
|
544
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
545
|
+
reasoning: "high" | "low" | "medium";
|
|
546
|
+
maxThreadSize?: number | undefined;
|
|
547
|
+
hourlyLimits?: {
|
|
548
|
+
sub?: number | undefined;
|
|
549
|
+
ip?: number | undefined;
|
|
550
|
+
project?: number | undefined;
|
|
551
|
+
} | undefined;
|
|
552
|
+
voice?: boolean | undefined;
|
|
553
|
+
};
|
|
554
|
+
} | null;
|
|
555
|
+
threadLock?: "strict" | undefined;
|
|
556
|
+
}>;
|
|
557
|
+
export type AssistantSetupResponse = z.infer<typeof AssistantSetupResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";import{usingType as n}from"@salsita-ai/common/utils";import{SessionRole as
|
|
1
|
+
import{z as o}from"zod";import{usingType as n}from"@salsita-ai/common/utils";import{AccessLevel as e,SessionRole as t}from"../../api/index.js";import{DeploymentAssistant as r}from"../../assistant/index.js";import{ConfigurationId as s,DeploymentId as i,FrontendUrl as a,RevisionId as l}from"../../domain/index.js";import{CallLambdaBackResourceType as d}from"../tasks/index.js";export const CallbackPayload=o.object({replayData:o.record(o.unknown()),resources:o.record(o.object({type:o.literal(d.Link),link:o.string()}))});export const CallbackResponse=o.object({result:o.record(o.unknown()).optional()});export const AuthUserIdSource=o.enum(["clerk","custom","phoenix"]);export const AuthHandlerResponse=o.discriminatedUnion("success",[o.object({success:o.literal(!0),data:o.record(o.unknown()),role:o.nativeEnum(t),refreshToken:o.string().optional(),expirationTime:o.number().optional(),scopes:o.array(o.string()).optional(),userId:o.string().optional(),userIdSource:AuthUserIdSource.optional()}),o.object({success:o.literal(!1)})]);export const RefreshPayload=o.object({type:o.literal("refresh"),refreshToken:o.string()});export const CodePayload=o.object({type:o.literal("code"),accessToken:o.string(),refreshToken:o.string().optional(),idToken:o.string().optional()});export const AnonymousPayload=o.object({type:o.literal("anonymous")});export const PhoenixAuthPayload=o.object({type:o.literal("phoenix"),userId:o.string().uuid(),role:o.enum([t.User,t.Admin,t.SuperAdmin]),data:o.object({id:o.string().uuid(),emailAddress:o.string().email(),fullName:o.string().nullable(),tags:o.array(o.string()),accessToken:o.literal("")}),expirationTime:o.number()});export const AuthPayload=o.union([RefreshPayload,CodePayload,AnonymousPayload,PhoenixAuthPayload]);export const FinalizeWebhookPayload=o.object({configurationId:o.string().transform(n(s)),revisionId:o.string().transform(n(l)),deploymentId:o.string().transform(n(i)),frontendUrl:o.string().transform(n(a)),rootEntityType:o.string(),entities:o.array(o.object({type:o.string(),id:o.string()}).and(o.record(o.unknown()))),modelVersion:o.number().positive(),data:o.record(o.unknown()),frontendData:o.record(o.unknown()).optional(),locale:o.string(),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),publishedAdminRevisionPath:o.string().optional(),publishedChunkUrls:o.record(o.string()).optional(),chunksUploadUrl:o.string().optional(),connectedProviderAccessTokens:o.record(o.string()).optional()});export const FetchBackendDataPayload=o.object({deploymentId:o.string().transform(n(i)),frontendUrl:o.string().transform(n(a)),frontendData:o.record(o.unknown()).optional(),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),publishedAdminRevisionPath:o.string().optional(),publishedChunkUrls:o.record(o.string()).optional()});export const FetchBackendDataHandlerResponse=o.object({backendData:o.record(o.unknown())});export const AssistantSetupPayload=o.object({deploymentId:o.string().transform(n(i)),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),sub:o.string().optional(),access:o.nativeEnum(e)});export const AssistantSetupResponse=o.object({setup:r.nullable(),threadLock:o.literal("strict").optional()}).strict();
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { APIGatewayProxyEventV2, LambdaFunctionURLResult } from 'aws-lambda';
|
|
2
2
|
import type { Logger } from '@salsita-ai/common/utils';
|
|
3
|
-
import { ApplicationType } from '../../domain/index.js';
|
|
4
3
|
import { type WebhookFinalizeTaskConfiguration } from '../tasks/index.js';
|
|
5
4
|
import type { AuthHandlerResponse, CallbackResponse, FetchBackendDataHandlerResponse } from './webhook-api-types.js';
|
|
6
|
-
import { AuthPayload, CallbackPayload, FetchBackendDataPayload, FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
7
|
-
export declare const getAuthRoute: () => string;
|
|
8
|
-
export declare const getFinalizeRoute: (applicationType: ApplicationType) => string;
|
|
9
|
-
export declare const getCallbackRoute: () => string;
|
|
10
|
-
export declare const getFetchBackendDataRoute: () => string;
|
|
5
|
+
import { AssistantSetupPayload, AssistantSetupResponse, AuthPayload, CallbackPayload, FetchBackendDataPayload, FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
11
6
|
export declare const handleWebhookSafely: (handler: (e: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>, logger: Logger) => (event: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>;
|
|
12
7
|
type CallbackHandler = (body: CallbackPayload<Record<string, unknown>, string>, e: APIGatewayProxyEventV2) => Promise<CallbackResponse<Record<string, unknown>>>;
|
|
13
8
|
type FinalizeHandler = (body: FinalizeWebhookPayload<Record<string, unknown>, {
|
|
@@ -18,6 +13,7 @@ type AuthHandler = (body: AuthPayload, e: APIGatewayProxyEventV2) => Promise<Aut
|
|
|
18
13
|
type FetchBackendDataHandler = (body: FetchBackendDataPayload<Record<string, unknown>, Record<string, unknown>>, e: APIGatewayProxyEventV2) => Promise<FetchBackendDataHandlerResponse>;
|
|
19
14
|
export declare const routeWebhookRequests: (handlers: {
|
|
20
15
|
configurator?: {
|
|
16
|
+
onAssistantSetup?: (body: AssistantSetupPayload, e: APIGatewayProxyEventV2) => Promise<AssistantSetupResponse>;
|
|
21
17
|
onFetchBackendData?: FetchBackendDataHandler;
|
|
22
18
|
onCallback?: CallbackHandler;
|
|
23
19
|
onFinalize?: FinalizeHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as o,match as
|
|
1
|
+
import{P as o,match as r}from"ts-pattern";import{ApplicationType as t}from"../../domain/index.js";import{validateTaskConfiguration as n}from"../tasks/index.js";import{createBackendDataResponse as e}from"./backend-data-response.js";import{AssistantSetupPayload as i,AssistantSetupResponse as a,AuthPayload as s,CallbackPayload as f,FetchBackendDataPayload as d,FinalizeWebhookPayload as c}from"./webhook-api-types.js";export const handleWebhookSafely=(o,r)=>async t=>{try{return await o(t)}catch(n){let o=`Webhook failed: ${n instanceof Error?n.message:"Unknown error"}`,t="object"==typeof n&&n instanceof Error?n:Error(o);return r.error(o,{},t),{statusCode:500,body:JSON.stringify({message:o})}}};export const routeWebhookRequests=(h,u)=>handleWebhookSafely(async p=>{if(!p.body)throw Error("No body found in the webhook event!");let w=JSON.parse(p.isBase64Encoded?Buffer.from(p.body,"base64").toString():p.body);return r(p.queryStringParameters?.o).with("assistantSetup",async()=>{if(!h.configurator?.onAssistantSetup)throw Error("Assistant setup operation is not configured for this webhook!");let o=await h.configurator.onAssistantSetup(i.parse(w),p);return{statusCode:200,body:JSON.stringify(a.parse(o))}}).with("auth",async()=>{if(u.info("Handling auth operation."),!h.onAuth)throw Error("Auth operation is not configured for this webhook!");let o=s.parse(w);return{statusCode:200,body:JSON.stringify(await h.onAuth(o,p))}}).with("callback",async()=>{if(u.info("Handling configurator callback operation."),!h.configurator?.onCallback)throw Error("Auth operation is not configured for this webhook!");let o=f.parse(w);return{statusCode:200,body:JSON.stringify(await h.configurator.onCallback(o,p))}}).with(o.union(void 0,"finalize"),()=>r(p.queryStringParameters?.t).with(t.Admin,async()=>{if(u.info("Handling admin finalize operation."),!h.admin?.onFinalize)throw Error("Admin finalize operation is not configured for this webhook!");let o=c.parse(w),r=await h.admin.onFinalize(o,p);return n(r),{statusCode:200,body:JSON.stringify(r)}}).with(o.union(void 0,t.Configurator),async()=>{if(u.info("Handling configurator finalize operation."),!h.configurator?.onFinalize)throw Error("Configurator finalize operation is not configured for this webhook!");let o=c.parse(w),r=await h.configurator.onFinalize(o,p);return n(r),{statusCode:200,body:JSON.stringify(r)}}).otherwise(o=>{throw Error(`Can not parse application type - unknown type: ${o}!`)})).with("fetchBackendData",async()=>{if(u.info("Handling fetch backend data operation."),!h.configurator?.onFetchBackendData)throw Error("Fetch backend data operation is not configured for this webhook!");let o=d.parse(w);return e(await h.configurator.onFetchBackendData(o,p),Object.entries(p.headers).find(([o])=>"accept-encoding"===o.toLowerCase())?.[1])}).otherwise(o=>{throw Error(`Can not parse webhook operation - unknown operation: ${o}!`)})},u);
|
|
@@ -28,23 +28,29 @@ export declare const TunneledWebhookResponse: z.ZodObject<{
|
|
|
28
28
|
status: z.ZodNumber;
|
|
29
29
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
30
30
|
body: z.ZodString;
|
|
31
|
+
isBase64Encoded: z.ZodOptional<z.ZodBoolean>;
|
|
31
32
|
}, "strip", z.ZodTypeAny, {
|
|
32
33
|
status: number;
|
|
33
34
|
headers?: Record<string, string> | undefined;
|
|
34
35
|
body: string;
|
|
36
|
+
isBase64Encoded?: boolean | undefined;
|
|
35
37
|
}, {
|
|
36
38
|
status: number;
|
|
37
39
|
headers?: Record<string, string> | undefined;
|
|
38
40
|
body: string;
|
|
41
|
+
isBase64Encoded?: boolean | undefined;
|
|
39
42
|
}>;
|
|
40
43
|
export type TunneledWebhookResponse = z.infer<typeof TunneledWebhookResponse>;
|
|
41
44
|
/** Payload used to claim a development deployment and wait for its next webhook request. */
|
|
42
45
|
export declare const WebhookTunnelPollRequest: z.ZodObject<{
|
|
43
46
|
sessionId: z.ZodString;
|
|
47
|
+
acceptResponseEncoding: z.ZodOptional<z.ZodLiteral<"gzip">>;
|
|
44
48
|
}, "strip", z.ZodTypeAny, {
|
|
45
49
|
sessionId: string;
|
|
50
|
+
acceptResponseEncoding?: "gzip" | undefined;
|
|
46
51
|
}, {
|
|
47
52
|
sessionId: string;
|
|
53
|
+
acceptResponseEncoding?: "gzip" | undefined;
|
|
48
54
|
}>;
|
|
49
55
|
export type WebhookTunnelPollRequest = z.infer<typeof WebhookTunnelPollRequest>;
|
|
50
56
|
/** Result of waiting for the next tunneled webhook request. */
|
|
@@ -98,17 +104,20 @@ export declare const WebhookTunnelRespondRequest: z.ZodObject<{
|
|
|
98
104
|
status: z.ZodNumber;
|
|
99
105
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
100
106
|
body: z.ZodString;
|
|
107
|
+
isBase64Encoded: z.ZodOptional<z.ZodBoolean>;
|
|
101
108
|
}, "strip", z.ZodTypeAny, {
|
|
102
109
|
sessionId: string;
|
|
103
110
|
requestId: string;
|
|
104
111
|
status: number;
|
|
105
112
|
headers?: Record<string, string> | undefined;
|
|
106
113
|
body: string;
|
|
114
|
+
isBase64Encoded?: boolean | undefined;
|
|
107
115
|
}, {
|
|
108
116
|
sessionId: string;
|
|
109
117
|
requestId: string;
|
|
110
118
|
status: number;
|
|
111
119
|
headers?: Record<string, string> | undefined;
|
|
112
120
|
body: string;
|
|
121
|
+
isBase64Encoded?: boolean | undefined;
|
|
113
122
|
}>;
|
|
114
123
|
export type WebhookTunnelRespondRequest = z.infer<typeof WebhookTunnelRespondRequest>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";export const TunneledWebhookRequest=e.object({requestId:e.string(),url:e.string(),method:e.string(),headers:e.record(e.string()),body:e.string().nullable(),deadline:e.number()});export const TunneledWebhookResponse=e.object({status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string()});export const WebhookTunnelPollRequest=e.object({sessionId:e.string()});export const WebhookTunnelPollResponse=e.object({request:TunneledWebhookRequest.nullable()});export const WebhookTunnelRespondRequest=e.object({sessionId:e.string(),requestId:e.string(),status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string()});
|
|
1
|
+
import{z as e}from"zod";export const TunneledWebhookRequest=e.object({requestId:e.string(),url:e.string(),method:e.string(),headers:e.record(e.string()),body:e.string().nullable(),deadline:e.number()});export const TunneledWebhookResponse=e.object({status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string(),isBase64Encoded:e.boolean().optional()});export const WebhookTunnelPollRequest=e.object({sessionId:e.string(),acceptResponseEncoding:e.literal("gzip").optional()});export const WebhookTunnelPollResponse=e.object({request:TunneledWebhookRequest.nullable()});export const WebhookTunnelRespondRequest=e.object({sessionId:e.string(),requestId:e.string(),status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string(),isBase64Encoded:e.boolean().optional()});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salsita-ai/contracts",
|
|
3
|
-
"version": "0.50.0-develop.
|
|
3
|
+
"version": "0.50.0-develop.4c59c65881",
|
|
4
4
|
"description": "Shared API, authentication, domain, chat, and webhook contracts for Phoenix.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salsita",
|
|
@@ -48,23 +48,22 @@
|
|
|
48
48
|
"@tanstack/ai": "0.64.0",
|
|
49
49
|
"@types/aws-lambda": "8.10.133",
|
|
50
50
|
"ajv": "8.20.0",
|
|
51
|
-
"http-errors": "2.0.1",
|
|
52
51
|
"jose": "6.2.3",
|
|
53
|
-
"lodash-es": "4.18.1",
|
|
54
52
|
"openai": "7.23.0",
|
|
53
|
+
"remark": "15.0.1",
|
|
54
|
+
"remark-gfm": "4.0.0",
|
|
55
55
|
"ts-pattern": "5.9.0",
|
|
56
56
|
"uuid": "14.0.0",
|
|
57
57
|
"valid-url": "1.0.9",
|
|
58
58
|
"zod": "3.25.76",
|
|
59
|
-
"@salsita-ai/common": "0.50.0-develop.
|
|
59
|
+
"@salsita-ai/common": "0.50.0-develop.4c59c65881"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@lingui/core": "5.9.5",
|
|
63
63
|
"@swc/cli": "0.8.1",
|
|
64
64
|
"@swc/core": "1.15.40",
|
|
65
|
-
"@types/
|
|
65
|
+
"@types/mdast": "4.0.4",
|
|
66
66
|
"@types/json-schema": "7.0.15",
|
|
67
|
-
"@types/lodash-es": "4.17.12",
|
|
68
67
|
"@types/valid-url": "1.0.7",
|
|
69
68
|
"eslint": "9.39.4",
|
|
70
69
|
"prettier": "3.8.3",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side tool of the assistant chat: the browser draws its own details (user agent, viewport,
|
|
3
|
-
* pixel ratio, language) onto a canvas and returns the capture as an image content part. It carries
|
|
4
|
-
* no domain meaning; it proves that a client tool result reaches the model as an image.
|
|
5
|
-
*
|
|
6
|
-
* The server passes the definition to the model without an implementation, so every call becomes a
|
|
7
|
-
* client-tool interrupt; the SDK registers the browser implementation via `.client()`.
|
|
8
|
-
*
|
|
9
|
-
* The input schema is plain JSON Schema because `@tanstack/ai` converts only schemas that expose
|
|
10
|
-
* `~standard.jsonSchema` (Zod 4.2+), which the workspace's Zod 3 does not.
|
|
11
|
-
*/
|
|
12
|
-
export declare const browserDetailsTool: import("@tanstack/ai").ToolDefinition<{
|
|
13
|
-
type: string;
|
|
14
|
-
properties: {};
|
|
15
|
-
required: never[];
|
|
16
|
-
}, undefined, "getBrowserDetails", false, undefined>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{toolDefinition as e}from"@tanstack/ai";export const browserDetailsTool=e({name:"getBrowserDetails",description:"Captures the user's browser details (user agent, viewport size, device pixel ratio, language) as an image.",inputSchema:{type:"object",properties:{},required:[]}});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type OpenAI from 'openai';
|
|
2
|
-
export declare const createAssistantMessage: (content?: string, toolCalls?: OpenAI.Chat.Completions.ChatCompletionMessageToolCall[]) => OpenAI.ChatCompletionAssistantMessageParam;
|
|
3
|
-
export declare const createToolCallResultMessage: (content: string, toolCallId: string) => OpenAI.Chat.Completions.ChatCompletionToolMessageParam;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const createAssistantMessage=(t,o)=>({role:"assistant",...t?{content:t}:void 0,...o?{tool_calls:o.filter(t=>"function"===t.type).map(t=>({id:t.id,function:t.function,type:"function"}))}:void 0});export const createToolCallResultMessage=(t,o)=>({role:"tool",content:t,tool_call_id:o});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const simpleAugmentationHandler=t=>e=>({result:e[t]?JSON.stringify(e):""});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JSONSchemaType } from 'ajv';
|
|
2
|
-
import type { Empty } from '../utils/types.js';
|
|
3
|
-
import type { ChatExecutableFunction, ChatFunction, ChatFunctionDefinition } from './types.js';
|
|
4
|
-
export declare const createChatExecutableFunction: <C extends Empty = Empty, R extends Empty = Empty, P = undefined>(name: string, parameters: JSONSchemaType<P> | undefined, func: ChatFunction<C, R, P>) => ChatExecutableFunction<C, R, P>;
|
|
5
|
-
export declare const createChatFunctionDefinition: <C extends Empty = Empty, R extends Empty = Empty, P = undefined>(name: string, description: string, parameters: JSONSchemaType<P> | undefined, func: ChatFunction<C, R, P>) => ChatFunctionDefinition<C, R, P>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createValidator as t}from"./validate.js";export const createChatExecutableFunction=(e,a,n)=>({name:e,function:n,validate:t(a)});export const createChatFunctionDefinition=(t,e,a,n)=>({description:e,parameters:a,...createChatExecutableFunction(t,a,n)});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { ApplicationType } from '../../domain/index.js';
|
|
2
|
-
import { type CallbackPayload, CallbackResponse, type FetchBackendDataPayload, type FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
3
|
-
export type WebhookHttpClient = (url: string, init: RequestInit) => Promise<Response>;
|
|
4
|
-
export declare const fetchWebhookHttpClient: WebhookHttpClient;
|
|
5
|
-
export declare const createUrlWebhookHttpClient: (baseUrl: string, httpClient?: WebhookHttpClient) => WebhookHttpClient;
|
|
6
|
-
export declare class WebhookClient {
|
|
7
|
-
private readonly _httpClient;
|
|
8
|
-
constructor(httpClient: WebhookHttpClient);
|
|
9
|
-
/** @deprecated Pass createUrlWebhookHttpClient(baseUrl, httpClient) instead. This overload will be removed in a future version. */
|
|
10
|
-
constructor(baseUrl: string, httpClient?: WebhookHttpClient);
|
|
11
|
-
handleRefreshFlow: (refreshToken: string) => Promise<{
|
|
12
|
-
success: true;
|
|
13
|
-
data: Record<string, unknown>;
|
|
14
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
15
|
-
refreshToken?: string | undefined;
|
|
16
|
-
expirationTime?: number | undefined;
|
|
17
|
-
scopes?: string[] | undefined;
|
|
18
|
-
userId?: string | undefined;
|
|
19
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
20
|
-
} | {
|
|
21
|
-
success: false;
|
|
22
|
-
}>;
|
|
23
|
-
handleCodeFlow: (accessToken: string, refreshToken: string | undefined, idToken: string | undefined) => Promise<{
|
|
24
|
-
success: true;
|
|
25
|
-
data: Record<string, unknown>;
|
|
26
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
27
|
-
refreshToken?: string | undefined;
|
|
28
|
-
expirationTime?: number | undefined;
|
|
29
|
-
scopes?: string[] | undefined;
|
|
30
|
-
userId?: string | undefined;
|
|
31
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
success: false;
|
|
34
|
-
}>;
|
|
35
|
-
handleAnonymousFlow: () => Promise<{
|
|
36
|
-
success: true;
|
|
37
|
-
data: Record<string, unknown>;
|
|
38
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
39
|
-
refreshToken?: string | undefined;
|
|
40
|
-
expirationTime?: number | undefined;
|
|
41
|
-
scopes?: string[] | undefined;
|
|
42
|
-
userId?: string | undefined;
|
|
43
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
44
|
-
} | {
|
|
45
|
-
success: false;
|
|
46
|
-
}>;
|
|
47
|
-
finalize: (data: FinalizeWebhookPayload<Record<string, unknown>, {
|
|
48
|
-
id: string;
|
|
49
|
-
type: string;
|
|
50
|
-
}, Record<string, unknown>, Record<string, unknown>>, applicationType: ApplicationType) => Promise<{
|
|
51
|
-
dataVersion: 1;
|
|
52
|
-
tasks: (import("../tasks/call-lambda-back-task.js").CallLambdaBackTask<Record<string, unknown>, string> | import("../tasks/edit-google-spreadsheet-task.js").EditGoogleSpreadsheetTask | import("../tasks/generate-csv-task.js").GenerateCsvTask | import("../tasks/generate-images-task.js").GenerateImagesTask | import("../tasks/generate-pdf-task.js").GeneratePdfTask | import("../tasks/generate-pdf-task.js").GenerateStaticPdfTask | import("../tasks/send-email-task.js").SendEmailTask | import("../tasks/send-http-task.js").SendHttpRequestTask | import("../tasks/send-email-task.js").SendStaticEmailTask | import("../tasks/woocommerce-add-to-cart-task.js").WooCommerceAddToCartTask | {
|
|
53
|
-
type: "GenerateConfigurationLink";
|
|
54
|
-
name: string;
|
|
55
|
-
frontendUrl: string & import("@salsita-ai/common/utils").Brand<"FrontendUrl">;
|
|
56
|
-
expiration?: number | undefined;
|
|
57
|
-
access: "o" | "r" | "rr";
|
|
58
|
-
configurationId: string & import("@salsita-ai/common/utils").Brand<"ConfigurationId">;
|
|
59
|
-
revisionId?: import("../../domain/index.js").RevisionId | undefined;
|
|
60
|
-
} | {
|
|
61
|
-
type: "PublishRevision";
|
|
62
|
-
version: number & import("@salsita-ai/common/utils").Brand<"PublishedDataRevisionVersion">;
|
|
63
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
64
|
-
data: Record<string, unknown>;
|
|
65
|
-
} | {
|
|
66
|
-
type: "PublishRevisionChunks";
|
|
67
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
68
|
-
chunks: {
|
|
69
|
-
key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
|
|
70
|
-
scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
|
|
71
|
-
data: Record<string, unknown>;
|
|
72
|
-
}[];
|
|
73
|
-
publishedDataHash: string;
|
|
74
|
-
} | {
|
|
75
|
-
type: "PublishRevisionChunksStaged";
|
|
76
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
77
|
-
publishedDataHash: string;
|
|
78
|
-
})[];
|
|
79
|
-
resources: import("../index.js").FinalizeTaskResource<string>[];
|
|
80
|
-
}>;
|
|
81
|
-
callback: (payload: CallbackPayload<Record<string, unknown>, string>) => Promise<CallbackResponse<Record<string, unknown>>>;
|
|
82
|
-
fetchBackendData: (payload: FetchBackendDataPayload<Record<string, unknown>, Record<string, unknown>>) => Promise<{
|
|
83
|
-
backendData: Record<string, unknown>;
|
|
84
|
-
}>;
|
|
85
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{WebhookFinalizeTaskConfiguration as t}from"../tasks/index.js";import{AuthHandlerResponse as e,CallbackResponse as o,FetchBackendDataHandlerResponse as a}from"./webhook-api-types.js";import{getAuthRoute as i,getCallbackRoute as n,getFetchBackendDataRoute as r,getFinalizeRoute as s}from"./webhook-routing.js";export const fetchWebhookHttpClient=(t,e)=>fetch(t,e);export const createUrlWebhookHttpClient=(t,e=fetchWebhookHttpClient)=>(o,a)=>e(`${t}${o}`,a);export class WebhookClient{_httpClient;constructor(t,e=fetchWebhookHttpClient){this._httpClient="string"==typeof t?createUrlWebhookHttpClient(t,e):t}handleRefreshFlow=async t=>{let o=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"refresh",refreshToken:t})});if(!o.ok)throw Error(`Refresh webhook call failed: ${await o.text()}`);return e.parse(await o.json())};handleCodeFlow=async(t,o,a)=>{let n=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"code",accessToken:t,refreshToken:o,idToken:a})});if(!n.ok)throw Error(`Refresh webhook call failed: ${await n.text()}`);return e.parse(await n.json())};handleAnonymousFlow=async()=>{let t=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"anonymous"})});if(!t.ok)throw Error(`Refresh webhook call failed: ${await t.text()}`);return e.parse(await t.json())};finalize=async(e,o)=>{let a=await this._httpClient(s(o),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok)throw Error("Lambda call failed: "+await a.text());let i=await a.json();return t.parse(i)};callback=async t=>{let e=await this._httpClient(n(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw Error("Lambda call failed: "+await e.text());let a=await e.json();return o.parse(a)};fetchBackendData=async t=>{let e=await this._httpClient(r(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw Error("Lambda call failed: "+await e.text());return a.parse(await e.json())}}
|