samva 0.51.0 → 0.53.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/AGENTS.md +5 -2
- package/README.md +1 -0
- package/dist/client/sdk.gen.d.ts +82 -36
- package/dist/client/sdk.gen.js +192 -57
- package/dist/client/types.gen.d.ts +607 -291
- package/dist/effect/campaigns.d.ts +56 -56
- package/dist/effect/descriptors/integrations-catalog.d.ts +1 -1
- package/dist/effect/descriptors/integrations-catalog.js +1 -1
- package/dist/effect/descriptors/integrations.d.ts +1 -1
- package/dist/effect/descriptors/integrations.js +1 -1
- package/dist/effect/descriptors/logs.d.ts +21 -0
- package/dist/effect/descriptors/logs.js +23 -0
- package/dist/effect/descriptors/whats-app.d.ts +1 -1
- package/dist/effect/descriptors/whats-app.js +1 -1
- package/dist/effect/events.d.ts +16 -0
- package/dist/effect/generated/agents.js +4 -4
- package/dist/effect/generated/campaigns.d.ts +18 -6
- package/dist/effect/generated/campaigns.js +2 -6
- package/dist/effect/generated/email.js +3 -3
- package/dist/effect/generated/events.d.ts +48 -0
- package/dist/effect/generated/events.js +1 -1
- package/dist/effect/generated/index.d.ts +3 -1
- package/dist/effect/generated/integrations-catalog.d.ts +93 -49
- package/dist/effect/generated/integrations-catalog.js +17 -28
- package/dist/effect/generated/integrations.d.ts +20 -40
- package/dist/effect/generated/integrations.js +9 -13
- package/dist/effect/generated/journeys.d.ts +1113 -67
- package/dist/effect/generated/journeys.js +14 -8
- package/dist/effect/generated/logs.d.ts +2323 -0
- package/dist/effect/generated/logs.js +312 -0
- package/dist/effect/generated/mailboxes.d.ts +38 -24
- package/dist/effect/generated/mailboxes.js +22 -21
- package/dist/effect/generated/messages.d.ts +11 -882
- package/dist/effect/generated/messages.js +4 -243
- package/dist/effect/generated/newsletter-domains.d.ts +61 -13
- package/dist/effect/generated/newsletter-domains.js +5 -5
- package/dist/effect/generated/newsletter-issues.d.ts +166 -34
- package/dist/effect/generated/newsletter-issues.js +12 -12
- package/dist/effect/generated/newsletters.d.ts +76 -16
- package/dist/effect/generated/newsletters.js +6 -6
- package/dist/effect/generated/organizations.js +1 -1
- package/dist/effect/generated/scheduled-messages.d.ts +36 -0
- package/dist/effect/generated/scheduled-messages.js +1 -1
- package/dist/effect/generated/shared.d.ts +1706 -442
- package/dist/effect/generated/shared.js +370 -93
- package/dist/effect/generated/subscriptions.d.ts +4 -4
- package/dist/effect/generated/subscriptions.js +2 -6
- package/dist/effect/generated/template-registrations.d.ts +46 -10
- package/dist/effect/generated/template-registrations.js +4 -4
- package/dist/effect/generated/templates.js +2 -2
- package/dist/effect/generated/whats-app-flows.d.ts +173 -35
- package/dist/effect/generated/whats-app-flows.js +19 -17
- package/dist/effect/generated/whats-app-setup-links.d.ts +61 -13
- package/dist/effect/generated/whats-app-setup-links.js +5 -5
- package/dist/effect/generated/whats-app.d.ts +187 -65
- package/dist/effect/generated/whats-app.js +18 -24
- package/dist/effect/generated-metadata.d.ts +15 -3
- package/dist/effect/generated-metadata.js +375 -349
- package/dist/effect/index.d.ts +1 -0
- package/dist/effect/index.js +2 -1
- package/dist/effect/integrations-catalog.d.ts +92 -4
- package/dist/effect/integrations.d.ts +40 -8
- package/dist/effect/internal/client.js +25 -3
- package/dist/effect/internal/log-events.d.ts +19 -0
- package/dist/effect/internal/log-events.js +53 -0
- package/dist/effect/internal/mailbox-events.d.ts +6 -2
- package/dist/effect/internal/mailbox-events.js +4 -3
- package/dist/effect/journeys.d.ts +212 -146
- package/dist/effect/logs.d.ts +149 -0
- package/dist/effect/logs.js +18 -0
- package/dist/effect/mailboxes.d.ts +158 -150
- package/dist/effect/mailboxes.js +1 -1
- package/dist/effect/newsletter-domains.d.ts +2 -2
- package/dist/effect/scheduled-messages.d.ts +66 -0
- package/dist/effect/whatsapp-flows.d.ts +30 -0
- package/dist/effect/whatsapp-setup-links.d.ts +2 -2
- package/dist/effect/whatsapp.d.ts +73 -3
- package/dist/mailbox-events.d.ts +50 -3
- package/dist/mailbox-events.js +38 -19
- package/dist/package.js +1 -1
- package/dist/promises/client.d.ts +3 -1
- package/dist/promises/client.js +3 -1
- package/dist/promises/errors.gen.d.ts +2 -0
- package/dist/promises/errors.gen.js +137 -34
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/request-id.d.ts +3 -0
- package/dist/request-id.js +7 -0
- package/dist/service-map.d.ts +14 -3
- package/package.json +6 -2
|
@@ -251,6 +251,33 @@ export declare const create: (input: {
|
|
|
251
251
|
} | null | undefined;
|
|
252
252
|
} | undefined;
|
|
253
253
|
readonly flowToken?: string | undefined;
|
|
254
|
+
readonly flowActionData?: {
|
|
255
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
256
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
257
|
+
} | null)[] | {
|
|
258
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
259
|
+
} | null)[] | {
|
|
260
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
261
|
+
} | null)[] | {
|
|
262
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
263
|
+
} | null)[] | {
|
|
264
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
265
|
+
} | null)[] | {
|
|
266
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
267
|
+
} | null)[] | {
|
|
268
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
269
|
+
} | null)[] | {
|
|
270
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
271
|
+
} | null)[] | {
|
|
272
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
273
|
+
} | null)[] | {
|
|
274
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
275
|
+
} | null)[] | {
|
|
276
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
277
|
+
} | null)[] | {
|
|
278
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
279
|
+
} | null | undefined;
|
|
280
|
+
} | undefined;
|
|
254
281
|
} | {
|
|
255
282
|
readonly templateSlug: string;
|
|
256
283
|
readonly templateData?: {
|
|
@@ -281,6 +308,33 @@ export declare const create: (input: {
|
|
|
281
308
|
} | null | undefined;
|
|
282
309
|
} | undefined;
|
|
283
310
|
readonly flowToken?: string | undefined;
|
|
311
|
+
readonly flowActionData?: {
|
|
312
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
313
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
314
|
+
} | null)[] | {
|
|
315
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
316
|
+
} | null)[] | {
|
|
317
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
318
|
+
} | null)[] | {
|
|
319
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
320
|
+
} | null)[] | {
|
|
321
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
322
|
+
} | null)[] | {
|
|
323
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
324
|
+
} | null)[] | {
|
|
325
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
326
|
+
} | null)[] | {
|
|
327
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
328
|
+
} | null)[] | {
|
|
329
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
330
|
+
} | null)[] | {
|
|
331
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
332
|
+
} | null)[] | {
|
|
333
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
334
|
+
} | null)[] | {
|
|
335
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
336
|
+
} | null | undefined;
|
|
337
|
+
} | undefined;
|
|
284
338
|
} | {
|
|
285
339
|
readonly media: {
|
|
286
340
|
readonly type: "image";
|
|
@@ -624,12 +678,18 @@ export declare const list: ((input?: {
|
|
|
624
678
|
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
625
679
|
};
|
|
626
680
|
readonly flowToken?: string;
|
|
681
|
+
readonly flowActionData?: {
|
|
682
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
683
|
+
};
|
|
627
684
|
} | {
|
|
628
685
|
readonly templateSlug: string;
|
|
629
686
|
readonly templateData?: {
|
|
630
687
|
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
631
688
|
};
|
|
632
689
|
readonly flowToken?: string;
|
|
690
|
+
readonly flowActionData?: {
|
|
691
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
692
|
+
};
|
|
633
693
|
} | {
|
|
634
694
|
readonly media: {
|
|
635
695
|
readonly type: "image";
|
|
@@ -949,12 +1009,18 @@ export declare const list: ((input?: {
|
|
|
949
1009
|
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
950
1010
|
};
|
|
951
1011
|
readonly flowToken?: string;
|
|
1012
|
+
readonly flowActionData?: {
|
|
1013
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
1014
|
+
};
|
|
952
1015
|
} | {
|
|
953
1016
|
readonly templateSlug: string;
|
|
954
1017
|
readonly templateData?: {
|
|
955
1018
|
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
956
1019
|
};
|
|
957
1020
|
readonly flowToken?: string;
|
|
1021
|
+
readonly flowActionData?: {
|
|
1022
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
1023
|
+
};
|
|
958
1024
|
} | {
|
|
959
1025
|
readonly media: {
|
|
960
1026
|
readonly type: "image";
|
|
@@ -2,6 +2,7 @@ export declare const create: (input: {
|
|
|
2
2
|
readonly projectId: string;
|
|
3
3
|
readonly handle: string;
|
|
4
4
|
readonly categories: readonly ("APPOINTMENT_BOOKING" | "CONTACT_US" | "CUSTOMER_SUPPORT" | "LEAD_GENERATION" | "OTHER" | "SIGN_IN" | "SIGN_UP" | "SURVEY")[];
|
|
5
|
+
readonly submissionHandler?: "agent" | "app" | undefined;
|
|
5
6
|
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappFlowsCreate">;
|
|
6
7
|
export declare const list: (input?: never, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappFlowsList">;
|
|
7
8
|
export declare const get: (input: {
|
|
@@ -11,6 +12,35 @@ export declare const recordVersion: (input: {
|
|
|
11
12
|
readonly id: string;
|
|
12
13
|
readonly commitSha: string;
|
|
13
14
|
readonly expectedWorkspaceRevision: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly flowJson: {
|
|
18
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
|
|
19
|
+
readonly [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null | undefined;
|
|
20
|
+
} | null)[] | {
|
|
21
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
22
|
+
} | null)[] | {
|
|
23
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
24
|
+
} | null)[] | {
|
|
25
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
26
|
+
} | null)[] | {
|
|
27
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
28
|
+
} | null)[] | {
|
|
29
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
30
|
+
} | null)[] | {
|
|
31
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
32
|
+
} | null)[] | {
|
|
33
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
34
|
+
} | null)[] | {
|
|
35
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
36
|
+
} | null)[] | {
|
|
37
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
38
|
+
} | null)[] | {
|
|
39
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
40
|
+
} | null)[] | {
|
|
41
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
42
|
+
} | null | undefined;
|
|
43
|
+
};
|
|
14
44
|
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappFlowsRecordVersion">;
|
|
15
45
|
export declare const listVersions: (input: {
|
|
16
46
|
readonly id: string;
|
|
@@ -35,7 +35,7 @@ export declare const list: ((input?: {
|
|
|
35
35
|
readonly updatedAt: string;
|
|
36
36
|
}[];
|
|
37
37
|
readonly nextCursor: string | null;
|
|
38
|
-
}, import("./errors.js").
|
|
38
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
39
39
|
readonly items: (input?: {
|
|
40
40
|
readonly limit?: number | null | undefined;
|
|
41
41
|
readonly cursor?: string | undefined;
|
|
@@ -56,7 +56,7 @@ export declare const list: ((input?: {
|
|
|
56
56
|
readonly revokedAt: string | null;
|
|
57
57
|
readonly createdAt: string;
|
|
58
58
|
readonly updatedAt: string;
|
|
59
|
-
}, import("./errors.js").
|
|
59
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
60
60
|
};
|
|
61
61
|
export declare const get: (input: {
|
|
62
62
|
readonly linkId: string;
|
|
@@ -19,13 +19,83 @@ export declare const getServiceWindowBilling: (input: {
|
|
|
19
19
|
export declare const getMediaDownloadUrl: (input: {
|
|
20
20
|
readonly deliveryId: string;
|
|
21
21
|
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappGetMediaDownloadUrl">;
|
|
22
|
-
export declare const listBusinessAccounts: (input?: {
|
|
23
|
-
readonly page?: number | null | undefined;
|
|
22
|
+
export declare const listBusinessAccounts: ((input?: {
|
|
24
23
|
readonly limit?: number | null | undefined;
|
|
24
|
+
readonly cursor?: string | undefined;
|
|
25
25
|
readonly isActive?: boolean | null | undefined;
|
|
26
26
|
readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
|
|
27
27
|
readonly namespaceId?: string | undefined;
|
|
28
|
-
} | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappListBusinessAccounts"
|
|
28
|
+
} | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappListBusinessAccounts">) & {
|
|
29
|
+
readonly pages: (input?: {
|
|
30
|
+
readonly limit?: number | null | undefined;
|
|
31
|
+
readonly cursor?: string | undefined;
|
|
32
|
+
readonly isActive?: boolean | null | undefined;
|
|
33
|
+
readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
|
|
34
|
+
readonly namespaceId?: string | undefined;
|
|
35
|
+
} | undefined) => import("effect/Stream").Stream<{
|
|
36
|
+
readonly items: readonly {
|
|
37
|
+
readonly id: string & import("effect/Brand").Brand<"WhatsAppBusinessAccountId">;
|
|
38
|
+
readonly organizationId: string;
|
|
39
|
+
readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
|
|
40
|
+
readonly phoneNumber: string;
|
|
41
|
+
readonly phoneNumberId: string;
|
|
42
|
+
readonly displayName: string;
|
|
43
|
+
readonly whatsappBusinessAccountId: string;
|
|
44
|
+
readonly verificationStatus: "failed" | "pending" | "suspended" | "verified";
|
|
45
|
+
readonly credentialStatus: "active" | "reconnect_required";
|
|
46
|
+
readonly tokenExpiresAt: string | null;
|
|
47
|
+
readonly isDefault: boolean;
|
|
48
|
+
readonly webhookUrl: string | null;
|
|
49
|
+
readonly qualityRating: "green" | "red" | "unknown" | "yellow";
|
|
50
|
+
readonly messagingLimit: string | null;
|
|
51
|
+
readonly currentLimit: number;
|
|
52
|
+
readonly businessPortfolioId: string | null;
|
|
53
|
+
readonly businessAppConnectedAt: string | null;
|
|
54
|
+
readonly businessAppDisconnectedAt: string | null;
|
|
55
|
+
readonly businessAppDisconnectReason: "accountDisconnected" | "businessDowngrade" | "changeNumber" | "companionInactivity" | "offboarded" | "partnerRemoved" | "primaryInactivity" | "userReRegistered" | null;
|
|
56
|
+
readonly contactsSyncRequestedAt: string | null;
|
|
57
|
+
readonly historySyncStatus: "completed" | "declined" | "importing" | "requested" | null;
|
|
58
|
+
readonly historySyncProgress: number | null;
|
|
59
|
+
readonly isActive: boolean;
|
|
60
|
+
readonly createdAt: string;
|
|
61
|
+
readonly updatedAt: string;
|
|
62
|
+
}[];
|
|
63
|
+
readonly nextCursor: string | null;
|
|
64
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
65
|
+
readonly items: (input?: {
|
|
66
|
+
readonly limit?: number | null | undefined;
|
|
67
|
+
readonly cursor?: string | undefined;
|
|
68
|
+
readonly isActive?: boolean | null | undefined;
|
|
69
|
+
readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
|
|
70
|
+
readonly namespaceId?: string | undefined;
|
|
71
|
+
} | undefined) => import("effect/Stream").Stream<{
|
|
72
|
+
readonly id: string & import("effect/Brand").Brand<"WhatsAppBusinessAccountId">;
|
|
73
|
+
readonly organizationId: string;
|
|
74
|
+
readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
|
|
75
|
+
readonly phoneNumber: string;
|
|
76
|
+
readonly phoneNumberId: string;
|
|
77
|
+
readonly displayName: string;
|
|
78
|
+
readonly whatsappBusinessAccountId: string;
|
|
79
|
+
readonly verificationStatus: "failed" | "pending" | "suspended" | "verified";
|
|
80
|
+
readonly credentialStatus: "active" | "reconnect_required";
|
|
81
|
+
readonly tokenExpiresAt: string | null;
|
|
82
|
+
readonly isDefault: boolean;
|
|
83
|
+
readonly webhookUrl: string | null;
|
|
84
|
+
readonly qualityRating: "green" | "red" | "unknown" | "yellow";
|
|
85
|
+
readonly messagingLimit: string | null;
|
|
86
|
+
readonly currentLimit: number;
|
|
87
|
+
readonly businessPortfolioId: string | null;
|
|
88
|
+
readonly businessAppConnectedAt: string | null;
|
|
89
|
+
readonly businessAppDisconnectedAt: string | null;
|
|
90
|
+
readonly businessAppDisconnectReason: "accountDisconnected" | "businessDowngrade" | "changeNumber" | "companionInactivity" | "offboarded" | "partnerRemoved" | "primaryInactivity" | "userReRegistered" | null;
|
|
91
|
+
readonly contactsSyncRequestedAt: string | null;
|
|
92
|
+
readonly historySyncStatus: "completed" | "declined" | "importing" | "requested" | null;
|
|
93
|
+
readonly historySyncProgress: number | null;
|
|
94
|
+
readonly isActive: boolean;
|
|
95
|
+
readonly createdAt: string;
|
|
96
|
+
readonly updatedAt: string;
|
|
97
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
98
|
+
};
|
|
29
99
|
export declare const connectBusinessAccount: (input: {
|
|
30
100
|
readonly code: string | import("effect/Redacted").Redacted<string>;
|
|
31
101
|
readonly wabaId: string;
|
package/dist/mailbox-events.d.ts
CHANGED
|
@@ -173,15 +173,56 @@ export declare const MAILBOX_EVENT_STREAM_PING_MILLIS = 30000;
|
|
|
173
173
|
* indistinguishable from a quiet mailbox.
|
|
174
174
|
*/
|
|
175
175
|
export declare const MAILBOX_EVENT_STREAM_IDLE_MILLIS: number;
|
|
176
|
+
export type EventStreamFrame = {
|
|
177
|
+
readonly kind: "event";
|
|
178
|
+
readonly cursor: string;
|
|
179
|
+
readonly id: string;
|
|
180
|
+
readonly event: {
|
|
181
|
+
readonly type: string;
|
|
182
|
+
readonly timestamp: string;
|
|
183
|
+
readonly data: unknown;
|
|
184
|
+
readonly match: unknown;
|
|
185
|
+
};
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: "live" | "progress";
|
|
188
|
+
readonly cursor: string;
|
|
189
|
+
} | {
|
|
190
|
+
readonly kind: "pong";
|
|
191
|
+
};
|
|
176
192
|
/** The events URL for an API origin: `https://api.samva.dev` → `wss://events.samva.dev/v1/…`. */
|
|
193
|
+
export declare const eventStreamUrl: (connection: Pick<MailboxEventStreamConnection, "baseUrl">, options: Pick<MailboxEventStreamOptions, "eventsUrl" | "cursor" | "mailboxIds">, path?: string) => URL;
|
|
177
194
|
export declare const mailboxEventsUrl: (connection: Pick<MailboxEventStreamConnection, "baseUrl">, options: Pick<MailboxEventStreamOptions, "eventsUrl" | "cursor" | "mailboxIds">) => URL;
|
|
195
|
+
/** A failure and whether the stream may try again after it. */
|
|
196
|
+
interface Outcome {
|
|
197
|
+
readonly error: MailboxEventStreamError;
|
|
198
|
+
readonly retry: boolean;
|
|
199
|
+
readonly retryAfterMillis?: number | undefined;
|
|
200
|
+
}
|
|
201
|
+
/** A refused upgrade, as the plain GET that follows it read it. */
|
|
202
|
+
interface Refusal {
|
|
203
|
+
readonly status: number;
|
|
204
|
+
readonly body: unknown;
|
|
205
|
+
readonly retryAfterSeconds: number | undefined;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* What a refusal means for the stream. Every 4xx except `408` and `429` ends it: the host will
|
|
209
|
+
* keep refusing the same request. `5xx`, `408`, and `429` retry, after the delay the host asked
|
|
210
|
+
* for when it asked for one.
|
|
211
|
+
*/
|
|
212
|
+
export declare const refusalOutcome: (refusal: Refusal) => Outcome;
|
|
178
213
|
/**
|
|
179
214
|
* A resumable stream of mailbox events. Iterate it with `for await`; break out of the loop or call
|
|
180
215
|
* {@link close} to end it.
|
|
181
216
|
*/
|
|
182
|
-
export declare class
|
|
217
|
+
export declare class EventStream<Event extends {
|
|
218
|
+
readonly cursor: string;
|
|
219
|
+
}> implements AsyncIterable<Event> {
|
|
183
220
|
#private;
|
|
184
|
-
|
|
221
|
+
private readonly path;
|
|
222
|
+
private readonly readEvent;
|
|
223
|
+
constructor(connection: MailboxEventStreamConnection, options: MailboxEventStreamOptions, path: string, readEvent: (frame: Extract<EventStreamFrame, {
|
|
224
|
+
kind: "event";
|
|
225
|
+
}>) => Event | undefined);
|
|
185
226
|
/**
|
|
186
227
|
* The position to resume from: the last handled event's cursor, or a later position the
|
|
187
228
|
* server confirmed with nothing in between for this stream. Undefined until there is one.
|
|
@@ -197,5 +238,11 @@ export declare class MailboxEventStream implements AsyncIterable<MailboxEvent> {
|
|
|
197
238
|
* {@link markHandled} was called, so a resume repeats it. A pending iteration finishes.
|
|
198
239
|
*/
|
|
199
240
|
close(): void;
|
|
200
|
-
[Symbol.asyncIterator](): AsyncIterator<
|
|
241
|
+
[Symbol.asyncIterator](): AsyncIterator<Event>;
|
|
242
|
+
}
|
|
243
|
+
/** The refusal's JSON body, or undefined when it is not JSON; reads at most {@link REFUSAL_BODY_LIMIT}. */
|
|
244
|
+
export declare const readRefusalBody: (response: Response) => Promise<unknown>;
|
|
245
|
+
export declare class MailboxEventStream extends EventStream<MailboxEvent> {
|
|
246
|
+
constructor(connection: MailboxEventStreamConnection, options?: MailboxEventStreamOptions);
|
|
201
247
|
}
|
|
248
|
+
export {};
|
package/dist/mailbox-events.js
CHANGED
|
@@ -126,7 +126,7 @@ const decodeFrame = (raw) => {
|
|
|
126
126
|
cursor: parsed.cursor
|
|
127
127
|
};
|
|
128
128
|
if (parsed.kind !== "event" || typeof parsed.id !== "string" || !isRecord(parsed.event)) return;
|
|
129
|
-
const { type, timestamp, data } = parsed.event;
|
|
129
|
+
const { type, timestamp, data, match } = parsed.event;
|
|
130
130
|
if (typeof type !== "string" || typeof timestamp !== "string") return void 0;
|
|
131
131
|
return {
|
|
132
132
|
kind: "event",
|
|
@@ -135,12 +135,13 @@ const decodeFrame = (raw) => {
|
|
|
135
135
|
event: {
|
|
136
136
|
type,
|
|
137
137
|
timestamp,
|
|
138
|
-
data
|
|
138
|
+
data,
|
|
139
|
+
match
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
142
|
};
|
|
142
143
|
/** The events URL for an API origin: `https://api.samva.dev` → `wss://events.samva.dev/v1/…`. */
|
|
143
|
-
const
|
|
144
|
+
const eventStreamUrl = (connection, options, path = MAILBOX_EVENT_STREAM_PATH) => {
|
|
144
145
|
const invalid = (message) => new MailboxEventStreamError({
|
|
145
146
|
_tag: "StreamClientError",
|
|
146
147
|
message
|
|
@@ -158,7 +159,7 @@ const mailboxEventsUrl = (connection, options) => {
|
|
|
158
159
|
if (url.protocol === "https:") url.protocol = "wss:";
|
|
159
160
|
else if (url.protocol === "http:") url.protocol = "ws:";
|
|
160
161
|
if (url.protocol !== "wss:" && url.protocol !== "ws:") throw invalid("The events origin must be an http, https, ws, or wss URL.");
|
|
161
|
-
url.pathname =
|
|
162
|
+
url.pathname = path;
|
|
162
163
|
url.search = "";
|
|
163
164
|
url.hash = "";
|
|
164
165
|
if (options.cursor !== void 0) url.searchParams.set("cursor", options.cursor);
|
|
@@ -255,7 +256,9 @@ const sleep = (millis, signal) => new Promise((resolve) => {
|
|
|
255
256
|
* A resumable stream of mailbox events. Iterate it with `for await`; break out of the loop or call
|
|
256
257
|
* {@link close} to end it.
|
|
257
258
|
*/
|
|
258
|
-
var
|
|
259
|
+
var EventStream = class {
|
|
260
|
+
path;
|
|
261
|
+
readEvent;
|
|
259
262
|
#connection;
|
|
260
263
|
#options;
|
|
261
264
|
#stop = new AbortController();
|
|
@@ -276,11 +279,13 @@ var MailboxEventStream = class {
|
|
|
276
279
|
#inHand;
|
|
277
280
|
#cursor;
|
|
278
281
|
#unacked = 0;
|
|
279
|
-
constructor(connection, options
|
|
282
|
+
constructor(connection, options, path, readEvent) {
|
|
283
|
+
this.path = path;
|
|
284
|
+
this.readEvent = readEvent;
|
|
280
285
|
this.#connection = connection;
|
|
281
286
|
this.#options = options;
|
|
282
287
|
this.#cursor = options.cursor;
|
|
283
|
-
|
|
288
|
+
eventStreamUrl(connection, options, path);
|
|
284
289
|
if (options.signal?.aborted) this.close();
|
|
285
290
|
else {
|
|
286
291
|
this.#callerSignal = options.signal;
|
|
@@ -484,10 +489,10 @@ var MailboxEventStream = class {
|
|
|
484
489
|
}));
|
|
485
490
|
return resolve({ kind: "stopped" });
|
|
486
491
|
}
|
|
487
|
-
const url =
|
|
492
|
+
const url = eventStreamUrl(this.#connection, {
|
|
488
493
|
...this.#options,
|
|
489
494
|
cursor: this.#resumeCursor()
|
|
490
|
-
});
|
|
495
|
+
}, this.path);
|
|
491
496
|
let opened = false;
|
|
492
497
|
let settled = false;
|
|
493
498
|
let idleTimer;
|
|
@@ -544,13 +549,16 @@ var MailboxEventStream = class {
|
|
|
544
549
|
}
|
|
545
550
|
if (frame.kind === "pong") return;
|
|
546
551
|
if (frame.kind === "event") {
|
|
547
|
-
this
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
const event = this.readEvent(frame);
|
|
553
|
+
if (event === void 0) {
|
|
554
|
+
this.#fail(new MailboxEventStreamError({
|
|
555
|
+
_tag: "StreamProtocolError",
|
|
556
|
+
message: DESCRIPTION.StreamProtocolError,
|
|
557
|
+
cursor: this.#cursor
|
|
558
|
+
}));
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
this.#queue.push(event);
|
|
554
562
|
this.#wake();
|
|
555
563
|
return;
|
|
556
564
|
}
|
|
@@ -580,10 +588,10 @@ var MailboxEventStream = class {
|
|
|
580
588
|
* are worth a retry.
|
|
581
589
|
*/
|
|
582
590
|
async #diagnose() {
|
|
583
|
-
const url =
|
|
591
|
+
const url = eventStreamUrl(this.#connection, {
|
|
584
592
|
...this.#options,
|
|
585
593
|
cursor: this.#resumeCursor()
|
|
586
|
-
});
|
|
594
|
+
}, this.path);
|
|
587
595
|
url.protocol = url.protocol === "wss:" ? "https:" : "http:";
|
|
588
596
|
const deadline = new AbortController();
|
|
589
597
|
const onStop = () => deadline.abort();
|
|
@@ -653,6 +661,17 @@ const readRefusalBody = async (response) => {
|
|
|
653
661
|
return;
|
|
654
662
|
}
|
|
655
663
|
};
|
|
656
|
-
|
|
664
|
+
var MailboxEventStream = class extends EventStream {
|
|
665
|
+
constructor(connection, options = {}) {
|
|
666
|
+
super(connection, options, MAILBOX_EVENT_STREAM_PATH, (frame) => ({
|
|
667
|
+
cursor: frame.cursor,
|
|
668
|
+
id: frame.id,
|
|
669
|
+
type: frame.event.type,
|
|
670
|
+
timestamp: frame.event.timestamp,
|
|
671
|
+
data: isRecord(frame.event.data) ? frame.event.data : {}
|
|
672
|
+
}));
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
export { EventStream, MAILBOX_EVENT_STREAM_IDLE_MILLIS, MAILBOX_EVENT_STREAM_PING_MILLIS, MailboxEventStream, MailboxEventStreamCloseCode, MailboxEventStreamError, eventStreamUrl, readRefusalBody, refusalOutcome };
|
|
657
676
|
|
|
658
677
|
//# sourceMappingURL=mailbox-events.js.map
|
package/dist/package.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
import { type Client, type Config } from "../client/client/index.js";
|
|
30
|
-
import { Agents as agents, Accounts as accounts, Integrations as integrations, IntegrationCatalog as integrationCatalog, Whatsapp as whatsapp, WhatsappFlows as whatsappFlows, WhatsappSetupLinks as whatsappSetupLinks, TemplateRegistrations as templateRegistrations, TemplateShareLinks as templateShareLinks, Analytics as analytics, ApiKeys as apiKeys, ApprovalRequests as approvalRequests, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, Events as events, Feedback as feedback, Journeys as journeys, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, Policies as policies, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen.js";
|
|
30
|
+
import { Agents as agents, Accounts as accounts, Integrations as integrations, IntegrationCatalog as integrationCatalog, Whatsapp as whatsapp, WhatsappFlows as whatsappFlows, WhatsappSetupLinks as whatsappSetupLinks, TemplateRegistrations as templateRegistrations, TemplateShareLinks as templateShareLinks, Analytics as analytics, ApiKeys as apiKeys, ApprovalRequests as approvalRequests, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, Events as events, Feedback as feedback, Journeys as journeys, Logs as logs, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, Policies as policies, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen.js";
|
|
31
31
|
import type { MessagesSendData } from "../client/types.gen.js";
|
|
32
32
|
import { MailboxEventStream, type MailboxEventStreamOptions } from "../mailbox-events.js";
|
|
33
33
|
import { type RequestPolicy } from "./request.js";
|
|
@@ -170,6 +170,7 @@ export interface SamvaRawClient {
|
|
|
170
170
|
readonly feedback: typeof feedback;
|
|
171
171
|
readonly whoami: typeof whoami;
|
|
172
172
|
readonly journeys: typeof journeys;
|
|
173
|
+
readonly logs: typeof logs;
|
|
173
174
|
readonly mailboxes: typeof mailboxes;
|
|
174
175
|
readonly namespaces: typeof namespaces;
|
|
175
176
|
}
|
|
@@ -184,6 +185,7 @@ export type PromiseMailboxesService = DirectService<typeof mailboxes> & {
|
|
|
184
185
|
export interface SamvaClient {
|
|
185
186
|
/** Bound, unmodified Hey API methods and their original result envelopes. */
|
|
186
187
|
readonly raw: SamvaRawClient;
|
|
188
|
+
readonly logs: DirectService<typeof logs>;
|
|
187
189
|
readonly messages: DirectService<PromiseMessagesTransport>;
|
|
188
190
|
readonly scheduledMessages: DirectService<typeof scheduledMessages>;
|
|
189
191
|
readonly brands: DirectService<typeof brands>;
|
package/dist/promises/client.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createClient as createClient$1 } from "../client/client/client.gen.js";
|
|
|
4
4
|
import { SamvaOperations } from "../effect/generated-metadata.js";
|
|
5
5
|
import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTimeoutError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, ShareLinkUnavailable, SlugTaken, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, fromApiError } from "./errors.gen.js";
|
|
6
6
|
import { configureRequests, startAttempt, uploadTimeout } from "./request.js";
|
|
7
|
-
import { Accounts, Agents, Analytics, ApiKeys, ApprovalRequests, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, Feedback, IntegrationCatalog, Integrations, Journeys, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, Policies, ScheduledMessages, Subscriptions, TemplateRegistrations, TemplateShareLinks, Templates, TopicForms, Topics, Webhooks, Whatsapp, WhatsappFlows, WhatsappSetupLinks, Whoami } from "../client/sdk.gen.js";
|
|
7
|
+
import { Accounts, Agents, Analytics, ApiKeys, ApprovalRequests, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, Feedback, IntegrationCatalog, Integrations, Journeys, Logs, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, Policies, ScheduledMessages, Subscriptions, TemplateRegistrations, TemplateShareLinks, Templates, TopicForms, Topics, Webhooks, Whatsapp, WhatsappFlows, WhatsappSetupLinks, Whoami } from "../client/sdk.gen.js";
|
|
8
8
|
import { MediaUploadError, mediaCreateBody, planInlineUploads, withUploadedAttachments } from "../inline-attachments.js";
|
|
9
9
|
import { MailboxEventStream } from "../mailbox-events.js";
|
|
10
10
|
import { buildEmailSendPayload, buildMessagesSendPayload, replyToEmailsPayload } from "../normalize.js";
|
|
@@ -286,6 +286,7 @@ function makeClient(config) {
|
|
|
286
286
|
feedback: createBoundService(Feedback, clientInstance),
|
|
287
287
|
whoami: createBoundService(Whoami, clientInstance),
|
|
288
288
|
journeys: createBoundService(Journeys, clientInstance),
|
|
289
|
+
logs: createBoundService(Logs, clientInstance),
|
|
289
290
|
mailboxes: createBoundService(Mailboxes, clientInstance),
|
|
290
291
|
namespaces: createBoundService(Namespaces, clientInstance)
|
|
291
292
|
};
|
|
@@ -298,6 +299,7 @@ function makeClient(config) {
|
|
|
298
299
|
const promiseEmail = createPromiseEmailTransport(clientInstance);
|
|
299
300
|
const result = {
|
|
300
301
|
raw,
|
|
302
|
+
logs: createDirectService(raw.logs),
|
|
301
303
|
messages: createDirectService(promiseMessages),
|
|
302
304
|
scheduledMessages: createDirectService(raw.scheduledMessages),
|
|
303
305
|
brands: createDirectService(raw.brands),
|
|
@@ -10,6 +10,7 @@ export declare abstract class SamvaApiError<Tag extends SamvaApiErrorTag = Samva
|
|
|
10
10
|
readonly request: Request | undefined;
|
|
11
11
|
readonly response: Response | undefined;
|
|
12
12
|
readonly status: number | undefined;
|
|
13
|
+
readonly requestId: string | undefined;
|
|
13
14
|
protected constructor(message: string, context?: SamvaApiErrorContext);
|
|
14
15
|
}
|
|
15
16
|
/** A transport or malformed-response failure that is not part of the API error contract. */
|
|
@@ -18,6 +19,7 @@ export declare class SamvaTransportError extends Error {
|
|
|
18
19
|
readonly request: Request | undefined;
|
|
19
20
|
readonly response: Response | undefined;
|
|
20
21
|
readonly status: number | undefined;
|
|
22
|
+
readonly requestId: string | undefined;
|
|
21
23
|
readonly cause: unknown;
|
|
22
24
|
constructor(cause: unknown, context?: SamvaApiErrorContext);
|
|
23
25
|
}
|