samva 0.55.0 → 0.56.1
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 +2 -2
- package/README.md +9 -8
- package/dist/client/sdk.gen.d.ts +13 -4
- package/dist/client/sdk.gen.js +32 -1
- package/dist/client/types.gen.d.ts +66 -6
- package/dist/effect/accounts.js +9 -10
- package/dist/effect/agents.js +16 -17
- package/dist/effect/analytics.js +9 -10
- package/dist/effect/api-keys.js +11 -12
- package/dist/effect/approval-requests.js +7 -8
- package/dist/effect/attachments.js +7 -8
- package/dist/effect/brands.js +9 -10
- package/dist/effect/campaigns.js +18 -19
- package/dist/effect/contact-groups.js +13 -14
- package/dist/effect/contacts.js +29 -30
- package/dist/effect/conversations.js +16 -17
- package/dist/effect/custom-fields.js +7 -8
- package/dist/effect/descriptors/accounts.d.ts +50 -52
- package/dist/effect/descriptors/accounts.js +50 -52
- package/dist/effect/descriptors/agents.d.ts +113 -115
- package/dist/effect/descriptors/agents.js +120 -122
- package/dist/effect/descriptors/analytics.d.ts +47 -49
- package/dist/effect/descriptors/analytics.js +42 -44
- package/dist/effect/descriptors/api-keys.d.ts +69 -71
- package/dist/effect/descriptors/api-keys.js +73 -75
- package/dist/effect/descriptors/approval-requests.d.ts +34 -36
- package/dist/effect/descriptors/approval-requests.js +36 -38
- package/dist/effect/descriptors/attachments.d.ts +34 -36
- package/dist/effect/descriptors/attachments.js +36 -38
- package/dist/effect/descriptors/brands.d.ts +51 -53
- package/dist/effect/descriptors/brands.js +53 -55
- package/dist/effect/descriptors/campaigns.d.ts +130 -132
- package/dist/effect/descriptors/campaigns.js +137 -139
- package/dist/effect/descriptors/contact-groups.d.ts +86 -88
- package/dist/effect/descriptors/contact-groups.js +90 -92
- package/dist/effect/descriptors/contacts.d.ts +242 -244
- package/dist/effect/descriptors/contacts.js +227 -229
- package/dist/effect/descriptors/conversations.d.ts +114 -116
- package/dist/effect/descriptors/conversations.js +123 -125
- package/dist/effect/descriptors/custom-fields.d.ts +33 -35
- package/dist/effect/descriptors/custom-fields.js +33 -35
- package/dist/effect/descriptors/email.d.ts +623 -625
- package/dist/effect/descriptors/email.js +562 -578
- package/dist/effect/descriptors/events.d.ts +15 -17
- package/dist/effect/descriptors/events.js +14 -16
- package/dist/effect/descriptors/feedback.d.ts +7 -9
- package/dist/effect/descriptors/feedback.js +3 -3
- package/dist/effect/descriptors/integrations-catalog.d.ts +159 -161
- package/dist/effect/descriptors/integrations-catalog.js +142 -144
- package/dist/effect/descriptors/integrations.d.ts +60 -62
- package/dist/effect/descriptors/integrations.js +63 -65
- package/dist/effect/descriptors/journeys.d.ts +123 -125
- package/dist/effect/descriptors/journeys.js +133 -135
- package/dist/effect/descriptors/logs.d.ts +16 -18
- package/dist/effect/descriptors/logs.js +16 -18
- package/dist/effect/descriptors/mailboxes.d.ts +780 -782
- package/dist/effect/descriptors/mailboxes.js +795 -797
- package/dist/effect/descriptors/media.d.ts +43 -45
- package/dist/effect/descriptors/media.js +46 -48
- package/dist/effect/descriptors/messages.d.ts +86 -88
- package/dist/effect/descriptors/messages.js +83 -92
- package/dist/effect/descriptors/namespaces.d.ts +96 -98
- package/dist/effect/descriptors/namespaces.js +107 -109
- package/dist/effect/descriptors/newsletter-domains.d.ts +35 -37
- package/dist/effect/descriptors/newsletter-domains.js +39 -41
- package/dist/effect/descriptors/newsletter-issues.d.ts +98 -100
- package/dist/effect/descriptors/newsletter-issues.js +109 -111
- package/dist/effect/descriptors/newsletters.d.ts +43 -45
- package/dist/effect/descriptors/newsletters.js +46 -48
- package/dist/effect/descriptors/operations.d.ts +25 -27
- package/dist/effect/descriptors/operations.js +26 -28
- package/dist/effect/descriptors/organizations.d.ts +96 -98
- package/dist/effect/descriptors/organizations.js +86 -88
- package/dist/effect/descriptors/phone-numbers.d.ts +41 -43
- package/dist/effect/descriptors/phone-numbers.js +40 -42
- package/dist/effect/descriptors/policies.d.ts +26 -28
- package/dist/effect/descriptors/policies.js +29 -31
- package/dist/effect/descriptors/scheduled-messages.d.ts +42 -44
- package/dist/effect/descriptors/scheduled-messages.js +43 -45
- package/dist/effect/descriptors/subscriptions.d.ts +7 -9
- package/dist/effect/descriptors/subscriptions.js +3 -3
- package/dist/effect/descriptors/template-registrations.d.ts +26 -28
- package/dist/effect/descriptors/template-registrations.js +29 -31
- package/dist/effect/descriptors/template-share-links.d.ts +44 -46
- package/dist/effect/descriptors/template-share-links.js +49 -51
- package/dist/effect/descriptors/templates.d.ts +361 -363
- package/dist/effect/descriptors/templates.js +348 -350
- package/dist/effect/descriptors/topic-forms.d.ts +44 -46
- package/dist/effect/descriptors/topic-forms.js +49 -51
- package/dist/effect/descriptors/topics.d.ts +77 -79
- package/dist/effect/descriptors/topics.js +80 -82
- package/dist/effect/descriptors/webhooks.d.ts +96 -98
- package/dist/effect/descriptors/webhooks.js +103 -105
- package/dist/effect/descriptors/whats-app-flows.d.ts +86 -88
- package/dist/effect/descriptors/whats-app-flows.js +90 -92
- package/dist/effect/descriptors/whats-app-setup-links.d.ts +33 -35
- package/dist/effect/descriptors/whats-app-setup-links.js +33 -35
- package/dist/effect/descriptors/whats-app.d.ts +111 -103
- package/dist/effect/descriptors/whats-app.js +111 -103
- package/dist/effect/descriptors/whoami.d.ts +7 -9
- package/dist/effect/descriptors/whoami.js +3 -3
- package/dist/effect/email.js +66 -67
- package/dist/effect/events.js +5 -6
- package/dist/effect/feedback.js +4 -4
- package/dist/effect/generated/accounts.d.ts +144 -142
- package/dist/effect/generated/accounts.js +14 -9
- package/dist/effect/generated/agents.d.ts +1502 -1493
- package/dist/effect/generated/agents.js +28 -16
- package/dist/effect/generated/analytics.d.ts +55 -53
- package/dist/effect/generated/analytics.js +14 -9
- package/dist/effect/generated/api-keys.d.ts +216 -212
- package/dist/effect/generated/api-keys.js +18 -11
- package/dist/effect/generated/approval-requests.d.ts +60 -60
- package/dist/effect/generated/approval-requests.js +10 -7
- package/dist/effect/generated/attachments.d.ts +32 -32
- package/dist/effect/generated/attachments.js +10 -7
- package/dist/effect/generated/brands.d.ts +179 -177
- package/dist/effect/generated/brands.js +14 -9
- package/dist/effect/generated/campaigns.d.ts +1083 -1072
- package/dist/effect/generated/campaigns.js +32 -18
- package/dist/effect/generated/contact-events.d.ts +3 -6
- package/dist/effect/generated/contact-events.js +4 -4
- package/dist/effect/generated/contact-groups.d.ts +186 -180
- package/dist/effect/generated/contact-groups.js +22 -13
- package/dist/effect/generated/contacts.d.ts +1565 -1545
- package/dist/effect/generated/contacts.js +50 -27
- package/dist/effect/generated/conversations.d.ts +340 -331
- package/dist/effect/generated/conversations.js +28 -16
- package/dist/effect/generated/custom-fields.d.ts +63 -63
- package/dist/effect/generated/custom-fields.js +10 -7
- package/dist/effect/generated/email.d.ts +2731 -2671
- package/dist/effect/generated/email.js +130 -67
- package/dist/effect/generated/events.d.ts +160 -162
- package/dist/effect/generated/events.js +6 -5
- package/dist/effect/generated/feedback.d.ts +3 -6
- package/dist/effect/generated/feedback.js +4 -4
- package/dist/effect/generated/index.d.ts +174 -45
- package/dist/effect/generated/integrations-catalog.d.ts +459 -446
- package/dist/effect/generated/integrations-catalog.js +36 -20
- package/dist/effect/generated/integrations.d.ts +155 -152
- package/dist/effect/generated/integrations.js +16 -10
- package/dist/effect/generated/journeys.d.ts +864 -854
- package/dist/effect/generated/journeys.js +30 -17
- package/dist/effect/generated/logs.d.ts +147 -149
- package/dist/effect/generated/logs.js +6 -5
- package/dist/effect/generated/mailboxes.d.ts +7271 -7196
- package/dist/effect/generated/mailboxes.js +160 -82
- package/dist/effect/generated/media.d.ts +77 -76
- package/dist/effect/generated/media.js +12 -8
- package/dist/effect/generated/messages.d.ts +1092 -1086
- package/dist/effect/generated/messages.js +22 -13
- package/dist/effect/generated/namespaces.d.ts +184 -177
- package/dist/effect/generated/namespaces.js +24 -14
- package/dist/effect/generated/newsletter-domains.d.ts +57 -57
- package/dist/effect/generated/newsletter-domains.js +10 -7
- package/dist/effect/generated/newsletter-issues.d.ts +225 -218
- package/dist/effect/generated/newsletter-issues.js +24 -14
- package/dist/effect/generated/newsletters.d.ts +46 -45
- package/dist/effect/generated/newsletters.js +12 -8
- package/dist/effect/generated/operations.d.ts +79 -80
- package/dist/effect/generated/operations.js +8 -6
- package/dist/effect/generated/organizations.d.ts +438 -430
- package/dist/effect/generated/organizations.js +26 -15
- package/dist/effect/generated/phone-numbers.d.ts +87 -86
- package/dist/effect/generated/phone-numbers.js +12 -8
- package/dist/effect/generated/policies.d.ts +64 -65
- package/dist/effect/generated/policies.js +8 -6
- package/dist/effect/generated/scheduled-messages.d.ts +66 -65
- package/dist/effect/generated/scheduled-messages.js +12 -8
- package/dist/effect/generated/shared.d.ts +37 -37
- package/dist/effect/generated/shared.js +63 -61
- package/dist/effect/generated/subscriptions.d.ts +3 -6
- package/dist/effect/generated/subscriptions.js +4 -4
- package/dist/effect/generated/template-registrations.d.ts +142 -134
- package/dist/effect/generated/template-registrations.js +9 -6
- package/dist/effect/generated/template-share-links.d.ts +25 -24
- package/dist/effect/generated/template-share-links.js +12 -8
- package/dist/effect/generated/templates.d.ts +2678 -2645
- package/dist/effect/generated/templates.js +76 -40
- package/dist/effect/generated/topic-forms.d.ts +47 -46
- package/dist/effect/generated/topic-forms.js +12 -8
- package/dist/effect/generated/topics.d.ts +204 -199
- package/dist/effect/generated/topics.js +20 -12
- package/dist/effect/generated/webhooks.d.ts +284 -277
- package/dist/effect/generated/webhooks.js +28 -14
- package/dist/effect/generated/whats-app-flows.d.ts +250 -244
- package/dist/effect/generated/whats-app-flows.js +22 -13
- package/dist/effect/generated/whats-app-setup-links.d.ts +107 -107
- package/dist/effect/generated/whats-app-setup-links.js +10 -7
- package/dist/effect/generated/whats-app.d.ts +482 -298
- package/dist/effect/generated/whats-app.js +58 -16
- package/dist/effect/generated/whoami.d.ts +3 -6
- package/dist/effect/generated/whoami.js +4 -4
- package/dist/effect/generated-metadata.d.ts +6 -0
- package/dist/effect/generated-metadata.js +1 -0
- package/dist/effect/integrations-catalog.js +20 -21
- package/dist/effect/integrations.js +10 -11
- package/dist/effect/internal/client.d.ts +2 -1
- package/dist/effect/internal/client.js +3 -3
- package/dist/effect/internal/email-sender.js +5 -4
- package/dist/effect/internal/operation.d.ts +11 -7
- package/dist/effect/internal/operation.js +17 -12
- package/dist/effect/internal/send.js +11 -8
- package/dist/effect/journeys.js +17 -18
- package/dist/effect/logs.js +5 -6
- package/dist/effect/mailboxes.js +82 -83
- package/dist/effect/media.js +8 -9
- package/dist/effect/messages.js +12 -13
- package/dist/effect/namespaces.js +14 -15
- package/dist/effect/newsletter-domains.js +7 -8
- package/dist/effect/newsletter-issues.js +14 -15
- package/dist/effect/newsletters.js +8 -9
- package/dist/effect/operations.js +6 -7
- package/dist/effect/organizations.js +15 -16
- package/dist/effect/phone-numbers.js +8 -9
- package/dist/effect/policies.js +6 -7
- package/dist/effect/runtime.js +3 -3
- package/dist/effect/scheduled-messages.js +8 -9
- package/dist/effect/subscriptions.js +4 -4
- package/dist/effect/template-registrations.js +6 -7
- package/dist/effect/template-share-links.js +8 -9
- package/dist/effect/templates.js +40 -41
- package/dist/effect/topic-forms.js +8 -9
- package/dist/effect/topics.js +12 -13
- package/dist/effect/webhooks.d.ts +4 -4
- package/dist/effect/webhooks.js +14 -15
- package/dist/effect/whatsapp-flows.js +13 -14
- package/dist/effect/whatsapp-setup-links.js +7 -8
- package/dist/effect/whatsapp.d.ts +6 -0
- package/dist/effect/whatsapp.js +18 -17
- package/dist/effect/whoami.js +4 -4
- package/dist/package.json.js +1 -1
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/service-map.d.ts +5 -0
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NonEmptySensitiveString, SensitiveString } from "../runtime.js";
|
|
2
|
-
import { HttpApiEndpoint,
|
|
2
|
+
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
|
-
import { ApiKeySecurityMiddleware, BillingProviderError, CampaignId, ConflictError, CredentialsError, ForbiddenError, GatewayTimeoutError, InternalError, JourneyId, MalformedRequestError, MessageDeliveryId, NamespaceId, PaymentRequiredError, ResourceNotFoundError, TemplateId, UnauthorizedError, ValidationError, WhatsAppBusinessAccountId, WhatsAppChannelError } from "./shared.js";
|
|
4
|
+
import { ApiKeySecurityMiddleware, BillingProviderError, CampaignId, ConflictError, CredentialsError, ForbiddenError, GatewayTimeoutError, InternalError, JourneyId, MalformedRequestError, MessageDeliveryId, NamespaceId, OrganizationId, PaymentRequiredError, ResourceNotFoundError, TemplateId, UnauthorizedError, ValidationError, WhatsAppBusinessAccountId, WhatsAppChannelError } from "./shared.js";
|
|
5
5
|
// src/effect/generated/whats-app.ts
|
|
6
6
|
const WhatsAppServiceWindowId = /* @__PURE__ */ (() => Schema.String.check(Schema.isPattern(new globalThis.RegExp("^wasw_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
|
|
7
7
|
expected: "a string matching the RegExp ^wasw_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
@@ -107,6 +107,7 @@ const WhatsappListBusinessAccounts200 = /* @__PURE__ */ (() => Schema.Struct({
|
|
|
107
107
|
]), Schema.Null]),
|
|
108
108
|
historySyncProgress: Schema.Union([Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ expected: "a value less than or equal to 100" })), Schema.Null]),
|
|
109
109
|
isActive: Schema.Boolean,
|
|
110
|
+
releasedAt: Schema.optionalKey(Schema.String),
|
|
110
111
|
createdAt: Schema.String,
|
|
111
112
|
updatedAt: Schema.String
|
|
112
113
|
})),
|
|
@@ -177,6 +178,7 @@ const WhatsappConnectBusinessAccount201 = /* @__PURE__ */ (() => Schema.Struct({
|
|
|
177
178
|
]), Schema.Null]),
|
|
178
179
|
historySyncProgress: Schema.Union([Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ expected: "a value less than or equal to 100" })), Schema.Null]),
|
|
179
180
|
isActive: Schema.Boolean,
|
|
181
|
+
releasedAt: Schema.optionalKey(Schema.String),
|
|
180
182
|
createdAt: Schema.String,
|
|
181
183
|
updatedAt: Schema.String
|
|
182
184
|
}))();
|
|
@@ -244,6 +246,7 @@ const WhatsappGetBusinessAccount200 = /* @__PURE__ */ (() => Schema.Struct({
|
|
|
244
246
|
]), Schema.Null]),
|
|
245
247
|
historySyncProgress: Schema.Union([Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ expected: "a value less than or equal to 100" })), Schema.Null]),
|
|
246
248
|
isActive: Schema.Boolean,
|
|
249
|
+
releasedAt: Schema.optionalKey(Schema.String),
|
|
247
250
|
createdAt: Schema.String,
|
|
248
251
|
updatedAt: Schema.String
|
|
249
252
|
}))();
|
|
@@ -321,6 +324,7 @@ const WhatsappUpdateBusinessAccount200 = /* @__PURE__ */ (() => Schema.Struct({
|
|
|
321
324
|
]), Schema.Null]),
|
|
322
325
|
historySyncProgress: Schema.Union([Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ expected: "a value less than or equal to 100" })), Schema.Null]),
|
|
323
326
|
isActive: Schema.Boolean,
|
|
327
|
+
releasedAt: Schema.optionalKey(Schema.String),
|
|
324
328
|
createdAt: Schema.String,
|
|
325
329
|
updatedAt: Schema.String
|
|
326
330
|
}))();
|
|
@@ -331,6 +335,17 @@ const WhatsappUpdateBusinessAccount404 = ResourceNotFoundError;
|
|
|
331
335
|
const WhatsappUpdateBusinessAccount422 = ValidationError;
|
|
332
336
|
const WhatsappUpdateBusinessAccount500 = InternalError;
|
|
333
337
|
const WhatsappUpdateBusinessAccount504 = GatewayTimeoutError;
|
|
338
|
+
const WhatsappReleaseBusinessAccountPathParams = /* @__PURE__ */ (() => Schema.Struct({ accountId: WhatsAppBusinessAccountId }))();
|
|
339
|
+
const WhatsappReleaseBusinessAccountRequestJson = /* @__PURE__ */ (() => Schema.Struct({ targetOrganizationId: OrganizationId }))();
|
|
340
|
+
const WhatsappReleaseBusinessAccount200 = /* @__PURE__ */ (() => Schema.Struct({ success: Schema.Literal(true) }))();
|
|
341
|
+
const WhatsappReleaseBusinessAccount400 = MalformedRequestError;
|
|
342
|
+
const WhatsappReleaseBusinessAccount401 = UnauthorizedError;
|
|
343
|
+
const WhatsappReleaseBusinessAccount403 = ForbiddenError;
|
|
344
|
+
const WhatsappReleaseBusinessAccount404 = ResourceNotFoundError;
|
|
345
|
+
const WhatsappReleaseBusinessAccount409 = ConflictError;
|
|
346
|
+
const WhatsappReleaseBusinessAccount422 = ValidationError;
|
|
347
|
+
const WhatsappReleaseBusinessAccount500 = InternalError;
|
|
348
|
+
const WhatsappReleaseBusinessAccount504 = GatewayTimeoutError;
|
|
334
349
|
const WhatsappSetDefaultBusinessAccountPathParams = /* @__PURE__ */ (() => Schema.Struct({ accountId: WhatsAppBusinessAccountId }))();
|
|
335
350
|
const WhatsappSetDefaultBusinessAccount200 = /* @__PURE__ */ (() => Schema.Struct({
|
|
336
351
|
id: WhatsAppBusinessAccountId,
|
|
@@ -385,6 +400,7 @@ const WhatsappSetDefaultBusinessAccount200 = /* @__PURE__ */ (() => Schema.Struc
|
|
|
385
400
|
]), Schema.Null]),
|
|
386
401
|
historySyncProgress: Schema.Union([Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ expected: "a value less than or equal to 100" })), Schema.Null]),
|
|
387
402
|
isActive: Schema.Boolean,
|
|
403
|
+
releasedAt: Schema.optionalKey(Schema.String),
|
|
388
404
|
createdAt: Schema.String,
|
|
389
405
|
updatedAt: Schema.String
|
|
390
406
|
}))();
|
|
@@ -500,7 +516,7 @@ const WhatsappGetTemplateStats403 = ForbiddenError;
|
|
|
500
516
|
const WhatsappGetTemplateStats422 = ValidationError;
|
|
501
517
|
const WhatsappGetTemplateStats500 = InternalError;
|
|
502
518
|
const WhatsappGetTemplateStats504 = GatewayTimeoutError;
|
|
503
|
-
|
|
519
|
+
const WhatsappListBusinessAccountsEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappListBusinessAccounts", "/v1/whatsapp/business-accounts", {
|
|
504
520
|
query: WhatsappListBusinessAccountsQuery,
|
|
505
521
|
success: WhatsappListBusinessAccounts200,
|
|
506
522
|
error: [
|
|
@@ -511,7 +527,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
511
527
|
WhatsappListBusinessAccounts500,
|
|
512
528
|
WhatsappListBusinessAccounts504.pipe(HttpApiSchema.status(504))
|
|
513
529
|
]
|
|
514
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.listBusinessAccounts").annotate(OpenApi.Summary, "List WhatsApp business accounts").annotate(OpenApi.Description, "Lists connected WhatsApp business accounts, newest first. Pass nextCursor back as cursor to continue.")
|
|
530
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.listBusinessAccounts").annotate(OpenApi.Summary, "List WhatsApp business accounts").annotate(OpenApi.Description, "Lists connected WhatsApp business accounts, newest first. Pass nextCursor back as cursor to continue."))();
|
|
531
|
+
const WhatsappConnectBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.post("whatsappConnectBusinessAccount", "/v1/whatsapp/business-accounts", {
|
|
515
532
|
payload: WhatsappConnectBusinessAccountRequestJson,
|
|
516
533
|
success: WhatsappConnectBusinessAccount201.pipe(HttpApiSchema.status(201)),
|
|
517
534
|
error: [
|
|
@@ -526,7 +543,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
526
543
|
WhatsappConnectBusinessAccount502.pipe(HttpApiSchema.status(502)),
|
|
527
544
|
WhatsappConnectBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
528
545
|
]
|
|
529
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.connectBusinessAccount").annotate(OpenApi.Summary, "Connect a WhatsApp business account").annotate(OpenApi.Description, "Completes embedded signup: exchanges its code for the business's Meta token, checks the token grants Samva both WhatsApp permissions over the WABA, subscribes Samva to the WABA's webhooks, and registers the phone number with the Cloud API. A number that stays on the WhatsApp Business app (coexistence) is already registered, so it skips registration and Samva asks Meta to sync its contacts and chat history. A number Meta has not verified yet connects as pending; sync it once verification finishes.")
|
|
546
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.connectBusinessAccount").annotate(OpenApi.Summary, "Connect a WhatsApp business account").annotate(OpenApi.Description, "Completes embedded signup: exchanges its code for the business's Meta token, checks the token grants Samva both WhatsApp permissions over the WABA, subscribes Samva to the WABA's webhooks, and registers the phone number with the Cloud API. A number that stays on the WhatsApp Business app (coexistence) is already registered, so it skips registration and Samva asks Meta to sync its contacts and chat history. A number Meta has not verified yet connects as pending; sync it once verification finishes."))();
|
|
547
|
+
const WhatsappGetBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetBusinessAccount", "/v1/whatsapp/business-accounts/:accountId", {
|
|
530
548
|
params: WhatsappGetBusinessAccountPathParams,
|
|
531
549
|
success: WhatsappGetBusinessAccount200,
|
|
532
550
|
error: [
|
|
@@ -538,7 +556,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
538
556
|
WhatsappGetBusinessAccount500,
|
|
539
557
|
WhatsappGetBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
540
558
|
]
|
|
541
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getBusinessAccount").annotate(OpenApi.Summary, "Get a WhatsApp business account").annotate(OpenApi.Description, "Returns a single connected WhatsApp business account by its identifier.")
|
|
559
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getBusinessAccount").annotate(OpenApi.Summary, "Get a WhatsApp business account").annotate(OpenApi.Description, "Returns a single connected WhatsApp business account by its identifier."))();
|
|
560
|
+
const WhatsappDisconnectBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.delete("whatsappDisconnectBusinessAccount", "/v1/whatsapp/business-accounts/:accountId", {
|
|
542
561
|
params: WhatsappDisconnectBusinessAccountPathParams,
|
|
543
562
|
success: WhatsappDisconnectBusinessAccount200,
|
|
544
563
|
error: [
|
|
@@ -550,7 +569,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
550
569
|
WhatsappDisconnectBusinessAccount500,
|
|
551
570
|
WhatsappDisconnectBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
552
571
|
]
|
|
553
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.disconnectBusinessAccount").annotate(OpenApi.Summary, "Disconnect a WhatsApp business account").annotate(OpenApi.Description, "Disconnects a WhatsApp business account from the organization.")
|
|
572
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.disconnectBusinessAccount").annotate(OpenApi.Summary, "Disconnect a WhatsApp business account").annotate(OpenApi.Description, "Disconnects a WhatsApp business account from the organization."))();
|
|
573
|
+
const WhatsappUpdateBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.patch("whatsappUpdateBusinessAccount", "/v1/whatsapp/business-accounts/:accountId", {
|
|
554
574
|
params: WhatsappUpdateBusinessAccountPathParams,
|
|
555
575
|
payload: WhatsappUpdateBusinessAccountRequestJson,
|
|
556
576
|
success: WhatsappUpdateBusinessAccount200,
|
|
@@ -563,7 +583,23 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
563
583
|
WhatsappUpdateBusinessAccount500,
|
|
564
584
|
WhatsappUpdateBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
565
585
|
]
|
|
566
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.updateBusinessAccount").annotate(OpenApi.Summary, "Update a WhatsApp business account").annotate(OpenApi.Description, "Updates the display name or webhook settings of a connected WhatsApp business account.")
|
|
586
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.updateBusinessAccount").annotate(OpenApi.Summary, "Update a WhatsApp business account").annotate(OpenApi.Description, "Updates the display name or webhook settings of a connected WhatsApp business account."))();
|
|
587
|
+
const WhatsappReleaseBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.post("whatsappReleaseBusinessAccount", "/v1/whatsapp/business-accounts/:accountId/release", {
|
|
588
|
+
params: WhatsappReleaseBusinessAccountPathParams,
|
|
589
|
+
payload: WhatsappReleaseBusinessAccountRequestJson,
|
|
590
|
+
success: WhatsappReleaseBusinessAccount200,
|
|
591
|
+
error: [
|
|
592
|
+
WhatsappReleaseBusinessAccount400.pipe(HttpApiSchema.status(400)),
|
|
593
|
+
WhatsappReleaseBusinessAccount401.pipe(HttpApiSchema.status(401)),
|
|
594
|
+
WhatsappReleaseBusinessAccount403.pipe(HttpApiSchema.status(403)),
|
|
595
|
+
WhatsappReleaseBusinessAccount404.pipe(HttpApiSchema.status(404)),
|
|
596
|
+
WhatsappReleaseBusinessAccount409.pipe(HttpApiSchema.status(409)),
|
|
597
|
+
WhatsappReleaseBusinessAccount422.pipe(HttpApiSchema.status(422)),
|
|
598
|
+
WhatsappReleaseBusinessAccount500,
|
|
599
|
+
WhatsappReleaseBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
600
|
+
]
|
|
601
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.releaseBusinessAccount").annotate(OpenApi.Summary, "Release a WhatsApp number to another organization").annotate(OpenApi.Description, "Reserves a disconnected WhatsApp number for the named Samva organization. The recipient claims it through fresh Meta Embedded Signup for the same WhatsApp Business Account, Meta phone number ID, and E.164 number. The old account remains in history and cannot reconnect."))();
|
|
602
|
+
const WhatsappSetDefaultBusinessAccountEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.post("whatsappSetDefaultBusinessAccount", "/v1/whatsapp/business-accounts/:accountId/set-default", {
|
|
567
603
|
params: WhatsappSetDefaultBusinessAccountPathParams,
|
|
568
604
|
success: WhatsappSetDefaultBusinessAccount200,
|
|
569
605
|
error: [
|
|
@@ -575,7 +611,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
575
611
|
WhatsappSetDefaultBusinessAccount500,
|
|
576
612
|
WhatsappSetDefaultBusinessAccount504.pipe(HttpApiSchema.status(504))
|
|
577
613
|
]
|
|
578
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.setDefaultBusinessAccount").annotate(OpenApi.Summary, "Set the default WhatsApp business account").annotate(OpenApi.Description, "Marks a connected WhatsApp business account as the organization's default and returns it.")
|
|
614
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.setDefaultBusinessAccount").annotate(OpenApi.Summary, "Set the default WhatsApp business account").annotate(OpenApi.Description, "Marks a connected WhatsApp business account as the organization's default and returns it."))();
|
|
615
|
+
const WhatsappSyncAccountStatusEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.post("whatsappSyncAccountStatus", "/v1/whatsapp/business-accounts/:accountId/sync", {
|
|
579
616
|
params: WhatsappSyncAccountStatusPathParams,
|
|
580
617
|
success: WhatsappSyncAccountStatus200,
|
|
581
618
|
error: [
|
|
@@ -588,7 +625,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
588
625
|
WhatsappSyncAccountStatus502.pipe(HttpApiSchema.status(502)),
|
|
589
626
|
WhatsappSyncAccountStatus504.pipe(HttpApiSchema.status(504))
|
|
590
627
|
]
|
|
591
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.syncAccountStatus").annotate(OpenApi.Summary, "Sync a WhatsApp business account status").annotate(OpenApi.Description, "Reads the number's quality rating, messaging limit, and registration from Meta, and registers the number with the Cloud API if it is verified but not yet registered.")
|
|
628
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.syncAccountStatus").annotate(OpenApi.Summary, "Sync a WhatsApp business account status").annotate(OpenApi.Description, "Reads the number's quality rating, messaging limit, and registration from Meta, and registers the number with the Cloud API if it is verified but not yet registered."))();
|
|
629
|
+
const WhatsappGetMediaDownloadUrlEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetMediaDownloadUrl", "/v1/whatsapp/media/:deliveryId/download-url", {
|
|
592
630
|
params: WhatsappGetMediaDownloadUrlPathParams,
|
|
593
631
|
success: WhatsappGetMediaDownloadUrl200,
|
|
594
632
|
error: [
|
|
@@ -600,7 +638,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
600
638
|
WhatsappGetMediaDownloadUrl500,
|
|
601
639
|
WhatsappGetMediaDownloadUrl504.pipe(HttpApiSchema.status(504))
|
|
602
640
|
]
|
|
603
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getMediaDownloadUrl").annotate(OpenApi.Summary, "Get a WhatsApp media download URL").annotate(OpenApi.Description, "Returns a short-lived URL for the media an inbound WhatsApp delivery carried, when Samva stored it.")
|
|
641
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getMediaDownloadUrl").annotate(OpenApi.Summary, "Get a WhatsApp media download URL").annotate(OpenApi.Description, "Returns a short-lived URL for the media an inbound WhatsApp delivery carried, when Samva stored it."))();
|
|
642
|
+
const WhatsappGetServiceWindowBillingEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetServiceWindowBilling", "/v1/whatsapp/service-window/billing", {
|
|
604
643
|
query: WhatsappGetServiceWindowBillingQuery,
|
|
605
644
|
success: WhatsappGetServiceWindowBilling200,
|
|
606
645
|
error: [
|
|
@@ -612,7 +651,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
612
651
|
WhatsappGetServiceWindowBilling500,
|
|
613
652
|
WhatsappGetServiceWindowBilling504.pipe(HttpApiSchema.status(504))
|
|
614
653
|
]
|
|
615
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getServiceWindowBilling").annotate(OpenApi.Summary, "Get WhatsApp service window billing").annotate(OpenApi.Description, "Returns message counts and the estimated Meta cost for a WhatsApp service window.")
|
|
654
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getServiceWindowBilling").annotate(OpenApi.Summary, "Get WhatsApp service window billing").annotate(OpenApi.Description, "Returns message counts and the estimated Meta cost for a WhatsApp service window."))();
|
|
655
|
+
const WhatsappGetServiceWindowStatusEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetServiceWindowStatus", "/v1/whatsapp/service-window/status", {
|
|
616
656
|
query: WhatsappGetServiceWindowStatusQuery,
|
|
617
657
|
success: WhatsappGetServiceWindowStatus200,
|
|
618
658
|
error: [
|
|
@@ -624,7 +664,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
624
664
|
WhatsappGetServiceWindowStatus500,
|
|
625
665
|
WhatsappGetServiceWindowStatus504.pipe(HttpApiSchema.status(504))
|
|
626
666
|
]
|
|
627
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getServiceWindowStatus").annotate(OpenApi.Summary, "Get WhatsApp service window status").annotate(OpenApi.Description, "Returns whether the service window and free entry point are active for a customer and business phone pair.")
|
|
667
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getServiceWindowStatus").annotate(OpenApi.Summary, "Get WhatsApp service window status").annotate(OpenApi.Description, "Returns whether the service window and free entry point are active for a customer and business phone pair."))();
|
|
668
|
+
const WhatsappGetStatsEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetStats", "/v1/whatsapp/stats", {
|
|
628
669
|
query: WhatsappGetStatsQuery,
|
|
629
670
|
success: WhatsappGetStats200,
|
|
630
671
|
error: [
|
|
@@ -635,7 +676,8 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
635
676
|
WhatsappGetStats500,
|
|
636
677
|
WhatsappGetStats504.pipe(HttpApiSchema.status(504))
|
|
637
678
|
]
|
|
638
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getStats").annotate(OpenApi.Summary, "Get WhatsApp messaging stats").annotate(OpenApi.Description, "Returns aggregate WhatsApp delivery, read, and failure statistics for the organization.")
|
|
679
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getStats").annotate(OpenApi.Summary, "Get WhatsApp messaging stats").annotate(OpenApi.Description, "Returns aggregate WhatsApp delivery, read, and failure statistics for the organization."))();
|
|
680
|
+
const WhatsappGetTemplateStatsEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whatsappGetTemplateStats", "/v1/whatsapp/templates/stats", {
|
|
639
681
|
query: WhatsappGetTemplateStatsQuery,
|
|
640
682
|
success: WhatsappGetTemplateStats200,
|
|
641
683
|
error: [
|
|
@@ -646,7 +688,7 @@ var WhatsAppGroup = class extends HttpApiGroup.make("WhatsApp").add(HttpApiEndpo
|
|
|
646
688
|
WhatsappGetTemplateStats500,
|
|
647
689
|
WhatsappGetTemplateStats504.pipe(HttpApiSchema.status(504))
|
|
648
690
|
]
|
|
649
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getTemplateStats").annotate(OpenApi.Summary, "Get WhatsApp template stats").annotate(OpenApi.Description, "Returns sent, delivered, read, and failed counts and Meta's estimated cost for each WhatsApp template, split by what sent it: a campaign, a journey step, or a direct send. Filter by template, campaign, journey, or the time the message was created."))
|
|
650
|
-
export { MoneyAmount,
|
|
691
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whatsapp.getTemplateStats").annotate(OpenApi.Summary, "Get WhatsApp template stats").annotate(OpenApi.Description, "Returns sent, delivered, read, and failed counts and Meta's estimated cost for each WhatsApp template, split by what sent it: a campaign, a journey step, or a direct send. Filter by template, campaign, journey, or the time the message was created."))();
|
|
692
|
+
export { MoneyAmount, WhatsAppServiceWindowId, WhatsAppTemplateStats, WhatsAppTemplateStatsRow, WhatsAppTemplateStatsSource, WhatsappConnectBusinessAccount201, WhatsappConnectBusinessAccount400, WhatsappConnectBusinessAccount401, WhatsappConnectBusinessAccount402, WhatsappConnectBusinessAccount403, WhatsappConnectBusinessAccount404, WhatsappConnectBusinessAccount409, WhatsappConnectBusinessAccount422, WhatsappConnectBusinessAccount500, WhatsappConnectBusinessAccount502, WhatsappConnectBusinessAccount504, WhatsappConnectBusinessAccountEndpoint, WhatsappConnectBusinessAccountRequestJson, WhatsappDisconnectBusinessAccount200, WhatsappDisconnectBusinessAccount400, WhatsappDisconnectBusinessAccount401, WhatsappDisconnectBusinessAccount403, WhatsappDisconnectBusinessAccount404, WhatsappDisconnectBusinessAccount422, WhatsappDisconnectBusinessAccount500, WhatsappDisconnectBusinessAccount504, WhatsappDisconnectBusinessAccountEndpoint, WhatsappDisconnectBusinessAccountPathParams, WhatsappGetBusinessAccount200, WhatsappGetBusinessAccount400, WhatsappGetBusinessAccount401, WhatsappGetBusinessAccount403, WhatsappGetBusinessAccount404, WhatsappGetBusinessAccount422, WhatsappGetBusinessAccount500, WhatsappGetBusinessAccount504, WhatsappGetBusinessAccountEndpoint, WhatsappGetBusinessAccountPathParams, WhatsappGetMediaDownloadUrl200, WhatsappGetMediaDownloadUrl400, WhatsappGetMediaDownloadUrl401, WhatsappGetMediaDownloadUrl403, WhatsappGetMediaDownloadUrl404, WhatsappGetMediaDownloadUrl422, WhatsappGetMediaDownloadUrl500, WhatsappGetMediaDownloadUrl504, WhatsappGetMediaDownloadUrlEndpoint, WhatsappGetMediaDownloadUrlPathParams, WhatsappGetServiceWindowBilling200, WhatsappGetServiceWindowBilling400, WhatsappGetServiceWindowBilling401, WhatsappGetServiceWindowBilling403, WhatsappGetServiceWindowBilling404, WhatsappGetServiceWindowBilling422, WhatsappGetServiceWindowBilling500, WhatsappGetServiceWindowBilling504, WhatsappGetServiceWindowBillingEndpoint, WhatsappGetServiceWindowBillingQuery, WhatsappGetServiceWindowStatus200, WhatsappGetServiceWindowStatus400, WhatsappGetServiceWindowStatus401, WhatsappGetServiceWindowStatus403, WhatsappGetServiceWindowStatus404, WhatsappGetServiceWindowStatus422, WhatsappGetServiceWindowStatus500, WhatsappGetServiceWindowStatus504, WhatsappGetServiceWindowStatusEndpoint, WhatsappGetServiceWindowStatusQuery, WhatsappGetStats200, WhatsappGetStats400, WhatsappGetStats401, WhatsappGetStats403, WhatsappGetStats422, WhatsappGetStats500, WhatsappGetStats504, WhatsappGetStatsEndpoint, WhatsappGetStatsQuery, WhatsappGetTemplateStats200, WhatsappGetTemplateStats400, WhatsappGetTemplateStats401, WhatsappGetTemplateStats403, WhatsappGetTemplateStats422, WhatsappGetTemplateStats500, WhatsappGetTemplateStats504, WhatsappGetTemplateStatsEndpoint, WhatsappGetTemplateStatsQuery, WhatsappListBusinessAccounts200, WhatsappListBusinessAccounts400, WhatsappListBusinessAccounts401, WhatsappListBusinessAccounts403, WhatsappListBusinessAccounts422, WhatsappListBusinessAccounts500, WhatsappListBusinessAccounts504, WhatsappListBusinessAccountsEndpoint, WhatsappListBusinessAccountsQuery, WhatsappReleaseBusinessAccount200, WhatsappReleaseBusinessAccount400, WhatsappReleaseBusinessAccount401, WhatsappReleaseBusinessAccount403, WhatsappReleaseBusinessAccount404, WhatsappReleaseBusinessAccount409, WhatsappReleaseBusinessAccount422, WhatsappReleaseBusinessAccount500, WhatsappReleaseBusinessAccount504, WhatsappReleaseBusinessAccountEndpoint, WhatsappReleaseBusinessAccountPathParams, WhatsappReleaseBusinessAccountRequestJson, WhatsappSetDefaultBusinessAccount200, WhatsappSetDefaultBusinessAccount400, WhatsappSetDefaultBusinessAccount401, WhatsappSetDefaultBusinessAccount403, WhatsappSetDefaultBusinessAccount404, WhatsappSetDefaultBusinessAccount422, WhatsappSetDefaultBusinessAccount500, WhatsappSetDefaultBusinessAccount504, WhatsappSetDefaultBusinessAccountEndpoint, WhatsappSetDefaultBusinessAccountPathParams, WhatsappSyncAccountStatus200, WhatsappSyncAccountStatus400, WhatsappSyncAccountStatus401, WhatsappSyncAccountStatus403, WhatsappSyncAccountStatus404, WhatsappSyncAccountStatus422, WhatsappSyncAccountStatus500, WhatsappSyncAccountStatus502, WhatsappSyncAccountStatus504, WhatsappSyncAccountStatusEndpoint, WhatsappSyncAccountStatusPathParams, WhatsappUpdateBusinessAccount200, WhatsappUpdateBusinessAccount400, WhatsappUpdateBusinessAccount401, WhatsappUpdateBusinessAccount403, WhatsappUpdateBusinessAccount404, WhatsappUpdateBusinessAccount422, WhatsappUpdateBusinessAccount500, WhatsappUpdateBusinessAccount504, WhatsappUpdateBusinessAccountEndpoint, WhatsappUpdateBusinessAccountPathParams, WhatsappUpdateBusinessAccountRequestJson };
|
|
651
693
|
|
|
652
694
|
//# sourceMappingURL=whats-app.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpApiEndpoint
|
|
1
|
+
import { HttpApiEndpoint } from "effect/http-api";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import { ApiKeyAccess, ApiKeySecurityMiddleware, ForbiddenError, GatewayTimeoutError, InternalError, MalformedRequestError, OrganizationId, UnauthorizedError, ValidationError } from "./shared.js";
|
|
4
4
|
export type WhoamiUser = {
|
|
@@ -195,7 +195,7 @@ export type WhoamiGet500 = InternalError;
|
|
|
195
195
|
export declare const WhoamiGet500: typeof InternalError;
|
|
196
196
|
export type WhoamiGet504 = GatewayTimeoutError;
|
|
197
197
|
export declare const WhoamiGet504: typeof GatewayTimeoutError;
|
|
198
|
-
declare const
|
|
198
|
+
export declare const WhoamiGetEndpoint: HttpApiEndpoint.HttpApiEndpoint<"whoamiGet", "GET", "/v1/whoami", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
199
199
|
readonly organization: Schema.Struct<{
|
|
200
200
|
readonly id: Schema.brand<Schema.String, "OrganizationId">;
|
|
201
201
|
readonly slug: Schema.String;
|
|
@@ -324,7 +324,4 @@ declare const WhoamiGroup_base: HttpApiGroup.HttpApiGroup<"Whoami", HttpApiEndpo
|
|
|
324
324
|
readonly _tag: Schema.tag<"ValidationError">;
|
|
325
325
|
readonly message: Schema.String;
|
|
326
326
|
readonly fields: Schema.optionalKey<Schema.Union<readonly [Schema.$Record<Schema.String, Schema.$Array<Schema.String>>, Schema.Null]>>;
|
|
327
|
-
}>, never, never> | typeof InternalError>, ApiKeySecurityMiddleware, never
|
|
328
|
-
export declare class WhoamiGroup extends WhoamiGroup_base {
|
|
329
|
-
}
|
|
330
|
-
export {};
|
|
327
|
+
}>, never, never> | typeof InternalError>, ApiKeySecurityMiddleware, never>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpApiEndpoint,
|
|
1
|
+
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import { ApiKeyAccess, ApiKeySecurityMiddleware, ForbiddenError, GatewayTimeoutError, InternalError, MalformedRequestError, OrganizationId, UnauthorizedError, ValidationError } from "./shared.js";
|
|
4
4
|
// src/effect/generated/whoami.ts
|
|
@@ -41,7 +41,7 @@ const WhoamiGet403 = ForbiddenError;
|
|
|
41
41
|
const WhoamiGet422 = ValidationError;
|
|
42
42
|
const WhoamiGet500 = InternalError;
|
|
43
43
|
const WhoamiGet504 = GatewayTimeoutError;
|
|
44
|
-
|
|
44
|
+
const WhoamiGetEndpoint = /* @__PURE__ */ (() => HttpApiEndpoint.get("whoamiGet", "/v1/whoami", {
|
|
45
45
|
success: WhoamiGet200,
|
|
46
46
|
error: [
|
|
47
47
|
WhoamiGet400.pipe(HttpApiSchema.status(400)),
|
|
@@ -51,7 +51,7 @@ var WhoamiGroup = class extends HttpApiGroup.make("Whoami").add(HttpApiEndpoint.
|
|
|
51
51
|
WhoamiGet500,
|
|
52
52
|
WhoamiGet504.pipe(HttpApiSchema.status(504))
|
|
53
53
|
]
|
|
54
|
-
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whoami.get").annotate(OpenApi.Summary, "Get the calling credential").annotate(OpenApi.Description, "Returns the organization the request acts in and the credential it presents: an API key with its name, prefix, and access, or a signed-in user with their role. Any valid credential may call it, whatever its grants."))
|
|
55
|
-
export { Whoami, WhoamiApiKeyCredential, WhoamiGet200, WhoamiGet400, WhoamiGet401, WhoamiGet403, WhoamiGet422, WhoamiGet500, WhoamiGet504,
|
|
54
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "whoami.get").annotate(OpenApi.Summary, "Get the calling credential").annotate(OpenApi.Description, "Returns the organization the request acts in and the credential it presents: an API key with its name, prefix, and access, or a signed-in user with their role. Any valid credential may call it, whatever its grants."))();
|
|
55
|
+
export { Whoami, WhoamiApiKeyCredential, WhoamiGet200, WhoamiGet400, WhoamiGet401, WhoamiGet403, WhoamiGet422, WhoamiGet500, WhoamiGet504, WhoamiGetEndpoint, WhoamiOrganization, WhoamiUser, WhoamiUserCredential };
|
|
56
56
|
|
|
57
57
|
//# sourceMappingURL=whoami.js.map
|
|
@@ -2896,6 +2896,12 @@ export declare const SamvaOperations: {
|
|
|
2896
2896
|
readonly idempotent: false;
|
|
2897
2897
|
readonly paginated: false;
|
|
2898
2898
|
};
|
|
2899
|
+
readonly whatsappReleaseBusinessAccount: {
|
|
2900
|
+
readonly group: "WhatsApp";
|
|
2901
|
+
readonly method: "POST";
|
|
2902
|
+
readonly idempotent: false;
|
|
2903
|
+
readonly paginated: false;
|
|
2904
|
+
};
|
|
2899
2905
|
readonly whatsappSetDefaultBusinessAccount: {
|
|
2900
2906
|
readonly group: "WhatsApp";
|
|
2901
2907
|
readonly method: "POST";
|
|
@@ -1619,6 +1619,7 @@ const SamvaOperations = {
|
|
|
1619
1619
|
whatsappGetBusinessAccount: operationMetadata154,
|
|
1620
1620
|
whatsappDisconnectBusinessAccount: operationMetadata155,
|
|
1621
1621
|
whatsappUpdateBusinessAccount: operationMetadata156,
|
|
1622
|
+
whatsappReleaseBusinessAccount: operationMetadata153,
|
|
1622
1623
|
whatsappSetDefaultBusinessAccount: operationMetadata153,
|
|
1623
1624
|
whatsappSyncAccountStatus: operationMetadata153,
|
|
1624
1625
|
whatsappFlowsList: operationMetadata157,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { integrationCatalogList, integrationCatalogPrepare, integrationCatalogRecipeCatalog, integrationCatalogRecipeConnectionHandoff, integrationCatalogRecipePreview, integrationCatalogRecipeReadiness, integrationCatalogRecipeSetupActivate, integrationCatalogRecipeSetupGet, integrationCatalogRecipeSetupReplace, integrationCatalogRecipeSetupsList, integrationCatalogRecipeTest, integrationCatalogRecipeTestHandoff, integrationCatalogRecipeTestReceipt, integrationCatalogRecipeWhatsAppChallengeBegin, integrationCatalogRecipeWhatsAppChallengeConfirm, integrationCatalogRecipeWhatsAppChallengeGet, integrationCatalogSearch } from "./descriptors/integrations-catalog.js";
|
|
3
|
+
import { IntegrationCatalogListEndpoint, IntegrationCatalogPrepareEndpoint, IntegrationCatalogRecipeCatalogEndpoint, IntegrationCatalogRecipeConnectionHandoffEndpoint, IntegrationCatalogRecipePreviewEndpoint, IntegrationCatalogRecipeReadinessEndpoint, IntegrationCatalogRecipeSetupActivateEndpoint, IntegrationCatalogRecipeSetupGetEndpoint, IntegrationCatalogRecipeSetupReplaceEndpoint, IntegrationCatalogRecipeSetupsListEndpoint, IntegrationCatalogRecipeTestEndpoint, IntegrationCatalogRecipeTestHandoffEndpoint, IntegrationCatalogRecipeTestReceiptEndpoint, IntegrationCatalogRecipeWhatsAppChallengeBeginEndpoint, IntegrationCatalogRecipeWhatsAppChallengeConfirmEndpoint, IntegrationCatalogRecipeWhatsAppChallengeGetEndpoint, IntegrationCatalogSearchEndpoint } from "./generated/integrations-catalog.js";
|
|
4
|
+
import { operation } from "./internal/operation.js";
|
|
5
5
|
// src/effect/integrations-catalog.ts
|
|
6
6
|
var integrations_catalog_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
list: () => list,
|
|
@@ -22,24 +22,23 @@ var integrations_catalog_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
22
|
recipeWhatsAppChallengeGet: () => recipeWhatsAppChallengeGet,
|
|
23
23
|
search: () => search
|
|
24
24
|
});
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const list = /* @__PURE__ */ make("integrationCatalogList");
|
|
25
|
+
const recipeConnectionHandoff = /* @__PURE__ */ operation("integrationCatalogRecipeConnectionHandoff", IntegrationCatalogRecipeConnectionHandoffEndpoint, integrationCatalogRecipeConnectionHandoff);
|
|
26
|
+
const recipeTestHandoff = /* @__PURE__ */ operation("integrationCatalogRecipeTestHandoff", IntegrationCatalogRecipeTestHandoffEndpoint, integrationCatalogRecipeTestHandoff);
|
|
27
|
+
const recipeSetupsList = /* @__PURE__ */ operation("integrationCatalogRecipeSetupsList", IntegrationCatalogRecipeSetupsListEndpoint, integrationCatalogRecipeSetupsList);
|
|
28
|
+
const recipeSetupGet = /* @__PURE__ */ operation("integrationCatalogRecipeSetupGet", IntegrationCatalogRecipeSetupGetEndpoint, integrationCatalogRecipeSetupGet);
|
|
29
|
+
const recipeSetupReplace = /* @__PURE__ */ operation("integrationCatalogRecipeSetupReplace", IntegrationCatalogRecipeSetupReplaceEndpoint, integrationCatalogRecipeSetupReplace);
|
|
30
|
+
const recipeSetupActivate = /* @__PURE__ */ operation("integrationCatalogRecipeSetupActivate", IntegrationCatalogRecipeSetupActivateEndpoint, integrationCatalogRecipeSetupActivate);
|
|
31
|
+
const recipePreview = /* @__PURE__ */ operation("integrationCatalogRecipePreview", IntegrationCatalogRecipePreviewEndpoint, integrationCatalogRecipePreview);
|
|
32
|
+
const recipeWhatsAppChallengeBegin = /* @__PURE__ */ operation("integrationCatalogRecipeWhatsAppChallengeBegin", IntegrationCatalogRecipeWhatsAppChallengeBeginEndpoint, integrationCatalogRecipeWhatsAppChallengeBegin);
|
|
33
|
+
const recipeWhatsAppChallengeGet = /* @__PURE__ */ operation("integrationCatalogRecipeWhatsAppChallengeGet", IntegrationCatalogRecipeWhatsAppChallengeGetEndpoint, integrationCatalogRecipeWhatsAppChallengeGet);
|
|
34
|
+
const recipeWhatsAppChallengeConfirm = /* @__PURE__ */ operation("integrationCatalogRecipeWhatsAppChallengeConfirm", IntegrationCatalogRecipeWhatsAppChallengeConfirmEndpoint, integrationCatalogRecipeWhatsAppChallengeConfirm);
|
|
35
|
+
const recipeTest = /* @__PURE__ */ operation("integrationCatalogRecipeTest", IntegrationCatalogRecipeTestEndpoint, integrationCatalogRecipeTest);
|
|
36
|
+
const recipeTestReceipt = /* @__PURE__ */ operation("integrationCatalogRecipeTestReceipt", IntegrationCatalogRecipeTestReceiptEndpoint, integrationCatalogRecipeTestReceipt);
|
|
37
|
+
const recipeCatalog = /* @__PURE__ */ operation("integrationCatalogRecipeCatalog", IntegrationCatalogRecipeCatalogEndpoint, integrationCatalogRecipeCatalog);
|
|
38
|
+
const recipeReadiness = /* @__PURE__ */ operation("integrationCatalogRecipeReadiness", IntegrationCatalogRecipeReadinessEndpoint, integrationCatalogRecipeReadiness);
|
|
39
|
+
const prepare = /* @__PURE__ */ operation("integrationCatalogPrepare", IntegrationCatalogPrepareEndpoint, integrationCatalogPrepare);
|
|
40
|
+
const search = /* @__PURE__ */ operation("integrationCatalogSearch", IntegrationCatalogSearchEndpoint, integrationCatalogSearch);
|
|
41
|
+
const list = /* @__PURE__ */ operation("integrationCatalogList", IntegrationCatalogListEndpoint, integrationCatalogList);
|
|
43
42
|
export { integrations_catalog_exports, list, prepare, recipeCatalog, recipeConnectionHandoff, recipePreview, recipeReadiness, recipeSetupActivate, recipeSetupGet, recipeSetupReplace, recipeSetupsList, recipeTest, recipeTestHandoff, recipeTestReceipt, recipeWhatsAppChallengeBegin, recipeWhatsAppChallengeConfirm, recipeWhatsAppChallengeGet, search };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=integrations-catalog.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { integrationsGet, integrationsInstall, integrationsList, integrationsListTools, integrationsReadTool, integrationsRemove, integrationsUpdate } from "./descriptors/integrations.js";
|
|
3
|
+
import { IntegrationsGetEndpoint, IntegrationsInstallEndpoint, IntegrationsListEndpoint, IntegrationsListToolsEndpoint, IntegrationsReadToolEndpoint, IntegrationsRemoveEndpoint, IntegrationsUpdateEndpoint } from "./generated/integrations.js";
|
|
4
|
+
import { operation } from "./internal/operation.js";
|
|
5
5
|
// src/effect/integrations.ts
|
|
6
6
|
var integrations_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
get: () => get,
|
|
@@ -12,14 +12,13 @@ var integrations_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
12
|
remove: () => remove,
|
|
13
13
|
update: () => update
|
|
14
14
|
});
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const remove = /* @__PURE__ */ make("integrationsRemove");
|
|
15
|
+
const list = /* @__PURE__ */ operation("integrationsList", IntegrationsListEndpoint, integrationsList);
|
|
16
|
+
const install = /* @__PURE__ */ operation("integrationsInstall", IntegrationsInstallEndpoint, integrationsInstall);
|
|
17
|
+
const listTools = /* @__PURE__ */ operation("integrationsListTools", IntegrationsListToolsEndpoint, integrationsListTools);
|
|
18
|
+
const readTool = /* @__PURE__ */ operation("integrationsReadTool", IntegrationsReadToolEndpoint, integrationsReadTool);
|
|
19
|
+
const get = /* @__PURE__ */ operation("integrationsGet", IntegrationsGetEndpoint, integrationsGet);
|
|
20
|
+
const update = /* @__PURE__ */ operation("integrationsUpdate", IntegrationsUpdateEndpoint, integrationsUpdate);
|
|
21
|
+
const remove = /* @__PURE__ */ operation("integrationsRemove", IntegrationsRemoveEndpoint, integrationsRemove);
|
|
23
22
|
export { get, install, integrations_exports, list, listTools, readTool, remove, update };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=integrations.js.map
|
|
@@ -55,7 +55,8 @@ export interface Interface {
|
|
|
55
55
|
readonly timeoutMs?: number | null | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* The generated call for one endpoint. A group's client is built on the first call to any of its
|
|
58
|
-
* endpoints and reused, so a group the program never calls costs nothing.
|
|
58
|
+
* endpoints and reused for that group value, so a group the program never calls costs nothing.
|
|
59
|
+
* Operations pass one-endpoint groups, several of which share an identifier.
|
|
59
60
|
*/
|
|
60
61
|
readonly endpoint: <Name extends Operation>(group: HttpApiGroup.Constraint, name: Name) => Effect.Effect<OperationCall<Name>>;
|
|
61
62
|
/** The origin and headers a connection outside HTTP requests, such as the event stream, uses. */
|
|
@@ -49,9 +49,9 @@ const make = (config) => Effect.gen(function* () {
|
|
|
49
49
|
if (removesAttribution) attributed = HttpClientRequest.removeHeader(attributed, CLIENT_ATTRIBUTION_HEADER);
|
|
50
50
|
return HttpClientRequest.setHeaders(attributed, authHeaders(config));
|
|
51
51
|
}));
|
|
52
|
-
const groups = /* @__PURE__ */ new
|
|
52
|
+
const groups = /* @__PURE__ */ new WeakMap();
|
|
53
53
|
const groupClient = (group) => {
|
|
54
|
-
const built = groups.get(group
|
|
54
|
+
const built = groups.get(group);
|
|
55
55
|
if (built !== void 0) return Effect.succeed(built);
|
|
56
56
|
return HttpApiClient.group(HttpApi.make("SamvaApi").add(group).annotate(HttpApi.PayloadParseOptions, { onExcessProperty: "error" }), {
|
|
57
57
|
group: group.identifier,
|
|
@@ -59,7 +59,7 @@ const make = (config) => Effect.gen(function* () {
|
|
|
59
59
|
baseUrl
|
|
60
60
|
}).pipe(Effect.provide(AuthorizationClient), Effect.map((client) => {
|
|
61
61
|
const calls = client;
|
|
62
|
-
groups.set(group
|
|
62
|
+
groups.set(group, calls);
|
|
63
63
|
return calls;
|
|
64
64
|
}));
|
|
65
65
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { replyToEmailsPayload } from "../../normalize.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EmailAddSenderEndpoint } from "../generated/email.js";
|
|
4
4
|
import { generateIdempotencyKey, withRetry } from "../retry.js";
|
|
5
5
|
import { Service } from "./client.js";
|
|
6
|
-
import { attemptTimeout, callEndpoint, stripUndefined } from "./operation.js";
|
|
6
|
+
import { attemptTimeout, callEndpoint, endpointGroup, stripUndefined } from "./operation.js";
|
|
7
7
|
import { withTimeout } from "./timeout.js";
|
|
8
8
|
// src/effect/internal/email-sender.ts
|
|
9
|
-
const
|
|
9
|
+
const EmailAddSender = /* @__PURE__ */ endpointGroup("Email", EmailAddSenderEndpoint);
|
|
10
|
+
const addEmailSender = /* @__PURE__ */ Effect.fn("Email.addSender")(function* (input, options) {
|
|
10
11
|
const client = yield* Service;
|
|
11
12
|
const timeoutMs = attemptTimeout(options, client);
|
|
12
13
|
const idempotencyKey = options?.idempotencyKey ?? client.idempotency?.("emailAddSender") ?? (yield* generateIdempotencyKey);
|
|
13
14
|
const { replyToEmails, ...sender } = input;
|
|
14
|
-
return yield* withRetry(withTimeout(callEndpoint(
|
|
15
|
+
return yield* withRetry(withTimeout(callEndpoint(EmailAddSender, "emailAddSender", {
|
|
15
16
|
headers: { "idempotency-key": idempotencyKey },
|
|
16
17
|
payload: stripUndefined({
|
|
17
18
|
...sender,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Brand, Effect, Redacted, Stream } from "effect";
|
|
2
|
-
import type
|
|
2
|
+
import { type HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
3
3
|
import type { SDK_OPERATION_CALLS } from "../../service-map.js";
|
|
4
4
|
import { type FlatRaw, type Operation, type OperationResult } from "./client.js";
|
|
5
5
|
export type { OperationResult };
|
|
@@ -37,8 +37,8 @@ export declare const attemptTimeout: (options: {
|
|
|
37
37
|
readonly timeoutMs?: number | null | undefined;
|
|
38
38
|
}) => number | null;
|
|
39
39
|
/**
|
|
40
|
-
* What one operation wrapper reads at runtime. `codegen/generate-registry.ts` emits
|
|
41
|
-
* beside each domain, so a focused
|
|
40
|
+
* What one operation wrapper reads at runtime. `codegen/generate-registry.ts` emits one binding per
|
|
41
|
+
* operation beside each domain, so a focused import carries only its own operations' descriptors.
|
|
42
42
|
*/
|
|
43
43
|
interface OperationDescriptor {
|
|
44
44
|
readonly group: string;
|
|
@@ -54,7 +54,6 @@ interface OperationDescriptor {
|
|
|
54
54
|
readonly paths?: ReadonlyArray<string> | undefined;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
export type OperationDescriptors = Readonly<Record<string, OperationDescriptor>>;
|
|
58
57
|
type OperationFunction<Name extends SdkOperation> = (typeof SDK_OPERATION_CALLS)[Name] extends {
|
|
59
58
|
readonly kind: "none";
|
|
60
59
|
} ? (input?: never, options?: OperationOptions) => OperationResult<Name> : {} extends Input<Name> ? (input?: Input<Name>, options?: OperationOptions) => OperationResult<Name> : (input: Input<Name>, options?: OperationOptions) => OperationResult<Name>;
|
|
@@ -77,9 +76,14 @@ type PaginationCompanions<Parameters, A, E, R> = {} extends Parameters ? {
|
|
|
77
76
|
type WithPagination<Method> = Method extends (input: infer Parameters) => Effect.Effect<infer A, infer E, infer R> ? IsPaginated<A> extends true ? Method & PaginationCompanions<Parameters, A, E, R> : Method : Method;
|
|
78
77
|
export declare const stripUndefined: <Value>(input: Value) => Value;
|
|
79
78
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* A group holding only `endpoint`, so the client built for it decodes that endpoint's schemas and
|
|
80
|
+
* nothing else. The client caches by group identity: bind each one once, at module scope.
|
|
82
81
|
*/
|
|
83
|
-
export declare const
|
|
82
|
+
export declare const endpointGroup: (identifier: string, endpoint: HttpApiEndpoint.Top) => HttpApiGroup.Constraint;
|
|
83
|
+
/**
|
|
84
|
+
* One operation wrapper from its own endpoint and descriptor. Generated domain modules call this
|
|
85
|
+
* once per operation, so a bundler keeps only the operations a program imports.
|
|
86
|
+
*/
|
|
87
|
+
export declare const operation: <Name extends SdkOperation>(operationName: Name, endpoint: HttpApiEndpoint.Top, descriptor: OperationDescriptor) => WithPagination<OperationFunction<Name>>;
|
|
84
88
|
/** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
|
|
85
89
|
export declare const callEndpoint: <Name extends SdkOperation>(group: HttpApiGroup.Constraint, name: Name, request: unknown) => OperationResult<Name>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect, Predicate } from "effect";
|
|
2
|
+
import { HttpApiGroup } from "effect/http-api";
|
|
2
3
|
import { DEFAULT_TIMEOUT_MS, isRetrySafe, resolveTimeout } from "../../request-policy.js";
|
|
3
4
|
import { streamCursorItems, streamCursorPages } from "../pagination.js";
|
|
4
5
|
import { generateIdempotencyKey, withRetry } from "../retry.js";
|
|
@@ -51,14 +52,18 @@ const adapt = (descriptor, operationName, rawCall, input, idempotencyKey, timeou
|
|
|
51
52
|
};
|
|
52
53
|
const isCursorPageEnvelope = (value) => Predicate.isObject(value) && Array.isArray(value.items) && (value.nextCursor === null || typeof value.nextCursor === "string");
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
55
|
+
* A group holding only `endpoint`, so the client built for it decodes that endpoint's schemas and
|
|
56
|
+
* nothing else. The client caches by group identity: bind each one once, at module scope.
|
|
56
57
|
*/
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const endpointGroup = (identifier, endpoint) => HttpApiGroup.make(identifier).add(endpoint);
|
|
59
|
+
/**
|
|
60
|
+
* One operation wrapper from its own endpoint and descriptor. Generated domain modules call this
|
|
61
|
+
* once per operation, so a bundler keeps only the operations a program imports.
|
|
62
|
+
*/
|
|
63
|
+
const operation = (operationName, endpoint, descriptor) => {
|
|
64
|
+
if (endpoint.identifier !== operationName) throw new Error(`${operationName} is bound to the ${endpoint.identifier} endpoint`);
|
|
65
|
+
let group;
|
|
66
|
+
return make(() => group ??= endpointGroup(descriptor.group, endpoint), operationName, descriptor);
|
|
62
67
|
};
|
|
63
68
|
/** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
|
|
64
69
|
const callEndpoint = (group, name, request) => Effect.flatMap(Service, (client) => Effect.flatMap(client.endpoint(group, name), (call) => call(request)));
|
|
@@ -66,20 +71,20 @@ const make = (group, operationName, descriptor) => {
|
|
|
66
71
|
const call = Effect.fn(traceName(descriptor, operationName))(function* (input, options) {
|
|
67
72
|
const client = yield* Service;
|
|
68
73
|
const timeoutMs = attemptTimeout(options, client);
|
|
69
|
-
const rawCall = yield* client.endpoint(group, operationName);
|
|
74
|
+
const rawCall = yield* client.endpoint(group(), operationName);
|
|
70
75
|
const idempotencyKey = descriptor.idempotent ? options?.idempotencyKey ?? client.idempotency?.(operationName) ?? (yield* generateIdempotencyKey) : void 0;
|
|
71
76
|
return yield* adapt(descriptor, operationName, rawCall, input, idempotencyKey, timeoutMs);
|
|
72
77
|
});
|
|
73
|
-
const
|
|
78
|
+
const wrapper = call;
|
|
74
79
|
if (descriptor.paginated) {
|
|
75
80
|
const list = (input) => Effect.filterOrElse(call(input), isCursorPageEnvelope, () => Effect.die(/* @__PURE__ */ new Error(`${operationName} did not return a cursor page envelope`)));
|
|
76
|
-
Object.assign(
|
|
81
|
+
Object.assign(wrapper, {
|
|
77
82
|
pages: (input) => streamCursorPages(list, input ?? {}),
|
|
78
83
|
items: (input) => streamCursorItems(list, input ?? {})
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
|
-
return
|
|
86
|
+
return wrapper;
|
|
82
87
|
};
|
|
83
|
-
export { attemptTimeout, callEndpoint,
|
|
88
|
+
export { attemptTimeout, callEndpoint, endpointGroup, operation, stripUndefined };
|
|
84
89
|
|
|
85
90
|
//# sourceMappingURL=operation.js.map
|