@relyio/sdk 0.17.0 → 0.19.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/automations/index.cjs +71 -0
  3. package/dist/automations/index.d.cts +1590 -0
  4. package/dist/automations/index.d.ts +1590 -0
  5. package/dist/automations/index.js +6 -0
  6. package/dist/{chunk-RSHMA4KT.cjs → chunk-2SPPU2WG.cjs} +68 -68
  7. package/dist/{chunk-VS2DEUTN.js → chunk-356SF5Y2.js} +463 -26
  8. package/dist/chunk-5F3YYPLZ.cjs +19237 -0
  9. package/dist/chunk-7I3SC7SV.cjs +40 -0
  10. package/dist/chunk-DBYMG6MQ.cjs +535 -0
  11. package/dist/chunk-DI6KFDBO.js +43 -0
  12. package/dist/chunk-HDHBYYEY.js +36 -0
  13. package/dist/chunk-L6DXCKVQ.cjs +50 -0
  14. package/dist/{chunk-TZL374LS.cjs → chunk-M7MWNV3Q.cjs} +21 -21
  15. package/dist/{chunk-H6IBQSMM.js → chunk-NJQK5STK.js} +3 -3
  16. package/dist/chunk-NN45CSPZ.cjs +872 -0
  17. package/dist/{chunk-6E22GYPB.cjs → chunk-P23G5NXD.cjs} +781 -337
  18. package/dist/chunk-PZCDJFMA.js +19195 -0
  19. package/dist/chunk-T7LGREB3.js +848 -0
  20. package/dist/{chunk-BBUB7C2Z.js → chunk-W2A4OTCI.js} +3 -3
  21. package/dist/chunk-W2GRVXDG.js +520 -0
  22. package/dist/{chunk-5UMY6CS4.js → chunk-ZAKEY6DY.js} +3 -3
  23. package/dist/{chunk-LSRPMNPT.cjs → chunk-ZO6QDYJG.cjs} +7 -7
  24. package/dist/client/index.cjs +8 -7
  25. package/dist/client/index.d.cts +4 -3
  26. package/dist/client/index.d.ts +4 -3
  27. package/dist/client/index.js +6 -5
  28. package/dist/{define-content-type-AuL9-oz6.d.cts → define-content-type-BZ6X8GvL.d.cts} +4547 -842
  29. package/dist/{define-content-type-BGoQxqLf.d.ts → define-content-type-C12jh8cY.d.ts} +4547 -842
  30. package/dist/{define-schema-DgCX9YB7.d.ts → define-schema-BPlZl4a2.d.cts} +258 -10
  31. package/dist/{define-schema-DkXwpp0I.d.cts → define-schema-CK7TtYot.d.ts} +258 -10
  32. package/dist/dev-handshake/index.cjs +9 -9
  33. package/dist/dev-handshake/index.js +2 -2
  34. package/dist/extensions/index.cjs +100 -0
  35. package/dist/extensions/index.d.cts +6 -0
  36. package/dist/extensions/index.d.ts +6 -0
  37. package/dist/extensions/index.js +96 -0
  38. package/dist/functions/index.cjs +71 -0
  39. package/dist/functions/index.d.cts +6 -0
  40. package/dist/functions/index.d.ts +6 -0
  41. package/dist/functions/index.js +62 -0
  42. package/dist/{index-BBp8_tn9.d.ts → index-BxNnlc5D.d.ts} +167 -494
  43. package/dist/{index-DaMZ4FQ_.d.ts → index-C-MymZTe.d.ts} +1 -1
  44. package/dist/{index-DxRmKPrR.d.cts → index-D5jyIeQ5.d.cts} +167 -494
  45. package/dist/{index-Bp4AiNT3.d.cts → index-DN0l8RHw.d.cts} +1 -1
  46. package/dist/index.cjs +208 -185
  47. package/dist/index.d.cts +147 -17
  48. package/dist/index.d.ts +147 -17
  49. package/dist/index.js +11 -16
  50. package/dist/markdown/index.cjs +382 -382
  51. package/dist/markdown/index.js +1 -1
  52. package/dist/preview/index.cjs +11 -10
  53. package/dist/preview/index.js +3 -2
  54. package/dist/register-BiMQKVp-.d.ts +693 -0
  55. package/dist/register-DeMsaurp.d.cts +693 -0
  56. package/dist/rich-text/index.cjs +12 -12
  57. package/dist/rich-text/index.d.cts +2 -2
  58. package/dist/rich-text/index.d.ts +2 -2
  59. package/dist/rich-text/index.js +2 -2
  60. package/dist/schema/index.cjs +63 -34
  61. package/dist/schema/index.d.cts +14 -5
  62. package/dist/schema/index.d.ts +14 -5
  63. package/dist/schema/index.js +3 -2
  64. package/dist/types/index.d.cts +1 -1
  65. package/dist/types/index.d.ts +1 -1
  66. package/dist/utils/index.cjs +20 -20
  67. package/dist/utils/index.js +2 -2
  68. package/package.json +23 -5
  69. package/dist/chunk-6PTRZP5U.cjs +0 -433
  70. package/dist/chunk-DIZY6CKM.js +0 -950
  71. package/dist/chunk-GHYB6IZK.cjs +0 -983
  72. package/dist/chunk-MWMSFIWN.cjs +0 -17
  73. package/dist/chunk-OVMIHAYK.js +0 -411
  74. package/dist/chunk-XQ4QHWZE.js +0 -13
