samva 0.46.0 → 0.47.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 +13 -7
- package/README.md +107 -9
- package/dist/agent/index.d.ts +56 -0
- package/dist/agent/index.js +52 -0
- package/dist/agent/runtime.d.ts +3 -0
- package/dist/agent/runtime.js +74 -0
- package/dist/agent/test.d.ts +31 -0
- package/dist/agent/test.js +66 -0
- package/dist/agent/types.d.ts +123 -0
- package/dist/client/client/client.gen.d.ts +1 -1
- package/dist/client/client/index.d.ts +10 -10
- package/dist/client/client/types.gen.d.ts +4 -4
- package/dist/client/client/utils.gen.d.ts +2 -2
- package/dist/client/client.gen.d.ts +2 -2
- package/dist/client/core/bodySerializer.gen.d.ts +1 -1
- package/dist/client/core/serverSentEvents.gen.d.ts +1 -1
- package/dist/client/core/types.gen.d.ts +2 -2
- package/dist/client/core/utils.gen.d.ts +1 -1
- package/dist/client/sdk.gen.d.ts +41 -161
- package/dist/client/sdk.gen.js +1302 -1598
- package/dist/client/types.gen.d.ts +377 -966
- package/dist/effect/accounts.d.ts +6 -6
- package/dist/effect/accounts.js +2 -1
- package/dist/effect/agents.d.ts +355 -23
- package/dist/effect/agents.js +6 -3
- package/dist/effect/analytics.d.ts +6 -6
- package/dist/effect/analytics.js +2 -1
- package/dist/effect/api-keys.d.ts +13 -13
- package/dist/effect/api-keys.js +2 -1
- package/dist/effect/approval-requests.d.ts +4 -4
- package/dist/effect/approval-requests.js +2 -1
- package/dist/effect/attachments.d.ts +4 -4
- package/dist/effect/attachments.js +2 -1
- package/dist/effect/brands.d.ts +7 -7
- package/dist/effect/brands.js +2 -1
- package/dist/effect/campaigns.d.ts +205 -205
- package/dist/effect/campaigns.js +2 -1
- package/dist/effect/categories.d.ts +3 -3
- package/dist/effect/client.d.ts +1 -1
- package/dist/effect/contact-groups.d.ts +18 -18
- package/dist/effect/contact-groups.js +2 -1
- package/dist/effect/contacts.d.ts +41 -33
- package/dist/effect/contacts.js +8 -3
- package/dist/effect/conversations.d.ts +17 -17
- package/dist/effect/conversations.js +2 -1
- package/dist/effect/custom-fields.d.ts +4 -4
- package/dist/effect/custom-fields.js +2 -1
- package/dist/effect/descriptors/accounts.d.ts +59 -0
- package/dist/effect/descriptors/accounts.js +57 -0
- package/dist/effect/descriptors/agents.d.ts +129 -0
- package/dist/effect/descriptors/agents.js +127 -0
- package/dist/effect/descriptors/analytics.d.ts +56 -0
- package/dist/effect/descriptors/analytics.js +48 -0
- package/dist/effect/descriptors/api-keys.d.ts +80 -0
- package/dist/effect/descriptors/api-keys.js +80 -0
- package/dist/effect/descriptors/approval-requests.d.ts +41 -0
- package/dist/effect/descriptors/approval-requests.js +43 -0
- package/dist/effect/descriptors/attachments.d.ts +41 -0
- package/dist/effect/descriptors/attachments.js +43 -0
- package/dist/effect/descriptors/brands.d.ts +60 -0
- package/dist/effect/descriptors/brands.js +60 -0
- package/dist/effect/descriptors/campaigns.d.ts +148 -0
- package/dist/effect/descriptors/campaigns.js +144 -0
- package/dist/effect/descriptors/contact-groups.d.ts +99 -0
- package/dist/effect/descriptors/contact-groups.js +97 -0
- package/dist/effect/descriptors/contacts.d.ts +246 -0
- package/dist/effect/descriptors/contacts.js +234 -0
- package/dist/effect/descriptors/conversations.d.ts +130 -0
- package/dist/effect/descriptors/conversations.js +130 -0
- package/dist/effect/descriptors/custom-fields.d.ts +40 -0
- package/dist/effect/descriptors/custom-fields.js +40 -0
- package/dist/effect/descriptors/email.d.ts +607 -0
- package/dist/effect/descriptors/email.js +561 -0
- package/dist/effect/descriptors/events.d.ts +20 -0
- package/dist/effect/descriptors/events.js +20 -0
- package/dist/effect/descriptors/feedback.d.ts +11 -0
- package/dist/effect/descriptors/feedback.js +11 -0
- package/dist/effect/descriptors/integrations-catalog.d.ts +29 -0
- package/dist/effect/descriptors/integrations-catalog.js +27 -0
- package/dist/effect/descriptors/integrations.d.ts +70 -0
- package/dist/effect/descriptors/integrations.js +70 -0
- package/dist/effect/descriptors/journeys.d.ts +140 -0
- package/dist/effect/descriptors/journeys.js +140 -0
- package/dist/effect/descriptors/mailboxes.d.ts +724 -0
- package/dist/effect/descriptors/mailboxes.js +728 -0
- package/dist/effect/descriptors/media.d.ts +51 -0
- package/dist/effect/descriptors/media.js +53 -0
- package/dist/effect/descriptors/messages.d.ts +99 -0
- package/dist/effect/descriptors/messages.js +97 -0
- package/dist/effect/descriptors/namespaces.d.ts +110 -0
- package/dist/effect/descriptors/namespaces.js +114 -0
- package/dist/effect/descriptors/newsletter-domains.d.ts +42 -0
- package/dist/effect/descriptors/newsletter-domains.js +46 -0
- package/dist/effect/descriptors/newsletter-issues.d.ts +112 -0
- package/dist/effect/descriptors/newsletter-issues.js +116 -0
- package/dist/effect/descriptors/newsletters.d.ts +51 -0
- package/dist/effect/descriptors/newsletters.js +53 -0
- package/dist/effect/descriptors/operations.d.ts +31 -0
- package/dist/effect/descriptors/operations.js +33 -0
- package/dist/effect/descriptors/organizations.d.ts +111 -0
- package/dist/effect/descriptors/organizations.js +93 -0
- package/dist/effect/descriptors/policies.d.ts +32 -0
- package/dist/effect/descriptors/policies.js +36 -0
- package/dist/effect/descriptors/scheduled-messages.d.ts +50 -0
- package/dist/effect/descriptors/scheduled-messages.js +50 -0
- package/dist/effect/descriptors/subscriptions.d.ts +11 -0
- package/dist/effect/descriptors/subscriptions.js +11 -0
- package/dist/effect/descriptors/template-registrations.d.ts +32 -0
- package/dist/effect/descriptors/template-registrations.js +36 -0
- package/dist/effect/descriptors/template-share-links.d.ts +52 -0
- package/dist/effect/descriptors/template-share-links.js +56 -0
- package/dist/effect/descriptors/templates.d.ts +365 -0
- package/dist/effect/descriptors/templates.js +355 -0
- package/dist/effect/descriptors/topic-forms.d.ts +52 -0
- package/dist/effect/descriptors/topic-forms.js +56 -0
- package/dist/effect/descriptors/topics.d.ts +89 -0
- package/dist/effect/descriptors/topics.js +87 -0
- package/dist/effect/descriptors/webhooks.d.ts +110 -0
- package/dist/effect/descriptors/webhooks.js +110 -0
- package/dist/effect/descriptors/whats-app-flows.d.ts +99 -0
- package/dist/effect/descriptors/whats-app-flows.js +97 -0
- package/dist/effect/descriptors/whats-app-setup-links.d.ts +40 -0
- package/dist/effect/descriptors/whats-app-setup-links.js +40 -0
- package/dist/effect/descriptors/whats-app.d.ts +116 -0
- package/dist/effect/descriptors/whats-app.js +108 -0
- package/dist/effect/descriptors/whoami.d.ts +11 -0
- package/dist/effect/descriptors/whoami.js +11 -0
- package/dist/effect/email.d.ts +78 -78
- package/dist/effect/email.js +2 -1
- package/dist/effect/errors.d.ts +2 -2
- package/dist/effect/events.d.ts +3 -3
- package/dist/effect/events.js +2 -1
- package/dist/effect/feedback.d.ts +2 -2
- package/dist/effect/feedback.js +2 -1
- package/dist/effect/generated/accounts.d.ts +19 -9
- package/dist/effect/generated/accounts.js +1 -0
- package/dist/effect/generated/agents.d.ts +2967 -690
- package/dist/effect/generated/agents.js +54 -13
- package/dist/effect/generated/analytics.d.ts +1 -1
- package/dist/effect/generated/api-keys.d.ts +1 -1
- package/dist/effect/generated/approval-requests.d.ts +13 -13
- package/dist/effect/generated/attachments.d.ts +1 -1
- package/dist/effect/generated/brands.d.ts +1 -1
- package/dist/effect/generated/campaigns.d.ts +230 -230
- package/dist/effect/generated/contact-events.d.ts +4 -4
- package/dist/effect/generated/contact-groups.d.ts +1 -1
- package/dist/effect/generated/contacts.d.ts +907 -49
- package/dist/effect/generated/contacts.js +62 -3
- package/dist/effect/generated/conversations.d.ts +1 -1
- package/dist/effect/generated/custom-fields.d.ts +1 -1
- package/dist/effect/generated/email.d.ts +1 -1
- package/dist/effect/generated/events.d.ts +12 -12
- package/dist/effect/generated/feedback.d.ts +1 -1
- package/dist/effect/generated/index.d.ts +84 -88
- package/dist/effect/generated/integrations-catalog.d.ts +3 -3
- package/dist/effect/generated/integrations.d.ts +15 -15
- package/dist/effect/generated/journeys.d.ts +336 -96
- package/dist/effect/generated/journeys.js +3 -1
- package/dist/effect/generated/mailboxes.d.ts +93 -95
- package/dist/effect/generated/mailboxes.js +21 -25
- package/dist/effect/generated/media.d.ts +1 -1
- package/dist/effect/generated/messages.d.ts +1 -1
- package/dist/effect/generated/namespaces.d.ts +1 -1
- package/dist/effect/generated/newsletter-domains.d.ts +1 -1
- package/dist/effect/generated/newsletter-issues.d.ts +1 -1
- package/dist/effect/generated/newsletters.d.ts +1 -1
- package/dist/effect/generated/operations.d.ts +1 -1
- package/dist/effect/generated/organizations.d.ts +1 -1
- package/dist/effect/generated/policies.d.ts +1 -1
- package/dist/effect/generated/scheduled-messages.d.ts +147 -147
- package/dist/effect/generated/shared.d.ts +408 -102
- package/dist/effect/generated/shared.js +80 -36
- package/dist/effect/generated/subscriptions.d.ts +1 -1
- package/dist/effect/generated/template-registrations.d.ts +1 -4
- package/dist/effect/generated/template-registrations.js +2 -6
- package/dist/effect/generated/template-share-links.d.ts +1 -1
- package/dist/effect/generated/templates.d.ts +1 -1
- package/dist/effect/generated/topic-forms.d.ts +1 -1
- package/dist/effect/generated/topics.d.ts +1 -1
- package/dist/effect/generated/webhooks.d.ts +1 -1
- package/dist/effect/generated/whats-app-flows.d.ts +1 -1
- package/dist/effect/generated/whats-app-setup-links.d.ts +1 -1
- package/dist/effect/generated/whats-app.d.ts +1 -1
- package/dist/effect/generated/whoami.d.ts +1 -1
- package/dist/effect/generated-metadata.d.ts +18 -84
- package/dist/effect/generated-metadata.js +362 -415
- package/dist/effect/index.d.ts +45 -47
- package/dist/effect/index.js +1 -3
- package/dist/effect/integrations-catalog.d.ts +3 -3
- package/dist/effect/integrations-catalog.js +2 -1
- package/dist/effect/integrations.d.ts +11 -11
- package/dist/effect/integrations.js +2 -1
- package/dist/effect/internal/client.d.ts +3 -3
- package/dist/effect/internal/client.js +1 -1
- package/dist/effect/internal/email-sender.d.ts +4 -4
- package/dist/effect/internal/mailbox-events.d.ts +2 -2
- package/dist/effect/internal/operation.d.ts +24 -5
- package/dist/effect/internal/operation.js +25 -22
- package/dist/effect/internal/send.d.ts +4 -4
- package/dist/effect/journeys.d.ts +46 -22
- package/dist/effect/journeys.js +2 -1
- package/dist/effect/mailboxes.d.ts +163 -163
- package/dist/effect/mailboxes.js +2 -1
- package/dist/effect/media.d.ts +5 -5
- package/dist/effect/media.js +2 -1
- package/dist/effect/messages.d.ts +17 -17
- package/dist/effect/messages.js +2 -1
- package/dist/effect/namespaces.d.ts +15 -15
- package/dist/effect/namespaces.js +2 -1
- package/dist/effect/newsletter-domains.d.ts +6 -6
- package/dist/effect/newsletter-domains.js +2 -1
- package/dist/effect/newsletter-issues.d.ts +11 -11
- package/dist/effect/newsletter-issues.js +2 -1
- package/dist/effect/newsletters.d.ts +5 -5
- package/dist/effect/newsletters.js +2 -1
- package/dist/effect/operations.d.ts +5 -5
- package/dist/effect/operations.js +2 -1
- package/dist/effect/organizations.d.ts +12 -12
- package/dist/effect/organizations.js +2 -1
- package/dist/effect/policies.d.ts +3 -3
- package/dist/effect/policies.js +2 -1
- package/dist/effect/scheduled-messages.d.ts +371 -371
- package/dist/effect/scheduled-messages.js +2 -1
- package/dist/effect/subscriptions.d.ts +1 -1
- package/dist/effect/subscriptions.js +2 -1
- package/dist/effect/template-registrations.d.ts +3 -3
- package/dist/effect/template-registrations.js +2 -1
- package/dist/effect/template-share-links.d.ts +5 -5
- package/dist/effect/template-share-links.js +2 -1
- package/dist/effect/templates.d.ts +46 -46
- package/dist/effect/templates.js +2 -1
- package/dist/effect/topic-forms.d.ts +5 -5
- package/dist/effect/topic-forms.js +2 -1
- package/dist/effect/topics.d.ts +13 -13
- package/dist/effect/topics.js +2 -1
- package/dist/effect/webhooks.d.ts +16 -16
- package/dist/effect/webhooks.js +2 -1
- package/dist/effect/whatsapp-flows.d.ts +10 -10
- package/dist/effect/whatsapp-flows.js +2 -1
- package/dist/effect/whatsapp-setup-links.d.ts +6 -6
- package/dist/effect/whatsapp-setup-links.js +2 -1
- package/dist/effect/whatsapp.d.ts +12 -12
- package/dist/effect/whatsapp.js +2 -1
- package/dist/effect/whoami.d.ts +1 -1
- package/dist/effect/whoami.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/promises/client.d.ts +10 -14
- package/dist/promises/client.js +3 -7
- package/dist/promises/errors.gen.d.ts +1 -1
- package/dist/promises/index.d.ts +5 -5
- package/dist/promises/request.d.ts +2 -2
- package/dist/promises/request.js +1 -1
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/request-policy.d.ts +10 -2
- package/dist/request-policy.js +3 -5
- package/dist/service-map.d.ts +18 -75
- package/package.json +17 -29
- package/dist/effect/extension-installations.d.ts +0 -132
- package/dist/effect/extension-installations.js +0 -28
- package/dist/effect/extensions.d.ts +0 -102
- package/dist/effect/extensions.js +0 -20
- package/dist/effect/generated/extension-installations.d.ts +0 -2761
- package/dist/effect/generated/extension-installations.js +0 -405
- package/dist/effect/generated/extensions.d.ts +0 -1037
- package/dist/effect/generated/extensions.js +0 -214
- package/dist/mailbox/dispatch.d.ts +0 -10
- package/dist/mailbox/dispatch.js +0 -66
- package/dist/mailbox/index.d.ts +0 -17
- package/dist/mailbox/index.js +0 -30
- package/dist/mailbox/test.d.ts +0 -25
- package/dist/mailbox/test.js +0 -181
- package/dist/mailbox/types.d.ts +0 -221
- package/dist/mailbox/webhook.d.ts +0 -10
- package/dist/mailbox/webhook.js +0 -41
- package/dist/service-map.js +0 -830
package/dist/effect/index.d.ts
CHANGED
|
@@ -16,51 +16,49 @@
|
|
|
16
16
|
* }).pipe(Effect.provide(Client.layerFetch({ apiKey: "<samva-api-key>" })));
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export * as Accounts from "./accounts";
|
|
20
|
-
export * as IntegrationCatalog from "./integrations-catalog";
|
|
21
|
-
export * as Integrations from "./integrations";
|
|
22
|
-
export * as Agents from "./agents";
|
|
23
|
-
export * as Analytics from "./analytics";
|
|
24
|
-
export * as ApiKeys from "./api-keys";
|
|
25
|
-
export * as ApprovalRequests from "./approval-requests";
|
|
26
|
-
export * as Attachments from "./attachments";
|
|
27
|
-
export * as Brands from "./brands";
|
|
28
|
-
export * as Campaigns from "./campaigns";
|
|
29
|
-
export * as Client from "./client";
|
|
30
|
-
export * as ContactGroups from "./contact-groups";
|
|
31
|
-
export * as Contacts from "./contacts";
|
|
32
|
-
export * as Conversations from "./conversations";
|
|
33
|
-
export * as CustomFields from "./custom-fields";
|
|
34
|
-
export * as Email from "./email";
|
|
35
|
-
export * as
|
|
36
|
-
export * as
|
|
37
|
-
export * as
|
|
38
|
-
export * as
|
|
39
|
-
export * as
|
|
40
|
-
export * as
|
|
41
|
-
export * as
|
|
42
|
-
export * as
|
|
43
|
-
export * as
|
|
44
|
-
export * as
|
|
45
|
-
export * as
|
|
46
|
-
export * as
|
|
47
|
-
export * as
|
|
48
|
-
export * as
|
|
49
|
-
export * as
|
|
50
|
-
export * as
|
|
51
|
-
export * as
|
|
52
|
-
export * as
|
|
53
|
-
export * as
|
|
54
|
-
export * as
|
|
55
|
-
export *
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export { type ErrorCategory, categoriesOf, hasCategory, isAuthError, isValidationError, isNotFoundError, isConflictError, isThrottlingError, isBillingError, isTransient, isRetryable, catchCategory, catchAuthError, catchValidationError, catchNotFoundError, catchConflictError, catchThrottlingError, catchBillingError, catchTransient, } from "./categories";
|
|
59
|
-
export type { CursorPageEnvelope } from "./pagination";
|
|
19
|
+
export * as Accounts from "./accounts.js";
|
|
20
|
+
export * as IntegrationCatalog from "./integrations-catalog.js";
|
|
21
|
+
export * as Integrations from "./integrations.js";
|
|
22
|
+
export * as Agents from "./agents.js";
|
|
23
|
+
export * as Analytics from "./analytics.js";
|
|
24
|
+
export * as ApiKeys from "./api-keys.js";
|
|
25
|
+
export * as ApprovalRequests from "./approval-requests.js";
|
|
26
|
+
export * as Attachments from "./attachments.js";
|
|
27
|
+
export * as Brands from "./brands.js";
|
|
28
|
+
export * as Campaigns from "./campaigns.js";
|
|
29
|
+
export * as Client from "./client.js";
|
|
30
|
+
export * as ContactGroups from "./contact-groups.js";
|
|
31
|
+
export * as Contacts from "./contacts.js";
|
|
32
|
+
export * as Conversations from "./conversations.js";
|
|
33
|
+
export * as CustomFields from "./custom-fields.js";
|
|
34
|
+
export * as Email from "./email.js";
|
|
35
|
+
export * as Events from "./events.js";
|
|
36
|
+
export * as Feedback from "./feedback.js";
|
|
37
|
+
export * as Journeys from "./journeys.js";
|
|
38
|
+
export * as Mailboxes from "./mailboxes.js";
|
|
39
|
+
export * as Media from "./media.js";
|
|
40
|
+
export * as Messages from "./messages.js";
|
|
41
|
+
export * as Namespaces from "./namespaces.js";
|
|
42
|
+
export * as Operations from "./operations.js";
|
|
43
|
+
export * as Organizations from "./organizations.js";
|
|
44
|
+
export * as Policies from "./policies.js";
|
|
45
|
+
export * as NewsletterDomains from "./newsletter-domains.js";
|
|
46
|
+
export * as Retry from "./retry.js";
|
|
47
|
+
export * as ScheduledMessages from "./scheduled-messages.js";
|
|
48
|
+
export * as Subscriptions from "./subscriptions.js";
|
|
49
|
+
export * as Templates from "./templates.js";
|
|
50
|
+
export * as Topics from "./topics.js";
|
|
51
|
+
export * as TopicForms from "./topic-forms.js";
|
|
52
|
+
export * as NewsletterIssues from "./newsletter-issues.js";
|
|
53
|
+
export * as Webhooks from "./webhooks.js";
|
|
54
|
+
export * as Whoami from "./whoami.js";
|
|
55
|
+
export * from "./errors.js";
|
|
56
|
+
export { type ErrorCategory, categoriesOf, hasCategory, isAuthError, isValidationError, isNotFoundError, isConflictError, isThrottlingError, isBillingError, isTransient, isRetryable, catchCategory, catchAuthError, catchValidationError, catchNotFoundError, catchConflictError, catchThrottlingError, catchBillingError, catchTransient, } from "./categories.js";
|
|
57
|
+
export type { CursorPageEnvelope } from "./pagination.js";
|
|
60
58
|
export type { Json as JsonValue } from "effect/Schema";
|
|
61
|
-
export * as Newsletters from "./newsletters";
|
|
62
|
-
export * as WhatsApp from "./whatsapp";
|
|
63
|
-
export * as WhatsAppFlows from "./whatsapp-flows";
|
|
64
|
-
export * as WhatsAppSetupLinks from "./whatsapp-setup-links";
|
|
65
|
-
export * as TemplateRegistrations from "./template-registrations";
|
|
66
|
-
export * as TemplateShareLinks from "./template-share-links";
|
|
59
|
+
export * as Newsletters from "./newsletters.js";
|
|
60
|
+
export * as WhatsApp from "./whatsapp.js";
|
|
61
|
+
export * as WhatsAppFlows from "./whatsapp-flows.js";
|
|
62
|
+
export * as WhatsAppSetupLinks from "./whatsapp-setup-links.js";
|
|
63
|
+
export * as TemplateRegistrations from "./template-registrations.js";
|
|
64
|
+
export * as TemplateShareLinks from "./template-share-links.js";
|
package/dist/effect/index.js
CHANGED
|
@@ -18,8 +18,6 @@ import { contacts_exports } from "./contacts.js";
|
|
|
18
18
|
import { conversations_exports } from "./conversations.js";
|
|
19
19
|
import { custom_fields_exports } from "./custom-fields.js";
|
|
20
20
|
import { email_exports } from "./email.js";
|
|
21
|
-
import { extension_installations_exports } from "./extension-installations.js";
|
|
22
|
-
import { extensions_exports } from "./extensions.js";
|
|
23
21
|
import { events_exports } from "./events.js";
|
|
24
22
|
import { feedback_exports } from "./feedback.js";
|
|
25
23
|
import { journeys_exports } from "./journeys.js";
|
|
@@ -45,4 +43,4 @@ import { whatsapp_flows_exports } from "./whatsapp-flows.js";
|
|
|
45
43
|
import { whatsapp_setup_links_exports } from "./whatsapp-setup-links.js";
|
|
46
44
|
import { template_registrations_exports } from "./template-registrations.js";
|
|
47
45
|
import { template_share_links_exports } from "./template-share-links.js";
|
|
48
|
-
export { accounts_exports as Accounts, agents_exports as Agents, analytics_exports as Analytics, AnalyticsQueryError, api_keys_exports as ApiKeys, approval_requests_exports as ApprovalRequests, attachments_exports as Attachments, BillingProviderError, BrandAddressRequiredError, brands_exports as Brands, CampaignFooterRequiredError, campaigns_exports as Campaigns, client_exports as Client, ConflictError, contact_groups_exports as ContactGroups, contacts_exports as Contacts, conversations_exports as Conversations, CredentialsError, custom_fields_exports as CustomFields, DeliveryUnavailableError, email_exports as Email, EmailChannelError, events_exports as Events,
|
|
46
|
+
export { accounts_exports as Accounts, agents_exports as Agents, analytics_exports as Analytics, AnalyticsQueryError, api_keys_exports as ApiKeys, approval_requests_exports as ApprovalRequests, attachments_exports as Attachments, BillingProviderError, BrandAddressRequiredError, brands_exports as Brands, CampaignFooterRequiredError, campaigns_exports as Campaigns, client_exports as Client, ConflictError, contact_groups_exports as ContactGroups, contacts_exports as Contacts, conversations_exports as Conversations, CredentialsError, custom_fields_exports as CustomFields, DeliveryUnavailableError, email_exports as Email, EmailChannelError, events_exports as Events, ExternalServiceError, feedback_exports as Feedback, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, integrations_catalog_exports as IntegrationCatalog, integrations_exports as Integrations, InternalError, journeys_exports as Journeys, MailboxSendConflictError, MailboxSendRefusedError, mailboxes_exports as Mailboxes, MalformedRequestError, media_exports as Media, MediaUploadError, messages_exports as Messages, namespaces_exports as Namespaces, newsletter_domains_exports as NewsletterDomains, newsletter_issues_exports as NewsletterIssues, newsletters_exports as Newsletters, OnboardingReviewRequiredError, operations_exports as Operations, organizations_exports as Organizations, PaymentRequiredError, policies_exports as Policies, RateLimitedError, ResourceNotFoundError, retry_exports as Retry, scheduled_messages_exports as ScheduledMessages, SenderNotReadyError, ServiceUnavailableError, subscriptions_exports as Subscriptions, TemplateInUseError, template_registrations_exports as TemplateRegistrations, template_share_links_exports as TemplateShareLinks, TemplateSourceError, templates_exports as Templates, topic_forms_exports as TopicForms, topics_exports as Topics, UnauthorizedError, ValidationError, webhooks_exports as Webhooks, whatsapp_exports as WhatsApp, WhatsAppChannelError, whatsapp_flows_exports as WhatsAppFlows, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, whatsapp_setup_links_exports as WhatsAppSetupLinks, whoami_exports as Whoami, catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
|
|
@@ -27,12 +27,12 @@ export declare const prepare: (input: {
|
|
|
27
27
|
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
28
28
|
} | null | undefined;
|
|
29
29
|
} | undefined;
|
|
30
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationCatalogPrepare">;
|
|
30
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationCatalogPrepare">;
|
|
31
31
|
export declare const search: (input?: {
|
|
32
32
|
readonly key?: string | undefined;
|
|
33
33
|
readonly query?: string | undefined;
|
|
34
34
|
readonly category?: "accounting" | "calendar" | "channel" | "commerce" | "crm" | "dns" | "forms" | "helpdesk" | "knowledge" | "other" | "payments" | "productivity" | "reviews" | "shipping" | undefined;
|
|
35
35
|
readonly offset?: number | undefined;
|
|
36
36
|
readonly limit?: number | undefined;
|
|
37
|
-
} | undefined, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationCatalogSearch">;
|
|
38
|
-
export declare const list: (input?: never, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationCatalogList">;
|
|
37
|
+
} | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationCatalogSearch">;
|
|
38
|
+
export declare const list: (input?: never, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationCatalogList">;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { forGroup } from "./internal/operation.js";
|
|
3
|
+
import { integrationCatalogOperations } from "./descriptors/integrations-catalog.js";
|
|
3
4
|
import { IntegrationsCatalogGroup } from "./generated/integrations-catalog.js";
|
|
4
5
|
// src/effect/integrations-catalog.ts
|
|
5
6
|
var integrations_catalog_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -7,7 +8,7 @@ var integrations_catalog_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
8
|
prepare: () => prepare,
|
|
8
9
|
search: () => search
|
|
9
10
|
});
|
|
10
|
-
const make = /* @__PURE__ */ forGroup(IntegrationsCatalogGroup);
|
|
11
|
+
const make = /* @__PURE__ */ forGroup(IntegrationsCatalogGroup, integrationCatalogOperations);
|
|
11
12
|
const prepare = /* @__PURE__ */ make("integrationCatalogPrepare");
|
|
12
13
|
const search = /* @__PURE__ */ make("integrationCatalogSearch");
|
|
13
14
|
const list = /* @__PURE__ */ make("integrationCatalogList");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const list: ((input?: {
|
|
2
2
|
readonly limit?: number | null | undefined;
|
|
3
3
|
readonly cursor?: string | undefined;
|
|
4
|
-
} | undefined, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsList">) & {
|
|
4
|
+
} | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsList">) & {
|
|
5
5
|
readonly pages: (input?: {
|
|
6
6
|
readonly limit?: number | null | undefined;
|
|
7
7
|
readonly cursor?: string | undefined;
|
|
@@ -9,7 +9,7 @@ export declare const list: ((input?: {
|
|
|
9
9
|
readonly items: readonly {
|
|
10
10
|
readonly app: string;
|
|
11
11
|
readonly settings: {
|
|
12
|
-
readonly [x: string]: import("./generated").JsonValue;
|
|
12
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
13
13
|
};
|
|
14
14
|
readonly id: string & import("effect/Brand").Brand<"IntegrationId">;
|
|
15
15
|
readonly status: "connected" | "needsReconnect" | "pending";
|
|
@@ -39,14 +39,14 @@ export declare const list: ((input?: {
|
|
|
39
39
|
readonly updatedAt: string;
|
|
40
40
|
}[];
|
|
41
41
|
readonly nextCursor: string | null;
|
|
42
|
-
}, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").MalformedRequestError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
|
|
42
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
43
43
|
readonly items: (input?: {
|
|
44
44
|
readonly limit?: number | null | undefined;
|
|
45
45
|
readonly cursor?: string | undefined;
|
|
46
46
|
} | undefined) => import("effect/Stream").Stream<{
|
|
47
47
|
readonly app: string;
|
|
48
48
|
readonly settings: {
|
|
49
|
-
readonly [x: string]: import("./generated").JsonValue;
|
|
49
|
+
readonly [x: string]: import("./generated/index.js").JsonValue;
|
|
50
50
|
};
|
|
51
51
|
readonly id: string & import("effect/Brand").Brand<"IntegrationId">;
|
|
52
52
|
readonly status: "connected" | "needsReconnect" | "pending";
|
|
@@ -74,7 +74,7 @@ export declare const list: ((input?: {
|
|
|
74
74
|
readonly installedBy: (string & import("effect/Brand").Brand<"UserId">) | null;
|
|
75
75
|
readonly createdAt: string;
|
|
76
76
|
readonly updatedAt: string;
|
|
77
|
-
}, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").MalformedRequestError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
|
|
77
|
+
}, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
|
|
78
78
|
};
|
|
79
79
|
export declare const install: (input: {
|
|
80
80
|
readonly app: string;
|
|
@@ -108,21 +108,21 @@ export declare const install: (input: {
|
|
|
108
108
|
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
109
109
|
} | null | undefined;
|
|
110
110
|
} | undefined;
|
|
111
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsInstall">;
|
|
111
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsInstall">;
|
|
112
112
|
export declare const listTools: (input: {
|
|
113
113
|
readonly integrationId: string;
|
|
114
114
|
readonly offset?: number | null | undefined;
|
|
115
115
|
readonly revision?: string | undefined;
|
|
116
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsListTools">;
|
|
116
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsListTools">;
|
|
117
117
|
export declare const readTool: (input: {
|
|
118
118
|
readonly integrationId: string;
|
|
119
119
|
readonly tool: string;
|
|
120
120
|
readonly offset?: number | null | undefined;
|
|
121
121
|
readonly revision?: string | undefined;
|
|
122
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsReadTool">;
|
|
122
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsReadTool">;
|
|
123
123
|
export declare const get: (input: {
|
|
124
124
|
readonly integrationId: string;
|
|
125
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsGet">;
|
|
125
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsGet">;
|
|
126
126
|
export declare const update: (input: {
|
|
127
127
|
readonly integrationId: string;
|
|
128
128
|
readonly answerWithoutApproval?: boolean | undefined;
|
|
@@ -159,7 +159,7 @@ export declare const update: (input: {
|
|
|
159
159
|
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
160
160
|
} | null | undefined;
|
|
161
161
|
} | undefined;
|
|
162
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsUpdate">;
|
|
162
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsUpdate">;
|
|
163
163
|
export declare const remove: (input: {
|
|
164
164
|
readonly integrationId: string;
|
|
165
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"integrationsRemove">;
|
|
165
|
+
}, options?: import("./internal/operation.js").OperationOptions) => import("./internal/operation.js").OperationResult<"integrationsRemove">;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { forGroup } from "./internal/operation.js";
|
|
3
|
+
import { integrationsOperations } from "./descriptors/integrations.js";
|
|
3
4
|
import { IntegrationsGroup } from "./generated/integrations.js";
|
|
4
5
|
// src/effect/integrations.ts
|
|
5
6
|
var integrations_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -11,7 +12,7 @@ var integrations_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
12
|
remove: () => remove,
|
|
12
13
|
update: () => update
|
|
13
14
|
});
|
|
14
|
-
const make = /* @__PURE__ */ forGroup(IntegrationsGroup);
|
|
15
|
+
const make = /* @__PURE__ */ forGroup(IntegrationsGroup, integrationsOperations);
|
|
15
16
|
const list = /* @__PURE__ */ make("integrationsList");
|
|
16
17
|
const install = /* @__PURE__ */ make("integrationsInstall");
|
|
17
18
|
const listTools = /* @__PURE__ */ make("integrationsListTools");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Redacted } from "effect";
|
|
2
2
|
import { HttpApiClient, type HttpApiEndpoint, type HttpApiGroup } from "effect/http-api";
|
|
3
3
|
import * as HttpClient from "effect/http/HttpClient";
|
|
4
|
-
import { MediaUploadError } from "../../inline-attachments";
|
|
5
|
-
import type { MailboxEventStreamConnection } from "../../mailbox-events";
|
|
6
|
-
import type { SamvaApi } from "../generated/index";
|
|
4
|
+
import { MediaUploadError } from "../../inline-attachments.js";
|
|
5
|
+
import type { MailboxEventStreamConnection } from "../../mailbox-events.js";
|
|
6
|
+
import type { SamvaApi } from "../generated/index.js";
|
|
7
7
|
export interface ConfigBase {
|
|
8
8
|
readonly baseUrl?: string;
|
|
9
9
|
/** Generate the key once for each idempotent logical call. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CLIENT_ATTRIBUTION_HEADER, clientAttribution } from "../../client-attribution.js";
|
|
2
2
|
import { MediaUploadError, uploadContentType } from "../../inline-attachments.js";
|
|
3
3
|
import { ApiKeySecurityMiddleware } from "../generated/shared.js";
|
|
4
|
-
import { HttpApi, HttpApiClient, HttpApiMiddleware } from "effect/http-api";
|
|
5
4
|
import { Context, Effect, Layer, Redacted } from "effect";
|
|
5
|
+
import { HttpApi, HttpApiClient, HttpApiMiddleware } from "effect/http-api";
|
|
6
6
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
7
7
|
import * as HttpClient from "effect/http/HttpClient";
|
|
8
8
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { type FlatRaw, Service } from "./client";
|
|
3
|
-
import { type RequestArg } from "./operation";
|
|
4
|
-
import type { ErgonomicEmailList, SendOptions } from "./send";
|
|
2
|
+
import { type FlatRaw, Service } from "./client.js";
|
|
3
|
+
import { type RequestArg } from "./operation.js";
|
|
4
|
+
import type { ErgonomicEmailList, SendOptions } from "./send.js";
|
|
5
5
|
type AddSenderRequest = NonNullable<RequestArg<FlatRaw["emailAddSender"]>>;
|
|
6
6
|
export type EmailAddSenderInput = Omit<AddSenderRequest["payload"], "replyToEmails"> & {
|
|
7
7
|
readonly replyToEmails?: ErgonomicEmailList | null | undefined;
|
|
@@ -13,5 +13,5 @@ export declare const addEmailSender: (input: EmailAddSenderInput, options?: Send
|
|
|
13
13
|
readonly providerLifecycle: "active" | "deleting" | "failed" | "provisioning";
|
|
14
14
|
readonly providerFailureCode: string | null;
|
|
15
15
|
readonly createdAt: string;
|
|
16
|
-
}, import("
|
|
16
|
+
}, import("../index.js").ConflictError | import("../index.js").ExternalServiceError | import("../index.js").ForbiddenError | import("../index.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("../index.js").InternalError | import("../index.js").MalformedRequestError | import("../index.js").ResourceNotFoundError | import("effect/Schema").SchemaError | import("../index.js").UnauthorizedError | import("../index.js").ValidationError, Service>;
|
|
17
17
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stream } from "effect";
|
|
2
|
-
import { type MailboxEvent, type MailboxEventStreamFailure, type MailboxEventStreamOptions } from "../../mailbox-events";
|
|
3
|
-
import { Service } from "./client";
|
|
2
|
+
import { type MailboxEvent, type MailboxEventStreamFailure, type MailboxEventStreamOptions } from "../../mailbox-events.js";
|
|
3
|
+
import { Service } from "./client.js";
|
|
4
4
|
/**
|
|
5
5
|
* The organization's mailbox events as a stream, resuming from `cursor`. An event counts as handled
|
|
6
6
|
* once the stream is pulled again, or once it ends successfully after the event (as `Stream.take`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Brand, Effect, Redacted, Stream } from "effect";
|
|
2
2
|
import type { HttpApiGroup } from "effect/http-api";
|
|
3
|
-
import { SDK_OPERATION_CALLS } from "../../service-map";
|
|
4
|
-
import { type FlatRaw, type Operation, type OperationSuccess, Service } from "./client";
|
|
3
|
+
import type { SDK_OPERATION_CALLS } from "../../service-map.js";
|
|
4
|
+
import { type FlatRaw, type Operation, type OperationSuccess, Service } from "./client.js";
|
|
5
5
|
export type SdkOperation = keyof typeof SDK_OPERATION_CALLS & Operation;
|
|
6
6
|
type MethodReturn<Method> = Method extends (...args: infer _Args) => infer Return ? Return : never;
|
|
7
7
|
type Wire<Value> = Value extends string ? Value extends Brand.Brand<string> ? string : Value : Value extends Redacted.Redacted<infer Raw> ? Raw | Value : Value extends number | boolean | bigint | symbol | null | undefined ? Value : Value extends Date ? Value : Value extends ReadonlyArray<infer Item> ? ReadonlyArray<Wire<Item>> : Value extends object ? {
|
|
@@ -19,6 +19,25 @@ type Input<Name extends SdkOperation> = Wire<FlattenRequest<NonNullable<RequestA
|
|
|
19
19
|
export interface OperationOptions {
|
|
20
20
|
readonly idempotencyKey?: string | undefined;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* What one operation wrapper reads at runtime. `codegen/generate-registry.ts` emits a table of these
|
|
24
|
+
* beside each domain, so a focused entry carries its own operations' descriptors and not the API's.
|
|
25
|
+
*/
|
|
26
|
+
export interface OperationDescriptor {
|
|
27
|
+
readonly group: string;
|
|
28
|
+
readonly method: string;
|
|
29
|
+
readonly idempotent: boolean;
|
|
30
|
+
readonly idempotentWhen?: {
|
|
31
|
+
readonly field: string;
|
|
32
|
+
readonly equals: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
readonly paginated: boolean;
|
|
35
|
+
readonly call: {
|
|
36
|
+
readonly kind: string;
|
|
37
|
+
readonly paths?: ReadonlyArray<string> | undefined;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export type OperationDescriptors = Readonly<Record<string, OperationDescriptor>>;
|
|
22
41
|
export type OperationResult<Name extends SdkOperation> = Effect.Effect<OperationSuccess<Name>, Effect.Error<MethodReturn<FlatRaw[Name]>>, Service>;
|
|
23
42
|
type OperationFunction<Name extends SdkOperation> = (typeof SDK_OPERATION_CALLS)[Name] extends {
|
|
24
43
|
readonly kind: "none";
|
|
@@ -42,10 +61,10 @@ type PaginationCompanions<Parameters, A, E, R> = {} extends Parameters ? {
|
|
|
42
61
|
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;
|
|
43
62
|
export declare const stripUndefined: <Value>(input: Value) => Value;
|
|
44
63
|
/**
|
|
45
|
-
* Operation factory for one API group. Each domain module binds its own group
|
|
46
|
-
* loads that group's schemas and nothing else.
|
|
64
|
+
* Operation factory for one API group. Each domain module binds its own group and descriptor table,
|
|
65
|
+
* so importing it loads that group's schemas and metadata and nothing else.
|
|
47
66
|
*/
|
|
48
|
-
export declare const forGroup: (group: HttpApiGroup.Constraint) => <Name extends SdkOperation>(operationName: Name) => WithPagination<OperationFunction<Name>>;
|
|
67
|
+
export declare const forGroup: (group: HttpApiGroup.Constraint, descriptors: OperationDescriptors) => <Name extends SdkOperation>(operationName: Name) => WithPagination<OperationFunction<Name>>;
|
|
49
68
|
/** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
|
|
50
69
|
export declare const callEndpoint: (group: HttpApiGroup.Constraint, name: SdkOperation, request: unknown) => Effect.Effect<unknown, unknown, Service>;
|
|
51
70
|
export {};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { SamvaOperations } from "../generated-metadata.js";
|
|
2
1
|
import { isRetrySafe } from "../../request-policy.js";
|
|
3
|
-
import { SDK_OPERATION_CALLS } from "../../service-map.js";
|
|
4
2
|
import { streamCursorItems, streamCursorPages } from "../pagination.js";
|
|
5
3
|
import { generateIdempotencyKey, withRetry } from "../retry.js";
|
|
6
4
|
import { Service } from "./client.js";
|
|
7
5
|
import { Effect, Predicate } from "effect";
|
|
8
6
|
// src/effect/internal/operation.ts
|
|
9
|
-
const traceName = (operationName) => {
|
|
10
|
-
const moduleName =
|
|
7
|
+
const traceName = (descriptor, operationName) => {
|
|
8
|
+
const moduleName = descriptor.group.split(" ").map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase()).join("");
|
|
11
9
|
const prefix = moduleName[0].toLowerCase() + moduleName.slice(1);
|
|
12
10
|
if (!operationName.startsWith(prefix)) return `Samva.${operationName}`;
|
|
13
11
|
const method = operationName.slice(prefix.length);
|
|
@@ -19,19 +17,22 @@ const stripUndefined = (input) => {
|
|
|
19
17
|
if (Object.getPrototypeOf(input) !== Object.prototype) return input;
|
|
20
18
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0).map(([key, value]) => [key, stripUndefined(value)]));
|
|
21
19
|
};
|
|
22
|
-
const adapt = (operationName, rawCall, input, idempotencyKey) => {
|
|
23
|
-
const
|
|
20
|
+
const adapt = (descriptor, operationName, rawCall, input, idempotencyKey) => {
|
|
21
|
+
const callDescriptor = descriptor.call;
|
|
24
22
|
const call = (request = {}) => {
|
|
25
23
|
const operation = rawCall({
|
|
26
24
|
...request,
|
|
27
|
-
|
|
25
|
+
headers: {
|
|
26
|
+
...request["headers"],
|
|
27
|
+
...idempotencyKey === void 0 ? {} : { "idempotency-key": idempotencyKey }
|
|
28
|
+
}
|
|
28
29
|
});
|
|
29
|
-
return isRetrySafe(
|
|
30
|
+
return isRetrySafe(descriptor, input) ? withRetry(operation) : operation;
|
|
30
31
|
};
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
33
|
-
if (
|
|
34
|
-
const pathDescriptor =
|
|
32
|
+
if (callDescriptor.kind === "none") return call();
|
|
33
|
+
if (callDescriptor.kind === "params") return call({ query: stripUndefined(input ?? {}) });
|
|
34
|
+
if (callDescriptor.kind === "payload") return call({ payload: stripUndefined(input ?? {}) });
|
|
35
|
+
const pathDescriptor = callDescriptor;
|
|
35
36
|
const inputRecord = input ?? {};
|
|
36
37
|
const params = {};
|
|
37
38
|
for (const path of pathDescriptor.paths) {
|
|
@@ -47,24 +48,26 @@ const adapt = (operationName, rawCall, input, idempotencyKey) => {
|
|
|
47
48
|
};
|
|
48
49
|
const isCursorPageEnvelope = (value) => Predicate.isObject(value) && Array.isArray(value.items) && (value.nextCursor === null || typeof value.nextCursor === "string");
|
|
49
50
|
/**
|
|
50
|
-
* Operation factory for one API group. Each domain module binds its own group
|
|
51
|
-
* loads that group's schemas and nothing else.
|
|
51
|
+
* Operation factory for one API group. Each domain module binds its own group and descriptor table,
|
|
52
|
+
* so importing it loads that group's schemas and metadata and nothing else.
|
|
52
53
|
*/
|
|
53
|
-
const forGroup = (group) => (operationName) => {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const forGroup = (group, descriptors) => (operationName) => {
|
|
55
|
+
const descriptor = descriptors[operationName];
|
|
56
|
+
if (descriptor === void 0) throw new Error(`${operationName} has no descriptor in this entry`);
|
|
57
|
+
if (descriptor.group !== group.identifier) throw new Error(`${operationName} is not an endpoint of ${group.identifier}`);
|
|
58
|
+
return make(group, operationName, descriptor);
|
|
56
59
|
};
|
|
57
60
|
/** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
|
|
58
61
|
const callEndpoint = (group, name, request) => Effect.flatMap(Service, (client) => Effect.flatMap(client.endpoint(group, name), (call) => call(request)));
|
|
59
|
-
const make = (group, operationName) => {
|
|
60
|
-
const call = Effect.fn(traceName(operationName))(function* (input, options) {
|
|
62
|
+
const make = (group, operationName, descriptor) => {
|
|
63
|
+
const call = Effect.fn(traceName(descriptor, operationName))(function* (input, options) {
|
|
61
64
|
const client = yield* Service;
|
|
62
65
|
const rawCall = yield* client.endpoint(group, operationName);
|
|
63
|
-
const idempotencyKey =
|
|
64
|
-
return yield* adapt(operationName, rawCall, input, idempotencyKey);
|
|
66
|
+
const idempotencyKey = descriptor.idempotent ? options?.idempotencyKey ?? client.idempotency?.(operationName) ?? (yield* generateIdempotencyKey) : void 0;
|
|
67
|
+
return yield* adapt(descriptor, operationName, rawCall, input, idempotencyKey);
|
|
65
68
|
});
|
|
66
69
|
const operation = call;
|
|
67
|
-
if (
|
|
70
|
+
if (descriptor.paginated) {
|
|
68
71
|
const list = (input) => Effect.filterOrElse(call(input), isCursorPageEnvelope, () => Effect.die(/* @__PURE__ */ new Error(`${operationName} did not return a cursor page envelope`)));
|
|
69
72
|
Object.assign(operation, {
|
|
70
73
|
pages: (input) => streamCursorPages(list, input ?? {}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { type MediaUploadError } from "../../inline-attachments";
|
|
3
|
-
import type { SendMessagePayload } from "../generated/shared";
|
|
4
|
-
import { Service } from "./client";
|
|
5
|
-
import { type OperationResult } from "./operation";
|
|
2
|
+
import { type MediaUploadError } from "../../inline-attachments.js";
|
|
3
|
+
import type { SendMessagePayload } from "../generated/shared.js";
|
|
4
|
+
import { Service } from "./client.js";
|
|
5
|
+
import { type OperationResult } from "./operation.js";
|
|
6
6
|
type MessagePayload = typeof SendMessagePayload.Encoded;
|
|
7
7
|
export type MessageRecipient = EmailPayload["to"][number];
|
|
8
8
|
type ContactObjectRecipient = {
|