@salsita-ai/contracts 0.50.0-develop.11a39afa73 → 0.50.0-develop.12744a81f2
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 +5 -2
- package/dist/api/cli-access.d.ts +60 -0
- package/dist/api/cli-access.js +1 -0
- package/dist/api/cli-login-approval.d.ts +15 -0
- package/dist/api/cli-login-approval.js +1 -0
- package/dist/api/cli-sign-in.d.ts +23 -0
- package/dist/api/cli-sign-in.js +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.js +1 -1
- package/dist/api/session-token.d.ts +1 -1
- package/dist/api/studio-session.d.ts +47 -0
- package/dist/api/studio-session.js +1 -1
- package/dist/api/workspace-creation-options.d.ts +19 -0
- package/dist/api/workspace-creation-options.js +1 -0
- package/dist/api/workspace-creation.d.ts +19 -0
- package/dist/api/workspace-creation.js +1 -0
- package/dist/assistant/ban-tool.d.ts +2 -2
- package/dist/assistant/ban-tool.js +1 -1
- package/dist/assistant/deployment-assistant.d.ts +43 -0
- package/dist/assistant/deployment-assistant.js +1 -1
- package/dist/assistant/graphql-tools.d.ts +4 -2
- package/dist/assistant/graphql-tools.js +1 -1
- package/dist/assistant/index.d.ts +1 -1
- package/dist/assistant/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/activations/environment-activation-kind.d.ts +11 -0
- package/dist/domain/deployments/activations/environment-activation-kind.js +1 -0
- package/dist/domain/deployments/activations/index.d.ts +2 -0
- package/dist/domain/deployments/activations/index.js +1 -0
- package/dist/domain/deployments/activations/production-rollback-state.d.ts +14 -0
- package/dist/domain/deployments/activations/production-rollback-state.js +1 -0
- 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 +16 -0
- package/dist/domain/deployments/api-tokens/limits.js +1 -0
- package/dist/domain/deployments/custom-domains/custom-domain.d.ts +40 -0
- package/dist/domain/deployments/custom-domains/custom-domain.js +1 -0
- package/dist/domain/deployments/custom-domains/index.d.ts +1 -0
- package/dist/domain/deployments/custom-domains/index.js +1 -0
- package/dist/domain/deployments/deployment-build-domain.d.ts +8 -0
- package/dist/domain/deployments/deployment-domain.d.ts +2 -0
- package/dist/domain/deployments/index.d.ts +7 -0
- package/dist/domain/deployments/index.js +1 -1
- package/dist/domain/deployments/previews/index.d.ts +2 -0
- package/dist/domain/deployments/previews/index.js +1 -0
- package/dist/domain/deployments/previews/preview-limits.d.ts +5 -0
- package/dist/domain/deployments/previews/preview-limits.js +1 -0
- package/dist/domain/deployments/previews/preview-name.d.ts +23 -0
- package/dist/domain/deployments/previews/preview-name.js +1 -0
- package/dist/domain/deployments/project-domain.d.ts +6 -3
- package/dist/domain/deployments/sdk-builder-environment-domain.d.ts +20 -0
- package/dist/domain/deployments/sdk-builder-environment-domain.js +1 -0
- package/dist/domain/deployments/sdk-builder-project-domain.d.ts +22 -0
- package/dist/domain/deployments/sdk-builder-project-domain.js +1 -0
- package/dist/domain/deployments/sdk-builder-setup-domain.d.ts +5 -4
- package/dist/domain/deployments/teardowns/index.d.ts +1 -0
- package/dist/domain/deployments/teardowns/index.js +1 -0
- package/dist/domain/deployments/teardowns/teardown-status.d.ts +23 -0
- package/dist/domain/deployments/teardowns/teardown-status.js +1 -0
- package/dist/domain/index.d.ts +3 -0
- package/dist/domain/index.js +1 -1
- package/dist/domain/product-configurations/analytics/configuration-chart-definition.d.ts +798 -0
- package/dist/domain/product-configurations/analytics/configuration-chart-definition.js +1 -0
- package/dist/domain/product-configurations/analytics/index.d.ts +1 -0
- package/dist/domain/product-configurations/analytics/index.js +1 -0
- package/dist/domain/product-configurations/configuration-insight-field.d.ts +54 -0
- package/dist/domain/product-configurations/configuration-insight-field.js +1 -0
- package/dist/domain/product-configurations/configuration-insight-status.d.ts +4 -0
- package/dist/domain/product-configurations/configuration-insight-status.js +1 -0
- package/dist/domain/product-configurations/configuration-insight-value.d.ts +114 -0
- package/dist/domain/product-configurations/configuration-insight-value.js +1 -0
- package/dist/domain/product-configurations/index.d.ts +4 -0
- package/dist/domain/product-configurations/index.js +1 -1
- package/dist/domain/workspace-lifecycle/disabled-workspace-status.d.ts +7 -0
- package/dist/domain/workspace-lifecycle/disabled-workspace-status.js +1 -0
- package/dist/domain/workspace-lifecycle/index.d.ts +3 -0
- package/dist/domain/workspace-lifecycle/index.js +1 -0
- package/dist/domain/workspace-lifecycle/workspace-disabled-message.d.ts +6 -0
- package/dist/domain/workspace-lifecycle/workspace-disabled-message.js +1 -0
- package/dist/domain/workspace-lifecycle/workspace-status.d.ts +13 -0
- package/dist/domain/workspace-lifecycle/workspace-status.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/configuration-insights-payload.d.ts +41 -0
- package/dist/webhook/implementation/configuration-insights-payload.js +1 -0
- package/dist/webhook/implementation/configuration-insights-response.d.ts +184 -0
- package/dist/webhook/implementation/configuration-insights-response.js +1 -0
- package/dist/webhook/implementation/index.d.ts +3 -1
- package/dist/webhook/implementation/index.js +1 -1
- package/dist/webhook/implementation/webhook-api-types.d.ts +123 -5
- package/dist/webhook/implementation/webhook-api-types.js +1 -1
- package/dist/webhook/implementation/webhook-routing.d.ts +3 -0
- package/dist/webhook/implementation/webhook-routing.js +1 -1
- package/package.json +2 -2
|
@@ -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 {
|
|
@@ -345,6 +444,7 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
345
444
|
model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
|
|
346
445
|
reasoning: z.ZodEnum<["low", "medium", "high"]>;
|
|
347
446
|
maxThreadSize: z.ZodOptional<z.ZodNumber>;
|
|
447
|
+
maxToolCallsPerMessage: z.ZodOptional<z.ZodNumber>;
|
|
348
448
|
hourlyLimits: z.ZodOptional<z.ZodObject<{
|
|
349
449
|
sub: z.ZodOptional<z.ZodNumber>;
|
|
350
450
|
ip: z.ZodOptional<z.ZodNumber>;
|
|
@@ -358,30 +458,36 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
358
458
|
ip?: number | undefined;
|
|
359
459
|
project?: number | undefined;
|
|
360
460
|
}>>;
|
|
461
|
+
retentionDays: z.ZodOptional<z.ZodNumber>;
|
|
361
462
|
voice: z.ZodOptional<z.ZodBoolean>;
|
|
362
463
|
}, "strict", z.ZodTypeAny, {
|
|
363
464
|
provider: "openai";
|
|
364
465
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
365
466
|
reasoning: "high" | "low" | "medium";
|
|
366
467
|
maxThreadSize?: number | undefined;
|
|
468
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
367
469
|
hourlyLimits?: {
|
|
368
470
|
sub?: number | undefined;
|
|
369
471
|
ip?: number | undefined;
|
|
370
472
|
project?: number | undefined;
|
|
371
473
|
} | undefined;
|
|
474
|
+
retentionDays?: number | undefined;
|
|
372
475
|
voice?: boolean | undefined;
|
|
373
476
|
}, {
|
|
374
477
|
provider: "openai";
|
|
375
478
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
376
479
|
reasoning: "high" | "low" | "medium";
|
|
377
480
|
maxThreadSize?: number | undefined;
|
|
481
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
378
482
|
hourlyLimits?: {
|
|
379
483
|
sub?: number | undefined;
|
|
380
484
|
ip?: number | undefined;
|
|
381
485
|
project?: number | undefined;
|
|
382
486
|
} | undefined;
|
|
487
|
+
retentionDays?: number | undefined;
|
|
383
488
|
voice?: boolean | undefined;
|
|
384
489
|
}>;
|
|
490
|
+
images: z.ZodOptional<z.ZodLiteral<false>>;
|
|
385
491
|
}, "strict", z.ZodTypeAny, {
|
|
386
492
|
sdl: string;
|
|
387
493
|
prompt: string;
|
|
@@ -391,13 +497,16 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
391
497
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
392
498
|
reasoning: "high" | "low" | "medium";
|
|
393
499
|
maxThreadSize?: number | undefined;
|
|
500
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
394
501
|
hourlyLimits?: {
|
|
395
502
|
sub?: number | undefined;
|
|
396
503
|
ip?: number | undefined;
|
|
397
504
|
project?: number | undefined;
|
|
398
505
|
} | undefined;
|
|
506
|
+
retentionDays?: number | undefined;
|
|
399
507
|
voice?: boolean | undefined;
|
|
400
508
|
};
|
|
509
|
+
images?: false | undefined;
|
|
401
510
|
}, {
|
|
402
511
|
sdl: string;
|
|
403
512
|
prompt: string;
|
|
@@ -407,13 +516,16 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
407
516
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
408
517
|
reasoning: "high" | "low" | "medium";
|
|
409
518
|
maxThreadSize?: number | undefined;
|
|
519
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
410
520
|
hourlyLimits?: {
|
|
411
521
|
sub?: number | undefined;
|
|
412
522
|
ip?: number | undefined;
|
|
413
523
|
project?: number | undefined;
|
|
414
524
|
} | undefined;
|
|
525
|
+
retentionDays?: number | undefined;
|
|
415
526
|
voice?: boolean | undefined;
|
|
416
527
|
};
|
|
528
|
+
images?: false | undefined;
|
|
417
529
|
}>>;
|
|
418
530
|
threadLock: z.ZodOptional<z.ZodLiteral<"strict">>;
|
|
419
531
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -426,13 +538,16 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
426
538
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
427
539
|
reasoning: "high" | "low" | "medium";
|
|
428
540
|
maxThreadSize?: number | undefined;
|
|
541
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
429
542
|
hourlyLimits?: {
|
|
430
543
|
sub?: number | undefined;
|
|
431
544
|
ip?: number | undefined;
|
|
432
545
|
project?: number | undefined;
|
|
433
546
|
} | undefined;
|
|
547
|
+
retentionDays?: number | undefined;
|
|
434
548
|
voice?: boolean | undefined;
|
|
435
549
|
};
|
|
550
|
+
images?: false | undefined;
|
|
436
551
|
} | null;
|
|
437
552
|
threadLock?: "strict" | undefined;
|
|
438
553
|
}, {
|
|
@@ -445,13 +560,16 @@ export declare const AssistantSetupResponse: z.ZodObject<{
|
|
|
445
560
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
446
561
|
reasoning: "high" | "low" | "medium";
|
|
447
562
|
maxThreadSize?: number | undefined;
|
|
563
|
+
maxToolCallsPerMessage?: number | undefined;
|
|
448
564
|
hourlyLimits?: {
|
|
449
565
|
sub?: number | undefined;
|
|
450
566
|
ip?: number | undefined;
|
|
451
567
|
project?: number | undefined;
|
|
452
568
|
} | undefined;
|
|
569
|
+
retentionDays?: number | undefined;
|
|
453
570
|
voice?: boolean | undefined;
|
|
454
571
|
};
|
|
572
|
+
images?: false | undefined;
|
|
455
573
|
} | null;
|
|
456
574
|
threadLock?: "strict" | undefined;
|
|
457
575
|
}>;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,6 +1,8 @@
|
|
|
1
1
|
import type { APIGatewayProxyEventV2, LambdaFunctionURLResult } from 'aws-lambda';
|
|
2
2
|
import type { Logger } from '@salsita-ai/common/utils';
|
|
3
3
|
import { type WebhookFinalizeTaskConfiguration } from '../tasks/index.js';
|
|
4
|
+
import { ConfigurationInsightsPayload } from './configuration-insights-payload.js';
|
|
5
|
+
import { ConfigurationInsightsResponse } from './configuration-insights-response.js';
|
|
4
6
|
import type { AuthHandlerResponse, CallbackResponse, FetchBackendDataHandlerResponse } from './webhook-api-types.js';
|
|
5
7
|
import { AssistantSetupPayload, AssistantSetupResponse, AuthPayload, CallbackPayload, FetchBackendDataPayload, FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
6
8
|
export declare const handleWebhookSafely: (handler: (e: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>, logger: Logger) => (event: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>;
|
|
@@ -13,6 +15,7 @@ type AuthHandler = (body: AuthPayload, e: APIGatewayProxyEventV2) => Promise<Aut
|
|
|
13
15
|
type FetchBackendDataHandler = (body: FetchBackendDataPayload<Record<string, unknown>, Record<string, unknown>>, e: APIGatewayProxyEventV2) => Promise<FetchBackendDataHandlerResponse>;
|
|
14
16
|
export declare const routeWebhookRequests: (handlers: {
|
|
15
17
|
configurator?: {
|
|
18
|
+
onConfigurationInsights?: (body: ConfigurationInsightsPayload) => Promise<ConfigurationInsightsResponse>;
|
|
16
19
|
onAssistantSetup?: (body: AssistantSetupPayload, e: APIGatewayProxyEventV2) => Promise<AssistantSetupResponse>;
|
|
17
20
|
onFetchBackendData?: FetchBackendDataHandler;
|
|
18
21
|
onCallback?: CallbackHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as o,match as
|
|
1
|
+
import{P as o,match as t}from"ts-pattern";import{ApplicationType as r}from"../../domain/index.js";import{validateTaskConfiguration as n}from"../tasks/index.js";import{createBackendDataResponse as i}from"./backend-data-response.js";import{ConfigurationInsightsPayload as a}from"./configuration-insights-payload.js";import{ConfigurationInsightsResponse as e}from"./configuration-insights-response.js";import{AssistantSetupPayload as s,AssistantSetupResponse as f,AuthPayload as u,CallbackPayload as c,FetchBackendDataPayload as h,FinalizeWebhookPayload as d}from"./webhook-api-types.js";export const handleWebhookSafely=(o,t)=>async r=>{try{return await o(r)}catch(n){let o=`Webhook failed: ${n instanceof Error?n.message:"Unknown error"}`,r="object"==typeof n&&n instanceof Error?n:Error(o);return t.error(o,{},r),{statusCode:500,body:JSON.stringify({message:o})}}};export const routeWebhookRequests=(p,g)=>handleWebhookSafely(async l=>{if(!l.body)throw Error("No body found in the webhook event!");let w=JSON.parse(l.isBase64Encoded?Buffer.from(l.body,"base64").toString():l.body);return t(l.queryStringParameters?.o).with("configurationInsights",async()=>{let o=p.configurator?.onConfigurationInsights?await p.configurator.onConfigurationInsights(a.parse(w)):{status:"unavailable",values:[]};return{statusCode:200,body:JSON.stringify(e.parse(o))}}).with("assistantSetup",async()=>{if(!p.configurator?.onAssistantSetup)throw Error("Assistant setup operation is not configured for this webhook!");let o=await p.configurator.onAssistantSetup(s.parse(w),l);return{statusCode:200,body:JSON.stringify(f.parse(o))}}).with("auth",async()=>{if(g.info("Handling auth operation."),!p.onAuth)throw Error("Auth operation is not configured for this webhook!");let o=u.parse(w);return{statusCode:200,body:JSON.stringify(await p.onAuth(o,l))}}).with("callback",async()=>{if(g.info("Handling configurator callback operation."),!p.configurator?.onCallback)throw Error("Auth operation is not configured for this webhook!");let o=c.parse(w);return{statusCode:200,body:JSON.stringify(await p.configurator.onCallback(o,l))}}).with(o.union(void 0,"finalize"),()=>t(l.queryStringParameters?.t).with(r.Admin,async()=>{if(g.info("Handling admin finalize operation."),!p.admin?.onFinalize)throw Error("Admin finalize operation is not configured for this webhook!");let o=d.parse(w),t=await p.admin.onFinalize(o,l);return n(t),{statusCode:200,body:JSON.stringify(t)}}).with(o.union(void 0,r.Configurator),async()=>{if(g.info("Handling configurator finalize operation."),!p.configurator?.onFinalize)throw Error("Configurator finalize operation is not configured for this webhook!");let o=d.parse(w),t=await p.configurator.onFinalize(o,l);return n(t),{statusCode:200,body:JSON.stringify(t)}}).otherwise(o=>{throw Error(`Can not parse application type - unknown type: ${o}!`)})).with("fetchBackendData",async()=>{if(g.info("Handling fetch backend data operation."),!p.configurator?.onFetchBackendData)throw Error("Fetch backend data operation is not configured for this webhook!");let o=h.parse(w);return i(await p.configurator.onFetchBackendData(o,l),Object.entries(l.headers).find(([o])=>"accept-encoding"===o.toLowerCase())?.[1])}).otherwise(o=>{throw Error(`Can not parse webhook operation - unknown operation: ${o}!`)})},g);
|
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.12744a81f2",
|
|
4
4
|
"description": "Shared API, authentication, domain, chat, and webhook contracts for Phoenix.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salsita",
|
|
@@ -56,7 +56,7 @@
|
|
|
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.12744a81f2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@lingui/core": "5.9.5",
|