@@ -0,0 +1,872 @@
1
+ 'use strict';
2
+
3
+ var chunkL6DXCKVQ_cjs = require('./chunk-L6DXCKVQ.cjs');
4
+
5
+ /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
6
+
7
+ // ../../platform/api-contract/dist/chunk-46347LG2.js
8
+ function defineRoute(route) {
9
+ if (route.kind === "raw" && route.standardShape === void 0) {
10
+ throw new Error("kind 'raw' requires a named StandardShape");
11
+ }
12
+ if (route.kind === "raw" && route.success === 302 && !route.headers.some((header) => header.name === "Location")) {
13
+ throw new Error("a raw route declaring success 302 must declare its 'Location' header");
14
+ }
15
+ if (route.kind === "stream" && route.stream === void 0) {
16
+ throw new Error("kind 'stream' requires a StreamDeclaration");
17
+ }
18
+ if (route.kind === "collection" && route.page === void 0) {
19
+ throw new Error("kind 'collection' requires a page dialect");
20
+ }
21
+ if (route.queues === true) {
22
+ if (route.kind !== "object" && route.kind !== "empty") {
23
+ throw new Error(
24
+ `kind '${route.kind}' cannot declare \`queues\`: only an object or empty route answers 202 beside its own status`
25
+ );
26
+ }
27
+ if (route.kind === "object" && route.success === 202) {
28
+ throw new Error("a route whose own status is 202 cannot also declare `queues`");
29
+ }
30
+ }
31
+ if ((route.kind === "object" || route.kind === "collection") && route.negotiated !== void 0) {
32
+ refuseMismatchedAlternate(route, route.negotiated["text/event-stream"]);
33
+ }
34
+ return route;
35
+ }
36
+ chunkL6DXCKVQ_cjs.__name(defineRoute, "defineRoute");
37
+ function refuseMismatchedAlternate(route, stream) {
38
+ if (stream.kind !== "stream") {
39
+ throw new Error("a negotiated 'text/event-stream' alternate must be kind 'stream'");
40
+ }
41
+ if (stream.stream.mediaType !== "text/event-stream") {
42
+ throw new Error(
43
+ `a negotiated 'text/event-stream' alternate declares media type "${stream.stream.mediaType}"`
44
+ );
45
+ }
46
+ const own = [...new Set(route.codes)].sort();
47
+ const alternate = [...new Set(stream.codes)].sort();
48
+ if (own.length !== alternate.length || own.some((code, index) => code !== alternate[index])) {
49
+ throw new Error(
50
+ `a negotiated alternate refuses with [${alternate.join(", ")}] while its route refuses with [${own.join(", ")}]; one route refuses with one set of codes on every transport`
51
+ );
52
+ }
53
+ }
54
+ chunkL6DXCKVQ_cjs.__name(refuseMismatchedAlternate, "refuseMismatchedAlternate");
55
+
56
+ // ../../platform/api-contract/dist/chunk-WT7DXIEW.js
57
+ var HEADER_END_USER = {
58
+ name: "X-RelyIO-End-User",
59
+ in: "request",
60
+ required: false
61
+ };
62
+ var END_USER_TOKEN_REFUSAL_REASONS = [
63
+ "missing",
64
+ "no-identity-source",
65
+ "malformed",
66
+ "unsupported-algorithm",
67
+ "wrong-issuer",
68
+ "unknown-key",
69
+ "bad-signature",
70
+ "wrong-audience",
71
+ "expired",
72
+ "not-yet-valid",
73
+ "missing-subject"
74
+ ];
75
+
76
+ // ../../platform/api-contract/dist/index.js
77
+ var HEADER_RETRY_AFTER = { name: "Retry-After" };
78
+ var HEADER_IF_MATCH = {
79
+ name: "If-Match",
80
+ in: "request",
81
+ required: false
82
+ };
83
+ function entityTag(parts) {
84
+ return `"${parts.entryUid}:${parts.locale}:${parts.version}:${parts.sharedVersion}"`;
85
+ }
86
+ chunkL6DXCKVQ_cjs.__name(entityTag, "entityTag");
87
+ var HEADER_IDEMPOTENCY_KEY = {
88
+ name: "Idempotency-Key",
89
+ in: "request",
90
+ required: false
91
+ };
92
+ var FRESH_PARAMETER = "_fresh";
93
+ var K = new Uint32Array([
94
+ 1116352408,
95
+ 1899447441,
96
+ 3049323471,
97
+ 3921009573,
98
+ 961987163,
99
+ 1508970993,
100
+ 2453635748,
101
+ 2870763221,
102
+ 3624381080,
103
+ 310598401,
104
+ 607225278,
105
+ 1426881987,
106
+ 1925078388,
107
+ 2162078206,
108
+ 2614888103,
109
+ 3248222580,
110
+ 3835390401,
111
+ 4022224774,
112
+ 264347078,
113
+ 604807628,
114
+ 770255983,
115
+ 1249150122,
116
+ 1555081692,
117
+ 1996064986,
118
+ 2554220882,
119
+ 2821834349,
120
+ 2952996808,
121
+ 3210313671,
122
+ 3336571891,
123
+ 3584528711,
124
+ 113926993,
125
+ 338241895,
126
+ 666307205,
127
+ 773529912,
128
+ 1294757372,
129
+ 1396182291,
130
+ 1695183700,
131
+ 1986661051,
132
+ 2177026350,
133
+ 2456956037,
134
+ 2730485921,
135
+ 2820302411,
136
+ 3259730800,
137
+ 3345764771,
138
+ 3516065817,
139
+ 3600352804,
140
+ 4094571909,
141
+ 275423344,
142
+ 430227734,
143
+ 506948616,
144
+ 659060556,
145
+ 883997877,
146
+ 958139571,
147
+ 1322822218,
148
+ 1537002063,
149
+ 1747873779,
150
+ 1955562222,
151
+ 2024104815,
152
+ 2227730452,
153
+ 2361852424,
154
+ 2428436474,
155
+ 2756734187,
156
+ 3204031479,
157
+ 3329325298
158
+ ]);
159
+ var rotr = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((value, bits) => value >>> bits | value << 32 - bits, "rotr");
160
+ function sha256Hex(text) {
161
+ const bytes = new globalThis.TextEncoder().encode(text);
162
+ const blocks = Math.ceil((bytes.length + 9) / 64);
163
+ const padded = new Uint8Array(blocks * 64);
164
+ padded.set(bytes);
165
+ padded[bytes.length] = 128;
166
+ const view = new DataView(padded.buffer);
167
+ const bits = bytes.length * 8;
168
+ view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
169
+ view.setUint32(padded.length - 4, bits >>> 0);
170
+ const hash = new Uint32Array([
171
+ 1779033703,
172
+ 3144134277,
173
+ 1013904242,
174
+ 2773480762,
175
+ 1359893119,
176
+ 2600822924,
177
+ 528734635,
178
+ 1541459225
179
+ ]);
180
+ const w = new Uint32Array(64);
181
+ for (let block = 0; block < blocks; block++) {
182
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(block * 64 + i * 4);
183
+ for (let i = 16; i < 64; i++) {
184
+ const w15 = w[i - 15];
185
+ const w2 = w[i - 2];
186
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
187
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
188
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
189
+ }
190
+ let a = hash[0];
191
+ let b = hash[1];
192
+ let c = hash[2];
193
+ let d = hash[3];
194
+ let e = hash[4];
195
+ let f = hash[5];
196
+ let g = hash[6];
197
+ let h = hash[7];
198
+ for (let i = 0; i < 64; i++) {
199
+ const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
200
+ const choice = e & f ^ ~e & g;
201
+ const t1 = h + s1 + choice + K[i] + w[i] >>> 0;
202
+ const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
203
+ const majority = a & b ^ a & c ^ b & c;
204
+ const t2 = s0 + majority >>> 0;
205
+ h = g;
206
+ g = f;
207
+ f = e;
208
+ e = d + t1 >>> 0;
209
+ d = c;
210
+ c = b;
211
+ b = a;
212
+ a = t1 + t2 >>> 0;
213
+ }
214
+ hash[0] = hash[0] + a;
215
+ hash[1] = hash[1] + b;
216
+ hash[2] = hash[2] + c;
217
+ hash[3] = hash[3] + d;
218
+ hash[4] = hash[4] + e;
219
+ hash[5] = hash[5] + f;
220
+ hash[6] = hash[6] + g;
221
+ hash[7] = hash[7] + h;
222
+ }
223
+ return Array.from(hash, (word) => word.toString(16).padStart(8, "0")).join("");
224
+ }
225
+ chunkL6DXCKVQ_cjs.__name(sha256Hex, "sha256Hex");
226
+ var PREVIEW_DATASET_PREFIX = "preview/";
227
+ var READABLE_MAX = 40;
228
+ var HASH_DIGITS = 8;
229
+ function previewDatasetSlug(branch) {
230
+ const name = branch.startsWith("refs/heads/") ? branch.slice("refs/heads/".length) : branch;
231
+ if (name === "") {
232
+ throw new TypeError(`previewDatasetSlug: ${JSON.stringify(branch)} names no Git branch`);
233
+ }
234
+ const readable = name.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/^-+|-+$/g, "").slice(0, READABLE_MAX).replace(/-+$/, "");
235
+ const hash = sha256Hex(name).slice(0, HASH_DIGITS);
236
+ return `${PREVIEW_DATASET_PREFIX}${readable === "" ? "" : `${readable}-`}${hash}`;
237
+ }
238
+ chunkL6DXCKVQ_cjs.__name(previewDatasetSlug, "previewDatasetSlug");
239
+ var VISITOR_LIVE_PATH = "/visitor/changes";
240
+ var VISITOR_QUERY = {
241
+ /** The publishable key. */
242
+ key: "key",
243
+ /** A dataset id or name the key reaches; absent, the key's default dataset. */
244
+ dataset: "dataset",
245
+ /** The cursor to continue from; absent, the socket starts now. */
246
+ since: "since",
247
+ /** Comma-separated content types to keep; absent keeps every type. */
248
+ types: "types",
249
+ /** Comma-separated entry ids to keep; absent keeps every entry. */
250
+ ids: "ids",
251
+ /** The poll's client id. Required on a poll, and not read on a socket. */
252
+ client: "client"
253
+ };
254
+ var VISITOR_CURSOR = /^[\w.~-]{1,256}$/;
255
+ var VISITOR_POLL_INTERVAL_MS = 15e3;
256
+ var VISITOR_KEEPALIVE = { request: "ping", response: "pong" };
257
+ var VISITOR_FRAMES = {
258
+ opened: "feed.opened",
259
+ changes: "feed.changes",
260
+ resync: "feed.resync"
261
+ };
262
+ defineRoute({
263
+ kind: "object",
264
+ headers: [HEADER_RETRY_AFTER],
265
+ codes: [
266
+ "REQUEST_INVALID",
267
+ "MISSING_API_KEY",
268
+ "INVALID_API_KEY",
269
+ "ACCESS_DENIED",
270
+ "METHOD_NOT_ALLOWED",
271
+ "SERVICE_INDETERMINATE",
272
+ "USAGE_QUOTA_EXCEEDED",
273
+ "RATE_LIMIT_EXCEEDED"
274
+ ]
275
+ });
276
+ var VISITOR_CLOSE_CODES = {
277
+ /** A query the door cannot read: a malformed `since`, filter, `dataset` or `client`. */
278
+ requestInvalid: 4400,
279
+ /** No publishable key, or one that is unknown, revoked, expired, a secret key or a preview key. */
280
+ keyRefused: 4401,
281
+ /** The page's `Origin` is absent, or not on the key's allowed origins. */
282
+ originRefused: 4403,
283
+ /** `dataset` names nothing the key reaches. */
284
+ datasetRefused: 4404,
285
+ /** The key's scope, the project's counter or the feed could not be reached just now. */
286
+ unavailable: 1013,
287
+ /**
288
+ * The project holds as many visitor connections as its plan allows — Starter's 100 — or its
289
+ * Organization is suspended. As HTTP's 402: more needs a bigger plan, or visitors leaving.
290
+ */
291
+ allowanceReached: 4402,
292
+ /** This client's address holds as many connections to the project as one address may. */
293
+ addressLimitReached: 4429,
294
+ /** The project is at its per-project safety ceiling — Pro's 50,000 — whatever it would pay for. */
295
+ ceilingReached: 4503
296
+ };
297
+ var VISITOR_CLOSE_RETRY = {
298
+ 4400: "stop",
299
+ 4401: "stop",
300
+ 4403: "stop",
301
+ 4404: "stop",
302
+ 1013: "retry",
303
+ 4402: "back-off",
304
+ 4429: "back-off",
305
+ 4503: "back-off"
306
+ };
307
+ var VISITOR_POLL_RETRY = {
308
+ REQUEST_INVALID: "stop",
309
+ MISSING_API_KEY: "stop",
310
+ INVALID_API_KEY: "stop",
311
+ ACCESS_DENIED: "stop",
312
+ METHOD_NOT_ALLOWED: "stop",
313
+ SERVICE_INDETERMINATE: "retry",
314
+ USAGE_QUOTA_EXCEEDED: "back-off",
315
+ RATE_LIMIT_EXCEEDED: "back-off"
316
+ };
317
+ var VISITOR_ADMISSION_RETRY_AFTER_SECONDS = 60;
318
+ function parseVisitorFrame(text) {
319
+ let value;
320
+ try {
321
+ value = JSON.parse(text);
322
+ } catch {
323
+ return null;
324
+ }
325
+ if (!isRecord2(value) || !isCursor(value.cursor)) return null;
326
+ switch (value.type) {
327
+ case VISITOR_FRAMES.opened: {
328
+ return hasOnly(value, ["type", "cursor"]) ? { type: VISITOR_FRAMES.opened, cursor: value.cursor } : null;
329
+ }
330
+ case VISITOR_FRAMES.changes: {
331
+ const changes = hasOnly(value, ["type", "changes", "cursor"]) ? readVisitorChanges(value.changes) : null;
332
+ return changes === null ? null : { type: VISITOR_FRAMES.changes, changes, cursor: value.cursor };
333
+ }
334
+ case VISITOR_FRAMES.resync: {
335
+ return hasOnly(value, ["type", "reason", "cursor"]) && isResyncReason(value.reason) ? { type: VISITOR_FRAMES.resync, reason: value.reason, cursor: value.cursor } : null;
336
+ }
337
+ default: {
338
+ return null;
339
+ }
340
+ }
341
+ }
342
+ chunkL6DXCKVQ_cjs.__name(parseVisitorFrame, "parseVisitorFrame");
343
+ function readVisitorPollAnswer(value) {
344
+ if (!isRecord2(value) || !isCursor(value.cursor)) return null;
345
+ if (value.kind === "resync") {
346
+ return hasOnly(value, ["kind", "reason", "cursor"]) && isResyncReason(value.reason) ? { kind: "resync", reason: value.reason, cursor: value.cursor } : null;
347
+ }
348
+ if (value.kind !== "changes" || !hasOnly(value, ["kind", "changes", "cursor"])) return null;
349
+ const changes = readVisitorChanges(value.changes);
350
+ return changes === null ? null : { kind: "changes", changes, cursor: value.cursor };
351
+ }
352
+ chunkL6DXCKVQ_cjs.__name(readVisitorPollAnswer, "readVisitorPollAnswer");
353
+ var CHANGE_KINDS = /* @__PURE__ */ new Set([
354
+ "published",
355
+ "updated",
356
+ "unpublished",
357
+ "deleted"
358
+ ]);
359
+ var RESYNC_REASONS = /* @__PURE__ */ new Set([
360
+ "retention",
361
+ "dataset-replaced",
362
+ "ahead-of-head",
363
+ "foreign-cursor",
364
+ "too-far-behind"
365
+ ]);
366
+ function isResyncReason(value) {
367
+ return typeof value === "string" && RESYNC_REASONS.has(value);
368
+ }
369
+ chunkL6DXCKVQ_cjs.__name(isResyncReason, "isResyncReason");
370
+ function readVisitorChanges(value) {
371
+ if (!Array.isArray(value)) return null;
372
+ const changes = [];
373
+ for (const item of value) {
374
+ if (!isRecord2(item) || !hasOnly(item, ["entryId", "contentType", "locale", "kind"])) return null;
375
+ const { entryId, contentType, locale, kind } = item;
376
+ if (!isNonEmptyString2(entryId) || !isNonEmptyString2(contentType)) return null;
377
+ if (locale !== null && typeof locale !== "string") return null;
378
+ if (typeof kind !== "string" || !CHANGE_KINDS.has(kind)) return null;
379
+ changes.push({ entryId, contentType, locale, kind });
380
+ }
381
+ return changes;
382
+ }
383
+ chunkL6DXCKVQ_cjs.__name(readVisitorChanges, "readVisitorChanges");
384
+ function isCursor(value) {
385
+ return typeof value === "string" && VISITOR_CURSOR.test(value);
386
+ }
387
+ chunkL6DXCKVQ_cjs.__name(isCursor, "isCursor");
388
+ function isRecord2(value) {
389
+ return typeof value === "object" && value !== null && !Array.isArray(value);
390
+ }
391
+ chunkL6DXCKVQ_cjs.__name(isRecord2, "isRecord2");
392
+ function isNonEmptyString2(value) {
393
+ return typeof value === "string" && value.length > 0;
394
+ }
395
+ chunkL6DXCKVQ_cjs.__name(isNonEmptyString2, "isNonEmptyString2");
396
+ function hasOnly(value, keys) {
397
+ const present = Object.keys(value);
398
+ return present.length === keys.length && present.every((key) => keys.includes(key));
399
+ }
400
+ chunkL6DXCKVQ_cjs.__name(hasOnly, "hasOnly");
401
+ var FUNCTION_RUN_FAILURES = [
402
+ "threw",
403
+ "exceeded-cpu",
404
+ "exceeded-memory",
405
+ "exceeded-duration",
406
+ "load-failed",
407
+ "output-invalid"
408
+ ];
409
+ new Set(FUNCTION_RUN_FAILURES);
410
+ var WEBHOOK_EVENT_ID_HEADER = "x-relyio-event-id";
411
+ var RESEND_IDEMPOTENCY_HEADER = "Idempotency-Key";
412
+ var RESEND_ATTACHMENTS_MAX_BYTES = 25 * 1024 * 1024;
413
+ var DEPLOYMENT_SUCCEEDED = "deployment.succeeded";
414
+ var STRIPE_EVENT_FIELDS = [
415
+ { path: "id", type: "string", required: true },
416
+ { path: "type", type: "string", required: true },
417
+ { path: "created", type: "number", required: true },
418
+ { path: "livemode", type: "boolean", required: true },
419
+ { path: "data.object.id", type: "string", required: true },
420
+ { path: "data.object.object", type: "string", required: true },
421
+ { path: "data.object.metadata", type: "object", required: false, values: "string" }
422
+ ];
423
+ var STRIPE_SUBSCRIPTION_FIELDS = [
424
+ ...STRIPE_EVENT_FIELDS,
425
+ { path: "data.object.status", type: "string", required: true },
426
+ { path: "data.object.customer", type: "string", required: true },
427
+ { path: "data.object.cancel_at_period_end", type: "boolean", required: false },
428
+ { path: "data.object.cancel_at", type: "number", required: false },
429
+ { path: "data.object.canceled_at", type: "number", required: false },
430
+ { path: "data.object.ended_at", type: "number", required: false },
431
+ { path: "data.object.start_date", type: "number", required: false },
432
+ { path: "data.object.trial_end", type: "number", required: false }
433
+ ];
434
+ var IDENTITY_CLAIMS_SETTING = "claims";
435
+ var IDENTITY_CLAIMS_SETTING_FIELD = {
436
+ key: IDENTITY_CLAIMS_SETTING,
437
+ label: "Claims",
438
+ type: "text",
439
+ maxLength: 512,
440
+ required: false,
441
+ helpText: "The Claims your Policies read off an End user\u2019s token, by name, separated by commas: `plan, role`. A Claim not named here is never read; one named and missing from a token is absent."
442
+ };
443
+ var EXTENSION_SURFACES = {
444
+ webhook: {
445
+ settings: [],
446
+ actions: {
447
+ post: {
448
+ action: "post",
449
+ // An Automation step's (REL-3849): the step names where and what, and the send is signed with
450
+ // the Connection's signing secret, its custom headers sent too.
451
+ step: {
452
+ input: [
453
+ {
454
+ key: "url",
455
+ type: "url",
456
+ required: true,
457
+ description: "Where to POST: an http(s) URL."
458
+ },
459
+ {
460
+ key: "headers",
461
+ type: "headers",
462
+ required: false,
463
+ description: "Request headers, sent after the Connection\u2019s custom headers. The headers RelyIO signs with are its own."
464
+ },
465
+ {
466
+ key: "body",
467
+ type: "json",
468
+ required: false,
469
+ description: "The JSON body. Absent, the body is `null`."
470
+ }
471
+ ],
472
+ output: [
473
+ {
474
+ key: "status",
475
+ type: "number",
476
+ required: true,
477
+ description: "The HTTP status the receiver answered."
478
+ },
479
+ {
480
+ key: "body",
481
+ type: "text",
482
+ required: false,
483
+ description: "The first kilobyte of the receiver\u2019s answer, as text."
484
+ }
485
+ ],
486
+ sample: { status: 200, body: "" },
487
+ // The webhook contract: a receiver dedupes on the delivery id, which carries `<runId>:<step>`.
488
+ idempotencyHeader: WEBHOOK_EVENT_ID_HEADER
489
+ }
490
+ }
491
+ },
492
+ triggers: {},
493
+ fieldKinds: {},
494
+ recordTypes: {}
495
+ },
496
+ vercel: {
497
+ settings: [],
498
+ actions: {},
499
+ triggers: {
500
+ deploymentSucceeded: {
501
+ trigger: DEPLOYMENT_SUCCEEDED,
502
+ payload: [
503
+ { path: "payload.deployment.id", type: "string", required: true },
504
+ { path: "payload.deployment.url", type: "string", required: false },
505
+ // A deployment made from the Vercel CLI names no commit: it is delivered, and links nothing.
506
+ { path: "payload.deployment.meta.githubCommitSha", type: "string", required: false },
507
+ { path: "payload.deployment.meta.githubCommitRef", type: "string", required: false },
508
+ { path: "payload.project.id", type: "string", required: true },
509
+ // `null` for a preview deployment, `production` for production.
510
+ { path: "payload.target", type: "string", required: false }
511
+ ]
512
+ }
513
+ },
514
+ fieldKinds: {},
515
+ recordTypes: {}
516
+ },
517
+ netlify: {
518
+ settings: [],
519
+ actions: {},
520
+ triggers: {
521
+ deploymentSucceeded: {
522
+ trigger: DEPLOYMENT_SUCCEEDED,
523
+ payload: [
524
+ { path: "id", type: "string", required: true },
525
+ { path: "site_id", type: "string", required: true },
526
+ { path: "state", type: "string", required: true },
527
+ // `production`, `deploy-preview` or `branch-deploy`.
528
+ { path: "context", type: "string", required: false },
529
+ { path: "branch", type: "string", required: false },
530
+ // A deploy from the Netlify CLI names no commit: it is delivered, and links nothing.
531
+ { path: "commit_ref", type: "string", required: false },
532
+ { path: "deploy_ssl_url", type: "string", required: false }
533
+ ]
534
+ }
535
+ },
536
+ fieldKinds: {},
537
+ recordTypes: {}
538
+ },
539
+ // Triggers only (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a Checkout
540
+ // completed or a charge was refunded — and, since spec 4 (REL-3893), that a subscription was
541
+ // created, changed or ended. No Action: checkout keeps calling Stripe from a Function with its own
542
+ // Secret (spec 2).
543
+ stripe: {
544
+ settings: [],
545
+ actions: {},
546
+ triggers: {
547
+ paymentIntentSucceeded: {
548
+ trigger: "payment_intent.succeeded",
549
+ payload: [
550
+ ...STRIPE_EVENT_FIELDS,
551
+ { path: "data.object.amount", type: "number", required: true },
552
+ { path: "data.object.amount_received", type: "number", required: true },
553
+ { path: "data.object.currency", type: "string", required: true },
554
+ { path: "data.object.status", type: "string", required: true },
555
+ { path: "data.object.customer", type: "string", required: false },
556
+ { path: "data.object.latest_charge", type: "string", required: false },
557
+ { path: "data.object.receipt_email", type: "string", required: false }
558
+ ]
559
+ },
560
+ paymentIntentPaymentFailed: {
561
+ trigger: "payment_intent.payment_failed",
562
+ payload: [
563
+ ...STRIPE_EVENT_FIELDS,
564
+ { path: "data.object.amount", type: "number", required: true },
565
+ { path: "data.object.currency", type: "string", required: true },
566
+ { path: "data.object.status", type: "string", required: true },
567
+ { path: "data.object.customer", type: "string", required: false },
568
+ { path: "data.object.last_payment_error.code", type: "string", required: false },
569
+ { path: "data.object.last_payment_error.message", type: "string", required: false }
570
+ ]
571
+ },
572
+ checkoutSessionCompleted: {
573
+ trigger: "checkout.session.completed",
574
+ payload: [
575
+ ...STRIPE_EVENT_FIELDS,
576
+ { path: "data.object.mode", type: "string", required: true },
577
+ { path: "data.object.payment_status", type: "string", required: true },
578
+ { path: "data.object.amount_total", type: "number", required: false },
579
+ { path: "data.object.currency", type: "string", required: false },
580
+ { path: "data.object.payment_intent", type: "string", required: false },
581
+ { path: "data.object.customer", type: "string", required: false },
582
+ { path: "data.object.customer_details.email", type: "string", required: false },
583
+ { path: "data.object.client_reference_id", type: "string", required: false }
584
+ ]
585
+ },
586
+ chargeRefunded: {
587
+ trigger: "charge.refunded",
588
+ payload: [
589
+ ...STRIPE_EVENT_FIELDS,
590
+ { path: "data.object.amount", type: "number", required: true },
591
+ { path: "data.object.amount_refunded", type: "number", required: true },
592
+ { path: "data.object.currency", type: "string", required: true },
593
+ { path: "data.object.refunded", type: "boolean", required: true },
594
+ { path: "data.object.payment_intent", type: "string", required: false }
595
+ ]
596
+ },
597
+ customerSubscriptionCreated: {
598
+ trigger: "customer.subscription.created",
599
+ payload: STRIPE_SUBSCRIPTION_FIELDS
600
+ },
601
+ customerSubscriptionUpdated: {
602
+ trigger: "customer.subscription.updated",
603
+ payload: [
604
+ ...STRIPE_SUBSCRIPTION_FIELDS,
605
+ // The status it had before this change, when the change was to its status
606
+ { path: "data.previous_attributes.status", type: "string", required: false }
607
+ ]
608
+ },
609
+ customerSubscriptionDeleted: {
610
+ trigger: "customer.subscription.deleted",
611
+ payload: STRIPE_SUBSCRIPTION_FIELDS
612
+ }
613
+ },
614
+ fieldKinds: {},
615
+ recordTypes: {}
616
+ },
617
+ slack: {
618
+ settings: [
619
+ {
620
+ key: "defaultChannel",
621
+ label: "Default channel",
622
+ type: "text",
623
+ prefix: "#",
624
+ maxLength: 80,
625
+ required: false,
626
+ helpText: "The channel a message goes to when its step names none: #orders."
627
+ }
628
+ ],
629
+ actions: {
630
+ postMessage: {
631
+ action: "postMessage",
632
+ // Spec 3, "Slack" (REL-3855): `channel` defaults to the `defaultChannel` setting, `text`,
633
+ // optional blocks; posted as RelyIO's app's bot with the Connection's bot token.
634
+ step: {
635
+ input: [
636
+ {
637
+ key: "channel",
638
+ type: "text",
639
+ required: false,
640
+ setting: "defaultChannel",
641
+ description: "The channel to post to, by name (#orders-review) or id. Absent, the defaultChannel setting."
642
+ },
643
+ {
644
+ key: "text",
645
+ type: "text",
646
+ required: true,
647
+ description: "The message, in Slack\u2019s mrkdwn; also the notification text when blocks are sent."
648
+ },
649
+ {
650
+ key: "blocks",
651
+ type: "json",
652
+ required: false,
653
+ description: "Block Kit blocks to post instead of plain text."
654
+ }
655
+ ],
656
+ output: [
657
+ {
658
+ key: "ts",
659
+ type: "text",
660
+ required: true,
661
+ description: "The posted message\u2019s timestamp, Slack\u2019s id for it in its channel."
662
+ },
663
+ {
664
+ key: "channel",
665
+ type: "text",
666
+ required: true,
667
+ description: "The channel the message was posted to, as Slack answered it."
668
+ }
669
+ ],
670
+ // A Recorded post hands this on, with the channel it would have posted to in place of
671
+ // `sample` (the events worker's Slack sender, `sampleOf`).
672
+ sample: { ts: "sample", channel: "sample" },
673
+ // Slack keys nothing to dedupe a post on: a post that succeeded is never sent again, and
674
+ // one whose outcome is unknown is not either.
675
+ idempotencyHeader: null
676
+ }
677
+ }
678
+ },
679
+ triggers: {},
680
+ fieldKinds: {},
681
+ recordTypes: {}
682
+ },
683
+ // Resend (spec 3, REL-3854): an email, its Files attached. The sender is the step's, else the
684
+ // Project's `from`; `html` or `text` is the body, at least one of them.
685
+ resend: {
686
+ settings: [
687
+ {
688
+ key: "from",
689
+ label: "From",
690
+ type: "text",
691
+ maxLength: 320,
692
+ required: false,
693
+ helpText: "Who an email is from when its step names no sender: an address on a domain verified in Resend, such as Acme <orders@acme.shop>."
694
+ }
695
+ ],
696
+ actions: {
697
+ send: {
698
+ action: "send",
699
+ step: {
700
+ input: [
701
+ {
702
+ key: "to",
703
+ type: "text",
704
+ required: true,
705
+ description: "Who the email is to: an address, or several separated by commas."
706
+ },
707
+ { key: "subject", type: "text", required: true, description: "The subject line." },
708
+ {
709
+ key: "html",
710
+ type: "text",
711
+ required: false,
712
+ description: "The body as HTML. `html` or `text` is required, or both."
713
+ },
714
+ {
715
+ key: "text",
716
+ type: "text",
717
+ required: false,
718
+ description: "The body as plain text. `html` or `text` is required, or both."
719
+ },
720
+ {
721
+ key: "from",
722
+ type: "text",
723
+ required: false,
724
+ setting: "from",
725
+ description: "Who the email is from: an address on a domain verified in Resend. Absent, the Project\u2019s `from` setting; with neither, the send is refused."
726
+ },
727
+ {
728
+ key: "attachments",
729
+ type: "files",
730
+ required: false,
731
+ maxBytes: RESEND_ATTACHMENTS_MAX_BYTES,
732
+ description: "Files a Record of the run\u2019s Dataset holds (`event.record.invoice`), attached under their names. The send point reads their bytes."
733
+ }
734
+ ],
735
+ output: [
736
+ {
737
+ key: "id",
738
+ type: "text",
739
+ required: true,
740
+ description: "The id Resend gave the email."
741
+ }
742
+ ],
743
+ sample: { id: "resend-sample" },
744
+ // Resend dedupes a send on this header for 24 hours; it carries `<runId>:<step>`
745
+ idempotencyHeader: RESEND_IDEMPOTENCY_HEADER
746
+ }
747
+ }
748
+ },
749
+ triggers: {},
750
+ fieldKinds: {},
751
+ recordTypes: {}
752
+ },
753
+ /**
754
+ * The plain OIDC identity source (spec 4, REL-3880): any issuer that publishes a discovery
755
+ * document — Auth0, Supabase Auth, an own one. Its Connection, per Environment, holds the issuer
756
+ * and the audience; it has no Action and no Trigger. Its one setting is the Claims the Project
757
+ * relies on ({@link IDENTITY_CLAIMS_SETTING}).
758
+ */
759
+ oidc: {
760
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
761
+ actions: {},
762
+ triggers: {},
763
+ fieldKinds: {},
764
+ recordTypes: {}
765
+ },
766
+ /**
767
+ * Clerk as an identity source (spec 4, REL-3881): its Connection, per Environment, holds the
768
+ * instance's publishable key — which encodes the Frontend API, and so the issuer — its secret key,
769
+ * its webhook signing secret and the origins its tokens may be minted for. Its one setting so far
770
+ * is the Claims the Project relies on, as `oidc`'s; its Triggers come with its users (spec 4, E3).
771
+ *
772
+ * Its Action, `updateUserMetadata` (REL-3893), merges `publicMetadata` into a Clerk user's public
773
+ * metadata with the Connection's secret key — the newsletter's `syncPlan` sets `{ plan: 'paid' }` —
774
+ * and a session token carries it once the customer adds the Claim to Clerk's session token
775
+ * (`"plan": "{{user.public_metadata.plan}}"`, the Clerk Extension's guide).
776
+ */
777
+ clerk: {
778
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
779
+ actions: {
780
+ updateUserMetadata: {
781
+ action: "updateUserMetadata",
782
+ step: {
783
+ input: [
784
+ {
785
+ key: "userId",
786
+ type: "text",
787
+ required: true,
788
+ description: "The Clerk user\u2019s id, `user_\u2026`: a token\u2019s `sub`."
789
+ },
790
+ {
791
+ key: "publicMetadata",
792
+ type: "json",
793
+ required: true,
794
+ description: "An object merged into the user\u2019s public metadata: each key given replaces theirs, a nested object is merged, and a key set to `null` is removed. Keys not given are kept."
795
+ }
796
+ ],
797
+ output: [
798
+ {
799
+ key: "id",
800
+ type: "text",
801
+ required: true,
802
+ description: "The id of the user Clerk updated."
803
+ }
804
+ ],
805
+ sample: { id: "user_sample" },
806
+ // Clerk's Backend API keys nothing to dedupe a request on: an update that succeeded is never
807
+ // sent again, and one whose outcome is unknown is not either.
808
+ idempotencyHeader: null
809
+ }
810
+ }
811
+ },
812
+ triggers: {},
813
+ /**
814
+ * Its one field kind (REL-3894): `clerk.userRef()`, a reference to `clerkUser` that the Studio
815
+ * picks by name or email rather than by pasting an id.
816
+ */
817
+ fieldKinds: {
818
+ userRef: {
819
+ base: { type: "reference", to: "clerkUser" },
820
+ picker: {
821
+ search: ["email", "firstName", "lastName"],
822
+ title: ["firstName", "lastName"],
823
+ description: "email",
824
+ image: "imageUrl"
825
+ }
826
+ }
827
+ },
828
+ /** Its Managed user type (REL-3888): `clerk.user`, the Record kept for each Clerk user. */
829
+ recordTypes: { user: "clerkUser" }
830
+ }
831
+ };
832
+ var CONTRIBUTED_FIELD_KIND_OPTION = "fieldKind";
833
+ function contributedFieldKindName(extension, kind) {
834
+ return `${extension}.${kind}`;
835
+ }
836
+ chunkL6DXCKVQ_cjs.__name(contributedFieldKindName, "contributedFieldKindName");
837
+ var EXTENSION_BACKFILL_REFUSALS = [
838
+ "connection-gone",
839
+ "connection-inactive",
840
+ "connection-unreadable",
841
+ "vendor-refused",
842
+ "vendor-unavailable",
843
+ "vendor-answer-unreadable",
844
+ "extension-not-backfilled"
845
+ ];
846
+ new Set(EXTENSION_BACKFILL_REFUSALS);
847
+
848
+ exports.CONTRIBUTED_FIELD_KIND_OPTION = CONTRIBUTED_FIELD_KIND_OPTION;
849
+ exports.END_USER_TOKEN_REFUSAL_REASONS = END_USER_TOKEN_REFUSAL_REASONS;
850
+ exports.EXTENSION_SURFACES = EXTENSION_SURFACES;
851
+ exports.FRESH_PARAMETER = FRESH_PARAMETER;
852
+ exports.HEADER_END_USER = HEADER_END_USER;
853
+ exports.HEADER_IDEMPOTENCY_KEY = HEADER_IDEMPOTENCY_KEY;
854
+ exports.HEADER_IF_MATCH = HEADER_IF_MATCH;
855
+ exports.HEADER_RETRY_AFTER = HEADER_RETRY_AFTER;
856
+ exports.PREVIEW_DATASET_PREFIX = PREVIEW_DATASET_PREFIX;
857
+ exports.VISITOR_ADMISSION_RETRY_AFTER_SECONDS = VISITOR_ADMISSION_RETRY_AFTER_SECONDS;
858
+ exports.VISITOR_CLOSE_CODES = VISITOR_CLOSE_CODES;
859
+ exports.VISITOR_CLOSE_RETRY = VISITOR_CLOSE_RETRY;
860
+ exports.VISITOR_FRAMES = VISITOR_FRAMES;
861
+ exports.VISITOR_KEEPALIVE = VISITOR_KEEPALIVE;
862
+ exports.VISITOR_LIVE_PATH = VISITOR_LIVE_PATH;
863
+ exports.VISITOR_POLL_INTERVAL_MS = VISITOR_POLL_INTERVAL_MS;
864
+ exports.VISITOR_POLL_RETRY = VISITOR_POLL_RETRY;
865
+ exports.VISITOR_QUERY = VISITOR_QUERY;
866
+ exports.contributedFieldKindName = contributedFieldKindName;
867
+ exports.entityTag = entityTag;
868
+ exports.parseVisitorFrame = parseVisitorFrame;
869
+ exports.previewDatasetSlug = previewDatasetSlug;
870
+ exports.readVisitorPollAnswer = readVisitorPollAnswer;
871
+ //# sourceMappingURL=chunk-NN45CSPZ.cjs.map
872
+ //# sourceMappingURL=chunk-NN45CSPZ.cjs.map