@relyio/sdk 0.17.0 → 0.18.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/CHANGELOG.md +15 -0
- package/dist/automations/index.cjs +70 -0
- package/dist/automations/index.d.cts +1309 -0
- package/dist/automations/index.d.ts +1309 -0
- package/dist/automations/index.js +5 -0
- package/dist/{chunk-RSHMA4KT.cjs → chunk-2SPPU2WG.cjs} +68 -68
- package/dist/chunk-7I3SC7SV.cjs +40 -0
- package/dist/chunk-DI6KFDBO.js +43 -0
- package/dist/chunk-EDE2H37D.js +686 -0
- package/dist/chunk-HDHBYYEY.js +36 -0
- package/dist/{chunk-6E22GYPB.cjs → chunk-IFKF72VJ.cjs} +705 -320
- package/dist/chunk-L6DXCKVQ.cjs +50 -0
- package/dist/chunk-LSI26ZN2.cjs +535 -0
- package/dist/{chunk-TZL374LS.cjs → chunk-M7MWNV3Q.cjs} +21 -21
- package/dist/{chunk-H6IBQSMM.js → chunk-NJQK5STK.js} +3 -3
- package/dist/chunk-R6E4HE7R.js +520 -0
- package/dist/chunk-SHSK7UUY.cjs +706 -0
- package/dist/{chunk-BBUB7C2Z.js → chunk-W2A4OTCI.js} +3 -3
- package/dist/chunk-W7JFHSFM.js +18718 -0
- package/dist/{chunk-5UMY6CS4.js → chunk-ZAKEY6DY.js} +3 -3
- package/dist/chunk-ZAMAR3X2.cjs +18759 -0
- package/dist/{chunk-VS2DEUTN.js → chunk-ZHTJ7GXH.js} +387 -8
- package/dist/{chunk-LSRPMNPT.cjs → chunk-ZO6QDYJG.cjs} +7 -7
- package/dist/client/index.cjs +8 -7
- package/dist/client/index.d.cts +4 -3
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +6 -5
- package/dist/{define-content-type-AuL9-oz6.d.cts → define-content-type-NEQDrvdq.d.cts} +3342 -805
- package/dist/{define-content-type-BGoQxqLf.d.ts → define-content-type-fb-WCD5e.d.ts} +3342 -805
- package/dist/{define-schema-DgCX9YB7.d.ts → define-schema-DZhtvLiK.d.cts} +157 -10
- package/dist/{define-schema-DkXwpp0I.d.cts → define-schema-Dlwh6l_J.d.ts} +157 -10
- package/dist/dev-handshake/index.cjs +9 -9
- package/dist/dev-handshake/index.js +2 -2
- package/dist/extensions/index.cjs +80 -0
- package/dist/extensions/index.d.cts +792 -0
- package/dist/extensions/index.d.ts +792 -0
- package/dist/extensions/index.js +76 -0
- package/dist/functions/index.cjs +68 -0
- package/dist/functions/index.d.cts +6 -0
- package/dist/functions/index.d.ts +6 -0
- package/dist/functions/index.js +59 -0
- package/dist/{index-DaMZ4FQ_.d.ts → index-C4LqrNd1.d.ts} +1 -1
- package/dist/{index-Bp4AiNT3.d.cts → index-Dnmt_UOo.d.cts} +1 -1
- package/dist/{index-DxRmKPrR.d.cts → index-DwHcL6x5.d.cts} +83 -428
- package/dist/{index-BBp8_tn9.d.ts → index-M3luH06A.d.ts} +83 -428
- package/dist/index.cjs +204 -185
- package/dist/index.d.cts +93 -13
- package/dist/index.d.ts +93 -13
- package/dist/index.js +11 -16
- package/dist/markdown/index.cjs +382 -382
- package/dist/markdown/index.js +1 -1
- package/dist/preview/index.cjs +11 -10
- package/dist/preview/index.js +3 -2
- package/dist/register-B53i97A9.d.ts +677 -0
- package/dist/register-BYCs0FpF.d.cts +677 -0
- package/dist/rich-text/index.cjs +12 -12
- package/dist/rich-text/index.d.cts +2 -2
- package/dist/rich-text/index.d.ts +2 -2
- package/dist/rich-text/index.js +2 -2
- package/dist/schema/index.cjs +62 -34
- package/dist/schema/index.d.cts +127 -5
- package/dist/schema/index.d.ts +127 -5
- package/dist/schema/index.js +2 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +20 -20
- package/dist/utils/index.js +2 -2
- package/package.json +23 -5
- package/dist/chunk-6PTRZP5U.cjs +0 -433
- package/dist/chunk-DIZY6CKM.js +0 -950
- package/dist/chunk-GHYB6IZK.cjs +0 -983
- package/dist/chunk-MWMSFIWN.cjs +0 -17
- package/dist/chunk-OVMIHAYK.js +0 -411
- package/dist/chunk-XQ4QHWZE.js +0 -13
|
@@ -0,0 +1,706 @@
|
|
|
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/index.js
|
|
57
|
+
var HEADER_RETRY_AFTER = { name: "Retry-After" };
|
|
58
|
+
var HEADER_IF_MATCH = {
|
|
59
|
+
name: "If-Match",
|
|
60
|
+
in: "request",
|
|
61
|
+
required: false
|
|
62
|
+
};
|
|
63
|
+
function entityTag(parts) {
|
|
64
|
+
return `"${parts.entryUid}:${parts.locale}:${parts.version}:${parts.sharedVersion}"`;
|
|
65
|
+
}
|
|
66
|
+
chunkL6DXCKVQ_cjs.__name(entityTag, "entityTag");
|
|
67
|
+
var HEADER_IDEMPOTENCY_KEY = {
|
|
68
|
+
name: "Idempotency-Key",
|
|
69
|
+
in: "request",
|
|
70
|
+
required: false
|
|
71
|
+
};
|
|
72
|
+
var FRESH_PARAMETER = "_fresh";
|
|
73
|
+
var K = new Uint32Array([
|
|
74
|
+
1116352408,
|
|
75
|
+
1899447441,
|
|
76
|
+
3049323471,
|
|
77
|
+
3921009573,
|
|
78
|
+
961987163,
|
|
79
|
+
1508970993,
|
|
80
|
+
2453635748,
|
|
81
|
+
2870763221,
|
|
82
|
+
3624381080,
|
|
83
|
+
310598401,
|
|
84
|
+
607225278,
|
|
85
|
+
1426881987,
|
|
86
|
+
1925078388,
|
|
87
|
+
2162078206,
|
|
88
|
+
2614888103,
|
|
89
|
+
3248222580,
|
|
90
|
+
3835390401,
|
|
91
|
+
4022224774,
|
|
92
|
+
264347078,
|
|
93
|
+
604807628,
|
|
94
|
+
770255983,
|
|
95
|
+
1249150122,
|
|
96
|
+
1555081692,
|
|
97
|
+
1996064986,
|
|
98
|
+
2554220882,
|
|
99
|
+
2821834349,
|
|
100
|
+
2952996808,
|
|
101
|
+
3210313671,
|
|
102
|
+
3336571891,
|
|
103
|
+
3584528711,
|
|
104
|
+
113926993,
|
|
105
|
+
338241895,
|
|
106
|
+
666307205,
|
|
107
|
+
773529912,
|
|
108
|
+
1294757372,
|
|
109
|
+
1396182291,
|
|
110
|
+
1695183700,
|
|
111
|
+
1986661051,
|
|
112
|
+
2177026350,
|
|
113
|
+
2456956037,
|
|
114
|
+
2730485921,
|
|
115
|
+
2820302411,
|
|
116
|
+
3259730800,
|
|
117
|
+
3345764771,
|
|
118
|
+
3516065817,
|
|
119
|
+
3600352804,
|
|
120
|
+
4094571909,
|
|
121
|
+
275423344,
|
|
122
|
+
430227734,
|
|
123
|
+
506948616,
|
|
124
|
+
659060556,
|
|
125
|
+
883997877,
|
|
126
|
+
958139571,
|
|
127
|
+
1322822218,
|
|
128
|
+
1537002063,
|
|
129
|
+
1747873779,
|
|
130
|
+
1955562222,
|
|
131
|
+
2024104815,
|
|
132
|
+
2227730452,
|
|
133
|
+
2361852424,
|
|
134
|
+
2428436474,
|
|
135
|
+
2756734187,
|
|
136
|
+
3204031479,
|
|
137
|
+
3329325298
|
|
138
|
+
]);
|
|
139
|
+
var rotr = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((value, bits) => value >>> bits | value << 32 - bits, "rotr");
|
|
140
|
+
function sha256Hex(text) {
|
|
141
|
+
const bytes = new globalThis.TextEncoder().encode(text);
|
|
142
|
+
const blocks = Math.ceil((bytes.length + 9) / 64);
|
|
143
|
+
const padded = new Uint8Array(blocks * 64);
|
|
144
|
+
padded.set(bytes);
|
|
145
|
+
padded[bytes.length] = 128;
|
|
146
|
+
const view = new DataView(padded.buffer);
|
|
147
|
+
const bits = bytes.length * 8;
|
|
148
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
149
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
150
|
+
const hash = new Uint32Array([
|
|
151
|
+
1779033703,
|
|
152
|
+
3144134277,
|
|
153
|
+
1013904242,
|
|
154
|
+
2773480762,
|
|
155
|
+
1359893119,
|
|
156
|
+
2600822924,
|
|
157
|
+
528734635,
|
|
158
|
+
1541459225
|
|
159
|
+
]);
|
|
160
|
+
const w = new Uint32Array(64);
|
|
161
|
+
for (let block = 0; block < blocks; block++) {
|
|
162
|
+
for (let i = 0; i < 16; i++) w[i] = view.getUint32(block * 64 + i * 4);
|
|
163
|
+
for (let i = 16; i < 64; i++) {
|
|
164
|
+
const w15 = w[i - 15];
|
|
165
|
+
const w2 = w[i - 2];
|
|
166
|
+
const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
|
|
167
|
+
const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
|
|
168
|
+
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
169
|
+
}
|
|
170
|
+
let a = hash[0];
|
|
171
|
+
let b = hash[1];
|
|
172
|
+
let c = hash[2];
|
|
173
|
+
let d = hash[3];
|
|
174
|
+
let e = hash[4];
|
|
175
|
+
let f = hash[5];
|
|
176
|
+
let g = hash[6];
|
|
177
|
+
let h = hash[7];
|
|
178
|
+
for (let i = 0; i < 64; i++) {
|
|
179
|
+
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
180
|
+
const choice = e & f ^ ~e & g;
|
|
181
|
+
const t1 = h + s1 + choice + K[i] + w[i] >>> 0;
|
|
182
|
+
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
183
|
+
const majority = a & b ^ a & c ^ b & c;
|
|
184
|
+
const t2 = s0 + majority >>> 0;
|
|
185
|
+
h = g;
|
|
186
|
+
g = f;
|
|
187
|
+
f = e;
|
|
188
|
+
e = d + t1 >>> 0;
|
|
189
|
+
d = c;
|
|
190
|
+
c = b;
|
|
191
|
+
b = a;
|
|
192
|
+
a = t1 + t2 >>> 0;
|
|
193
|
+
}
|
|
194
|
+
hash[0] = hash[0] + a;
|
|
195
|
+
hash[1] = hash[1] + b;
|
|
196
|
+
hash[2] = hash[2] + c;
|
|
197
|
+
hash[3] = hash[3] + d;
|
|
198
|
+
hash[4] = hash[4] + e;
|
|
199
|
+
hash[5] = hash[5] + f;
|
|
200
|
+
hash[6] = hash[6] + g;
|
|
201
|
+
hash[7] = hash[7] + h;
|
|
202
|
+
}
|
|
203
|
+
return Array.from(hash, (word) => word.toString(16).padStart(8, "0")).join("");
|
|
204
|
+
}
|
|
205
|
+
chunkL6DXCKVQ_cjs.__name(sha256Hex, "sha256Hex");
|
|
206
|
+
var PREVIEW_DATASET_PREFIX = "preview/";
|
|
207
|
+
var READABLE_MAX = 40;
|
|
208
|
+
var HASH_DIGITS = 8;
|
|
209
|
+
function previewDatasetSlug(branch) {
|
|
210
|
+
const name = branch.startsWith("refs/heads/") ? branch.slice("refs/heads/".length) : branch;
|
|
211
|
+
if (name === "") {
|
|
212
|
+
throw new TypeError(`previewDatasetSlug: ${JSON.stringify(branch)} names no Git branch`);
|
|
213
|
+
}
|
|
214
|
+
const readable = name.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/^-+|-+$/g, "").slice(0, READABLE_MAX).replace(/-+$/, "");
|
|
215
|
+
const hash = sha256Hex(name).slice(0, HASH_DIGITS);
|
|
216
|
+
return `${PREVIEW_DATASET_PREFIX}${readable === "" ? "" : `${readable}-`}${hash}`;
|
|
217
|
+
}
|
|
218
|
+
chunkL6DXCKVQ_cjs.__name(previewDatasetSlug, "previewDatasetSlug");
|
|
219
|
+
var VISITOR_LIVE_PATH = "/visitor/changes";
|
|
220
|
+
var VISITOR_QUERY = {
|
|
221
|
+
/** The publishable key. */
|
|
222
|
+
key: "key",
|
|
223
|
+
/** A dataset id or name the key reaches; absent, the key's default dataset. */
|
|
224
|
+
dataset: "dataset",
|
|
225
|
+
/** The cursor to continue from; absent, the socket starts now. */
|
|
226
|
+
since: "since",
|
|
227
|
+
/** Comma-separated content types to keep; absent keeps every type. */
|
|
228
|
+
types: "types",
|
|
229
|
+
/** Comma-separated entry ids to keep; absent keeps every entry. */
|
|
230
|
+
ids: "ids",
|
|
231
|
+
/** The poll's client id. Required on a poll, and not read on a socket. */
|
|
232
|
+
client: "client"
|
|
233
|
+
};
|
|
234
|
+
var VISITOR_CURSOR = /^[\w.~-]{1,256}$/;
|
|
235
|
+
var VISITOR_POLL_INTERVAL_MS = 15e3;
|
|
236
|
+
var VISITOR_KEEPALIVE = { request: "ping", response: "pong" };
|
|
237
|
+
var VISITOR_FRAMES = {
|
|
238
|
+
opened: "feed.opened",
|
|
239
|
+
changes: "feed.changes",
|
|
240
|
+
resync: "feed.resync"
|
|
241
|
+
};
|
|
242
|
+
defineRoute({
|
|
243
|
+
kind: "object",
|
|
244
|
+
headers: [HEADER_RETRY_AFTER],
|
|
245
|
+
codes: [
|
|
246
|
+
"REQUEST_INVALID",
|
|
247
|
+
"MISSING_API_KEY",
|
|
248
|
+
"INVALID_API_KEY",
|
|
249
|
+
"ACCESS_DENIED",
|
|
250
|
+
"METHOD_NOT_ALLOWED",
|
|
251
|
+
"SERVICE_INDETERMINATE",
|
|
252
|
+
"USAGE_QUOTA_EXCEEDED",
|
|
253
|
+
"RATE_LIMIT_EXCEEDED"
|
|
254
|
+
]
|
|
255
|
+
});
|
|
256
|
+
var VISITOR_CLOSE_CODES = {
|
|
257
|
+
/** A query the door cannot read: a malformed `since`, filter, `dataset` or `client`. */
|
|
258
|
+
requestInvalid: 4400,
|
|
259
|
+
/** No publishable key, or one that is unknown, revoked, expired, a secret key or a preview key. */
|
|
260
|
+
keyRefused: 4401,
|
|
261
|
+
/** The page's `Origin` is absent, or not on the key's allowed origins. */
|
|
262
|
+
originRefused: 4403,
|
|
263
|
+
/** `dataset` names nothing the key reaches. */
|
|
264
|
+
datasetRefused: 4404,
|
|
265
|
+
/** The key's scope, the project's counter or the feed could not be reached just now. */
|
|
266
|
+
unavailable: 1013,
|
|
267
|
+
/**
|
|
268
|
+
* The project holds as many visitor connections as its plan allows — Starter's 100 — or its
|
|
269
|
+
* Organization is suspended. As HTTP's 402: more needs a bigger plan, or visitors leaving.
|
|
270
|
+
*/
|
|
271
|
+
allowanceReached: 4402,
|
|
272
|
+
/** This client's address holds as many connections to the project as one address may. */
|
|
273
|
+
addressLimitReached: 4429,
|
|
274
|
+
/** The project is at its per-project safety ceiling — Pro's 50,000 — whatever it would pay for. */
|
|
275
|
+
ceilingReached: 4503
|
|
276
|
+
};
|
|
277
|
+
var VISITOR_CLOSE_RETRY = {
|
|
278
|
+
4400: "stop",
|
|
279
|
+
4401: "stop",
|
|
280
|
+
4403: "stop",
|
|
281
|
+
4404: "stop",
|
|
282
|
+
1013: "retry",
|
|
283
|
+
4402: "back-off",
|
|
284
|
+
4429: "back-off",
|
|
285
|
+
4503: "back-off"
|
|
286
|
+
};
|
|
287
|
+
var VISITOR_POLL_RETRY = {
|
|
288
|
+
REQUEST_INVALID: "stop",
|
|
289
|
+
MISSING_API_KEY: "stop",
|
|
290
|
+
INVALID_API_KEY: "stop",
|
|
291
|
+
ACCESS_DENIED: "stop",
|
|
292
|
+
METHOD_NOT_ALLOWED: "stop",
|
|
293
|
+
SERVICE_INDETERMINATE: "retry",
|
|
294
|
+
USAGE_QUOTA_EXCEEDED: "back-off",
|
|
295
|
+
RATE_LIMIT_EXCEEDED: "back-off"
|
|
296
|
+
};
|
|
297
|
+
var VISITOR_ADMISSION_RETRY_AFTER_SECONDS = 60;
|
|
298
|
+
function parseVisitorFrame(text) {
|
|
299
|
+
let value;
|
|
300
|
+
try {
|
|
301
|
+
value = JSON.parse(text);
|
|
302
|
+
} catch {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
if (!isRecord2(value) || !isCursor(value.cursor)) return null;
|
|
306
|
+
switch (value.type) {
|
|
307
|
+
case VISITOR_FRAMES.opened: {
|
|
308
|
+
return hasOnly(value, ["type", "cursor"]) ? { type: VISITOR_FRAMES.opened, cursor: value.cursor } : null;
|
|
309
|
+
}
|
|
310
|
+
case VISITOR_FRAMES.changes: {
|
|
311
|
+
const changes = hasOnly(value, ["type", "changes", "cursor"]) ? readVisitorChanges(value.changes) : null;
|
|
312
|
+
return changes === null ? null : { type: VISITOR_FRAMES.changes, changes, cursor: value.cursor };
|
|
313
|
+
}
|
|
314
|
+
case VISITOR_FRAMES.resync: {
|
|
315
|
+
return hasOnly(value, ["type", "reason", "cursor"]) && isResyncReason(value.reason) ? { type: VISITOR_FRAMES.resync, reason: value.reason, cursor: value.cursor } : null;
|
|
316
|
+
}
|
|
317
|
+
default: {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
chunkL6DXCKVQ_cjs.__name(parseVisitorFrame, "parseVisitorFrame");
|
|
323
|
+
function readVisitorPollAnswer(value) {
|
|
324
|
+
if (!isRecord2(value) || !isCursor(value.cursor)) return null;
|
|
325
|
+
if (value.kind === "resync") {
|
|
326
|
+
return hasOnly(value, ["kind", "reason", "cursor"]) && isResyncReason(value.reason) ? { kind: "resync", reason: value.reason, cursor: value.cursor } : null;
|
|
327
|
+
}
|
|
328
|
+
if (value.kind !== "changes" || !hasOnly(value, ["kind", "changes", "cursor"])) return null;
|
|
329
|
+
const changes = readVisitorChanges(value.changes);
|
|
330
|
+
return changes === null ? null : { kind: "changes", changes, cursor: value.cursor };
|
|
331
|
+
}
|
|
332
|
+
chunkL6DXCKVQ_cjs.__name(readVisitorPollAnswer, "readVisitorPollAnswer");
|
|
333
|
+
var CHANGE_KINDS = /* @__PURE__ */ new Set([
|
|
334
|
+
"published",
|
|
335
|
+
"updated",
|
|
336
|
+
"unpublished",
|
|
337
|
+
"deleted"
|
|
338
|
+
]);
|
|
339
|
+
var RESYNC_REASONS = /* @__PURE__ */ new Set([
|
|
340
|
+
"retention",
|
|
341
|
+
"dataset-replaced",
|
|
342
|
+
"ahead-of-head",
|
|
343
|
+
"foreign-cursor",
|
|
344
|
+
"too-far-behind"
|
|
345
|
+
]);
|
|
346
|
+
function isResyncReason(value) {
|
|
347
|
+
return typeof value === "string" && RESYNC_REASONS.has(value);
|
|
348
|
+
}
|
|
349
|
+
chunkL6DXCKVQ_cjs.__name(isResyncReason, "isResyncReason");
|
|
350
|
+
function readVisitorChanges(value) {
|
|
351
|
+
if (!Array.isArray(value)) return null;
|
|
352
|
+
const changes = [];
|
|
353
|
+
for (const item of value) {
|
|
354
|
+
if (!isRecord2(item) || !hasOnly(item, ["entryId", "contentType", "locale", "kind"])) return null;
|
|
355
|
+
const { entryId, contentType, locale, kind } = item;
|
|
356
|
+
if (!isNonEmptyString2(entryId) || !isNonEmptyString2(contentType)) return null;
|
|
357
|
+
if (locale !== null && typeof locale !== "string") return null;
|
|
358
|
+
if (typeof kind !== "string" || !CHANGE_KINDS.has(kind)) return null;
|
|
359
|
+
changes.push({ entryId, contentType, locale, kind });
|
|
360
|
+
}
|
|
361
|
+
return changes;
|
|
362
|
+
}
|
|
363
|
+
chunkL6DXCKVQ_cjs.__name(readVisitorChanges, "readVisitorChanges");
|
|
364
|
+
function isCursor(value) {
|
|
365
|
+
return typeof value === "string" && VISITOR_CURSOR.test(value);
|
|
366
|
+
}
|
|
367
|
+
chunkL6DXCKVQ_cjs.__name(isCursor, "isCursor");
|
|
368
|
+
function isRecord2(value) {
|
|
369
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
370
|
+
}
|
|
371
|
+
chunkL6DXCKVQ_cjs.__name(isRecord2, "isRecord2");
|
|
372
|
+
function isNonEmptyString2(value) {
|
|
373
|
+
return typeof value === "string" && value.length > 0;
|
|
374
|
+
}
|
|
375
|
+
chunkL6DXCKVQ_cjs.__name(isNonEmptyString2, "isNonEmptyString2");
|
|
376
|
+
function hasOnly(value, keys) {
|
|
377
|
+
const present = Object.keys(value);
|
|
378
|
+
return present.length === keys.length && present.every((key) => keys.includes(key));
|
|
379
|
+
}
|
|
380
|
+
chunkL6DXCKVQ_cjs.__name(hasOnly, "hasOnly");
|
|
381
|
+
var FUNCTION_RUN_FAILURES = [
|
|
382
|
+
"threw",
|
|
383
|
+
"exceeded-cpu",
|
|
384
|
+
"exceeded-memory",
|
|
385
|
+
"exceeded-duration",
|
|
386
|
+
"load-failed",
|
|
387
|
+
"output-invalid"
|
|
388
|
+
];
|
|
389
|
+
new Set(FUNCTION_RUN_FAILURES);
|
|
390
|
+
var WEBHOOK_EVENT_ID_HEADER = "x-relyio-event-id";
|
|
391
|
+
var RESEND_IDEMPOTENCY_HEADER = "Idempotency-Key";
|
|
392
|
+
var RESEND_ATTACHMENTS_MAX_BYTES = 25 * 1024 * 1024;
|
|
393
|
+
var DEPLOYMENT_SUCCEEDED = "deployment.succeeded";
|
|
394
|
+
var STRIPE_EVENT_FIELDS = [
|
|
395
|
+
{ path: "id", type: "string", required: true },
|
|
396
|
+
{ path: "type", type: "string", required: true },
|
|
397
|
+
{ path: "created", type: "number", required: true },
|
|
398
|
+
{ path: "livemode", type: "boolean", required: true },
|
|
399
|
+
{ path: "data.object.id", type: "string", required: true },
|
|
400
|
+
{ path: "data.object.object", type: "string", required: true },
|
|
401
|
+
{ path: "data.object.metadata", type: "object", required: false, values: "string" }
|
|
402
|
+
];
|
|
403
|
+
var EXTENSION_SURFACES = {
|
|
404
|
+
webhook: {
|
|
405
|
+
settings: [],
|
|
406
|
+
actions: {
|
|
407
|
+
post: {
|
|
408
|
+
action: "post",
|
|
409
|
+
// An Automation step's (REL-3849): the step names where and what, and the send is signed with
|
|
410
|
+
// the Connection's signing secret, its custom headers sent too.
|
|
411
|
+
step: {
|
|
412
|
+
input: [
|
|
413
|
+
{
|
|
414
|
+
key: "url",
|
|
415
|
+
type: "url",
|
|
416
|
+
required: true,
|
|
417
|
+
description: "Where to POST: an http(s) URL."
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
key: "headers",
|
|
421
|
+
type: "headers",
|
|
422
|
+
required: false,
|
|
423
|
+
description: "Request headers, sent after the Connection\u2019s custom headers. The headers RelyIO signs with are its own."
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
key: "body",
|
|
427
|
+
type: "json",
|
|
428
|
+
required: false,
|
|
429
|
+
description: "The JSON body. Absent, the body is `null`."
|
|
430
|
+
}
|
|
431
|
+
],
|
|
432
|
+
output: [
|
|
433
|
+
{
|
|
434
|
+
key: "status",
|
|
435
|
+
type: "number",
|
|
436
|
+
required: true,
|
|
437
|
+
description: "The HTTP status the receiver answered."
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
key: "body",
|
|
441
|
+
type: "text",
|
|
442
|
+
required: false,
|
|
443
|
+
description: "The first kilobyte of the receiver\u2019s answer, as text."
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
sample: { status: 200, body: "" },
|
|
447
|
+
// The webhook contract: a receiver dedupes on the delivery id, which carries `<runId>:<step>`.
|
|
448
|
+
idempotencyHeader: WEBHOOK_EVENT_ID_HEADER
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
triggers: {}
|
|
453
|
+
},
|
|
454
|
+
vercel: {
|
|
455
|
+
settings: [],
|
|
456
|
+
actions: {},
|
|
457
|
+
triggers: {
|
|
458
|
+
deploymentSucceeded: {
|
|
459
|
+
trigger: DEPLOYMENT_SUCCEEDED,
|
|
460
|
+
payload: [
|
|
461
|
+
{ path: "payload.deployment.id", type: "string", required: true },
|
|
462
|
+
{ path: "payload.deployment.url", type: "string", required: false },
|
|
463
|
+
// A deployment made from the Vercel CLI names no commit: it is delivered, and links nothing.
|
|
464
|
+
{ path: "payload.deployment.meta.githubCommitSha", type: "string", required: false },
|
|
465
|
+
{ path: "payload.deployment.meta.githubCommitRef", type: "string", required: false },
|
|
466
|
+
{ path: "payload.project.id", type: "string", required: true },
|
|
467
|
+
// `null` for a preview deployment, `production` for production.
|
|
468
|
+
{ path: "payload.target", type: "string", required: false }
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
netlify: {
|
|
474
|
+
settings: [],
|
|
475
|
+
actions: {},
|
|
476
|
+
triggers: {
|
|
477
|
+
deploymentSucceeded: {
|
|
478
|
+
trigger: DEPLOYMENT_SUCCEEDED,
|
|
479
|
+
payload: [
|
|
480
|
+
{ path: "id", type: "string", required: true },
|
|
481
|
+
{ path: "site_id", type: "string", required: true },
|
|
482
|
+
{ path: "state", type: "string", required: true },
|
|
483
|
+
// `production`, `deploy-preview` or `branch-deploy`.
|
|
484
|
+
{ path: "context", type: "string", required: false },
|
|
485
|
+
{ path: "branch", type: "string", required: false },
|
|
486
|
+
// A deploy from the Netlify CLI names no commit: it is delivered, and links nothing.
|
|
487
|
+
{ path: "commit_ref", type: "string", required: false },
|
|
488
|
+
{ path: "deploy_ssl_url", type: "string", required: false }
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
// Triggers only in slice one (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a
|
|
494
|
+
// Checkout completed or a charge was refunded. No Action: checkout keeps calling Stripe from a
|
|
495
|
+
// Function with its own Secret (spec 2).
|
|
496
|
+
stripe: {
|
|
497
|
+
settings: [],
|
|
498
|
+
actions: {},
|
|
499
|
+
triggers: {
|
|
500
|
+
paymentIntentSucceeded: {
|
|
501
|
+
trigger: "payment_intent.succeeded",
|
|
502
|
+
payload: [
|
|
503
|
+
...STRIPE_EVENT_FIELDS,
|
|
504
|
+
{ path: "data.object.amount", type: "number", required: true },
|
|
505
|
+
{ path: "data.object.amount_received", type: "number", required: true },
|
|
506
|
+
{ path: "data.object.currency", type: "string", required: true },
|
|
507
|
+
{ path: "data.object.status", type: "string", required: true },
|
|
508
|
+
{ path: "data.object.customer", type: "string", required: false },
|
|
509
|
+
{ path: "data.object.latest_charge", type: "string", required: false },
|
|
510
|
+
{ path: "data.object.receipt_email", type: "string", required: false }
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
paymentIntentPaymentFailed: {
|
|
514
|
+
trigger: "payment_intent.payment_failed",
|
|
515
|
+
payload: [
|
|
516
|
+
...STRIPE_EVENT_FIELDS,
|
|
517
|
+
{ path: "data.object.amount", type: "number", required: true },
|
|
518
|
+
{ path: "data.object.currency", type: "string", required: true },
|
|
519
|
+
{ path: "data.object.status", type: "string", required: true },
|
|
520
|
+
{ path: "data.object.customer", type: "string", required: false },
|
|
521
|
+
{ path: "data.object.last_payment_error.code", type: "string", required: false },
|
|
522
|
+
{ path: "data.object.last_payment_error.message", type: "string", required: false }
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
checkoutSessionCompleted: {
|
|
526
|
+
trigger: "checkout.session.completed",
|
|
527
|
+
payload: [
|
|
528
|
+
...STRIPE_EVENT_FIELDS,
|
|
529
|
+
{ path: "data.object.mode", type: "string", required: true },
|
|
530
|
+
{ path: "data.object.payment_status", type: "string", required: true },
|
|
531
|
+
{ path: "data.object.amount_total", type: "number", required: false },
|
|
532
|
+
{ path: "data.object.currency", type: "string", required: false },
|
|
533
|
+
{ path: "data.object.payment_intent", type: "string", required: false },
|
|
534
|
+
{ path: "data.object.customer", type: "string", required: false },
|
|
535
|
+
{ path: "data.object.customer_details.email", type: "string", required: false },
|
|
536
|
+
{ path: "data.object.client_reference_id", type: "string", required: false }
|
|
537
|
+
]
|
|
538
|
+
},
|
|
539
|
+
chargeRefunded: {
|
|
540
|
+
trigger: "charge.refunded",
|
|
541
|
+
payload: [
|
|
542
|
+
...STRIPE_EVENT_FIELDS,
|
|
543
|
+
{ path: "data.object.amount", type: "number", required: true },
|
|
544
|
+
{ path: "data.object.amount_refunded", type: "number", required: true },
|
|
545
|
+
{ path: "data.object.currency", type: "string", required: true },
|
|
546
|
+
{ path: "data.object.refunded", type: "boolean", required: true },
|
|
547
|
+
{ path: "data.object.payment_intent", type: "string", required: false }
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
slack: {
|
|
553
|
+
settings: [
|
|
554
|
+
{
|
|
555
|
+
key: "defaultChannel",
|
|
556
|
+
label: "Default channel",
|
|
557
|
+
type: "text",
|
|
558
|
+
prefix: "#",
|
|
559
|
+
maxLength: 80,
|
|
560
|
+
required: false,
|
|
561
|
+
helpText: "The channel a message goes to when its step names none: #orders."
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
actions: {
|
|
565
|
+
postMessage: {
|
|
566
|
+
action: "postMessage",
|
|
567
|
+
// Spec 3, "Slack" (REL-3855): `channel` defaults to the `defaultChannel` setting, `text`,
|
|
568
|
+
// optional blocks; posted as RelyIO's app's bot with the Connection's bot token.
|
|
569
|
+
step: {
|
|
570
|
+
input: [
|
|
571
|
+
{
|
|
572
|
+
key: "channel",
|
|
573
|
+
type: "text",
|
|
574
|
+
required: false,
|
|
575
|
+
setting: "defaultChannel",
|
|
576
|
+
description: "The channel to post to, by name (#orders-review) or id. Absent, the defaultChannel setting."
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
key: "text",
|
|
580
|
+
type: "text",
|
|
581
|
+
required: true,
|
|
582
|
+
description: "The message, in Slack\u2019s mrkdwn; also the notification text when blocks are sent."
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
key: "blocks",
|
|
586
|
+
type: "json",
|
|
587
|
+
required: false,
|
|
588
|
+
description: "Block Kit blocks to post instead of plain text."
|
|
589
|
+
}
|
|
590
|
+
],
|
|
591
|
+
output: [
|
|
592
|
+
{
|
|
593
|
+
key: "ts",
|
|
594
|
+
type: "text",
|
|
595
|
+
required: true,
|
|
596
|
+
description: "The posted message\u2019s timestamp, Slack\u2019s id for it in its channel."
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
key: "channel",
|
|
600
|
+
type: "text",
|
|
601
|
+
required: true,
|
|
602
|
+
description: "The channel the message was posted to, as Slack answered it."
|
|
603
|
+
}
|
|
604
|
+
],
|
|
605
|
+
// A Recorded post hands this on, with the channel it would have posted to in place of
|
|
606
|
+
// `sample` (the events worker's Slack sender, `sampleOf`).
|
|
607
|
+
sample: { ts: "sample", channel: "sample" },
|
|
608
|
+
// Slack keys nothing to dedupe a post on: a post that succeeded is never sent again, and
|
|
609
|
+
// one whose outcome is unknown is not either.
|
|
610
|
+
idempotencyHeader: null
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
triggers: {}
|
|
615
|
+
},
|
|
616
|
+
// Resend (spec 3, REL-3854): an email, its Files attached. The sender is the step's, else the
|
|
617
|
+
// Project's `from`; `html` or `text` is the body, at least one of them.
|
|
618
|
+
resend: {
|
|
619
|
+
settings: [
|
|
620
|
+
{
|
|
621
|
+
key: "from",
|
|
622
|
+
label: "From",
|
|
623
|
+
type: "text",
|
|
624
|
+
maxLength: 320,
|
|
625
|
+
required: false,
|
|
626
|
+
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>."
|
|
627
|
+
}
|
|
628
|
+
],
|
|
629
|
+
actions: {
|
|
630
|
+
send: {
|
|
631
|
+
action: "send",
|
|
632
|
+
step: {
|
|
633
|
+
input: [
|
|
634
|
+
{
|
|
635
|
+
key: "to",
|
|
636
|
+
type: "text",
|
|
637
|
+
required: true,
|
|
638
|
+
description: "Who the email is to: an address, or several separated by commas."
|
|
639
|
+
},
|
|
640
|
+
{ key: "subject", type: "text", required: true, description: "The subject line." },
|
|
641
|
+
{
|
|
642
|
+
key: "html",
|
|
643
|
+
type: "text",
|
|
644
|
+
required: false,
|
|
645
|
+
description: "The body as HTML. `html` or `text` is required, or both."
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
key: "text",
|
|
649
|
+
type: "text",
|
|
650
|
+
required: false,
|
|
651
|
+
description: "The body as plain text. `html` or `text` is required, or both."
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
key: "from",
|
|
655
|
+
type: "text",
|
|
656
|
+
required: false,
|
|
657
|
+
setting: "from",
|
|
658
|
+
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."
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
key: "attachments",
|
|
662
|
+
type: "files",
|
|
663
|
+
required: false,
|
|
664
|
+
maxBytes: RESEND_ATTACHMENTS_MAX_BYTES,
|
|
665
|
+
description: "Files a Record of the run\u2019s Dataset holds (`event.record.invoice`), attached under their names. The send point reads their bytes."
|
|
666
|
+
}
|
|
667
|
+
],
|
|
668
|
+
output: [
|
|
669
|
+
{
|
|
670
|
+
key: "id",
|
|
671
|
+
type: "text",
|
|
672
|
+
required: true,
|
|
673
|
+
description: "The id Resend gave the email."
|
|
674
|
+
}
|
|
675
|
+
],
|
|
676
|
+
sample: { id: "resend-sample" },
|
|
677
|
+
// Resend dedupes a send on this header for 24 hours; it carries `<runId>:<step>`
|
|
678
|
+
idempotencyHeader: RESEND_IDEMPOTENCY_HEADER
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
triggers: {}
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
exports.EXTENSION_SURFACES = EXTENSION_SURFACES;
|
|
687
|
+
exports.FRESH_PARAMETER = FRESH_PARAMETER;
|
|
688
|
+
exports.HEADER_IDEMPOTENCY_KEY = HEADER_IDEMPOTENCY_KEY;
|
|
689
|
+
exports.HEADER_IF_MATCH = HEADER_IF_MATCH;
|
|
690
|
+
exports.HEADER_RETRY_AFTER = HEADER_RETRY_AFTER;
|
|
691
|
+
exports.PREVIEW_DATASET_PREFIX = PREVIEW_DATASET_PREFIX;
|
|
692
|
+
exports.VISITOR_ADMISSION_RETRY_AFTER_SECONDS = VISITOR_ADMISSION_RETRY_AFTER_SECONDS;
|
|
693
|
+
exports.VISITOR_CLOSE_CODES = VISITOR_CLOSE_CODES;
|
|
694
|
+
exports.VISITOR_CLOSE_RETRY = VISITOR_CLOSE_RETRY;
|
|
695
|
+
exports.VISITOR_FRAMES = VISITOR_FRAMES;
|
|
696
|
+
exports.VISITOR_KEEPALIVE = VISITOR_KEEPALIVE;
|
|
697
|
+
exports.VISITOR_LIVE_PATH = VISITOR_LIVE_PATH;
|
|
698
|
+
exports.VISITOR_POLL_INTERVAL_MS = VISITOR_POLL_INTERVAL_MS;
|
|
699
|
+
exports.VISITOR_POLL_RETRY = VISITOR_POLL_RETRY;
|
|
700
|
+
exports.VISITOR_QUERY = VISITOR_QUERY;
|
|
701
|
+
exports.entityTag = entityTag;
|
|
702
|
+
exports.parseVisitorFrame = parseVisitorFrame;
|
|
703
|
+
exports.previewDatasetSlug = previewDatasetSlug;
|
|
704
|
+
exports.readVisitorPollAnswer = readVisitorPollAnswer;
|
|
705
|
+
//# sourceMappingURL=chunk-SHSK7UUY.cjs.map
|
|
706
|
+
//# sourceMappingURL=chunk-SHSK7UUY.cjs.map
|