samva 0.16.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 +44 -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 +174 -3
- package/dist/client/types.gen.d.ts +1126 -11
- 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 -1
- package/dist/effect/api-keys.js +2 -28
- 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 -2
- package/dist/effect/email.js +2 -137
- 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 +1627 -0
- package/dist/effect/index.d.ts +3 -1
- package/dist/effect/index.js +29 -27
- 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 +112 -112
- package/dist/effect/mailboxes.js +1 -1
- 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 +8 -8
- package/dist/effect/whoami.js +2 -9
- 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 +2 -2
- package/dist/{inline-attachments-Cegg6tTF.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-BTXjPrwf.js → operation-n_IYgNVK.js} +75 -90
- package/dist/operations-CmB3FHwf.js +93 -0
- package/dist/organizations-A-plufWc.js +252 -0
- package/dist/promises/index.d.ts +7 -3
- package/dist/promises/index.js +2 -2
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/{promises-KrA2nSLg.js → promises---Kbh-7z.js} +467 -3
- 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 +85 -0
- 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 +13 -3
- package/dist/categories-DV51kr2H.js +0 -187
- package/dist/client-BMUew5Wp.js +0 -13794
- package/dist/effect/generated.d.ts +0 -64004
- package/dist/mailboxes-Thp5z0oX.js +0 -161
|
@@ -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. */
|
|
@@ -359,6 +358,62 @@ const SDK_OPERATION_CALLS = {
|
|
|
359
358
|
kind: "pathPayload",
|
|
360
359
|
paths: ["id"]
|
|
361
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
|
+
},
|
|
362
417
|
contactsList: { kind: "params" },
|
|
363
418
|
contactsCreate: { kind: "payload" },
|
|
364
419
|
contactsFind: { kind: "payload" },
|
|
@@ -1031,31 +1086,7 @@ const streamCursorPages = (operation, input) => Stream.paginate(startCursorOf(in
|
|
|
1031
1086
|
const streamCursorItems = (operation, input) => Stream.paginate(startCursorOf(input), (cursor) => fetchCursorPage(operation, input, cursor).pipe(Effect.map((result) => [result.items, Option.fromNullishOr(result.nextCursor)])));
|
|
1032
1087
|
//#endregion
|
|
1033
1088
|
//#region src/effect/internal/operation.ts
|
|
1034
|
-
const hasField = (node, name) => node?.propertySignatures?.some((property) => property.name === name) ?? false;
|
|
1035
|
-
const isCursorPaged = (success) => {
|
|
1036
|
-
if (!(success instanceof Set)) return false;
|
|
1037
|
-
for (const schema of success) for (const node of [
|
|
1038
|
-
schema.ast,
|
|
1039
|
-
schema.ast?.to,
|
|
1040
|
-
schema.ast?.from
|
|
1041
|
-
]) if (hasField(node, "items") && hasField(node, "nextCursor")) return true;
|
|
1042
|
-
return false;
|
|
1043
|
-
};
|
|
1044
|
-
const paginatedOperations = () => {
|
|
1045
|
-
const paginated = /* @__PURE__ */ new Set();
|
|
1046
|
-
const groups = SamvaApi.groups;
|
|
1047
|
-
for (const group of Object.values(groups)) for (const [name, endpoint] of Object.entries(group.endpoints)) if (isCursorPaged(endpoint.success)) paginated.add(name);
|
|
1048
|
-
return paginated;
|
|
1049
|
-
};
|
|
1050
|
-
const PAGINATED_OPERATIONS = paginatedOperations();
|
|
1051
1089
|
const READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
1052
|
-
const readOperations = () => {
|
|
1053
|
-
const reads = /* @__PURE__ */ new Set();
|
|
1054
|
-
const groups = SamvaApi.groups;
|
|
1055
|
-
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);
|
|
1056
|
-
return reads;
|
|
1057
|
-
};
|
|
1058
|
-
const READ_OPERATIONS = readOperations();
|
|
1059
1090
|
const MODULE_NAMES = {
|
|
1060
1091
|
analytics: "Analytics",
|
|
1061
1092
|
apiKeys: "ApiKeys",
|
|
@@ -1095,10 +1126,9 @@ const stripUndefined = (input) => {
|
|
|
1095
1126
|
if (Object.getPrototypeOf(input) !== Object.prototype) return input;
|
|
1096
1127
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0).map(([key, value]) => [key, stripUndefined(value)]));
|
|
1097
1128
|
};
|
|
1098
|
-
const rawOperation = (client, name) => client.operation(name);
|
|
1099
1129
|
const adapt = (operationName, rawCall, input) => {
|
|
1100
1130
|
const descriptor = SDK_OPERATION_CALLS[operationName];
|
|
1101
|
-
const call =
|
|
1131
|
+
const call = READ_METHODS.has(SamvaOperations[operationName].method) ? (request) => withRetry(rawCall(request)) : rawCall;
|
|
1102
1132
|
if (descriptor.kind === "none") return call();
|
|
1103
1133
|
if (descriptor.kind === "params") return call({ query: stripUndefined(input) });
|
|
1104
1134
|
if (descriptor.kind === "payload") return call({ payload: stripUndefined(input) });
|
|
@@ -1139,10 +1169,20 @@ const adapt = (operationName, rawCall, input) => {
|
|
|
1139
1169
|
});
|
|
1140
1170
|
};
|
|
1141
1171
|
const isCursorPageEnvelope = (value) => Predicate.isObject(value) && Array.isArray(value.items) && (value.nextCursor === null || typeof value.nextCursor === "string");
|
|
1142
|
-
|
|
1143
|
-
|
|
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))));
|
|
1144
1184
|
const operation = call;
|
|
1145
|
-
if (
|
|
1185
|
+
if (SamvaOperations[operationName].paginated) {
|
|
1146
1186
|
const list = (input) => Effect.filterOrElse(call(input), isCursorPageEnvelope, () => Effect.die(/* @__PURE__ */ new Error(`${operationName} did not return a cursor page envelope`)));
|
|
1147
1187
|
Object.assign(operation, {
|
|
1148
1188
|
pages: (input) => streamCursorPages(list, input ?? {}),
|
|
@@ -1151,62 +1191,7 @@ const make = (operationName) => {
|
|
|
1151
1191
|
}
|
|
1152
1192
|
return operation;
|
|
1153
1193
|
};
|
|
1154
|
-
/**
|
|
1155
|
-
* Inline attachment content over the API's request cap travels as media instead: the largest
|
|
1156
|
-
* attachments are uploaded (create, put to the presigned URL, complete) and replaced by their
|
|
1157
|
-
* `mediaId`. The returned payload is the one request every send attempt reuses, so nothing is
|
|
1158
|
-
* uploaded twice.
|
|
1159
|
-
*/
|
|
1160
|
-
const uploadOversizedAttachments = (client, payload) => Effect.gen(function* () {
|
|
1161
|
-
const plan = planInlineUploads(payload);
|
|
1162
|
-
if (plan.length === 0) return payload;
|
|
1163
|
-
const uploaded = /* @__PURE__ */ new Map();
|
|
1164
|
-
for (const upload of plan) {
|
|
1165
|
-
const created = yield* rawOperation(client, "mediaCreate")({ payload: mediaCreateBody(upload) });
|
|
1166
|
-
yield* client.putUpload({
|
|
1167
|
-
filename: upload.filename,
|
|
1168
|
-
mediaId: created.id,
|
|
1169
|
-
url: created.upload.url,
|
|
1170
|
-
method: created.upload.method,
|
|
1171
|
-
headers: created.upload.headers,
|
|
1172
|
-
bytes: upload.bytes
|
|
1173
|
-
});
|
|
1174
|
-
yield* rawOperation(client, "mediaComplete")({ params: { id: created.id } });
|
|
1175
|
-
uploaded.set(upload.index, {
|
|
1176
|
-
mediaId: created.id,
|
|
1177
|
-
upload
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
return withUploadedAttachments(payload, uploaded);
|
|
1181
|
-
});
|
|
1182
|
-
const sendPayload = (payload, options) => Effect.gen(function* () {
|
|
1183
|
-
const client = yield* Service;
|
|
1184
|
-
const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
|
|
1185
|
-
const prepared = yield* uploadOversizedAttachments(client, payload);
|
|
1186
|
-
return yield* withRetry(rawOperation(client, "messagesSend")({
|
|
1187
|
-
payload: stripUndefined(prepared),
|
|
1188
|
-
headers: { "idempotency-key": idempotencyKey }
|
|
1189
|
-
}));
|
|
1190
|
-
});
|
|
1191
|
-
const sendMessage = Effect.fn("Messages.send")(function* (input, options) {
|
|
1192
|
-
return yield* sendPayload(buildMessagesSendPayload(input), options);
|
|
1193
|
-
});
|
|
1194
|
-
const sendEmail = Effect.fn("Email.send")(function* (input, options) {
|
|
1195
|
-
return yield* sendPayload(buildEmailSendPayload(input), options);
|
|
1196
|
-
});
|
|
1197
|
-
const addEmailSender = Effect.fn("Email.addSender")(function* (input, options) {
|
|
1198
|
-
const client = yield* Service;
|
|
1199
|
-
const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
|
|
1200
|
-
const { replyToEmails, ...sender } = input;
|
|
1201
|
-
return yield* withRetry(rawOperation(client, "emailAddSender")({
|
|
1202
|
-
headers: { "idempotency-key": idempotencyKey },
|
|
1203
|
-
payload: stripUndefined({
|
|
1204
|
-
...sender,
|
|
1205
|
-
...replyToEmailsPayload(replyToEmails)
|
|
1206
|
-
})
|
|
1207
|
-
}));
|
|
1208
|
-
});
|
|
1209
1194
|
//#endregion
|
|
1210
|
-
export {
|
|
1195
|
+
export { forGroup as n, stripUndefined as r, callEndpoint as t };
|
|
1211
1196
|
|
|
1212
|
-
//# sourceMappingURL=operation-
|
|
1197
|
+
//# sourceMappingURL=operation-n_IYgNVK.js.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { At as OperationAccepted, D as Cursor, Jt as UnauthorizedError, K as ForbiddenError, Lt as ResourceNotFoundError, Y as InternalError, en as ValidationError, jt as OperationId, kt as Operation, 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/operations.ts
|
|
7
|
+
const OperationPage = /* @__PURE__ */ Schema.Struct({
|
|
8
|
+
items: Schema.Array(Operation),
|
|
9
|
+
nextCursor: Schema.Union([Schema.String, Schema.Null])
|
|
10
|
+
}).annotate({ identifier: "OperationPage" });
|
|
11
|
+
const OperationsListQuery = /* @__PURE__ */ Schema.Struct({
|
|
12
|
+
limit: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
13
|
+
cursor: Schema.optionalKey(Schema.Union([Cursor, Schema.Null])),
|
|
14
|
+
kind: Schema.optionalKey(Schema.Union([Schema.Union([Schema.Literal("email-domain-provisioning"), Schema.Literal("organization-deletion")]), Schema.Null])),
|
|
15
|
+
status: Schema.optionalKey(Schema.Union([Schema.Union([
|
|
16
|
+
Schema.Literal("pending"),
|
|
17
|
+
Schema.Literal("running"),
|
|
18
|
+
Schema.Literal("succeeded"),
|
|
19
|
+
Schema.Literal("failed")
|
|
20
|
+
]), Schema.Null]))
|
|
21
|
+
});
|
|
22
|
+
const OperationsList200 = OperationPage;
|
|
23
|
+
const OperationsList401 = UnauthorizedError;
|
|
24
|
+
const OperationsList403 = ForbiddenError;
|
|
25
|
+
const OperationsList422 = ValidationError;
|
|
26
|
+
const OperationsList500 = InternalError;
|
|
27
|
+
const OperationsList504 = GatewayTimeoutError;
|
|
28
|
+
const OperationsGetPathParams = /* @__PURE__ */ Schema.Struct({ id: OperationId });
|
|
29
|
+
const OperationsGet200 = Operation;
|
|
30
|
+
const OperationsGet401 = UnauthorizedError;
|
|
31
|
+
const OperationsGet403 = ForbiddenError;
|
|
32
|
+
const OperationsGet404 = ResourceNotFoundError;
|
|
33
|
+
const OperationsGet422 = ValidationError;
|
|
34
|
+
const OperationsGet500 = InternalError;
|
|
35
|
+
const OperationsGet504 = GatewayTimeoutError;
|
|
36
|
+
const OperationsRetryPathParams = /* @__PURE__ */ Schema.Struct({ id: OperationId });
|
|
37
|
+
const OperationsRetry202 = OperationAccepted;
|
|
38
|
+
const OperationsRetry401 = UnauthorizedError;
|
|
39
|
+
const OperationsRetry403 = ForbiddenError;
|
|
40
|
+
const OperationsRetry404 = ResourceNotFoundError;
|
|
41
|
+
const OperationsRetry409 = ConflictError;
|
|
42
|
+
const OperationsRetry422 = ValidationError;
|
|
43
|
+
const OperationsRetry500 = InternalError;
|
|
44
|
+
const OperationsRetry504 = GatewayTimeoutError;
|
|
45
|
+
var OperationsGroup = class extends HttpApiGroup.make("Operations").add(HttpApiEndpoint.get("operationsList", "/v1/operations", {
|
|
46
|
+
query: OperationsListQuery,
|
|
47
|
+
success: OperationsList200,
|
|
48
|
+
error: [
|
|
49
|
+
OperationsList401.pipe(HttpApiSchema.status(401)),
|
|
50
|
+
OperationsList403.pipe(HttpApiSchema.status(403)),
|
|
51
|
+
OperationsList422.pipe(HttpApiSchema.status(422)),
|
|
52
|
+
OperationsList500,
|
|
53
|
+
OperationsList504.pipe(HttpApiSchema.status(504))
|
|
54
|
+
]
|
|
55
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "operations.list").annotate(OpenApi.Summary, "List asynchronous operations").annotate(OpenApi.Description, "Lists asynchronous operations for the active organization, newest first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), HttpApiEndpoint.get("operationsGet", "/v1/operations/:id", {
|
|
56
|
+
params: OperationsGetPathParams,
|
|
57
|
+
success: OperationsGet200,
|
|
58
|
+
error: [
|
|
59
|
+
OperationsGet401.pipe(HttpApiSchema.status(401)),
|
|
60
|
+
OperationsGet403.pipe(HttpApiSchema.status(403)),
|
|
61
|
+
OperationsGet404.pipe(HttpApiSchema.status(404)),
|
|
62
|
+
OperationsGet422.pipe(HttpApiSchema.status(422)),
|
|
63
|
+
OperationsGet500,
|
|
64
|
+
OperationsGet504.pipe(HttpApiSchema.status(504))
|
|
65
|
+
]
|
|
66
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "operations.get").annotate(OpenApi.Summary, "Get an asynchronous operation").annotate(OpenApi.Description, "Returns one asynchronous operation from the active organization."), HttpApiEndpoint.post("operationsRetry", "/v1/operations/:id/retry", {
|
|
67
|
+
params: OperationsRetryPathParams,
|
|
68
|
+
success: OperationsRetry202.pipe(HttpApiSchema.status(202)),
|
|
69
|
+
error: [
|
|
70
|
+
OperationsRetry401.pipe(HttpApiSchema.status(401)),
|
|
71
|
+
OperationsRetry403.pipe(HttpApiSchema.status(403)),
|
|
72
|
+
OperationsRetry404.pipe(HttpApiSchema.status(404)),
|
|
73
|
+
OperationsRetry409.pipe(HttpApiSchema.status(409)),
|
|
74
|
+
OperationsRetry422.pipe(HttpApiSchema.status(422)),
|
|
75
|
+
OperationsRetry500,
|
|
76
|
+
OperationsRetry504.pipe(HttpApiSchema.status(504))
|
|
77
|
+
]
|
|
78
|
+
}).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "operations.retry").annotate(OpenApi.Summary, "Retry an asynchronous operation").annotate(OpenApi.Description, "Retries a failed operation in place when its error is retryable. Retrying an organization deletion additionally requires `organization:delete`.")).annotate(OpenApi.Description, "Status of accepted asynchronous mutations") {};
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/effect/operations.ts
|
|
81
|
+
var operations_exports = /* @__PURE__ */ __exportAll({
|
|
82
|
+
get: () => get,
|
|
83
|
+
list: () => list,
|
|
84
|
+
retry: () => retry
|
|
85
|
+
});
|
|
86
|
+
const make = forGroup(OperationsGroup);
|
|
87
|
+
const list = make("operationsList");
|
|
88
|
+
const get = make("operationsGet");
|
|
89
|
+
const retry = make("operationsRetry");
|
|
90
|
+
//#endregion
|
|
91
|
+
export { retry as i, list as n, operations_exports as r, get as t };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=operations-CmB3FHwf.js.map
|