samva 0.15.0 → 0.17.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 +4 -1
- package/README.md +46 -1
- package/dist/analytics-CaqPRsry.js +207 -0
- package/dist/api-keys-Ce1Y4_Ip.js +274 -0
- package/dist/attachments-DYqVIraC.js +140 -0
- package/dist/brands-ZwuOGIWO.js +175 -0
- package/dist/campaigns-DZlz1E9E.js +522 -0
- package/dist/categories-CA4XIQAb.js +1011 -0
- package/dist/client/sdk.gen.d.ts +234 -49
- package/dist/client/types.gen.d.ts +1521 -348
- package/dist/client-DOzUrdTE.js +1115 -0
- package/dist/contact-groups-BLbFXnjq.js +446 -0
- package/dist/contacts-BbsoXXB4.js +787 -0
- package/dist/conversations-_sRHueML.js +494 -0
- package/dist/custom-fields-BHWbwlKn.js +176 -0
- package/dist/effect/analytics.js +2 -21
- package/dist/effect/api-keys.d.ts +1 -0
- package/dist/effect/api-keys.js +2 -25
- package/dist/effect/attachments.js +2 -17
- package/dist/effect/brands.d.ts +1 -1
- package/dist/effect/brands.js +3 -24
- package/dist/effect/campaigns.js +2 -33
- package/dist/effect/categories.js +1 -1
- package/dist/effect/client.d.ts +1 -1
- package/dist/effect/client.js +3 -4
- package/dist/effect/contact-groups.js +2 -29
- package/dist/effect/contacts.d.ts +52 -0
- package/dist/effect/contacts.js +2 -47
- package/dist/effect/conversations.js +2 -35
- package/dist/effect/custom-fields.js +2 -17
- package/dist/effect/email.d.ts +3 -20
- package/dist/effect/email.js +2 -141
- package/dist/effect/events.d.ts +121 -0
- package/dist/effect/events.js +3 -0
- package/dist/effect/extension-installations.js +2 -27
- package/dist/effect/extensions.js +2 -19
- package/dist/effect/feedback.d.ts +1 -1
- package/dist/effect/feedback.js +3 -13
- package/dist/effect/generated/analytics.d.ts +715 -0
- package/dist/effect/generated/api-keys.d.ts +1627 -0
- package/dist/effect/generated/attachments.d.ts +554 -0
- package/dist/effect/generated/brands.d.ts +1118 -0
- package/dist/effect/generated/campaigns.d.ts +3783 -0
- package/dist/effect/generated/contact-events.d.ts +158 -0
- package/dist/effect/generated/contact-groups.d.ts +1445 -0
- package/dist/effect/generated/contacts.d.ts +3789 -0
- package/dist/effect/generated/conversations.d.ts +2870 -0
- package/dist/effect/generated/custom-fields.d.ts +562 -0
- package/dist/effect/generated/email.d.ts +10622 -0
- package/dist/effect/generated/events.d.ts +463 -0
- package/dist/effect/generated/extension-installations.d.ts +1786 -0
- package/dist/effect/generated/extensions.d.ts +927 -0
- package/dist/effect/generated/feedback.d.ts +116 -0
- package/dist/effect/generated/index.d.ts +61 -0
- package/dist/effect/generated/journeys.d.ts +6135 -0
- package/dist/effect/generated/mailboxes.d.ts +13641 -0
- package/dist/effect/generated/media.d.ts +741 -0
- package/dist/effect/generated/messages.d.ts +2355 -0
- package/dist/effect/generated/namespaces.d.ts +654 -0
- package/dist/effect/generated/operations.d.ts +514 -0
- package/dist/effect/generated/organizations.d.ts +1111 -0
- package/dist/effect/generated/scheduled-messages.d.ts +1798 -0
- package/dist/effect/generated/shared.d.ts +3250 -0
- package/dist/effect/generated/subscriptions.d.ts +188 -0
- package/dist/effect/generated/templates.d.ts +8177 -0
- package/dist/effect/generated/unsubscribe-groups.d.ts +1153 -0
- package/dist/effect/generated/webhooks.d.ts +1697 -0
- package/dist/effect/generated/whoami.d.ts +291 -0
- package/dist/effect/generated-metadata.d.ts +1631 -0
- package/dist/effect/index.d.ts +4 -1
- package/dist/effect/index.js +29 -26
- package/dist/effect/internal/client.d.ts +10 -7
- package/dist/effect/internal/email-sender.d.ts +17 -0
- package/dist/effect/internal/operation.d.ts +12 -72
- package/dist/effect/internal/send.d.ts +60 -0
- package/dist/effect/journeys.d.ts +2153 -0
- package/dist/effect/journeys.js +2 -0
- package/dist/effect/mailboxes.d.ts +255 -205
- package/dist/effect/mailboxes.js +2 -2
- package/dist/effect/media.js +3 -1
- package/dist/effect/messages.d.ts +2 -2
- package/dist/effect/messages.js +3 -1
- package/dist/effect/namespaces.js +2 -19
- package/dist/effect/operations.js +2 -15
- package/dist/effect/organizations.js +2 -23
- package/dist/effect/retry.js +1 -1
- package/dist/effect/scheduled-messages.js +2 -19
- package/dist/effect/subscriptions.js +2 -9
- package/dist/effect/templates.d.ts +1 -1
- package/dist/effect/templates.js +3 -78
- package/dist/effect/unsubscribe-groups.js +2 -27
- package/dist/effect/webhooks.d.ts +9 -9
- package/dist/effect/webhooks.js +3 -33
- package/dist/effect/whoami.d.ts +46 -0
- package/dist/effect/whoami.js +2 -0
- package/dist/email-R0NAA9PW.js +2498 -0
- package/dist/events-CxbTUHYT.js +82 -0
- package/dist/extension-installations-CD94LPmk.js +407 -0
- package/dist/extensions-BKyNQLvu.js +220 -0
- package/dist/feedback-Bpa09JOS.js +52 -0
- package/dist/index.js +3 -3
- package/dist/{inline-attachments-UxLeyytJ.js → inline-attachments-Bi1hDltp.js} +2 -2
- package/dist/journeys-CARo_BJT.js +499 -0
- package/dist/mailboxes-BRDn7BIK.js +2470 -0
- package/dist/media-VrrtNnft.js +181 -0
- package/dist/namespaces-CcvEbG-y.js +152 -0
- package/dist/{operation-BZ5Xov-x.js → operation-n_IYgNVK.js} +85 -102
- package/dist/operations-CmB3FHwf.js +93 -0
- package/dist/organizations-A-plufWc.js +252 -0
- package/dist/promises/errors.gen.d.ts +12 -2
- package/dist/promises/index.d.ts +9 -3
- package/dist/promises/index.js +3 -3
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/{promises-Cd6Jamqk.js → promises---Kbh-7z.js} +745 -195
- package/dist/runtime-P0l1_2-C.js +25 -0
- package/dist/scheduled-messages-DkKZRRaN.js +207 -0
- package/dist/send-Bxc0XfGE.js +722 -0
- package/dist/service-map.d.ts +101 -15
- package/dist/subscriptions-DEXYtMXg.js +67 -0
- package/dist/templates-DZomxsG7.js +2289 -0
- package/dist/unsubscribe-groups-Iqk4Isf9.js +291 -0
- package/dist/webhooks-CPXuu8Xf.js +530 -0
- package/dist/whoami-Ccz0jwlt.js +59 -0
- package/package.json +17 -3
- package/dist/categories-BGUBFdH9.js +0 -183
- package/dist/client-CDg7zJs0.js +0 -13726
- package/dist/effect/generated.d.ts +0 -64059
- package/dist/mailboxes-BH_JPmOE.js +0 -159
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Ht as SuccessResponse, Jt as UnauthorizedError, K as ForbiddenError, Lt as ResourceNotFoundError, Mt as OrganizationId, St as MediaId, Y as InternalError, en as ValidationError, q as GatewayTimeoutError, s as ApiKeySecurityMiddleware } from "./client-DOzUrdTE.js";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
//#region src/effect/generated/media.ts
|
|
5
|
+
const MediaUploadInstruction = /* @__PURE__ */ Schema.Struct({
|
|
6
|
+
url: Schema.String,
|
|
7
|
+
method: Schema.Literal("PUT"),
|
|
8
|
+
headers: Schema.Record(Schema.String, Schema.String),
|
|
9
|
+
expiresAt: Schema.String
|
|
10
|
+
}).annotate({ identifier: "MediaUploadInstruction" });
|
|
11
|
+
const MediaDownloadUrl = /* @__PURE__ */ Schema.Struct({
|
|
12
|
+
url: Schema.String,
|
|
13
|
+
expiresAt: Schema.String
|
|
14
|
+
}).annotate({ identifier: "MediaDownloadUrl" });
|
|
15
|
+
const Media = /* @__PURE__ */ Schema.Struct({
|
|
16
|
+
id: MediaId,
|
|
17
|
+
organizationId: OrganizationId,
|
|
18
|
+
status: Schema.Union([
|
|
19
|
+
Schema.Literal("pending"),
|
|
20
|
+
Schema.Literal("uploading"),
|
|
21
|
+
Schema.Literal("processing"),
|
|
22
|
+
Schema.Literal("ready"),
|
|
23
|
+
Schema.Literal("failed"),
|
|
24
|
+
Schema.Literal("deleted")
|
|
25
|
+
]),
|
|
26
|
+
filename: Schema.String,
|
|
27
|
+
contentType: Schema.String,
|
|
28
|
+
sizeBytes: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
|
|
29
|
+
width: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" })), Schema.Null]),
|
|
30
|
+
height: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" })), Schema.Null]),
|
|
31
|
+
durationMs: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })), Schema.Null]),
|
|
32
|
+
purpose: Schema.Union([
|
|
33
|
+
Schema.Literal("attachment"),
|
|
34
|
+
Schema.Literal("avatar"),
|
|
35
|
+
Schema.Literal("review_evidence")
|
|
36
|
+
]),
|
|
37
|
+
checksumSha256: Schema.Union([Schema.String, Schema.Null]),
|
|
38
|
+
expiresAt: Schema.Union([Schema.String, Schema.Null]),
|
|
39
|
+
createdAt: Schema.String,
|
|
40
|
+
confirmedAt: Schema.Union([Schema.String, Schema.Null])
|
|
41
|
+
}).annotate({ identifier: "Media" });
|
|
42
|
+
const CreatedMedia = /* @__PURE__ */ Schema.Struct({
|
|
43
|
+
id: MediaId,
|
|
44
|
+
organizationId: OrganizationId,
|
|
45
|
+
status: Schema.Union([
|
|
46
|
+
Schema.Literal("pending"),
|
|
47
|
+
Schema.Literal("uploading"),
|
|
48
|
+
Schema.Literal("processing"),
|
|
49
|
+
Schema.Literal("ready"),
|
|
50
|
+
Schema.Literal("failed"),
|
|
51
|
+
Schema.Literal("deleted")
|
|
52
|
+
]),
|
|
53
|
+
filename: Schema.String,
|
|
54
|
+
contentType: Schema.String,
|
|
55
|
+
sizeBytes: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
|
|
56
|
+
width: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" })), Schema.Null]),
|
|
57
|
+
height: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" })), Schema.Null]),
|
|
58
|
+
durationMs: Schema.Union([Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })), Schema.Null]),
|
|
59
|
+
purpose: Schema.Union([
|
|
60
|
+
Schema.Literal("attachment"),
|
|
61
|
+
Schema.Literal("avatar"),
|
|
62
|
+
Schema.Literal("review_evidence")
|
|
63
|
+
]),
|
|
64
|
+
checksumSha256: Schema.Union([Schema.String, Schema.Null]),
|
|
65
|
+
expiresAt: Schema.Union([Schema.String, Schema.Null]),
|
|
66
|
+
createdAt: Schema.String,
|
|
67
|
+
confirmedAt: Schema.Union([Schema.String, Schema.Null]),
|
|
68
|
+
upload: MediaUploadInstruction
|
|
69
|
+
}).annotate({ identifier: "CreatedMedia" });
|
|
70
|
+
const CompletedMedia = /* @__PURE__ */ Schema.Struct({
|
|
71
|
+
media: Media,
|
|
72
|
+
downloadUrl: Schema.String
|
|
73
|
+
}).annotate({ identifier: "CompletedMedia" });
|
|
74
|
+
const MediaCreateRequestJson = /* @__PURE__ */ Schema.Struct({
|
|
75
|
+
filename: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(255).annotate({ expected: "a string with at most 255 code points" })).check(Schema.isMaxLength(255).annotate({ expected: "a value with a length of at most 255" })),
|
|
76
|
+
contentType: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(127).annotate({ expected: "a string with at most 127 code points" })).check(Schema.isMaxLength(127).annotate({ expected: "a value with a length of at most 127" })),
|
|
77
|
+
sizeBytes: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isLessThanOrEqualTo(26214400).annotate({ expected: "a value less than or equal to 26214400" })).check(Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" })),
|
|
78
|
+
purpose: Schema.Union([
|
|
79
|
+
Schema.Literal("attachment"),
|
|
80
|
+
Schema.Literal("avatar"),
|
|
81
|
+
Schema.Literal("review_evidence")
|
|
82
|
+
]),
|
|
83
|
+
checksumSha256: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
|
|
84
|
+
});
|
|
85
|
+
const MediaCreate201 = CreatedMedia;
|
|
86
|
+
const MediaCreate401 = UnauthorizedError;
|
|
87
|
+
const MediaCreate403 = ForbiddenError;
|
|
88
|
+
const MediaCreate422 = ValidationError;
|
|
89
|
+
const MediaCreate500 = InternalError;
|
|
90
|
+
const MediaCreate504 = GatewayTimeoutError;
|
|
91
|
+
const MediaGetByIdPathParams = /* @__PURE__ */ Schema.Struct({ id: MediaId });
|
|
92
|
+
const MediaGetById200 = Media;
|
|
93
|
+
const MediaGetById401 = UnauthorizedError;
|
|
94
|
+
const MediaGetById403 = ForbiddenError;
|
|
95
|
+
const MediaGetById404 = ResourceNotFoundError;
|
|
96
|
+
const MediaGetById422 = ValidationError;
|
|
97
|
+
const MediaGetById500 = InternalError;
|
|
98
|
+
const MediaGetById504 = GatewayTimeoutError;
|
|
99
|
+
const MediaRemovePathParams = /* @__PURE__ */ Schema.Struct({ id: MediaId });
|
|
100
|
+
const MediaRemove200 = SuccessResponse;
|
|
101
|
+
const MediaRemove401 = UnauthorizedError;
|
|
102
|
+
const MediaRemove403 = ForbiddenError;
|
|
103
|
+
const MediaRemove404 = ResourceNotFoundError;
|
|
104
|
+
const MediaRemove422 = ValidationError;
|
|
105
|
+
const MediaRemove500 = InternalError;
|
|
106
|
+
const MediaRemove504 = GatewayTimeoutError;
|
|
107
|
+
const MediaCompletePathParams = /* @__PURE__ */ Schema.Struct({ id: MediaId });
|
|
108
|
+
const MediaComplete200 = CompletedMedia;
|
|
109
|
+
const MediaComplete401 = UnauthorizedError;
|
|
110
|
+
const MediaComplete403 = ForbiddenError;
|
|
111
|
+
const MediaComplete404 = ResourceNotFoundError;
|
|
112
|
+
const MediaComplete422 = ValidationError;
|
|
113
|
+
const MediaComplete500 = InternalError;
|
|
114
|
+
const MediaComplete504 = GatewayTimeoutError;
|
|
115
|
+
const MediaDownloadUrlPathParams = /* @__PURE__ */ Schema.Struct({ id: MediaId });
|
|
116
|
+
const MediaDownloadUrl200 = MediaDownloadUrl;
|
|
117
|
+
const MediaDownloadUrl401 = UnauthorizedError;
|
|
118
|
+
const MediaDownloadUrl403 = ForbiddenError;
|
|
119
|
+
const MediaDownloadUrl404 = ResourceNotFoundError;
|
|
120
|
+
const MediaDownloadUrl422 = ValidationError;
|
|
121
|
+
const MediaDownloadUrl500 = InternalError;
|
|
122
|
+
const MediaDownloadUrl504 = GatewayTimeoutError;
|
|
123
|
+
var MediaGroup = class extends HttpApiGroup.make("Media").add(HttpApiEndpoint.post("mediaCreate", "/v1/media", {
|
|
124
|
+
payload: MediaCreateRequestJson,
|
|
125
|
+
success: MediaCreate201.pipe(HttpApiSchema.status(201)),
|
|
126
|
+
error: [
|
|
127
|
+
MediaCreate401.pipe(HttpApiSchema.status(401)),
|
|
128
|
+
MediaCreate403.pipe(HttpApiSchema.status(403)),
|
|
129
|
+
MediaCreate422.pipe(HttpApiSchema.status(422)),
|
|
130
|
+
MediaCreate500,
|
|
131
|
+
MediaCreate504.pipe(HttpApiSchema.status(504))
|
|
132
|
+
]
|
|
133
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "media.create").annotate(OpenApi.Summary, "Create a media object").annotate(OpenApi.Description, "Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage. Requires `messages:create`, or `email:send` for `attachment` media."), HttpApiEndpoint.get("mediaGetById", "/v1/media/:id", {
|
|
134
|
+
params: MediaGetByIdPathParams,
|
|
135
|
+
success: MediaGetById200,
|
|
136
|
+
error: [
|
|
137
|
+
MediaGetById401.pipe(HttpApiSchema.status(401)),
|
|
138
|
+
MediaGetById403.pipe(HttpApiSchema.status(403)),
|
|
139
|
+
MediaGetById404.pipe(HttpApiSchema.status(404)),
|
|
140
|
+
MediaGetById422.pipe(HttpApiSchema.status(422)),
|
|
141
|
+
MediaGetById500,
|
|
142
|
+
MediaGetById504.pipe(HttpApiSchema.status(504))
|
|
143
|
+
]
|
|
144
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "media.getById").annotate(OpenApi.Summary, "Get a media object").annotate(OpenApi.Description, "Returns the media object's metadata, including status, dimensions, and confirmation timestamps."), HttpApiEndpoint.delete("mediaRemove", "/v1/media/:id", {
|
|
145
|
+
params: MediaRemovePathParams,
|
|
146
|
+
success: MediaRemove200,
|
|
147
|
+
error: [
|
|
148
|
+
MediaRemove401.pipe(HttpApiSchema.status(401)),
|
|
149
|
+
MediaRemove403.pipe(HttpApiSchema.status(403)),
|
|
150
|
+
MediaRemove404.pipe(HttpApiSchema.status(404)),
|
|
151
|
+
MediaRemove422.pipe(HttpApiSchema.status(422)),
|
|
152
|
+
MediaRemove500,
|
|
153
|
+
MediaRemove504.pipe(HttpApiSchema.status(504))
|
|
154
|
+
]
|
|
155
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "media.remove").annotate(OpenApi.Summary, "Delete a media object").annotate(OpenApi.Description, "Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready."), HttpApiEndpoint.post("mediaComplete", "/v1/media/:id/complete", {
|
|
156
|
+
params: MediaCompletePathParams,
|
|
157
|
+
success: MediaComplete200,
|
|
158
|
+
error: [
|
|
159
|
+
MediaComplete401.pipe(HttpApiSchema.status(401)),
|
|
160
|
+
MediaComplete403.pipe(HttpApiSchema.status(403)),
|
|
161
|
+
MediaComplete404.pipe(HttpApiSchema.status(404)),
|
|
162
|
+
MediaComplete422.pipe(HttpApiSchema.status(422)),
|
|
163
|
+
MediaComplete500,
|
|
164
|
+
MediaComplete504.pipe(HttpApiSchema.status(504))
|
|
165
|
+
]
|
|
166
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "media.complete").annotate(OpenApi.Summary, "Complete a media upload").annotate(OpenApi.Description, "Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL. Requires the permission that creating the media object did."), HttpApiEndpoint.get("mediaDownloadUrl", "/v1/media/:id/url", {
|
|
167
|
+
params: MediaDownloadUrlPathParams,
|
|
168
|
+
success: MediaDownloadUrl200,
|
|
169
|
+
error: [
|
|
170
|
+
MediaDownloadUrl401.pipe(HttpApiSchema.status(401)),
|
|
171
|
+
MediaDownloadUrl403.pipe(HttpApiSchema.status(403)),
|
|
172
|
+
MediaDownloadUrl404.pipe(HttpApiSchema.status(404)),
|
|
173
|
+
MediaDownloadUrl422.pipe(HttpApiSchema.status(422)),
|
|
174
|
+
MediaDownloadUrl500,
|
|
175
|
+
MediaDownloadUrl504.pipe(HttpApiSchema.status(504))
|
|
176
|
+
]
|
|
177
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "media.downloadUrl").annotate(OpenApi.Summary, "Get a media download URL").annotate(OpenApi.Description, "Generates a presigned, time-limited download URL for a ready media object.")).annotate(OpenApi.Description, "Media objects and the presigned uploads that fill them") {};
|
|
178
|
+
//#endregion
|
|
179
|
+
export { MediaGroup as t };
|
|
180
|
+
|
|
181
|
+
//# sourceMappingURL=media-VrrtNnft.js.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { D as Cursor, Dt as NamespaceMetadata, Et as NamespaceId, Ht as SuccessResponse, Jt as UnauthorizedError, K as ForbiddenError, Lt as ResourceNotFoundError, Y as InternalError, en as ValidationError, m as ConflictError, q as GatewayTimeoutError, s as ApiKeySecurityMiddleware } from "./client-DOzUrdTE.js";
|
|
3
|
+
import { n as forGroup } from "./operation-n_IYgNVK.js";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
//#region src/effect/generated/namespaces.ts
|
|
7
|
+
const NamespaceSummary = /* @__PURE__ */ Schema.Struct({
|
|
8
|
+
id: NamespaceId,
|
|
9
|
+
name: Schema.String,
|
|
10
|
+
createdAt: Schema.String
|
|
11
|
+
}).annotate({ identifier: "NamespaceSummary" });
|
|
12
|
+
const Namespace = /* @__PURE__ */ Schema.Struct({
|
|
13
|
+
id: NamespaceId,
|
|
14
|
+
name: Schema.String,
|
|
15
|
+
createdAt: Schema.String,
|
|
16
|
+
metadata: NamespaceMetadata,
|
|
17
|
+
updatedAt: Schema.String
|
|
18
|
+
}).annotate({ identifier: "Namespace" });
|
|
19
|
+
const NamespacePage = /* @__PURE__ */ Schema.Struct({
|
|
20
|
+
items: Schema.Array(NamespaceSummary),
|
|
21
|
+
nextCursor: Schema.Union([Schema.String, Schema.Null])
|
|
22
|
+
}).annotate({ identifier: "NamespacePage" });
|
|
23
|
+
const NamespacesListQuery = /* @__PURE__ */ Schema.Struct({
|
|
24
|
+
limit: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
25
|
+
cursor: Schema.optionalKey(Schema.Union([Cursor, Schema.Null])),
|
|
26
|
+
after: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
27
|
+
before: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
|
|
28
|
+
});
|
|
29
|
+
const NamespacesList200 = NamespacePage;
|
|
30
|
+
const NamespacesList401 = UnauthorizedError;
|
|
31
|
+
const NamespacesList403 = ForbiddenError;
|
|
32
|
+
const NamespacesList422 = ValidationError;
|
|
33
|
+
const NamespacesList500 = InternalError;
|
|
34
|
+
const NamespacesList504 = GatewayTimeoutError;
|
|
35
|
+
const NamespacesCreateRequestJson = /* @__PURE__ */ Schema.Struct({
|
|
36
|
+
name: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(128).annotate({ expected: "a string with at most 128 code points" })).check(Schema.isPattern(/* @__PURE__ */ new RegExp("^\\S[\\s\\S]*\\S$|^\\S$|^$", "u")).annotate({ expected: "a string matching the RegExp ^\\S[\\s\\S]*\\S$|^\\S$|^$" })).check(Schema.isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })),
|
|
37
|
+
metadata: Schema.optionalKey(Schema.Union([NamespaceMetadata, Schema.Null]))
|
|
38
|
+
});
|
|
39
|
+
const NamespacesCreate201 = Namespace;
|
|
40
|
+
const NamespacesCreate401 = UnauthorizedError;
|
|
41
|
+
const NamespacesCreate403 = ForbiddenError;
|
|
42
|
+
const NamespacesCreate409 = ConflictError;
|
|
43
|
+
const NamespacesCreate422 = ValidationError;
|
|
44
|
+
const NamespacesCreate500 = InternalError;
|
|
45
|
+
const NamespacesCreate504 = GatewayTimeoutError;
|
|
46
|
+
const NamespacesGetPathParams = /* @__PURE__ */ Schema.Struct({ id: NamespaceId });
|
|
47
|
+
const NamespacesGet200 = Namespace;
|
|
48
|
+
const NamespacesGet401 = UnauthorizedError;
|
|
49
|
+
const NamespacesGet403 = ForbiddenError;
|
|
50
|
+
const NamespacesGet404 = ResourceNotFoundError;
|
|
51
|
+
const NamespacesGet422 = ValidationError;
|
|
52
|
+
const NamespacesGet500 = InternalError;
|
|
53
|
+
const NamespacesGet504 = GatewayTimeoutError;
|
|
54
|
+
const NamespacesRemovePathParams = /* @__PURE__ */ Schema.Struct({ id: NamespaceId });
|
|
55
|
+
const NamespacesRemove200 = SuccessResponse;
|
|
56
|
+
const NamespacesRemove401 = UnauthorizedError;
|
|
57
|
+
const NamespacesRemove403 = ForbiddenError;
|
|
58
|
+
const NamespacesRemove404 = ResourceNotFoundError;
|
|
59
|
+
const NamespacesRemove409 = ConflictError;
|
|
60
|
+
const NamespacesRemove422 = ValidationError;
|
|
61
|
+
const NamespacesRemove500 = InternalError;
|
|
62
|
+
const NamespacesRemove504 = GatewayTimeoutError;
|
|
63
|
+
const NamespacesUpdatePathParams = /* @__PURE__ */ Schema.Struct({ id: NamespaceId });
|
|
64
|
+
const NamespacesUpdateRequestJson = /* @__PURE__ */ Schema.Struct({
|
|
65
|
+
name: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(128).annotate({ expected: "a string with at most 128 code points" })).check(Schema.isPattern(/* @__PURE__ */ new RegExp("^\\S[\\s\\S]*\\S$|^\\S$|^$", "u")).annotate({ expected: "a string matching the RegExp ^\\S[\\s\\S]*\\S$|^\\S$|^$" })).check(Schema.isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })), Schema.Null])),
|
|
66
|
+
metadata: Schema.optionalKey(Schema.Union([Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Null])), Schema.Null]))
|
|
67
|
+
});
|
|
68
|
+
const NamespacesUpdate200 = Namespace;
|
|
69
|
+
const NamespacesUpdate401 = UnauthorizedError;
|
|
70
|
+
const NamespacesUpdate403 = ForbiddenError;
|
|
71
|
+
const NamespacesUpdate404 = ResourceNotFoundError;
|
|
72
|
+
const NamespacesUpdate409 = ConflictError;
|
|
73
|
+
const NamespacesUpdate422 = ValidationError;
|
|
74
|
+
const NamespacesUpdate500 = InternalError;
|
|
75
|
+
const NamespacesUpdate504 = GatewayTimeoutError;
|
|
76
|
+
var NamespacesGroup = class extends HttpApiGroup.make("Namespaces").add(HttpApiEndpoint.get("namespacesList", "/v1/namespaces", {
|
|
77
|
+
query: NamespacesListQuery,
|
|
78
|
+
success: NamespacesList200,
|
|
79
|
+
error: [
|
|
80
|
+
NamespacesList401.pipe(HttpApiSchema.status(401)),
|
|
81
|
+
NamespacesList403.pipe(HttpApiSchema.status(403)),
|
|
82
|
+
NamespacesList422.pipe(HttpApiSchema.status(422)),
|
|
83
|
+
NamespacesList500,
|
|
84
|
+
NamespacesList504.pipe(HttpApiSchema.status(504))
|
|
85
|
+
]
|
|
86
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "namespaces.list").annotate(OpenApi.Summary, "List namespaces").annotate(OpenApi.Description, "Returns namespace summaries, newest first, filterable by creation time (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Read a namespace's metadata with `GET /v1/namespaces/{id}`."), HttpApiEndpoint.post("namespacesCreate", "/v1/namespaces", {
|
|
87
|
+
payload: NamespacesCreateRequestJson,
|
|
88
|
+
success: NamespacesCreate201.pipe(HttpApiSchema.status(201)),
|
|
89
|
+
error: [
|
|
90
|
+
NamespacesCreate401.pipe(HttpApiSchema.status(401)),
|
|
91
|
+
NamespacesCreate403.pipe(HttpApiSchema.status(403)),
|
|
92
|
+
NamespacesCreate409.pipe(HttpApiSchema.status(409)),
|
|
93
|
+
NamespacesCreate422.pipe(HttpApiSchema.status(422)),
|
|
94
|
+
NamespacesCreate500,
|
|
95
|
+
NamespacesCreate504.pipe(HttpApiSchema.status(504))
|
|
96
|
+
]
|
|
97
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "namespaces.create").annotate(OpenApi.Summary, "Create a namespace").annotate(OpenApi.Description, "Creates a namespace with status 201. Names are unique within the organization; a duplicate conflicts."), HttpApiEndpoint.get("namespacesGet", "/v1/namespaces/:id", {
|
|
98
|
+
params: NamespacesGetPathParams,
|
|
99
|
+
success: NamespacesGet200,
|
|
100
|
+
error: [
|
|
101
|
+
NamespacesGet401.pipe(HttpApiSchema.status(401)),
|
|
102
|
+
NamespacesGet403.pipe(HttpApiSchema.status(403)),
|
|
103
|
+
NamespacesGet404.pipe(HttpApiSchema.status(404)),
|
|
104
|
+
NamespacesGet422.pipe(HttpApiSchema.status(422)),
|
|
105
|
+
NamespacesGet500,
|
|
106
|
+
NamespacesGet504.pipe(HttpApiSchema.status(504))
|
|
107
|
+
]
|
|
108
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "namespaces.get").annotate(OpenApi.Summary, "Get a namespace").annotate(OpenApi.Description, "Returns one namespace."), HttpApiEndpoint.delete("namespacesRemove", "/v1/namespaces/:id", {
|
|
109
|
+
params: NamespacesRemovePathParams,
|
|
110
|
+
success: NamespacesRemove200,
|
|
111
|
+
error: [
|
|
112
|
+
NamespacesRemove401.pipe(HttpApiSchema.status(401)),
|
|
113
|
+
NamespacesRemove403.pipe(HttpApiSchema.status(403)),
|
|
114
|
+
NamespacesRemove404.pipe(HttpApiSchema.status(404)),
|
|
115
|
+
NamespacesRemove409.pipe(HttpApiSchema.status(409)),
|
|
116
|
+
NamespacesRemove422.pipe(HttpApiSchema.status(422)),
|
|
117
|
+
NamespacesRemove500,
|
|
118
|
+
NamespacesRemove504.pipe(HttpApiSchema.status(504))
|
|
119
|
+
]
|
|
120
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "namespaces.remove").annotate(OpenApi.Summary, "Delete a namespace").annotate(OpenApi.Description, "Deletes an empty namespace. A namespace that still holds mailboxes, API keys, or webhook endpoints conflicts: remove them first."), HttpApiEndpoint.patch("namespacesUpdate", "/v1/namespaces/:id", {
|
|
121
|
+
params: NamespacesUpdatePathParams,
|
|
122
|
+
payload: NamespacesUpdateRequestJson,
|
|
123
|
+
success: NamespacesUpdate200,
|
|
124
|
+
error: [
|
|
125
|
+
NamespacesUpdate401.pipe(HttpApiSchema.status(401)),
|
|
126
|
+
NamespacesUpdate403.pipe(HttpApiSchema.status(403)),
|
|
127
|
+
NamespacesUpdate404.pipe(HttpApiSchema.status(404)),
|
|
128
|
+
NamespacesUpdate409.pipe(HttpApiSchema.status(409)),
|
|
129
|
+
NamespacesUpdate422.pipe(HttpApiSchema.status(422)),
|
|
130
|
+
NamespacesUpdate500,
|
|
131
|
+
NamespacesUpdate504.pipe(HttpApiSchema.status(504))
|
|
132
|
+
]
|
|
133
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "namespaces.update").annotate(OpenApi.Summary, "Update a namespace").annotate(OpenApi.Description, "Updates the fields you name and keeps the rest. `metadata` merges into the stored metadata by key, and a `null` value deletes that key.")).annotate(OpenApi.Description, "Sub-tenants that confine mailboxes and API keys inside an organization") {};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/effect/namespaces.ts
|
|
136
|
+
var namespaces_exports = /* @__PURE__ */ __exportAll({
|
|
137
|
+
create: () => create,
|
|
138
|
+
get: () => get,
|
|
139
|
+
list: () => list,
|
|
140
|
+
remove: () => remove,
|
|
141
|
+
update: () => update
|
|
142
|
+
});
|
|
143
|
+
const make = forGroup(NamespacesGroup);
|
|
144
|
+
const list = make("namespacesList");
|
|
145
|
+
const create = make("namespacesCreate");
|
|
146
|
+
const get = make("namespacesGet");
|
|
147
|
+
const update = make("namespacesUpdate");
|
|
148
|
+
const remove = make("namespacesRemove");
|
|
149
|
+
//#endregion
|
|
150
|
+
export { remove as a, namespaces_exports as i, get as n, update as o, list as r, create as t };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=namespaces-CcvEbG-y.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { generateIdempotencyKey, withRetry } from "./effect/retry.js";
|
|
1
|
+
import { t as Service } from "./client-DOzUrdTE.js";
|
|
2
|
+
import { y as SamvaOperations } from "./categories-CA4XIQAb.js";
|
|
3
|
+
import { withRetry } from "./effect/retry.js";
|
|
5
4
|
import { Effect, Option, Predicate, Stream } from "effect";
|
|
6
5
|
//#region src/service-map.ts
|
|
7
6
|
/** How each generated Effect operation is adapted to the Promise facade's direct input shape. */
|
|
@@ -170,14 +169,6 @@ const SDK_OPERATION_CALLS = {
|
|
|
170
169
|
kind: "path",
|
|
171
170
|
paths: ["id"]
|
|
172
171
|
},
|
|
173
|
-
emailSetDomainDefaultSender: {
|
|
174
|
-
kind: "pathPayload",
|
|
175
|
-
paths: ["id"]
|
|
176
|
-
},
|
|
177
|
-
emailClearDomainDefaultSender: {
|
|
178
|
-
kind: "path",
|
|
179
|
-
paths: ["id"]
|
|
180
|
-
},
|
|
181
172
|
emailUpdateDomainConfig: {
|
|
182
173
|
kind: "pathPayload",
|
|
183
174
|
paths: ["id"]
|
|
@@ -367,6 +358,62 @@ const SDK_OPERATION_CALLS = {
|
|
|
367
358
|
kind: "pathPayload",
|
|
368
359
|
paths: ["id"]
|
|
369
360
|
},
|
|
361
|
+
journeysList: { kind: "params" },
|
|
362
|
+
journeysCreate: { kind: "payload" },
|
|
363
|
+
journeysGet: {
|
|
364
|
+
kind: "path",
|
|
365
|
+
paths: ["id"]
|
|
366
|
+
},
|
|
367
|
+
journeysUpdate: {
|
|
368
|
+
kind: "pathPayload",
|
|
369
|
+
paths: ["id"]
|
|
370
|
+
},
|
|
371
|
+
journeysRemove: {
|
|
372
|
+
kind: "path",
|
|
373
|
+
paths: ["id"]
|
|
374
|
+
},
|
|
375
|
+
journeysReplaceDraft: {
|
|
376
|
+
kind: "pathPayload",
|
|
377
|
+
paths: ["id"]
|
|
378
|
+
},
|
|
379
|
+
journeysPublish: {
|
|
380
|
+
kind: "pathPayload",
|
|
381
|
+
paths: ["id"]
|
|
382
|
+
},
|
|
383
|
+
journeysPause: {
|
|
384
|
+
kind: "path",
|
|
385
|
+
paths: ["id"]
|
|
386
|
+
},
|
|
387
|
+
journeysResume: {
|
|
388
|
+
kind: "path",
|
|
389
|
+
paths: ["id"]
|
|
390
|
+
},
|
|
391
|
+
journeysArchive: {
|
|
392
|
+
kind: "path",
|
|
393
|
+
paths: ["id"]
|
|
394
|
+
},
|
|
395
|
+
journeysGetVersion: {
|
|
396
|
+
kind: "path",
|
|
397
|
+
paths: ["id", "version"]
|
|
398
|
+
},
|
|
399
|
+
journeysStats: {
|
|
400
|
+
kind: "pathParams",
|
|
401
|
+
paths: ["id"]
|
|
402
|
+
},
|
|
403
|
+
journeysListRuns: {
|
|
404
|
+
kind: "pathParams",
|
|
405
|
+
paths: ["id"]
|
|
406
|
+
},
|
|
407
|
+
journeysGetRun: {
|
|
408
|
+
kind: "path",
|
|
409
|
+
paths: ["id", "runId"]
|
|
410
|
+
},
|
|
411
|
+
eventsCreate: { kind: "payload" },
|
|
412
|
+
eventsBatch: { kind: "payload" },
|
|
413
|
+
contactEventsListEvents: {
|
|
414
|
+
kind: "pathParams",
|
|
415
|
+
paths: ["id"]
|
|
416
|
+
},
|
|
370
417
|
contactsList: { kind: "params" },
|
|
371
418
|
contactsCreate: { kind: "payload" },
|
|
372
419
|
contactsFind: { kind: "payload" },
|
|
@@ -536,6 +583,7 @@ const SDK_OPERATION_CALLS = {
|
|
|
536
583
|
kind: "path",
|
|
537
584
|
paths: ["id", "inputContractId"]
|
|
538
585
|
},
|
|
586
|
+
whoamiGet: { kind: "none" },
|
|
539
587
|
webhooksList: { kind: "params" },
|
|
540
588
|
webhooksCreate: { kind: "payload" },
|
|
541
589
|
webhooksGet: {
|
|
@@ -706,13 +754,17 @@ const SDK_OPERATION_CALLS = {
|
|
|
706
754
|
kind: "path",
|
|
707
755
|
paths: ["id"]
|
|
708
756
|
},
|
|
709
|
-
|
|
757
|
+
mailboxesCreateEndpoint: {
|
|
710
758
|
kind: "pathPayload",
|
|
711
759
|
paths: ["id"]
|
|
712
760
|
},
|
|
713
|
-
|
|
761
|
+
mailboxesUpdateEndpoint: {
|
|
762
|
+
kind: "pathPayload",
|
|
763
|
+
paths: ["id", "endpointId"]
|
|
764
|
+
},
|
|
765
|
+
mailboxesRemoveEndpoint: {
|
|
714
766
|
kind: "path",
|
|
715
|
-
paths: ["id", "
|
|
767
|
+
paths: ["id", "endpointId"]
|
|
716
768
|
},
|
|
717
769
|
mailboxesPause: {
|
|
718
770
|
kind: "path",
|
|
@@ -1034,31 +1086,7 @@ const streamCursorPages = (operation, input) => Stream.paginate(startCursorOf(in
|
|
|
1034
1086
|
const streamCursorItems = (operation, input) => Stream.paginate(startCursorOf(input), (cursor) => fetchCursorPage(operation, input, cursor).pipe(Effect.map((result) => [result.items, Option.fromNullishOr(result.nextCursor)])));
|
|
1035
1087
|
//#endregion
|
|
1036
1088
|
//#region src/effect/internal/operation.ts
|
|
1037
|
-
const hasField = (node, name) => node?.propertySignatures?.some((property) => property.name === name) ?? false;
|
|
1038
|
-
const isCursorPaged = (success) => {
|
|
1039
|
-
if (!(success instanceof Set)) return false;
|
|
1040
|
-
for (const schema of success) for (const node of [
|
|
1041
|
-
schema.ast,
|
|
1042
|
-
schema.ast?.to,
|
|
1043
|
-
schema.ast?.from
|
|
1044
|
-
]) if (hasField(node, "items") && hasField(node, "nextCursor")) return true;
|
|
1045
|
-
return false;
|
|
1046
|
-
};
|
|
1047
|
-
const paginatedOperations = () => {
|
|
1048
|
-
const paginated = /* @__PURE__ */ new Set();
|
|
1049
|
-
const groups = SamvaApi.groups;
|
|
1050
|
-
for (const group of Object.values(groups)) for (const [name, endpoint] of Object.entries(group.endpoints)) if (isCursorPaged(endpoint.success)) paginated.add(name);
|
|
1051
|
-
return paginated;
|
|
1052
|
-
};
|
|
1053
|
-
const PAGINATED_OPERATIONS = paginatedOperations();
|
|
1054
1089
|
const READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
1055
|
-
const readOperations = () => {
|
|
1056
|
-
const reads = /* @__PURE__ */ new Set();
|
|
1057
|
-
const groups = SamvaApi.groups;
|
|
1058
|
-
for (const group of Object.values(groups)) for (const [name, endpoint] of Object.entries(group.endpoints)) if (READ_METHODS.has(endpoint.method)) reads.add(name);
|
|
1059
|
-
return reads;
|
|
1060
|
-
};
|
|
1061
|
-
const READ_OPERATIONS = readOperations();
|
|
1062
1090
|
const MODULE_NAMES = {
|
|
1063
1091
|
analytics: "Analytics",
|
|
1064
1092
|
apiKeys: "ApiKeys",
|
|
@@ -1081,7 +1109,8 @@ const MODULE_NAMES = {
|
|
|
1081
1109
|
scheduledMessages: "ScheduledMessages",
|
|
1082
1110
|
templates: "Templates",
|
|
1083
1111
|
unsubscribe: "UnsubscribeGroups",
|
|
1084
|
-
webhooks: "Webhooks"
|
|
1112
|
+
webhooks: "Webhooks",
|
|
1113
|
+
whoami: "Whoami"
|
|
1085
1114
|
};
|
|
1086
1115
|
const traceName = (operationName) => {
|
|
1087
1116
|
for (const [prefix, moduleName] of Object.entries(MODULE_NAMES)) {
|
|
@@ -1097,10 +1126,9 @@ const stripUndefined = (input) => {
|
|
|
1097
1126
|
if (Object.getPrototypeOf(input) !== Object.prototype) return input;
|
|
1098
1127
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0).map(([key, value]) => [key, stripUndefined(value)]));
|
|
1099
1128
|
};
|
|
1100
|
-
const rawOperation = (client, name) => client.operation(name);
|
|
1101
1129
|
const adapt = (operationName, rawCall, input) => {
|
|
1102
1130
|
const descriptor = SDK_OPERATION_CALLS[operationName];
|
|
1103
|
-
const call =
|
|
1131
|
+
const call = READ_METHODS.has(SamvaOperations[operationName].method) ? (request) => withRetry(rawCall(request)) : rawCall;
|
|
1104
1132
|
if (descriptor.kind === "none") return call();
|
|
1105
1133
|
if (descriptor.kind === "params") return call({ query: stripUndefined(input) });
|
|
1106
1134
|
if (descriptor.kind === "payload") return call({ payload: stripUndefined(input) });
|
|
@@ -1141,10 +1169,20 @@ const adapt = (operationName, rawCall, input) => {
|
|
|
1141
1169
|
});
|
|
1142
1170
|
};
|
|
1143
1171
|
const isCursorPageEnvelope = (value) => Predicate.isObject(value) && Array.isArray(value.items) && (value.nextCursor === null || typeof value.nextCursor === "string");
|
|
1144
|
-
|
|
1145
|
-
|
|
1172
|
+
/**
|
|
1173
|
+
* Operation factory for one API group. Each domain module binds its own group, so importing it
|
|
1174
|
+
* loads that group's schemas and nothing else.
|
|
1175
|
+
*/
|
|
1176
|
+
const forGroup = (group) => (operationName) => {
|
|
1177
|
+
if (SamvaOperations[operationName].group !== group.identifier) throw new Error(`${operationName} is not an endpoint of ${group.identifier}`);
|
|
1178
|
+
return make(group, operationName);
|
|
1179
|
+
};
|
|
1180
|
+
/** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
|
|
1181
|
+
const callEndpoint = (group, name, request) => Effect.flatMap(Service, (client) => Effect.flatMap(client.endpoint(group, name), (call) => call(request)));
|
|
1182
|
+
const make = (group, operationName) => {
|
|
1183
|
+
const call = Effect.fn(traceName(operationName))((input) => Effect.flatMap(Service, (client) => Effect.flatMap(client.endpoint(group, operationName), (rawCall) => adapt(operationName, rawCall, input))));
|
|
1146
1184
|
const operation = call;
|
|
1147
|
-
if (
|
|
1185
|
+
if (SamvaOperations[operationName].paginated) {
|
|
1148
1186
|
const list = (input) => Effect.filterOrElse(call(input), isCursorPageEnvelope, () => Effect.die(/* @__PURE__ */ new Error(`${operationName} did not return a cursor page envelope`)));
|
|
1149
1187
|
Object.assign(operation, {
|
|
1150
1188
|
pages: (input) => streamCursorPages(list, input ?? {}),
|
|
@@ -1153,62 +1191,7 @@ const make = (operationName) => {
|
|
|
1153
1191
|
}
|
|
1154
1192
|
return operation;
|
|
1155
1193
|
};
|
|
1156
|
-
/**
|
|
1157
|
-
* Inline attachment content over the API's request cap travels as media instead: the largest
|
|
1158
|
-
* attachments are uploaded (create, put to the presigned URL, complete) and replaced by their
|
|
1159
|
-
* `mediaId`. The returned payload is the one request every send attempt reuses, so nothing is
|
|
1160
|
-
* uploaded twice.
|
|
1161
|
-
*/
|
|
1162
|
-
const uploadOversizedAttachments = (client, payload) => Effect.gen(function* () {
|
|
1163
|
-
const plan = planInlineUploads(payload);
|
|
1164
|
-
if (plan.length === 0) return payload;
|
|
1165
|
-
const uploaded = /* @__PURE__ */ new Map();
|
|
1166
|
-
for (const upload of plan) {
|
|
1167
|
-
const created = yield* rawOperation(client, "mediaCreate")({ payload: mediaCreateBody(upload) });
|
|
1168
|
-
yield* client.putUpload({
|
|
1169
|
-
filename: upload.filename,
|
|
1170
|
-
mediaId: created.id,
|
|
1171
|
-
url: created.upload.url,
|
|
1172
|
-
method: created.upload.method,
|
|
1173
|
-
headers: created.upload.headers,
|
|
1174
|
-
bytes: upload.bytes
|
|
1175
|
-
});
|
|
1176
|
-
yield* rawOperation(client, "mediaComplete")({ params: { id: created.id } });
|
|
1177
|
-
uploaded.set(upload.index, {
|
|
1178
|
-
mediaId: created.id,
|
|
1179
|
-
upload
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
return withUploadedAttachments(payload, uploaded);
|
|
1183
|
-
});
|
|
1184
|
-
const sendPayload = (payload, options) => Effect.gen(function* () {
|
|
1185
|
-
const client = yield* Service;
|
|
1186
|
-
const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
|
|
1187
|
-
const prepared = yield* uploadOversizedAttachments(client, payload);
|
|
1188
|
-
return yield* withRetry(rawOperation(client, "messagesSend")({
|
|
1189
|
-
payload: stripUndefined(prepared),
|
|
1190
|
-
headers: { "idempotency-key": idempotencyKey }
|
|
1191
|
-
}));
|
|
1192
|
-
});
|
|
1193
|
-
const sendMessage = Effect.fn("Messages.send")(function* (input, options) {
|
|
1194
|
-
return yield* sendPayload(buildMessagesSendPayload(input), options);
|
|
1195
|
-
});
|
|
1196
|
-
const sendEmail = Effect.fn("Email.send")(function* (input, options) {
|
|
1197
|
-
return yield* sendPayload(buildEmailSendPayload(input), options);
|
|
1198
|
-
});
|
|
1199
|
-
const addEmailSender = Effect.fn("Email.addSender")(function* (input, options) {
|
|
1200
|
-
const client = yield* Service;
|
|
1201
|
-
const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
|
|
1202
|
-
const { replyToEmails, ...sender } = input;
|
|
1203
|
-
return yield* withRetry(rawOperation(client, "emailAddSender")({
|
|
1204
|
-
headers: { "idempotency-key": idempotencyKey },
|
|
1205
|
-
payload: stripUndefined({
|
|
1206
|
-
...sender,
|
|
1207
|
-
...replyToEmailsPayload(replyToEmails)
|
|
1208
|
-
})
|
|
1209
|
-
}));
|
|
1210
|
-
});
|
|
1211
1194
|
//#endregion
|
|
1212
|
-
export {
|
|
1195
|
+
export { forGroup as n, stripUndefined as r, callEndpoint as t };
|
|
1213
1196
|
|
|
1214
|
-
//# sourceMappingURL=operation-
|
|
1197
|
+
//# sourceMappingURL=operation-n_IYgNVK.js.map
|