@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
@@ -1,30 +1,31 @@
1
1
  'use strict';
2
2
 
3
- var chunkLSRPMNPT_cjs = require('./chunk-LSRPMNPT.cjs');
4
- var chunk6PTRZP5U_cjs = require('./chunk-6PTRZP5U.cjs');
5
- var chunkTZL374LS_cjs = require('./chunk-TZL374LS.cjs');
6
- var chunkMWMSFIWN_cjs = require('./chunk-MWMSFIWN.cjs');
3
+ var chunkM7MWNV3Q_cjs = require('./chunk-M7MWNV3Q.cjs');
4
+ var chunkZO6QDYJG_cjs = require('./chunk-ZO6QDYJG.cjs');
5
+ var chunk7I3SC7SV_cjs = require('./chunk-7I3SC7SV.cjs');
6
+ var chunkNN45CSPZ_cjs = require('./chunk-NN45CSPZ.cjs');
7
+ var chunkL6DXCKVQ_cjs = require('./chunk-L6DXCKVQ.cjs');
7
8
 
8
9
  /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
9
10
 
10
11
  // src/config/key-kind.ts
11
12
  var PUBLISHABLE_KEY_PREFIX = "rly_pub_";
12
- var isPublishableKey = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((apiKey) => apiKey?.startsWith(PUBLISHABLE_KEY_PREFIX) === true, "isPublishableKey");
13
+ var isPublishableKey = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((apiKey) => apiKey?.startsWith(PUBLISHABLE_KEY_PREFIX) === true, "isPublishableKey");
13
14
  var PREVIEW_KEY_PREFIX = "rly_prev_";
14
- var isPreviewKey = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((apiKey) => apiKey?.startsWith(PREVIEW_KEY_PREFIX) === true, "isPreviewKey");
15
+ var isPreviewKey = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((apiKey) => apiKey?.startsWith(PREVIEW_KEY_PREFIX) === true, "isPreviewKey");
15
16
 
16
17
  // src/errors/sdk-error.ts
17
18
  var _SDKError = class _SDKError extends Error {
18
19
  constructor(message, statusCode, cause, context) {
19
20
  super(message);
20
21
  /** HTTP status code if applicable */
21
- chunkMWMSFIWN_cjs.__publicField(this, "statusCode");
22
+ chunkL6DXCKVQ_cjs.__publicField(this, "statusCode");
22
23
  /** Original error that caused this error */
23
- chunkMWMSFIWN_cjs.__publicField(this, "cause");
24
+ chunkL6DXCKVQ_cjs.__publicField(this, "cause");
24
25
  /** Additional context about the error */
25
- chunkMWMSFIWN_cjs.__publicField(this, "context");
26
+ chunkL6DXCKVQ_cjs.__publicField(this, "context");
26
27
  /** Timestamp when the error occurred */
27
- chunkMWMSFIWN_cjs.__publicField(this, "timestamp");
28
+ chunkL6DXCKVQ_cjs.__publicField(this, "timestamp");
28
29
  this.name = this.constructor.name;
29
30
  this.statusCode = statusCode;
30
31
  this.cause = cause;
@@ -90,15 +91,15 @@ var _SDKError = class _SDKError extends Error {
90
91
  });
91
92
  }
92
93
  };
93
- chunkMWMSFIWN_cjs.__name(_SDKError, "SDKError");
94
+ chunkL6DXCKVQ_cjs.__name(_SDKError, "SDKError");
94
95
  var SDKError = _SDKError;
95
96
 
96
97
  // src/errors/content-errors.ts
97
98
  var _ResourceNotFoundError = class _ResourceNotFoundError extends SDKError {
98
99
  constructor(message = "Resource not found", statusCode = 404, cause, context) {
99
100
  super(message, statusCode, cause, context);
100
- chunkMWMSFIWN_cjs.__publicField(this, "code", "RESOURCE_NOT_FOUND");
101
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
101
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "RESOURCE_NOT_FOUND");
102
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
102
103
  }
103
104
  getUserMessage() {
104
105
  const resourceType = this.context?.resourceType;
@@ -109,90 +110,154 @@ var _ResourceNotFoundError = class _ResourceNotFoundError extends SDKError {
109
110
  return "The requested resource was not found.";
110
111
  }
111
112
  };
112
- chunkMWMSFIWN_cjs.__name(_ResourceNotFoundError, "ResourceNotFoundError");
113
+ chunkL6DXCKVQ_cjs.__name(_ResourceNotFoundError, "ResourceNotFoundError");
113
114
  var ResourceNotFoundError = _ResourceNotFoundError;
114
115
  var _ResourceConflictError = class _ResourceConflictError extends SDKError {
115
116
  constructor(message = "Resource conflict", statusCode = 409, cause, context) {
116
117
  super(message, statusCode, cause, context);
117
- chunkMWMSFIWN_cjs.__publicField(this, "code", "RESOURCE_CONFLICT");
118
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
118
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "RESOURCE_CONFLICT");
119
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
119
120
  }
120
121
  getUserMessage() {
121
122
  return "The resource could not be created or updated due to a conflict.";
122
123
  }
123
124
  };
124
- chunkMWMSFIWN_cjs.__name(_ResourceConflictError, "ResourceConflictError");
125
+ chunkL6DXCKVQ_cjs.__name(_ResourceConflictError, "ResourceConflictError");
125
126
  var ResourceConflictError = _ResourceConflictError;
126
127
  var _ResourceExpiredError = class _ResourceExpiredError extends SDKError {
127
128
  constructor(message = "Resource has expired", statusCode = 410, cause, context) {
128
129
  super(message, statusCode, cause, context);
129
- chunkMWMSFIWN_cjs.__publicField(this, "code", "RESOURCE_EXPIRED");
130
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
130
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "RESOURCE_EXPIRED");
131
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
131
132
  }
132
133
  getUserMessage() {
133
134
  return "The resource is no longer available.";
134
135
  }
135
136
  };
136
- chunkMWMSFIWN_cjs.__name(_ResourceExpiredError, "ResourceExpiredError");
137
+ chunkL6DXCKVQ_cjs.__name(_ResourceExpiredError, "ResourceExpiredError");
137
138
  var ResourceExpiredError = _ResourceExpiredError;
138
139
  function isResourceNotFound(error) {
139
140
  return error instanceof ResourceNotFoundError;
140
141
  }
141
- chunkMWMSFIWN_cjs.__name(isResourceNotFound, "isResourceNotFound");
142
+ chunkL6DXCKVQ_cjs.__name(isResourceNotFound, "isResourceNotFound");
142
143
  function isMissingEntry(error) {
143
144
  return error instanceof ResourceNotFoundError && error.context?.resourceType === "entry";
144
145
  }
145
- chunkMWMSFIWN_cjs.__name(isMissingEntry, "isMissingEntry");
146
+ chunkL6DXCKVQ_cjs.__name(isMissingEntry, "isMissingEntry");
146
147
 
147
148
  // src/errors/contract-errors.ts
148
149
  var _MissingApiKeyError = class _MissingApiKeyError extends SDKError {
149
150
  constructor(message = "No API key was sent", context) {
150
151
  super(message, 401, void 0, context);
151
- chunkMWMSFIWN_cjs.__publicField(this, "code", "MISSING_API_KEY");
152
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
152
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "MISSING_API_KEY");
153
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
153
154
  }
154
155
  getUserMessage() {
155
156
  return "No API key was sent. Set `apiKey` when creating the client.";
156
157
  }
157
158
  };
158
- chunkMWMSFIWN_cjs.__name(_MissingApiKeyError, "MissingApiKeyError");
159
+ chunkL6DXCKVQ_cjs.__name(_MissingApiKeyError, "MissingApiKeyError");
159
160
  var MissingApiKeyError = _MissingApiKeyError;
160
161
  var _ReadOnlyKeyError = class _ReadOnlyKeyError extends SDKError {
161
162
  constructor(message = "This API key is read-only", context) {
162
163
  super(message, 403, void 0, context);
163
- chunkMWMSFIWN_cjs.__publicField(this, "code", "READ_ONLY_KEY");
164
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
164
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "READ_ONLY_KEY");
165
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
165
166
  }
166
167
  getUserMessage() {
167
168
  return "This API key is read-only. Use a key with write access for this operation.";
168
169
  }
169
170
  };
170
- chunkMWMSFIWN_cjs.__name(_ReadOnlyKeyError, "ReadOnlyKeyError");
171
+ chunkL6DXCKVQ_cjs.__name(_ReadOnlyKeyError, "ReadOnlyKeyError");
171
172
  var ReadOnlyKeyError = _ReadOnlyKeyError;
173
+ var _PublishableKeyRefusedError = class _PublishableKeyRefusedError extends SDKError {
174
+ constructor(message = "A publishable key writes a Record only for a signed-in End user", context) {
175
+ super(message, 403, void 0, context);
176
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "PUBLISHABLE_KEY_REFUSED");
177
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
178
+ }
179
+ getUserMessage() {
180
+ return "A publishable key writes a Record only with a signed-in End user's token, and runs only a Function declaring endUsers. Send the End user's token, declare endUsers on the Function, or call it from your server with a secret key.";
181
+ }
182
+ };
183
+ chunkL6DXCKVQ_cjs.__name(_PublishableKeyRefusedError, "PublishableKeyRefusedError");
184
+ var PublishableKeyRefusedError = _PublishableKeyRefusedError;
185
+ var _FunctionRunFailedError = class _FunctionRunFailedError extends SDKError {
186
+ constructor(message = "The Function ended without an answer", run = {}, context) {
187
+ super(message, 500, void 0, context);
188
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "FUNCTION_RUN_FAILED");
189
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
190
+ chunkL6DXCKVQ_cjs.__publicField(this, "runId");
191
+ chunkL6DXCKVQ_cjs.__publicField(this, "failure");
192
+ chunkL6DXCKVQ_cjs.__publicField(this, "runError");
193
+ this.runId = run.runId;
194
+ this.failure = run.failure;
195
+ this.runError = run.runError;
196
+ }
197
+ getUserMessage() {
198
+ return this.runId === void 0 ? "The Function ended without an answer." : `The Function ended without an answer; its run is ${this.runId}.`;
199
+ }
200
+ };
201
+ chunkL6DXCKVQ_cjs.__name(_FunctionRunFailedError, "FunctionRunFailedError");
202
+ var FunctionRunFailedError = _FunctionRunFailedError;
203
+ var _FunctionContainersBusyError = class _FunctionContainersBusyError extends SDKError {
204
+ constructor(message = "The project is running as many Containers as its plan includes", name, context, retryAfterMs) {
205
+ super(message, 429, void 0, context);
206
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "FUNCTION_CONTAINERS_BUSY");
207
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
208
+ /** The Function that was not started. */
209
+ chunkL6DXCKVQ_cjs.__publicField(this, "function");
210
+ /** `Retry-After`, in milliseconds, where the response carried a readable one. */
211
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryAfterMs");
212
+ this.function = name;
213
+ this.retryAfterMs = retryAfterMs;
214
+ }
215
+ getUserMessage() {
216
+ return "Every Container this project may run at once is busy. Call again shortly.";
217
+ }
218
+ };
219
+ chunkL6DXCKVQ_cjs.__name(_FunctionContainersBusyError, "FunctionContainersBusyError");
220
+ var FunctionContainersBusyError = _FunctionContainersBusyError;
221
+ var _FunctionRunTimedOutError = class _FunctionRunTimedOutError extends SDKError {
222
+ constructor(message = "The Function had not answered within the wait", run = {}, context) {
223
+ super(message, 504, void 0, context);
224
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "FUNCTION_RUN_TIMED_OUT");
225
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
226
+ chunkL6DXCKVQ_cjs.__publicField(this, "runId");
227
+ chunkL6DXCKVQ_cjs.__publicField(this, "waitedMs");
228
+ this.runId = run.runId;
229
+ this.waitedMs = run.waitedMs;
230
+ }
231
+ getUserMessage() {
232
+ return this.runId === void 0 ? "The Function had not answered within the wait; it runs on." : `The Function had not answered within the wait; run ${this.runId} runs on.`;
233
+ }
234
+ };
235
+ chunkL6DXCKVQ_cjs.__name(_FunctionRunTimedOutError, "FunctionRunTimedOutError");
236
+ var FunctionRunTimedOutError = _FunctionRunTimedOutError;
172
237
  var _PlanFeatureUnavailableError = class _PlanFeatureUnavailableError extends SDKError {
173
238
  constructor(message = "This feature is not available on the current plan", feature, context) {
174
239
  super(message, 403, void 0, context);
175
- chunkMWMSFIWN_cjs.__publicField(this, "code", "PLAN_FEATURE_UNAVAILABLE");
176
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
240
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "PLAN_FEATURE_UNAVAILABLE");
241
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
177
242
  /** The entitlement key the service named, when it named one. */
178
- chunkMWMSFIWN_cjs.__publicField(this, "feature");
243
+ chunkL6DXCKVQ_cjs.__publicField(this, "feature");
179
244
  this.feature = feature;
180
245
  }
181
246
  getUserMessage() {
182
247
  return this.feature === void 0 ? "This feature is not available on the current plan." : `The current plan does not include "${this.feature}".`;
183
248
  }
184
249
  };
185
- chunkMWMSFIWN_cjs.__name(_PlanFeatureUnavailableError, "PlanFeatureUnavailableError");
250
+ chunkL6DXCKVQ_cjs.__name(_PlanFeatureUnavailableError, "PlanFeatureUnavailableError");
186
251
  var PlanFeatureUnavailableError = _PlanFeatureUnavailableError;
187
252
  var _UsageQuotaExceededError = class _UsageQuotaExceededError extends SDKError {
188
253
  constructor(message = "Usage quota exceeded", meter, limit, context) {
189
254
  super(message, 403, void 0, context);
190
- chunkMWMSFIWN_cjs.__publicField(this, "code", "USAGE_QUOTA_EXCEEDED");
191
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
255
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "USAGE_QUOTA_EXCEEDED");
256
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
192
257
  /** The meter the service named. Always present on a refusal from the contract. */
193
- chunkMWMSFIWN_cjs.__publicField(this, "meter");
258
+ chunkL6DXCKVQ_cjs.__publicField(this, "meter");
194
259
  /** The threshold, where the deciding seam carried one — often it does not. */
195
- chunkMWMSFIWN_cjs.__publicField(this, "limit");
260
+ chunkL6DXCKVQ_cjs.__publicField(this, "limit");
196
261
  this.meter = meter;
197
262
  this.limit = limit;
198
263
  }
@@ -200,17 +265,17 @@ var _UsageQuotaExceededError = class _UsageQuotaExceededError extends SDKError {
200
265
  return this.meter === void 0 ? "A usage quota for this account has been exceeded." : `The "${this.meter}" quota for this account has been exceeded.`;
201
266
  }
202
267
  };
203
- chunkMWMSFIWN_cjs.__name(_UsageQuotaExceededError, "UsageQuotaExceededError");
268
+ chunkL6DXCKVQ_cjs.__name(_UsageQuotaExceededError, "UsageQuotaExceededError");
204
269
  var UsageQuotaExceededError = _UsageQuotaExceededError;
205
270
  var _RateLimitError = class _RateLimitError extends SDKError {
206
271
  constructor(message = "Rate limit exceeded", limit, resetAt, context, retryAfterMs) {
207
272
  super(message, 429, void 0, context);
208
- chunkMWMSFIWN_cjs.__publicField(this, "code", "RATE_LIMIT_EXCEEDED");
209
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
210
- chunkMWMSFIWN_cjs.__publicField(this, "limit");
211
- chunkMWMSFIWN_cjs.__publicField(this, "resetAt");
273
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "RATE_LIMIT_EXCEEDED");
274
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
275
+ chunkL6DXCKVQ_cjs.__publicField(this, "limit");
276
+ chunkL6DXCKVQ_cjs.__publicField(this, "resetAt");
212
277
  /** `Retry-After`, in milliseconds, where the response carried a readable one. */
213
- chunkMWMSFIWN_cjs.__publicField(this, "retryAfterMs");
278
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryAfterMs");
214
279
  this.limit = limit;
215
280
  this.resetAt = resetAt;
216
281
  this.retryAfterMs = retryAfterMs;
@@ -219,56 +284,56 @@ var _RateLimitError = class _RateLimitError extends SDKError {
219
284
  return this.resetAt === void 0 ? "Too many requests. Please retry shortly." : `Too many requests. The window resets at ${this.resetAt}.`;
220
285
  }
221
286
  };
222
- chunkMWMSFIWN_cjs.__name(_RateLimitError, "RateLimitError");
287
+ chunkL6DXCKVQ_cjs.__name(_RateLimitError, "RateLimitError");
223
288
  var RateLimitError = _RateLimitError;
224
289
  var _MethodNotAllowedError = class _MethodNotAllowedError extends SDKError {
225
290
  constructor(message = "Method not allowed", context) {
226
291
  super(message, 405, void 0, context);
227
- chunkMWMSFIWN_cjs.__publicField(this, "code", "METHOD_NOT_ALLOWED");
228
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
292
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "METHOD_NOT_ALLOWED");
293
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
229
294
  }
230
295
  getUserMessage() {
231
296
  return "That operation is not available on this resource.";
232
297
  }
233
298
  };
234
- chunkMWMSFIWN_cjs.__name(_MethodNotAllowedError, "MethodNotAllowedError");
299
+ chunkL6DXCKVQ_cjs.__name(_MethodNotAllowedError, "MethodNotAllowedError");
235
300
  var MethodNotAllowedError = _MethodNotAllowedError;
236
301
  var _PayloadTooLargeError = class _PayloadTooLargeError extends SDKError {
237
302
  constructor(message = "Payload too large", limitBytes, context) {
238
303
  super(message, 413, void 0, context);
239
- chunkMWMSFIWN_cjs.__publicField(this, "code", "PAYLOAD_TOO_LARGE");
240
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
241
- chunkMWMSFIWN_cjs.__publicField(this, "limitBytes");
304
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "PAYLOAD_TOO_LARGE");
305
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
306
+ chunkL6DXCKVQ_cjs.__publicField(this, "limitBytes");
242
307
  this.limitBytes = limitBytes;
243
308
  }
244
309
  getUserMessage() {
245
310
  return this.limitBytes === void 0 ? "The request body is larger than this endpoint accepts." : `The request body is larger than the ${this.limitBytes}-byte limit.`;
246
311
  }
247
312
  };
248
- chunkMWMSFIWN_cjs.__name(_PayloadTooLargeError, "PayloadTooLargeError");
313
+ chunkL6DXCKVQ_cjs.__name(_PayloadTooLargeError, "PayloadTooLargeError");
249
314
  var PayloadTooLargeError = _PayloadTooLargeError;
250
315
  var _TransactionRolledBackError = class _TransactionRolledBackError extends SDKError {
251
316
  constructor(message = "Transaction rolled back", failedIndex, context) {
252
317
  super(message, 409, void 0, context);
253
- chunkMWMSFIWN_cjs.__publicField(this, "code", "TRANSACTION_ROLLED_BACK");
254
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
255
- chunkMWMSFIWN_cjs.__publicField(this, "failedIndex");
318
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "TRANSACTION_ROLLED_BACK");
319
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
320
+ chunkL6DXCKVQ_cjs.__publicField(this, "failedIndex");
256
321
  this.failedIndex = failedIndex;
257
322
  }
258
323
  getUserMessage() {
259
324
  return this.failedIndex === void 0 ? "The batch was rolled back; nothing was written." : `The batch was rolled back; nothing was written. This refusal is for operation ${this.failedIndex} of the batch, which is not necessarily the one that failed.`;
260
325
  }
261
326
  };
262
- chunkMWMSFIWN_cjs.__name(_TransactionRolledBackError, "TransactionRolledBackError");
327
+ chunkL6DXCKVQ_cjs.__name(_TransactionRolledBackError, "TransactionRolledBackError");
263
328
  var TransactionRolledBackError = _TransactionRolledBackError;
264
329
  var _ServiceIndeterminateError = class _ServiceIndeterminateError extends SDKError {
265
330
  constructor(message = "The service could not decide this request", missing, context, retryAfterMs) {
266
331
  super(message, 503, void 0, context);
267
- chunkMWMSFIWN_cjs.__publicField(this, "code", "SERVICE_INDETERMINATE");
268
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
269
- chunkMWMSFIWN_cjs.__publicField(this, "missing");
332
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "SERVICE_INDETERMINATE");
333
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
334
+ chunkL6DXCKVQ_cjs.__publicField(this, "missing");
270
335
  /** `Retry-After`, in milliseconds. The contract requires the header on this code. */
271
- chunkMWMSFIWN_cjs.__publicField(this, "retryAfterMs");
336
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryAfterMs");
272
337
  this.missing = missing;
273
338
  this.retryAfterMs = retryAfterMs;
274
339
  }
@@ -276,72 +341,85 @@ var _ServiceIndeterminateError = class _ServiceIndeterminateError extends SDKErr
276
341
  return "The service is temporarily unable to answer. Please retry.";
277
342
  }
278
343
  };
279
- chunkMWMSFIWN_cjs.__name(_ServiceIndeterminateError, "ServiceIndeterminateError");
344
+ chunkL6DXCKVQ_cjs.__name(_ServiceIndeterminateError, "ServiceIndeterminateError");
280
345
  var ServiceIndeterminateError = _ServiceIndeterminateError;
281
346
  var _ServerError = class _ServerError extends SDKError {
282
347
  constructor(message = "The service failed to handle the request", statusCode = 500, context) {
283
348
  super(message, statusCode, void 0, context);
284
- chunkMWMSFIWN_cjs.__publicField(this, "code", "INTERNAL_ERROR");
285
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
349
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "INTERNAL_ERROR");
350
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
286
351
  }
287
352
  getUserMessage() {
288
353
  return "Something went wrong on the RelyIO side. Please retry.";
289
354
  }
290
355
  };
291
- chunkMWMSFIWN_cjs.__name(_ServerError, "ServerError");
356
+ chunkL6DXCKVQ_cjs.__name(_ServerError, "ServerError");
292
357
  var ServerError = _ServerError;
293
358
  var _UnknownContractError = class _UnknownContractError extends SDKError {
294
359
  constructor(code, message, statusCode, context) {
295
360
  super(message, statusCode, void 0, context);
296
- chunkMWMSFIWN_cjs.__publicField(this, "code");
297
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
361
+ chunkL6DXCKVQ_cjs.__publicField(this, "code");
362
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
298
363
  this.code = code;
299
364
  }
300
365
  getUserMessage() {
301
366
  return `The service refused this request with "${this.code}".`;
302
367
  }
303
368
  };
304
- chunkMWMSFIWN_cjs.__name(_UnknownContractError, "UnknownContractError");
369
+ chunkL6DXCKVQ_cjs.__name(_UnknownContractError, "UnknownContractError");
305
370
  var UnknownContractError = _UnknownContractError;
306
371
 
307
372
  // src/errors/auth-errors.ts
308
373
  var _AuthorizationError = class _AuthorizationError extends SDKError {
309
374
  constructor(message = "Authorization failed", statusCode = 403, cause, context) {
310
375
  super(message, statusCode, cause, context);
311
- chunkMWMSFIWN_cjs.__publicField(this, "code", "AUTHORIZATION_ERROR");
312
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
376
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "AUTHORIZATION_ERROR");
377
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
313
378
  }
314
379
  getUserMessage() {
315
380
  return "You do not have permission to access this resource.";
316
381
  }
317
382
  };
318
- chunkMWMSFIWN_cjs.__name(_AuthorizationError, "AuthorizationError");
383
+ chunkL6DXCKVQ_cjs.__name(_AuthorizationError, "AuthorizationError");
319
384
  var AuthorizationError = _AuthorizationError;
320
385
  var _InvalidApiKeyError = class _InvalidApiKeyError extends SDKError {
321
386
  constructor(message = "Invalid API key", cause, context) {
322
387
  super(message, 401, cause, context);
323
- chunkMWMSFIWN_cjs.__publicField(this, "code", "INVALID_API_KEY");
324
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
388
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "INVALID_API_KEY");
389
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
325
390
  }
326
391
  getUserMessage() {
327
392
  return "Invalid API key. Please check your API key and try again.";
328
393
  }
329
394
  };
330
- chunkMWMSFIWN_cjs.__name(_InvalidApiKeyError, "InvalidApiKeyError");
395
+ chunkL6DXCKVQ_cjs.__name(_InvalidApiKeyError, "InvalidApiKeyError");
331
396
  var InvalidApiKeyError = _InvalidApiKeyError;
397
+ var _EndUserTokenInvalidError = class _EndUserTokenInvalidError extends SDKError {
398
+ constructor(message, reason, context) {
399
+ super(message, 401, void 0, context);
400
+ this.reason = reason;
401
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "END_USER_TOKEN_INVALID");
402
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
403
+ }
404
+ getUserMessage() {
405
+ return "Your session is not valid. Please sign in again.";
406
+ }
407
+ };
408
+ chunkL6DXCKVQ_cjs.__name(_EndUserTokenInvalidError, "EndUserTokenInvalidError");
409
+ var EndUserTokenInvalidError = _EndUserTokenInvalidError;
332
410
 
333
411
  // src/errors/network-errors.ts
334
412
  var _NetworkError = class _NetworkError extends SDKError {
335
413
  constructor(message = "Network request failed", statusCode, cause, context) {
336
414
  super(message, statusCode, cause, context);
337
- chunkMWMSFIWN_cjs.__publicField(this, "code", "NETWORK_ERROR");
338
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
415
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "NETWORK_ERROR");
416
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
339
417
  }
340
418
  getUserMessage() {
341
419
  return "Network connection failed. Please check your internet connection and try again.";
342
420
  }
343
421
  };
344
- chunkMWMSFIWN_cjs.__name(_NetworkError, "NetworkError");
422
+ chunkL6DXCKVQ_cjs.__name(_NetworkError, "NetworkError");
345
423
  var NetworkError = _NetworkError;
346
424
  var _TimeoutError = class _TimeoutError extends SDKError {
347
425
  /**
@@ -350,27 +428,27 @@ var _TimeoutError = class _TimeoutError extends SDKError {
350
428
  */
351
429
  constructor(message = "Request timed out", timeout, statusCode, cause, context) {
352
430
  super(message, statusCode, cause, { ...context, timeout });
353
- chunkMWMSFIWN_cjs.__publicField(this, "code", "TIMEOUT_ERROR");
354
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
431
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "TIMEOUT_ERROR");
432
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
355
433
  }
356
434
  getUserMessage() {
357
435
  const timeout = this.context?.timeout;
358
436
  return `Request timed out${timeout != null ? ` after ${timeout}ms` : ""}. Please try again.`;
359
437
  }
360
438
  };
361
- chunkMWMSFIWN_cjs.__name(_TimeoutError, "TimeoutError");
439
+ chunkL6DXCKVQ_cjs.__name(_TimeoutError, "TimeoutError");
362
440
  var TimeoutError = _TimeoutError;
363
441
  var _ConnectionError = class _ConnectionError extends SDKError {
364
442
  constructor(message = "Connection failed", statusCode, cause, context) {
365
443
  super(message, statusCode, cause, context);
366
- chunkMWMSFIWN_cjs.__publicField(this, "code", "CONNECTION_ERROR");
367
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
444
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "CONNECTION_ERROR");
445
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
368
446
  }
369
447
  getUserMessage() {
370
448
  return "Failed to connect to RelyIO servers. Please check your connection and try again.";
371
449
  }
372
450
  };
373
- chunkMWMSFIWN_cjs.__name(_ConnectionError, "ConnectionError");
451
+ chunkL6DXCKVQ_cjs.__name(_ConnectionError, "ConnectionError");
374
452
  var ConnectionError = _ConnectionError;
375
453
 
376
454
  // src/errors/validation-errors.ts
@@ -382,8 +460,8 @@ var _BaseValidationError = class _BaseValidationError extends SDKError {
382
460
  */
383
461
  constructor(message = "Validation failed", violations = [], statusCode = 400, cause, context) {
384
462
  super(message, statusCode, cause, { ...context, violations });
385
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
386
- chunkMWMSFIWN_cjs.__publicField(this, "violations");
463
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
464
+ chunkL6DXCKVQ_cjs.__publicField(this, "violations");
387
465
  this.violations = violations;
388
466
  }
389
467
  getUserMessage() {
@@ -415,26 +493,26 @@ var _BaseValidationError = class _BaseValidationError extends SDKError {
415
493
  return this.violations.map((v) => `${v.field}: ${v.message}`).join("\n");
416
494
  }
417
495
  };
418
- chunkMWMSFIWN_cjs.__name(_BaseValidationError, "BaseValidationError");
496
+ chunkL6DXCKVQ_cjs.__name(_BaseValidationError, "BaseValidationError");
419
497
  var BaseValidationError = _BaseValidationError;
420
498
  var _ValidationError = class _ValidationError extends BaseValidationError {
421
499
  constructor() {
422
500
  super(...arguments);
423
- chunkMWMSFIWN_cjs.__publicField(this, "code", "VALIDATION_ERROR");
501
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "VALIDATION_ERROR");
424
502
  }
425
503
  };
426
- chunkMWMSFIWN_cjs.__name(_ValidationError, "ValidationError");
504
+ chunkL6DXCKVQ_cjs.__name(_ValidationError, "ValidationError");
427
505
  var ValidationError = _ValidationError;
428
506
  var _InvalidPayloadError = class _InvalidPayloadError extends BaseValidationError {
429
507
  constructor(message = "Invalid payload", violations = [], cause, context) {
430
508
  super(message, violations, 400, cause, context);
431
- chunkMWMSFIWN_cjs.__publicField(this, "code", "INVALID_PAYLOAD");
509
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "INVALID_PAYLOAD");
432
510
  }
433
511
  getUserMessage() {
434
512
  return "The request payload is invalid. Please check your data and try again.";
435
513
  }
436
514
  };
437
- chunkMWMSFIWN_cjs.__name(_InvalidPayloadError, "InvalidPayloadError");
515
+ chunkL6DXCKVQ_cjs.__name(_InvalidPayloadError, "InvalidPayloadError");
438
516
  var InvalidPayloadError = _InvalidPayloadError;
439
517
 
440
518
  // ../../platform/api-contract/dist/client/index.js
@@ -442,11 +520,11 @@ var _a;
442
520
  var ContractBodyError = (_a = class extends Error {
443
521
  constructor(message, body) {
444
522
  super(message);
445
- chunkMWMSFIWN_cjs.__publicField(this, "body");
523
+ chunkL6DXCKVQ_cjs.__publicField(this, "body");
446
524
  this.name = "ContractBodyError";
447
525
  this.body = body;
448
526
  }
449
- }, chunkMWMSFIWN_cjs.__name(_a, "ContractBodyError"), _a);
527
+ }, chunkL6DXCKVQ_cjs.__name(_a, "ContractBodyError"), _a);
450
528
  function describe(body) {
451
529
  try {
452
530
  return JSON.stringify(body)?.slice(0, 200) ?? String(body);
@@ -454,7 +532,7 @@ function describe(body) {
454
532
  return String(body);
455
533
  }
456
534
  }
457
- chunkMWMSFIWN_cjs.__name(describe, "describe");
535
+ chunkL6DXCKVQ_cjs.__name(describe, "describe");
458
536
  function readPayload(body) {
459
537
  if (typeof body !== "object" || body === null || !("data" in body)) {
460
538
  throw new ContractBodyError(
@@ -464,7 +542,7 @@ function readPayload(body) {
464
542
  }
465
543
  return body.data;
466
544
  }
467
- chunkMWMSFIWN_cjs.__name(readPayload, "readPayload");
545
+ chunkL6DXCKVQ_cjs.__name(readPayload, "readPayload");
468
546
  function readError(body) {
469
547
  if (typeof body !== "object" || body === null || !("error" in body)) return void 0;
470
548
  const error = body.error;
@@ -478,7 +556,7 @@ function readError(body) {
478
556
  ..."details" in error ? { details: error.details } : {}
479
557
  };
480
558
  }
481
- chunkMWMSFIWN_cjs.__name(readError, "readError");
559
+ chunkL6DXCKVQ_cjs.__name(readError, "readError");
482
560
 
483
561
  // src/http/retry-after.ts
484
562
  function headerValue(headers, name) {
@@ -489,7 +567,7 @@ function headerValue(headers, name) {
489
567
  }
490
568
  return void 0;
491
569
  }
492
- chunkMWMSFIWN_cjs.__name(headerValue, "headerValue");
570
+ chunkL6DXCKVQ_cjs.__name(headerValue, "headerValue");
493
571
  function parseRetryAfterMs(value, nowMs) {
494
572
  if (value === void 0) return void 0;
495
573
  const trimmed = value.trim();
@@ -502,7 +580,7 @@ function parseRetryAfterMs(value, nowMs) {
502
580
  if (Number.isNaN(at)) return void 0;
503
581
  return Math.max(0, at - nowMs);
504
582
  }
505
- chunkMWMSFIWN_cjs.__name(parseRetryAfterMs, "parseRetryAfterMs");
583
+ chunkL6DXCKVQ_cjs.__name(parseRetryAfterMs, "parseRetryAfterMs");
506
584
 
507
585
  // src/errors/error-mapper.ts
508
586
  var STALE_VERSION_GUIDANCE = "The entry changed since it was read: re-read it with `fresh: true` and retry the write with what that read returns.";
@@ -516,7 +594,7 @@ var _ErrorMapper = class _ErrorMapper {
516
594
  return new NetworkError(`HTTP ${status}: ${statusText}`.trim(), status, void 0, context);
517
595
  }
518
596
  const retryAfterMs = parseRetryAfterMs(
519
- headerValue(headers, chunk6PTRZP5U_cjs.HEADER_RETRY_AFTER.name),
597
+ headerValue(headers, chunkNN45CSPZ_cjs.HEADER_RETRY_AFTER.name),
520
598
  Date.now()
521
599
  );
522
600
  return this.fromContractCode(refusal, status, context, retryAfterMs);
@@ -530,12 +608,18 @@ var _ErrorMapper = class _ErrorMapper {
530
608
  case "INVALID_API_KEY": {
531
609
  return new InvalidApiKeyError(message, void 0, context);
532
610
  }
611
+ case "END_USER_TOKEN_INVALID": {
612
+ return new EndUserTokenInvalidError(message, endUserTokenReasonOf(refusal), context);
613
+ }
533
614
  case "ACCESS_DENIED": {
534
615
  return new AuthorizationError(message, 403, void 0, context);
535
616
  }
536
617
  case "READ_ONLY_KEY": {
537
618
  return new ReadOnlyKeyError(message, context);
538
619
  }
620
+ case "PUBLISHABLE_KEY_REFUSED": {
621
+ return new PublishableKeyRefusedError(message, context);
622
+ }
539
623
  case "PLAN_FEATURE_UNAVAILABLE": {
540
624
  return new PlanFeatureUnavailableError(message, detailString(refusal, "feature"), context);
541
625
  }
@@ -579,7 +663,8 @@ var _ErrorMapper = class _ErrorMapper {
579
663
  return new ResourceConflictError(guidance, 409, void 0, {
580
664
  ...context,
581
665
  // What stands in the way, as a declared kind a program switches on: `draft-exists`,
582
- // `release-locked` or `slug-taken` from the Content API (REL-2446).
666
+ // `release-locked`, `slug-taken` or `value-taken` from the Content API (REL-2446,
667
+ // REL-3767).
583
668
  blockage,
584
669
  expectedVersion,
585
670
  actualVersion: detailNumber(refusal, "actualVersion"),
@@ -616,6 +701,32 @@ var _ErrorMapper = class _ErrorMapper {
616
701
  retryAfterMs
617
702
  );
618
703
  }
704
+ case "FUNCTION_RUN_FAILED": {
705
+ return new FunctionRunFailedError(
706
+ message,
707
+ {
708
+ runId: detailString(refusal, "runId"),
709
+ failure: detailString(refusal, "failure"),
710
+ runError: runErrorOf(refusal)
711
+ },
712
+ context
713
+ );
714
+ }
715
+ case "FUNCTION_RUN_TIMED_OUT": {
716
+ return new FunctionRunTimedOutError(
717
+ message,
718
+ { runId: detailString(refusal, "runId"), waitedMs: detailNumber(refusal, "waitedMs") },
719
+ context
720
+ );
721
+ }
722
+ case "FUNCTION_CONTAINERS_BUSY": {
723
+ return new FunctionContainersBusyError(
724
+ message,
725
+ detailString(refusal, "function"),
726
+ context,
727
+ retryAfterMs
728
+ );
729
+ }
619
730
  case "INTERNAL_ERROR": {
620
731
  return new ServerError(message, status, context);
621
732
  }
@@ -657,29 +768,36 @@ var _ErrorMapper = class _ErrorMapper {
657
768
  return error.name === "TypeError" && error.message.includes("fetch") || error.message.includes("timeout") || error.message.includes("Network Error") || error.message.includes("ECONNREFUSED");
658
769
  }
659
770
  };
660
- chunkMWMSFIWN_cjs.__name(_ErrorMapper, "ErrorMapper");
771
+ chunkL6DXCKVQ_cjs.__name(_ErrorMapper, "ErrorMapper");
661
772
  var ErrorMapper = _ErrorMapper;
662
773
  function knownCode(refusal) {
663
774
  return typeof refusal.code === "string" ? refusal.code : void 0;
664
775
  }
665
- chunkMWMSFIWN_cjs.__name(knownCode, "knownCode");
776
+ chunkL6DXCKVQ_cjs.__name(knownCode, "knownCode");
666
777
  function detailBag(refusal) {
667
778
  if (knownCode(refusal) === void 0) return void 0;
668
779
  const details = refusal.details;
669
780
  if (typeof details !== "object" || details === null) return void 0;
670
781
  return details;
671
782
  }
672
- chunkMWMSFIWN_cjs.__name(detailBag, "detailBag");
783
+ chunkL6DXCKVQ_cjs.__name(detailBag, "detailBag");
673
784
  function detailString(refusal, key) {
674
785
  const value = detailBag(refusal)?.[key];
675
786
  return typeof value === "string" ? value : void 0;
676
787
  }
677
- chunkMWMSFIWN_cjs.__name(detailString, "detailString");
788
+ chunkL6DXCKVQ_cjs.__name(detailString, "detailString");
678
789
  function detailNumber(refusal, key) {
679
790
  const value = detailBag(refusal)?.[key];
680
791
  return typeof value === "number" ? value : void 0;
681
792
  }
682
- chunkMWMSFIWN_cjs.__name(detailNumber, "detailNumber");
793
+ chunkL6DXCKVQ_cjs.__name(detailNumber, "detailNumber");
794
+ function runErrorOf(refusal) {
795
+ const error = detailBag(refusal)?.error;
796
+ if (typeof error !== "object" || error === null) return void 0;
797
+ const { name, message } = error;
798
+ return typeof name === "string" && typeof message === "string" ? { name, message } : void 0;
799
+ }
800
+ chunkL6DXCKVQ_cjs.__name(runErrorOf, "runErrorOf");
683
801
  function blockageOf(refusal) {
684
802
  const blockage = detailBag(refusal)?.blockage;
685
803
  if (typeof blockage !== "object" || blockage === null) return void 0;
@@ -688,7 +806,7 @@ function blockageOf(refusal) {
688
806
  const named = typeof facts === "object" && facts !== null && !Array.isArray(facts) ? facts : {};
689
807
  return { kind, facts: named };
690
808
  }
691
- chunkMWMSFIWN_cjs.__name(blockageOf, "blockageOf");
809
+ chunkL6DXCKVQ_cjs.__name(blockageOf, "blockageOf");
692
810
  function violationsOf(refusal) {
693
811
  const issues = detailBag(refusal)?.issues;
694
812
  if (!Array.isArray(issues)) return [];
@@ -699,7 +817,16 @@ function violationsOf(refusal) {
699
817
  path: issue.path === "" ? void 0 : issue.path.split(".")
700
818
  }));
701
819
  }
702
- chunkMWMSFIWN_cjs.__name(violationsOf, "violationsOf");
820
+ chunkL6DXCKVQ_cjs.__name(violationsOf, "violationsOf");
821
+ function endUserTokenReasonOf(refusal) {
822
+ const reason = detailString(refusal, "reason");
823
+ return isEndUserTokenReason(reason) ? reason : void 0;
824
+ }
825
+ chunkL6DXCKVQ_cjs.__name(endUserTokenReasonOf, "endUserTokenReasonOf");
826
+ function isEndUserTokenReason(value) {
827
+ return value !== void 0 && chunkNN45CSPZ_cjs.END_USER_TOKEN_REFUSAL_REASONS.includes(value);
828
+ }
829
+ chunkL6DXCKVQ_cjs.__name(isEndUserTokenReason, "isEndUserTokenReason");
703
830
 
704
831
  // src/http/api-routes.ts
705
832
  function fillPath(template, params) {
@@ -721,12 +848,23 @@ function fillPath(template, params) {
721
848
  }
722
849
  return filled;
723
850
  }
724
- chunkMWMSFIWN_cjs.__name(fillPath, "fillPath");
851
+ chunkL6DXCKVQ_cjs.__name(fillPath, "fillPath");
725
852
  var DECLARED_PATHS = {
726
853
  "/health": true,
727
854
  "/health/cache": true,
728
855
  "/health/live": true,
729
856
  "/health/ready": true,
857
+ "/internal/functions/runs/{runId}/actions": true,
858
+ "/internal/functions/runs/{runId}/bundle": true,
859
+ "/internal/functions/runs/{runId}/content": true,
860
+ "/internal/functions/runs/{runId}/outcome": true,
861
+ "/internal/functions/runs/{runId}/recorded": true,
862
+ "/internal/functions/runs/{runId}/records/batch": true,
863
+ "/internal/functions/runs/{runId}/records/file": true,
864
+ "/internal/functions/runs/{runId}/records/read": true,
865
+ "/internal/functions/tasks/{taskId}/run": true,
866
+ "/internal/functions/test-runs/{projectId}/{name}": true,
867
+ "/internal/functions/tool-calls/{projectId}/{name}": true,
730
868
  "/internal/live/visitor-feed/{projectId}/{datasetId}/changes": true,
731
869
  "/internal/live/visitor-key": true,
732
870
  "/internal/media/claim": true,
@@ -763,6 +901,11 @@ var DECLARED_PATHS = {
763
901
  "/v1/project": true,
764
902
  "/v1/queries/{name}": true,
765
903
  "/v1/query": true,
904
+ "/v1/functions/{name}": true,
905
+ "/v1/records/batch": true,
906
+ "/v1/records/{recordType}": true,
907
+ "/v1/records/{recordType}/files": true,
908
+ "/v1/records/{recordType}/{uid}": true,
766
909
  "/v1/search": true,
767
910
  "/v1/search/autocomplete": true,
768
911
  "/v1/search/similar": true,
@@ -784,7 +927,7 @@ function compile(path) {
784
927
  });
785
928
  return { path, segments };
786
929
  }
787
- chunkMWMSFIWN_cjs.__name(compile, "compile");
930
+ chunkL6DXCKVQ_cjs.__name(compile, "compile");
788
931
  function byRouterPrecedence(a, b) {
789
932
  const shared = Math.min(a.segments.length, b.segments.length);
790
933
  for (let index = 0; index < shared; index += 1) {
@@ -794,7 +937,7 @@ function byRouterPrecedence(a, b) {
794
937
  }
795
938
  return 0;
796
939
  }
797
- chunkMWMSFIWN_cjs.__name(byRouterPrecedence, "byRouterPrecedence");
940
+ chunkL6DXCKVQ_cjs.__name(byRouterPrecedence, "byRouterPrecedence");
798
941
  var COMPILED_ROUTES = Object.keys(DECLARED_PATHS).map(compile).sort(byRouterPrecedence);
799
942
  function matchRoute(url, options = {}) {
800
943
  const parsed = new URL(url, "http://relative.invalid");
@@ -822,7 +965,7 @@ function matchRoute(url, options = {}) {
822
965
  }
823
966
  return null;
824
967
  }
825
- chunkMWMSFIWN_cjs.__name(matchRoute, "matchRoute");
968
+ chunkL6DXCKVQ_cjs.__name(matchRoute, "matchRoute");
826
969
  function readQuery(searchParams) {
827
970
  const query = {};
828
971
  for (const key of new Set(searchParams.keys())) {
@@ -831,7 +974,7 @@ function readQuery(searchParams) {
831
974
  }
832
975
  return query;
833
976
  }
834
- chunkMWMSFIWN_cjs.__name(readQuery, "readQuery");
977
+ chunkL6DXCKVQ_cjs.__name(readQuery, "readQuery");
835
978
 
836
979
  // src/errors/instructed-delay.ts
837
980
  function serviceInstructedDelayMs(error, nowMs) {
@@ -846,7 +989,7 @@ function serviceInstructedDelayMs(error, nowMs) {
846
989
  const wait = resetAtMs - nowMs;
847
990
  return wait > 0 ? wait : void 0;
848
991
  }
849
- chunkMWMSFIWN_cjs.__name(serviceInstructedDelayMs, "serviceInstructedDelayMs");
992
+ chunkL6DXCKVQ_cjs.__name(serviceInstructedDelayMs, "serviceInstructedDelayMs");
850
993
 
851
994
  // src/http/retry-policy.ts
852
995
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
@@ -859,9 +1002,9 @@ var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
859
1002
  ]);
860
1003
  function isReplaySafe(request) {
861
1004
  if (IDEMPOTENT_METHODS.has(request.method.toUpperCase())) return true;
862
- return headerValue(request.headers, chunk6PTRZP5U_cjs.HEADER_IDEMPOTENCY_KEY.name) !== void 0;
1005
+ return headerValue(request.headers, chunkNN45CSPZ_cjs.HEADER_IDEMPOTENCY_KEY.name) !== void 0;
863
1006
  }
864
- chunkMWMSFIWN_cjs.__name(isReplaySafe, "isReplaySafe");
1007
+ chunkL6DXCKVQ_cjs.__name(isReplaySafe, "isReplaySafe");
865
1008
  var UNREACHABLE_CODES = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOTFOUND"]);
866
1009
  function isUnreachableHost(error, depth = 0) {
867
1010
  if (depth > 4 || typeof error !== "object" || error === null) return false;
@@ -872,10 +1015,10 @@ function isUnreachableHost(error, depth = 0) {
872
1015
  }
873
1016
  return isUnreachableHost(cause, depth + 1);
874
1017
  }
875
- chunkMWMSFIWN_cjs.__name(isUnreachableHost, "isUnreachableHost");
1018
+ chunkL6DXCKVQ_cjs.__name(isUnreachableHost, "isUnreachableHost");
876
1019
  var _DefaultRetryPolicy = class _DefaultRetryPolicy {
877
1020
  constructor(config) {
878
- chunkMWMSFIWN_cjs.__publicField(this, "config");
1021
+ chunkL6DXCKVQ_cjs.__publicField(this, "config");
879
1022
  this.config = config;
880
1023
  }
881
1024
  shouldRetry(attempt, error, request) {
@@ -892,7 +1035,7 @@ var _DefaultRetryPolicy = class _DefaultRetryPolicy {
892
1035
  return this.config.jitter ? delay * (0.5 + Math.random() * 0.5) : delay;
893
1036
  }
894
1037
  };
895
- chunkMWMSFIWN_cjs.__name(_DefaultRetryPolicy, "DefaultRetryPolicy");
1038
+ chunkL6DXCKVQ_cjs.__name(_DefaultRetryPolicy, "DefaultRetryPolicy");
896
1039
  var DefaultRetryPolicy = _DefaultRetryPolicy;
897
1040
  function retryPolicyFor(maxAttempts) {
898
1041
  return new DefaultRetryPolicy({
@@ -903,7 +1046,7 @@ function retryPolicyFor(maxAttempts) {
903
1046
  jitter: true
904
1047
  });
905
1048
  }
906
- chunkMWMSFIWN_cjs.__name(retryPolicyFor, "retryPolicyFor");
1049
+ chunkL6DXCKVQ_cjs.__name(retryPolicyFor, "retryPolicyFor");
907
1050
 
908
1051
  // src/config/preview-read.ts
909
1052
  var derived = /* @__PURE__ */ new Set();
@@ -912,19 +1055,19 @@ var announced = /* @__PURE__ */ new Set();
912
1055
  function noteDerivedPreview(dataset) {
913
1056
  derived.add(dataset);
914
1057
  }
915
- chunkMWMSFIWN_cjs.__name(noteDerivedPreview, "noteDerivedPreview");
1058
+ chunkL6DXCKVQ_cjs.__name(noteDerivedPreview, "noteDerivedPreview");
916
1059
  function isDerivedPreview(dataset) {
917
1060
  return derived.has(dataset);
918
1061
  }
919
- chunkMWMSFIWN_cjs.__name(isDerivedPreview, "isDerivedPreview");
1062
+ chunkL6DXCKVQ_cjs.__name(isDerivedPreview, "isDerivedPreview");
920
1063
  function isUnknownPreview(dataset) {
921
1064
  const since = unknown.get(dataset);
922
1065
  if (since === void 0) return false;
923
- if (Date.now() - since < chunk6PTRZP5U_cjs.UNKNOWN_PREVIEW_RECHECK_MS) return true;
1066
+ if (Date.now() - since < chunk7I3SC7SV_cjs.UNKNOWN_PREVIEW_RECHECK_MS) return true;
924
1067
  unknown.delete(dataset);
925
1068
  return false;
926
1069
  }
927
- chunkMWMSFIWN_cjs.__name(isUnknownPreview, "isUnknownPreview");
1070
+ chunkL6DXCKVQ_cjs.__name(isUnknownPreview, "isUnknownPreview");
928
1071
  function rememberUnknownPreview(dataset) {
929
1072
  unknown.set(dataset, Date.now());
930
1073
  if (announced.has(dataset)) return;
@@ -933,11 +1076,11 @@ function rememberUnknownPreview(dataset) {
933
1076
  `[RelyIO] No preview dataset "${dataset}" exists for this deployment's branch \u2014 reading the key's default dataset instead, and asking again in a minute.`
934
1077
  );
935
1078
  }
936
- chunkMWMSFIWN_cjs.__name(rememberUnknownPreview, "rememberUnknownPreview");
1079
+ chunkL6DXCKVQ_cjs.__name(rememberUnknownPreview, "rememberUnknownPreview");
937
1080
  function answersUnknownDataset(error, dataset) {
938
1081
  return error instanceof ResourceNotFoundError && error.context?.resourceType === "dataset" && error.context.resourceId === dataset;
939
1082
  }
940
- chunkMWMSFIWN_cjs.__name(answersUnknownDataset, "answersUnknownDataset");
1083
+ chunkL6DXCKVQ_cjs.__name(answersUnknownDataset, "answersUnknownDataset");
941
1084
 
942
1085
  // src/http/abortable-sleep.ts
943
1086
  function sleep(ms, signal) {
@@ -946,7 +1089,7 @@ function sleep(ms, signal) {
946
1089
  resolve();
947
1090
  return;
948
1091
  }
949
- const done = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => {
1092
+ const done = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => {
950
1093
  clearTimeout(timer);
951
1094
  signal?.removeEventListener("abort", done);
952
1095
  resolve();
@@ -955,37 +1098,37 @@ function sleep(ms, signal) {
955
1098
  signal?.addEventListener("abort", done, { once: true });
956
1099
  });
957
1100
  }
958
- chunkMWMSFIWN_cjs.__name(sleep, "sleep");
1101
+ chunkL6DXCKVQ_cjs.__name(sleep, "sleep");
959
1102
  function isAborted(signal) {
960
1103
  return signal?.aborted === true;
961
1104
  }
962
- chunkMWMSFIWN_cjs.__name(isAborted, "isAborted");
1105
+ chunkL6DXCKVQ_cjs.__name(isAborted, "isAborted");
963
1106
 
964
1107
  // src/http/request-timeout.ts
965
1108
  var MAX_TIMER_DELAY_MS = 2147483647;
966
1109
  function isTimerDelay(value) {
967
1110
  return typeof value === "number" && value >= 1 && value <= MAX_TIMER_DELAY_MS;
968
1111
  }
969
- chunkMWMSFIWN_cjs.__name(isTimerDelay, "isTimerDelay");
1112
+ chunkL6DXCKVQ_cjs.__name(isTimerDelay, "isTimerDelay");
970
1113
  function assertRequestTimeout(timeout) {
971
1114
  if (isTimerDelay(timeout)) return;
972
1115
  throw new Error(
973
1116
  `timeout must be a number of milliseconds from 1 to ${MAX_TIMER_DELAY_MS} \u2014 a timer given 0, NaN, Infinity or more fires at once and ends every request \u2014 and got ${String(timeout)}`
974
1117
  );
975
1118
  }
976
- chunkMWMSFIWN_cjs.__name(assertRequestTimeout, "assertRequestTimeout");
1119
+ chunkL6DXCKVQ_cjs.__name(assertRequestTimeout, "assertRequestTimeout");
977
1120
 
978
1121
  // src/http/http-client.ts
979
1122
  var _HttpClient = class _HttpClient {
980
1123
  constructor(config) {
981
1124
  /** What every request reads off the configuration, derived by {@link configure} and nowhere else. */
982
- chunkMWMSFIWN_cjs.__publicField(this, "connection");
1125
+ chunkL6DXCKVQ_cjs.__publicField(this, "connection");
983
1126
  /**
984
1127
  * Set on a view {@link withHeaders} made: the client every request is sent through, and the
985
1128
  * headers laid beneath each request's own. A view keeps no connection of its own that matters —
986
1129
  * everything it is asked to change, it changes on that client.
987
1130
  */
988
- chunkMWMSFIWN_cjs.__publicField(this, "view");
1131
+ chunkL6DXCKVQ_cjs.__publicField(this, "view");
989
1132
  this.connection = connectionFor(config);
990
1133
  this.announce();
991
1134
  }
@@ -994,7 +1137,7 @@ var _HttpClient = class _HttpClient {
994
1137
  baseUrl: this.connection.baseUrl,
995
1138
  timeout: this.connection.timeout,
996
1139
  retryAttempts: this.connection.config.retryAttempts,
997
- environment: chunkTZL374LS_cjs.isBrowser() ? "browser" : "node"
1140
+ environment: chunkM7MWNV3Q_cjs.isBrowser() ? "browser" : "node"
998
1141
  });
999
1142
  }
1000
1143
  /**
@@ -1056,22 +1199,33 @@ var _HttpClient = class _HttpClient {
1056
1199
  * constructor accepts one so that a module-scope client can be evaluated by a
1057
1200
  * build that holds no key (REL-1120) — and so does one whose `setApiKey` was
1058
1201
  * given none.
1202
+ *
1203
+ * The End user's token is asked for once, after the key is known to be there and before the first
1204
+ * attempt — of `getToken`, the nearest view's function, or the configuration's — so every retry
1205
+ * of one call sends the token its first attempt sent. See `RelyIOConfig.getToken`.
1059
1206
  */
1060
- async request(config) {
1207
+ async request(config, getToken) {
1061
1208
  if (this.view !== void 0) {
1062
- return this.view.client.request({
1063
- ...config,
1064
- headers: layerHeaders(this.view.headers, config.headers)
1065
- });
1209
+ return this.view.client.request(
1210
+ { ...config, headers: layerHeaders(this.view.headers, config.headers) },
1211
+ getToken ?? this.view.getToken
1212
+ );
1066
1213
  }
1067
1214
  if (config.timeout !== void 0) assertRequestTimeout(config.timeout);
1068
1215
  const mergedConfig = this.mergeRequestConfig(config);
1069
- if (presentKey(headerValue(mergedConfig.headers, API_KEY_HEADER)) === void 0) {
1216
+ if (presentCredential(headerValue(mergedConfig.headers, API_KEY_HEADER)) === void 0) {
1070
1217
  throw new MissingApiKeyError(
1071
1218
  "`apiKey` is missing: this client holds no API key, so the request was not sent. Pass `apiKey` to createClient \u2014 the documented setup reads it from RELYIO_API_KEY.",
1072
1219
  { url: mergedConfig.url, method: mergedConfig.method, sent: false }
1073
1220
  );
1074
1221
  }
1222
+ const tokenSource = getToken ?? this.connection.config.getToken;
1223
+ if (tokenSource !== void 0) {
1224
+ const token = presentCredential(await tokenSource());
1225
+ mergedConfig.headers = layerHeaders(mergedConfig.headers ?? {}, {
1226
+ [END_USER_HEADER]: token ?? null
1227
+ });
1228
+ }
1075
1229
  this.log("debug", "Making request", {
1076
1230
  method: mergedConfig.method,
1077
1231
  url: mergedConfig.url
@@ -1115,7 +1269,7 @@ var _HttpClient = class _HttpClient {
1115
1269
  });
1116
1270
  if (preview !== void 0 && answersUnknownDataset(sdkError, preview)) {
1117
1271
  rememberUnknownPreview(preview);
1118
- return this.request(config);
1272
+ return this.request(config, getToken);
1119
1273
  }
1120
1274
  this.log("error", "Request failed after all retries", {
1121
1275
  error: sdkError.toJSON(),
@@ -1146,7 +1300,7 @@ var _HttpClient = class _HttpClient {
1146
1300
  timedOut = true;
1147
1301
  controller.abort();
1148
1302
  }, config.timeout ?? this.connection.timeout);
1149
- const onCallerAbort = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => controller.abort(), "onCallerAbort");
1303
+ const onCallerAbort = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => controller.abort(), "onCallerAbort");
1150
1304
  caller?.addEventListener("abort", onCallerAbort, { once: true });
1151
1305
  try {
1152
1306
  const filteredHeaders = this.filterHeadersForBrowser(config.headers ?? {});
@@ -1159,7 +1313,7 @@ var _HttpClient = class _HttpClient {
1159
1313
  // runtime has no cookie jar for the mode to govern, so the field is left off and the
1160
1314
  // runtime's default stands; that includes Deno 1.x, whose global is a `window` with no
1161
1315
  // `document`. A Web Worker gets that default too: it has cookies but no `window`.
1162
- ...chunkTZL374LS_cjs.isBrowser() && {
1316
+ ...chunkM7MWNV3Q_cjs.isBrowser() && {
1163
1317
  credentials: credentialsModeFor(this.connection.config.browser.includeCredentials)
1164
1318
  }
1165
1319
  };
@@ -1212,7 +1366,7 @@ var _HttpClient = class _HttpClient {
1212
1366
  }
1213
1367
  );
1214
1368
  const { onCorsError } = this.connection.config.browser;
1215
- if (chunkTZL374LS_cjs.isBrowser() && onCorsError) {
1369
+ if (chunkM7MWNV3Q_cjs.isBrowser() && onCorsError) {
1216
1370
  try {
1217
1371
  onCorsError(corsError, {
1218
1372
  url: config.url,
@@ -1239,7 +1393,7 @@ var _HttpClient = class _HttpClient {
1239
1393
  * spellings, so `Origin` and `User-Agent` — how people write them — reached `fetch` (REL-1409).
1240
1394
  */
1241
1395
  filterHeadersForBrowser(headers) {
1242
- if (!chunkTZL374LS_cjs.isBrowser()) return headers;
1396
+ if (!chunkM7MWNV3Q_cjs.isBrowser()) return headers;
1243
1397
  return Object.fromEntries(
1244
1398
  Object.entries(headers).filter(
1245
1399
  ([name]) => !BROWSER_CONTROLLED_HEADERS.has(name.toLowerCase())
@@ -1327,7 +1481,7 @@ var _HttpClient = class _HttpClient {
1327
1481
  }
1328
1482
  }
1329
1483
  };
1330
- chunkMWMSFIWN_cjs.__name(_HttpClient, "HttpClient");
1484
+ chunkL6DXCKVQ_cjs.__name(_HttpClient, "HttpClient");
1331
1485
  var HttpClient = _HttpClient;
1332
1486
  var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1333
1487
  /**
@@ -1336,10 +1490,17 @@ var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1336
1490
  * retries and `fetch` are this client's as they are when each request is sent, so a later
1337
1491
  * `configure()` or `setApiKey()` on this client reaches the view, and one on the view reaches
1338
1492
  * this client. `client.with({ dataset })` is one (REL-2417).
1493
+ *
1494
+ * `options.getToken` is the End user's token function the view asks in place of this client's,
1495
+ * and of any view it is made from: `client.with({ getToken })` (REL-3882).
1339
1496
  */
1340
- withHeaders(headers) {
1497
+ withHeaders(headers, options = {}) {
1341
1498
  const view = new _ControlledHttpClient(this.connection.config);
1342
- view.view = { client: this, headers: { ...headers } };
1499
+ view.view = {
1500
+ client: this,
1501
+ headers: { ...headers },
1502
+ ...options.getToken === void 0 ? {} : { getToken: options.getToken }
1503
+ };
1343
1504
  return view;
1344
1505
  }
1345
1506
  /**
@@ -1361,7 +1522,7 @@ var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1361
1522
  * Replace the key every later request sends as `X-API-Key`, and the `apiKey` the configuration
1362
1523
  * reports.
1363
1524
  *
1364
- * The key is read the way construction reads it (`presentKey`): an absent, empty or blank key is
1525
+ * The key is read the way construction reads it (`presentCredential`): an absent, empty or blank key is
1365
1526
  * no key, so the header is dropped and the next request is refused with `MissingApiKeyError`
1366
1527
  * before anything is sent. A key header of any other spelling — one given in `headers` — goes
1367
1528
  * too, from the headers sent and from the headers the configuration reports, so the old key is
@@ -1382,20 +1543,21 @@ var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1382
1543
  this.connection = {
1383
1544
  ...this.connection,
1384
1545
  defaultHeaders: layerHeaders(this.connection.defaultHeaders, {
1385
- [API_KEY_HEADER]: presentKey(apiKey) ?? null
1546
+ [API_KEY_HEADER]: presentCredential(apiKey) ?? null
1386
1547
  })
1387
1548
  };
1388
1549
  }
1389
1550
  };
1390
- chunkMWMSFIWN_cjs.__name(_ControlledHttpClient, "ControlledHttpClient");
1551
+ chunkL6DXCKVQ_cjs.__name(_ControlledHttpClient, "ControlledHttpClient");
1391
1552
  var ControlledHttpClient = _ControlledHttpClient;
1392
1553
  var API_KEY_HEADER = "X-API-Key";
1393
1554
  var DATASET_HEADER = "X-RelyIO-Dataset";
1555
+ var END_USER_HEADER = chunkNN45CSPZ_cjs.HEADER_END_USER.name;
1394
1556
  function derivedPreviewIn(headers) {
1395
1557
  const dataset = headerValue(headers, DATASET_HEADER);
1396
1558
  return dataset !== void 0 && isDerivedPreview(dataset) ? dataset : void 0;
1397
1559
  }
1398
- chunkMWMSFIWN_cjs.__name(derivedPreviewIn, "derivedPreviewIn");
1560
+ chunkL6DXCKVQ_cjs.__name(derivedPreviewIn, "derivedPreviewIn");
1399
1561
  var BROWSER_CONTROLLED_HEADERS = /* @__PURE__ */ new Set([
1400
1562
  "user-agent",
1401
1563
  "referer",
@@ -1409,11 +1571,11 @@ function connectionFor(config) {
1409
1571
  const defaultHeaders = layerHeaders(
1410
1572
  layerHeaders({ "Content-Type": "application/json" }, config.headers),
1411
1573
  {
1412
- [API_KEY_HEADER]: presentKey(config.apiKey),
1574
+ [API_KEY_HEADER]: presentCredential(config.apiKey),
1413
1575
  [DATASET_HEADER]: config.dataset,
1414
1576
  // Only outside a browser, which controls this header. "A browser" is the core's one
1415
1577
  // definition, `isBrowser()` — every environment question in this file asks it.
1416
- "User-Agent": chunkTZL374LS_cjs.isBrowser() ? void 0 : `RelyIO-SDK/${globalWithVersion.__VERSION__ ?? "0.0.0"}`
1578
+ "User-Agent": chunkM7MWNV3Q_cjs.isBrowser() ? void 0 : `RelyIO-SDK/${globalWithVersion.__VERSION__ ?? "0.0.0"}`
1417
1579
  }
1418
1580
  );
1419
1581
  return {
@@ -1427,7 +1589,7 @@ function connectionFor(config) {
1427
1589
  retryPolicy: retryPolicyFor(config.retryAttempts)
1428
1590
  };
1429
1591
  }
1430
- chunkMWMSFIWN_cjs.__name(connectionFor, "connectionFor");
1592
+ chunkL6DXCKVQ_cjs.__name(connectionFor, "connectionFor");
1431
1593
  function layerHeaders(base, over) {
1432
1594
  const layered = { ...base };
1433
1595
  for (const [name, value] of Object.entries(over ?? {})) {
@@ -1440,62 +1602,62 @@ function layerHeaders(base, over) {
1440
1602
  }
1441
1603
  return layered;
1442
1604
  }
1443
- chunkMWMSFIWN_cjs.__name(layerHeaders, "layerHeaders");
1444
- function presentKey(value) {
1605
+ chunkL6DXCKVQ_cjs.__name(layerHeaders, "layerHeaders");
1606
+ function presentCredential(value) {
1445
1607
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
1446
1608
  }
1447
- chunkMWMSFIWN_cjs.__name(presentKey, "presentKey");
1609
+ chunkL6DXCKVQ_cjs.__name(presentCredential, "presentCredential");
1448
1610
  function credentialsModeFor(includeCredentials) {
1449
1611
  return includeCredentials ? "include" : "same-origin";
1450
1612
  }
1451
- chunkMWMSFIWN_cjs.__name(credentialsModeFor, "credentialsModeFor");
1613
+ chunkL6DXCKVQ_cjs.__name(credentialsModeFor, "credentialsModeFor");
1452
1614
 
1453
1615
  // src/http/write-options.ts
1454
1616
  function versionCheckOf(entry) {
1455
1617
  const { id, locale, version, sharedVersion } = entry._metadata;
1456
- return { id, locale, ifMatch: chunk6PTRZP5U_cjs.entityTag({ entryUid: id, locale, version, sharedVersion }) };
1618
+ return { id, locale, ifMatch: chunkNN45CSPZ_cjs.entityTag({ entryUid: id, locale, version, sharedVersion }) };
1457
1619
  }
1458
- chunkMWMSFIWN_cjs.__name(versionCheckOf, "versionCheckOf");
1620
+ chunkL6DXCKVQ_cjs.__name(versionCheckOf, "versionCheckOf");
1459
1621
  function mintIdempotencyKey() {
1460
1622
  const webCrypto = globalThis.crypto;
1461
1623
  if (typeof webCrypto?.randomUUID !== "function") return void 0;
1462
1624
  return webCrypto.randomUUID();
1463
1625
  }
1464
- chunkMWMSFIWN_cjs.__name(mintIdempotencyKey, "mintIdempotencyKey");
1626
+ chunkL6DXCKVQ_cjs.__name(mintIdempotencyKey, "mintIdempotencyKey");
1465
1627
  function writeHeaders(options) {
1466
1628
  const headers = {};
1467
1629
  if (options?.ifMatch !== void 0) {
1468
- headers[chunk6PTRZP5U_cjs.HEADER_IF_MATCH.name] = options.ifMatch;
1630
+ headers[chunkNN45CSPZ_cjs.HEADER_IF_MATCH.name] = options.ifMatch;
1469
1631
  }
1470
1632
  const idempotencyKey = options?.idempotencyKey ?? mintIdempotencyKey();
1471
1633
  if (idempotencyKey !== void 0) {
1472
- headers[chunk6PTRZP5U_cjs.HEADER_IDEMPOTENCY_KEY.name] = idempotencyKey;
1634
+ headers[chunkNN45CSPZ_cjs.HEADER_IDEMPOTENCY_KEY.name] = idempotencyKey;
1473
1635
  }
1474
1636
  return Object.keys(headers).length > 0 ? headers : void 0;
1475
1637
  }
1476
- chunkMWMSFIWN_cjs.__name(writeHeaders, "writeHeaders");
1638
+ chunkL6DXCKVQ_cjs.__name(writeHeaders, "writeHeaders");
1477
1639
 
1478
1640
  // src/content/client-locale.ts
1479
1641
  function callLocale(named, clientLocale) {
1480
1642
  if (named !== void 0) return named;
1481
1643
  return clientLocale === void 0 || clientLocale === "" ? void 0 : clientLocale;
1482
1644
  }
1483
- chunkMWMSFIWN_cjs.__name(callLocale, "callLocale");
1645
+ chunkL6DXCKVQ_cjs.__name(callLocale, "callLocale");
1484
1646
  function readClientLocale(locale) {
1485
1647
  return typeof locale === "function" ? locale : () => locale;
1486
1648
  }
1487
- chunkMWMSFIWN_cjs.__name(readClientLocale, "readClientLocale");
1649
+ chunkL6DXCKVQ_cjs.__name(readClientLocale, "readClientLocale");
1488
1650
 
1489
1651
  // src/content/read-terms.ts
1490
1652
  function writeChildrenQuery(params, options) {
1491
1653
  params.children = options.depth === void 0 ? "true" : `${options.depth}`;
1492
1654
  if (options.limit !== void 0) params.childrenLimit = options.limit;
1493
1655
  }
1494
- chunkMWMSFIWN_cjs.__name(writeChildrenQuery, "writeChildrenQuery");
1656
+ chunkL6DXCKVQ_cjs.__name(writeChildrenQuery, "writeChildrenQuery");
1495
1657
  function namesMetadata(key) {
1496
1658
  return key === "_metadata" || key.startsWith("_metadata.");
1497
1659
  }
1498
- chunkMWMSFIWN_cjs.__name(namesMetadata, "namesMetadata");
1660
+ chunkL6DXCKVQ_cjs.__name(namesMetadata, "namesMetadata");
1499
1661
  function refuseMetadataConditions(conditions) {
1500
1662
  const named = Object.keys(conditions).filter(namesMetadata);
1501
1663
  if (named.length === 0) return;
@@ -1508,7 +1670,7 @@ function refuseMetadataConditions(conditions) {
1508
1670
  }))
1509
1671
  );
1510
1672
  }
1511
- chunkMWMSFIWN_cjs.__name(refuseMetadataConditions, "refuseMetadataConditions");
1673
+ chunkL6DXCKVQ_cjs.__name(refuseMetadataConditions, "refuseMetadataConditions");
1512
1674
 
1513
1675
  // src/content/read-options.ts
1514
1676
  function listQuery(options, clientLocale) {
@@ -1532,7 +1694,7 @@ function listQuery(options, clientLocale) {
1532
1694
  writeReadTerms(query, options, clientLocale);
1533
1695
  return query;
1534
1696
  }
1535
- chunkMWMSFIWN_cjs.__name(listQuery, "listQuery");
1697
+ chunkL6DXCKVQ_cjs.__name(listQuery, "listQuery");
1536
1698
  function childrenQuery(options, clientLocale) {
1537
1699
  const query = {};
1538
1700
  if (options.limit !== void 0) query.limit = options.limit;
@@ -1541,34 +1703,34 @@ function childrenQuery(options, clientLocale) {
1541
1703
  writeReadTerms(query, options, clientLocale);
1542
1704
  return query;
1543
1705
  }
1544
- chunkMWMSFIWN_cjs.__name(childrenQuery, "childrenQuery");
1706
+ chunkL6DXCKVQ_cjs.__name(childrenQuery, "childrenQuery");
1545
1707
  function entryQuery(options, clientLocale) {
1546
1708
  const query = {};
1547
1709
  writeReadTerms(query, options, clientLocale);
1548
1710
  return query;
1549
1711
  }
1550
- chunkMWMSFIWN_cjs.__name(entryQuery, "entryQuery");
1712
+ chunkL6DXCKVQ_cjs.__name(entryQuery, "entryQuery");
1551
1713
  function documentQuery(options, clientLocale) {
1552
1714
  const query = {};
1553
1715
  writeDocumentTerms(query, options, clientLocale);
1554
1716
  return query;
1555
1717
  }
1556
- chunkMWMSFIWN_cjs.__name(documentQuery, "documentQuery");
1718
+ chunkL6DXCKVQ_cjs.__name(documentQuery, "documentQuery");
1557
1719
  function writeReadTerms(query, options, clientLocale) {
1558
1720
  writeDocumentTerms(query, options, clientLocale);
1559
1721
  if (options.children !== void 0) {
1560
1722
  writeChildrenQuery(query, options.children === true ? {} : options.children);
1561
1723
  }
1562
1724
  }
1563
- chunkMWMSFIWN_cjs.__name(writeReadTerms, "writeReadTerms");
1725
+ chunkL6DXCKVQ_cjs.__name(writeReadTerms, "writeReadTerms");
1564
1726
  function writeDocumentTerms(query, options, clientLocale) {
1565
1727
  if (options.include !== void 0 && options.include.length > 0) {
1566
1728
  query.include = options.include.join(",");
1567
1729
  }
1568
1730
  writeLocale(query, options.locale ?? clientLocale);
1569
- if (typeof options.fresh === "string") query[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = options.fresh;
1731
+ if (typeof options.fresh === "string") query[chunkNN45CSPZ_cjs.FRESH_PARAMETER] = options.fresh;
1570
1732
  }
1571
- chunkMWMSFIWN_cjs.__name(writeDocumentTerms, "writeDocumentTerms");
1733
+ chunkL6DXCKVQ_cjs.__name(writeDocumentTerms, "writeDocumentTerms");
1572
1734
  function writeLocale(query, locale) {
1573
1735
  if (locale === void 0) return;
1574
1736
  if (typeof locale === "string") {
@@ -1583,18 +1745,18 @@ function writeLocale(query, locale) {
1583
1745
  }
1584
1746
  query.locales = locale.join(",");
1585
1747
  }
1586
- chunkMWMSFIWN_cjs.__name(writeLocale, "writeLocale");
1748
+ chunkL6DXCKVQ_cjs.__name(writeLocale, "writeLocale");
1587
1749
  function signalOf(options) {
1588
1750
  return options.signal === void 0 ? {} : { signal: options.signal };
1589
1751
  }
1590
- chunkMWMSFIWN_cjs.__name(signalOf, "signalOf");
1752
+ chunkL6DXCKVQ_cjs.__name(signalOf, "signalOf");
1591
1753
  function readHeaders(options) {
1592
1754
  const headers = {};
1593
1755
  if (options.dataset !== void 0) headers[DATASET_HEADER] = options.dataset;
1594
1756
  if (options.fresh === true) headers["Cache-Control"] = "no-cache";
1595
1757
  return Object.keys(headers).length > 0 ? headers : void 0;
1596
1758
  }
1597
- chunkMWMSFIWN_cjs.__name(readHeaders, "readHeaders");
1759
+ chunkL6DXCKVQ_cjs.__name(readHeaders, "readHeaders");
1598
1760
 
1599
1761
  // src/content/entry-handle.ts
1600
1762
  var _EntryHandle = class _EntryHandle {
@@ -1607,7 +1769,7 @@ var _EntryHandle = class _EntryHandle {
1607
1769
  this.httpClient = httpClient;
1608
1770
  this.typeName = typeName;
1609
1771
  /** The client's locale, asked on every call rather than copied when this handle was taken. */
1610
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
1772
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
1611
1773
  this.clientLocale = readClientLocale(locale);
1612
1774
  }
1613
1775
  /**
@@ -1730,7 +1892,7 @@ var _EntryHandle = class _EntryHandle {
1730
1892
  });
1731
1893
  }
1732
1894
  };
1733
- chunkMWMSFIWN_cjs.__name(_EntryHandle, "EntryHandle");
1895
+ chunkL6DXCKVQ_cjs.__name(_EntryHandle, "EntryHandle");
1734
1896
  var EntryHandle = _EntryHandle;
1735
1897
 
1736
1898
  // src/content/content-client.ts
@@ -1853,15 +2015,15 @@ var _ContentClient = class _ContentClient extends EntryHandle {
1853
2015
  return response.body;
1854
2016
  }
1855
2017
  };
1856
- chunkMWMSFIWN_cjs.__name(_ContentClient, "ContentClient");
2018
+ chunkL6DXCKVQ_cjs.__name(_ContentClient, "ContentClient");
1857
2019
  var ContentClient = _ContentClient;
1858
2020
 
1859
2021
  // src/errors/file-errors.ts
1860
2022
  var _FileUploadError = class _FileUploadError extends SDKError {
1861
2023
  constructor(code, message, options = {}) {
1862
2024
  super(message, options.statusCode, options.cause, { ...options.context, fileErrorCode: code });
1863
- chunkMWMSFIWN_cjs.__publicField(this, "code");
1864
- chunkMWMSFIWN_cjs.__publicField(this, "retryable");
2025
+ chunkL6DXCKVQ_cjs.__publicField(this, "code");
2026
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable");
1865
2027
  this.code = code;
1866
2028
  this.retryable = options.retriable ?? false;
1867
2029
  }
@@ -1869,19 +2031,19 @@ var _FileUploadError = class _FileUploadError extends SDKError {
1869
2031
  return this.message;
1870
2032
  }
1871
2033
  };
1872
- chunkMWMSFIWN_cjs.__name(_FileUploadError, "FileUploadError");
2034
+ chunkL6DXCKVQ_cjs.__name(_FileUploadError, "FileUploadError");
1873
2035
  var FileUploadError = _FileUploadError;
1874
2036
  var _FileValidationError = class _FileValidationError extends BaseValidationError {
1875
2037
  constructor(message, violations = [], cause) {
1876
2038
  super(message, violations, 400, cause);
1877
- chunkMWMSFIWN_cjs.__publicField(this, "code", "FILE_VALIDATION_ERROR");
2039
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "FILE_VALIDATION_ERROR");
1878
2040
  }
1879
2041
  getUserMessage() {
1880
2042
  if (this.violations.length === 1) return this.violations[0]?.message ?? this.message;
1881
2043
  return this.message;
1882
2044
  }
1883
2045
  };
1884
- chunkMWMSFIWN_cjs.__name(_FileValidationError, "FileValidationError");
2046
+ chunkL6DXCKVQ_cjs.__name(_FileValidationError, "FileValidationError");
1885
2047
  var FileValidationError = _FileValidationError;
1886
2048
  function validateFile(file, constraints = {}) {
1887
2049
  const violations = [];
@@ -1904,7 +2066,7 @@ function validateFile(file, constraints = {}) {
1904
2066
  }
1905
2067
  return violations;
1906
2068
  }
1907
- chunkMWMSFIWN_cjs.__name(validateFile, "validateFile");
2069
+ chunkL6DXCKVQ_cjs.__name(validateFile, "validateFile");
1908
2070
 
1909
2071
  // src/errors/file-error-codes.ts
1910
2072
  var FILE_ERROR_CODES = [
@@ -1934,11 +2096,11 @@ function assertWaitOptions(options) {
1934
2096
  );
1935
2097
  }
1936
2098
  }
1937
- chunkMWMSFIWN_cjs.__name(assertWaitOptions, "assertWaitOptions");
2099
+ chunkL6DXCKVQ_cjs.__name(assertWaitOptions, "assertWaitOptions");
1938
2100
  function hasText(value) {
1939
2101
  return value != null && value !== "";
1940
2102
  }
1941
- chunkMWMSFIWN_cjs.__name(hasText, "hasText");
2103
+ chunkL6DXCKVQ_cjs.__name(hasText, "hasText");
1942
2104
  function processingFailure(subject, stored) {
1943
2105
  const storedCode = stored?.code;
1944
2106
  const code = FILE_ERROR_CODES.find((known) => known === storedCode) ?? "PROCESSING_FAILED";
@@ -1951,7 +2113,7 @@ function processingFailure(subject, stored) {
1951
2113
  }
1952
2114
  );
1953
2115
  }
1954
- chunkMWMSFIWN_cjs.__name(processingFailure, "processingFailure");
2116
+ chunkL6DXCKVQ_cjs.__name(processingFailure, "processingFailure");
1955
2117
  async function computeSha256Hex(blob) {
1956
2118
  try {
1957
2119
  const subtle = globalThis.crypto?.subtle;
@@ -1965,7 +2127,7 @@ async function computeSha256Hex(blob) {
1965
2127
  return void 0;
1966
2128
  }
1967
2129
  }
1968
- chunkMWMSFIWN_cjs.__name(computeSha256Hex, "computeSha256Hex");
2130
+ chunkL6DXCKVQ_cjs.__name(computeSha256Hex, "computeSha256Hex");
1969
2131
  var _AssetFileBuilder = class _AssetFileBuilder {
1970
2132
  /**
1971
2133
  * @param locale - The client's locale, sent when a call names none: the function
@@ -1976,7 +2138,7 @@ var _AssetFileBuilder = class _AssetFileBuilder {
1976
2138
  this.assetType = assetType;
1977
2139
  this.entryUid = entryUid;
1978
2140
  /** The client's locale, asked on every call rather than copied when this builder was taken. */
1979
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2141
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
1980
2142
  this.clientLocale = readClientLocale(locale);
1981
2143
  }
1982
2144
  /**
@@ -2233,7 +2395,7 @@ var _AssetFileBuilder = class _AssetFileBuilder {
2233
2395
  }
2234
2396
  }
2235
2397
  };
2236
- chunkMWMSFIWN_cjs.__name(_AssetFileBuilder, "AssetFileBuilder");
2398
+ chunkL6DXCKVQ_cjs.__name(_AssetFileBuilder, "AssetFileBuilder");
2237
2399
  var AssetFileBuilder = _AssetFileBuilder;
2238
2400
  var _AssetUploadBuilder = class _AssetUploadBuilder {
2239
2401
  /**
@@ -2244,19 +2406,19 @@ var _AssetUploadBuilder = class _AssetUploadBuilder {
2244
2406
  this.httpClient = httpClient;
2245
2407
  this.assetType = assetType;
2246
2408
  this.file = file;
2247
- chunkMWMSFIWN_cjs.__publicField(this, "_fileName");
2248
- chunkMWMSFIWN_cjs.__publicField(this, "_visibility");
2249
- chunkMWMSFIWN_cjs.__publicField(this, "_locale");
2250
- chunkMWMSFIWN_cjs.__publicField(this, "_publish");
2251
- chunkMWMSFIWN_cjs.__publicField(this, "_content", {});
2252
- chunkMWMSFIWN_cjs.__publicField(this, "_slug");
2253
- chunkMWMSFIWN_cjs.__publicField(this, "_waitForReady", false);
2254
- chunkMWMSFIWN_cjs.__publicField(this, "_waitOptions", {});
2255
- chunkMWMSFIWN_cjs.__publicField(this, "_onProgress");
2256
- chunkMWMSFIWN_cjs.__publicField(this, "_validate");
2257
- chunkMWMSFIWN_cjs.__publicField(this, "_maxPartRetries", 3);
2409
+ chunkL6DXCKVQ_cjs.__publicField(this, "_fileName");
2410
+ chunkL6DXCKVQ_cjs.__publicField(this, "_visibility");
2411
+ chunkL6DXCKVQ_cjs.__publicField(this, "_locale");
2412
+ chunkL6DXCKVQ_cjs.__publicField(this, "_publish");
2413
+ chunkL6DXCKVQ_cjs.__publicField(this, "_content", {});
2414
+ chunkL6DXCKVQ_cjs.__publicField(this, "_slug");
2415
+ chunkL6DXCKVQ_cjs.__publicField(this, "_waitForReady", false);
2416
+ chunkL6DXCKVQ_cjs.__publicField(this, "_waitOptions", {});
2417
+ chunkL6DXCKVQ_cjs.__publicField(this, "_onProgress");
2418
+ chunkL6DXCKVQ_cjs.__publicField(this, "_validate");
2419
+ chunkL6DXCKVQ_cjs.__publicField(this, "_maxPartRetries", 3);
2258
2420
  /** The client's locale, read once when the upload starts. */
2259
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2421
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
2260
2422
  this.clientLocale = readClientLocale(locale);
2261
2423
  }
2262
2424
  /** Subscribe to client → storage upload progress (single PUT + multipart). */
@@ -2492,7 +2654,7 @@ var _AssetUploadBuilder = class _AssetUploadBuilder {
2492
2654
  this._onProgress({ phase: "upload", loaded, total, progress });
2493
2655
  }
2494
2656
  };
2495
- chunkMWMSFIWN_cjs.__name(_AssetUploadBuilder, "AssetUploadBuilder");
2657
+ chunkL6DXCKVQ_cjs.__name(_AssetUploadBuilder, "AssetUploadBuilder");
2496
2658
  var AssetUploadBuilder = _AssetUploadBuilder;
2497
2659
  var _AssetClient = class _AssetClient extends EntryHandle {
2498
2660
  /**
@@ -2523,14 +2685,14 @@ var _AssetClient = class _AssetClient extends EntryHandle {
2523
2685
  return new AssetUploadBuilder(this.httpClient, this.typeName, file, this.clientLocale);
2524
2686
  }
2525
2687
  };
2526
- chunkMWMSFIWN_cjs.__name(_AssetClient, "AssetClient");
2688
+ chunkL6DXCKVQ_cjs.__name(_AssetClient, "AssetClient");
2527
2689
  var AssetClient = _AssetClient;
2528
2690
  function isAssetEntry(entry) {
2529
2691
  if (entry == null || typeof entry !== "object") return false;
2530
2692
  const metadata = entry._metadata;
2531
2693
  return metadata?.entryType === "asset";
2532
2694
  }
2533
- chunkMWMSFIWN_cjs.__name(isAssetEntry, "isAssetEntry");
2695
+ chunkL6DXCKVQ_cjs.__name(isAssetEntry, "isAssetEntry");
2534
2696
 
2535
2697
  // src/content/document-handle.ts
2536
2698
  var _DocumentHandle = class _DocumentHandle {
@@ -2543,7 +2705,7 @@ var _DocumentHandle = class _DocumentHandle {
2543
2705
  this.httpClient = httpClient;
2544
2706
  this.name = name;
2545
2707
  /** The client's locale, asked on every call rather than copied when this handle was taken. */
2546
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2708
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
2547
2709
  this.clientLocale = readClientLocale(locale);
2548
2710
  }
2549
2711
  async update(...args) {
@@ -2603,16 +2765,16 @@ var _DocumentHandle = class _DocumentHandle {
2603
2765
  return writeHeaders({ idempotencyKey: options?.idempotencyKey, ifMatch: write.ifMatch });
2604
2766
  }
2605
2767
  };
2606
- chunkMWMSFIWN_cjs.__name(_DocumentHandle, "DocumentHandle");
2768
+ chunkL6DXCKVQ_cjs.__name(_DocumentHandle, "DocumentHandle");
2607
2769
  var DocumentHandle = _DocumentHandle;
2608
2770
  function isCheckedUpdate(args) {
2609
2771
  return isRead(args[0]);
2610
2772
  }
2611
- chunkMWMSFIWN_cjs.__name(isCheckedUpdate, "isCheckedUpdate");
2773
+ chunkL6DXCKVQ_cjs.__name(isCheckedUpdate, "isCheckedUpdate");
2612
2774
  function isRead(value) {
2613
2775
  return "_metadata" in value && typeof value._metadata === "object" && value._metadata !== null;
2614
2776
  }
2615
- chunkMWMSFIWN_cjs.__name(isRead, "isRead");
2777
+ chunkL6DXCKVQ_cjs.__name(isRead, "isRead");
2616
2778
 
2617
2779
  // src/content/singleton-client.ts
2618
2780
  var _SingletonClient = class _SingletonClient extends DocumentHandle {
@@ -2670,7 +2832,7 @@ var _SingletonClient = class _SingletonClient extends DocumentHandle {
2670
2832
  });
2671
2833
  }
2672
2834
  };
2673
- chunkMWMSFIWN_cjs.__name(_SingletonClient, "SingletonClient");
2835
+ chunkL6DXCKVQ_cjs.__name(_SingletonClient, "SingletonClient");
2674
2836
  var SingletonClient = _SingletonClient;
2675
2837
 
2676
2838
  // src/content/settings-client.ts
@@ -2743,9 +2905,203 @@ var _SettingsClient = class _SettingsClient extends DocumentHandle {
2743
2905
  });
2744
2906
  }
2745
2907
  };
2746
- chunkMWMSFIWN_cjs.__name(_SettingsClient, "SettingsClient");
2908
+ chunkL6DXCKVQ_cjs.__name(_SettingsClient, "SettingsClient");
2747
2909
  var SettingsClient = _SettingsClient;
2748
2910
 
2911
+ // src/content/records-client.ts
2912
+ function isMissingRecord(error) {
2913
+ return error instanceof ResourceNotFoundError && error.context?.resourceType === "record";
2914
+ }
2915
+ chunkL6DXCKVQ_cjs.__name(isMissingRecord, "isMissingRecord");
2916
+ var _RecordsClient = class _RecordsClient {
2917
+ constructor(httpClient, recordType) {
2918
+ this.httpClient = httpClient;
2919
+ this.recordType = recordType;
2920
+ }
2921
+ /**
2922
+ * Store a Record, live the moment it lands. Values that break the Record type's fields are
2923
+ * refused with `ValidationError` naming each field, and nothing is stored. Values a unique set of
2924
+ * the type claims, held by another Record, are refused with `ResourceConflictError` — its
2925
+ * `blockage` is `{ kind: 'value-taken', facts: { fields, recordId } }` (REL-3782) — with no
2926
+ * `recordId` for an End user's write, whose read Policy may hide the holder (REL-3863).
2927
+ */
2928
+ async create(fields, options = {}) {
2929
+ return this.httpClient.fetchPayload(
2930
+ "/v1/records/{recordType}",
2931
+ "post",
2932
+ {
2933
+ path: { recordType: this.recordType },
2934
+ body: { fields },
2935
+ headers: readHeaders(options),
2936
+ ...signalOf(options)
2937
+ }
2938
+ );
2939
+ }
2940
+ /** One page of the Records `where` keeps, newest first unless `sort` names one key. */
2941
+ async list(options = {}) {
2942
+ const response = await this.httpClient.send(
2943
+ "/v1/records/{recordType}",
2944
+ "get",
2945
+ {
2946
+ path: { recordType: this.recordType },
2947
+ query: {
2948
+ ...options.where === void 0 ? {} : { filters: JSON.stringify(options.where) },
2949
+ ...options.sort === void 0 ? {} : { sort: options.sort },
2950
+ ...options.limit === void 0 ? {} : { limit: options.limit },
2951
+ ...options.cursor === void 0 ? {} : { cursor: options.cursor },
2952
+ ...options.count === true ? { count: "true" } : {},
2953
+ ...options.facets === void 0 || options.facets.length === 0 ? {} : { facets: options.facets.join(",") },
2954
+ ...includeQuery(options)
2955
+ },
2956
+ headers: readHeaders(options),
2957
+ ...signalOf(options)
2958
+ }
2959
+ );
2960
+ return response.body;
2961
+ }
2962
+ /**
2963
+ * Upload a File for one of this Record type's file fields (REL-3824), and answer what a create or
2964
+ * update sets the field to. The bytes go straight to object storage at the address the upload
2965
+ * names, never through RelyIO; a File outside the field's `accept` or over its `maxSize` is
2966
+ * refused with `ValidationError` naming the field before any byte is sent. An upload no write
2967
+ * names within a day is deleted with its bytes. Server-side only, as every Record call is.
2968
+ *
2969
+ * @example
2970
+ * ```typescript
2971
+ * const invoice = await relyio.records('order').upload('invoice', pdfBytes, {
2972
+ * name: 'invoice-1001.pdf',
2973
+ * type: 'application/pdf',
2974
+ * })
2975
+ * await relyio.records('order').update(id, { invoice }, { revision })
2976
+ * ```
2977
+ */
2978
+ async upload(field, bytes, options) {
2979
+ const size = bytes instanceof Blob ? bytes.size : bytes.byteLength;
2980
+ const upload = await this.httpClient.fetchPayload("/v1/records/{recordType}/files", "post", {
2981
+ path: { recordType: this.recordType },
2982
+ body: { field, name: options.name, type: options.type, size },
2983
+ headers: readHeaders(options),
2984
+ ...signalOf(options)
2985
+ });
2986
+ const response = await HttpClient.transfer(this.httpClient, upload.url, {
2987
+ method: upload.method,
2988
+ headers: upload.headers,
2989
+ body: bytes,
2990
+ ...signalOf(options)
2991
+ });
2992
+ if (!response.ok) {
2993
+ throw new FileUploadError(
2994
+ "INTERNAL",
2995
+ `Upload failed (${response.status} ${response.statusText}) for ${this.recordType}.${field}`,
2996
+ { retriable: response.status >= 500, statusCode: response.status }
2997
+ );
2998
+ }
2999
+ return { upload: upload.id };
3000
+ }
3001
+ /**
3002
+ * One Record by its id, or `null` when none is stored. A Record type nobody deployed throws
3003
+ * `ResourceNotFoundError` naming it, so it never reads as a missing Record.
3004
+ */
3005
+ async get(id, options = {}) {
3006
+ try {
3007
+ return await this.httpClient.fetchPayload(
3008
+ "/v1/records/{recordType}/{uid}",
3009
+ "get",
3010
+ {
3011
+ path: { recordType: this.recordType, uid: id },
3012
+ query: includeQuery(options),
3013
+ headers: readHeaders(options),
3014
+ ...signalOf(options)
3015
+ }
3016
+ );
3017
+ } catch (error) {
3018
+ if (isMissingRecord(error)) return null;
3019
+ throw error;
3020
+ }
3021
+ }
3022
+ /**
3023
+ * Change the fields named, against the revision the change was made on, and answer the Record at
3024
+ * its next revision. A field given `null` is removed; one not named keeps its value. A Record
3025
+ * written since `revision` is refused with `ResourceConflictError` — its `blockage` is
3026
+ * `{ kind: 'revision-stale', facts: { changedFields } }` — and nothing is written. Values that
3027
+ * break the Record type are refused with `ValidationError` naming each field, and values another
3028
+ * Record holds under a unique set with `ResourceConflictError`, its blockage `value-taken`.
3029
+ *
3030
+ * @example
3031
+ * ```typescript
3032
+ * const order = await relyio.records('order').get(id)
3033
+ * await relyio.records('order').update(id, { status: 'shipped' }, {
3034
+ * revision: order._metadata.revision,
3035
+ * })
3036
+ * ```
3037
+ */
3038
+ async update(id, fields, options) {
3039
+ return this.httpClient.fetchPayload(
3040
+ "/v1/records/{recordType}/{uid}",
3041
+ "patch",
3042
+ {
3043
+ path: { recordType: this.recordType, uid: id },
3044
+ body: { fields },
3045
+ headers: { ...readHeaders(options), "If-Match": `"${options.revision}"` },
3046
+ ...signalOf(options)
3047
+ }
3048
+ );
3049
+ }
3050
+ /**
3051
+ * Remove a Record. Another Record holding it through a reference declared to block its delete —
3052
+ * the default — is refused with `ResourceConflictError`, its `blockage`
3053
+ * (`{ kind: 'referenced', facts: { referrers } }`) naming each; one declared `nullify` is cleared.
3054
+ */
3055
+ async delete(id, options = {}) {
3056
+ await this.httpClient.send(
3057
+ "/v1/records/{recordType}/{uid}",
3058
+ "delete",
3059
+ {
3060
+ path: { recordType: this.recordType, uid: id },
3061
+ headers: readHeaders(options),
3062
+ ...signalOf(options)
3063
+ }
3064
+ );
3065
+ }
3066
+ };
3067
+ chunkL6DXCKVQ_cjs.__name(_RecordsClient, "RecordsClient");
3068
+ var RecordsClient = _RecordsClient;
3069
+ function includeQuery(options) {
3070
+ return {
3071
+ ...options.include === void 0 || options.include.length === 0 ? {} : { include: options.include.join(",") },
3072
+ ...options.locale === void 0 ? {} : { locale: options.locale }
3073
+ };
3074
+ }
3075
+ chunkL6DXCKVQ_cjs.__name(includeQuery, "includeQuery");
3076
+
3077
+ // src/content/record-batch.ts
3078
+ async function sendRecordBatch(httpClient, operations, options = {}) {
3079
+ const { idempotencyKey, ...call } = options;
3080
+ return httpClient.fetchPayload(
3081
+ "/v1/records/batch",
3082
+ "post",
3083
+ {
3084
+ body: { operations },
3085
+ headers: { ...readHeaders(call), ...writeHeaders({ idempotencyKey }) },
3086
+ ...signalOf(call)
3087
+ }
3088
+ );
3089
+ }
3090
+ chunkL6DXCKVQ_cjs.__name(sendRecordBatch, "sendRecordBatch");
3091
+ var OPERATION_PATH = /^operations\[(\d+)\]/;
3092
+ function refusedOperationOf(error) {
3093
+ if (typeof error !== "object" || error === null) return void 0;
3094
+ const { context, violations } = error;
3095
+ const operation = context?.blockage?.facts?.operation;
3096
+ if (typeof operation === "number") return operation;
3097
+ for (const violation of violations ?? []) {
3098
+ const match = typeof violation.field === "string" ? OPERATION_PATH.exec(violation.field) : null;
3099
+ if (match?.[1] !== void 0) return Number(match[1]);
3100
+ }
3101
+ return void 0;
3102
+ }
3103
+ chunkL6DXCKVQ_cjs.__name(refusedOperationOf, "refusedOperationOf");
3104
+
2749
3105
  // src/changes/changes.ts
2750
3106
  var CHANGES_POLL_TIMEOUT_MS = 25e3 + 5e3;
2751
3107
  var EXPIRED_REASONS2 = {
@@ -2759,14 +3115,14 @@ var _ChangesExpiredError = class _ChangesExpiredError extends ResourceExpiredErr
2759
3115
  /** The base class's signature, so `withContext` can rebuild one; then the position resynced to. */
2760
3116
  constructor(message, statusCode = 410, cause, context, fresh) {
2761
3117
  super(message, statusCode, cause, context);
2762
- chunkMWMSFIWN_cjs.__publicField(this, "reason");
3118
+ chunkL6DXCKVQ_cjs.__publicField(this, "reason");
2763
3119
  /**
2764
3120
  * The position the feed resynced to, which a refetch of everything names as `?_fresh`, as a
2765
3121
  * change's {@link FeedChange.fresh} is named: the head a `/v1/changes` resync took, or the cursor
2766
3122
  * the edge's `feed.resync` sent. `undefined` when there was no resync to take one — the error was
2767
3123
  * thrown (`onExpired: 'throw'`) — and on an error a caller built itself.
2768
3124
  */
2769
- chunkMWMSFIWN_cjs.__publicField(this, "fresh");
3125
+ chunkL6DXCKVQ_cjs.__publicField(this, "fresh");
2770
3126
  this.name = "ChangesExpiredError";
2771
3127
  this.reason = expiredReasonOf(context?.reason);
2772
3128
  this.fresh = fresh;
@@ -2803,7 +3159,7 @@ var _ChangesExpiredError = class _ChangesExpiredError extends ResourceExpiredErr
2803
3159
  );
2804
3160
  }
2805
3161
  };
2806
- chunkMWMSFIWN_cjs.__name(_ChangesExpiredError, "ChangesExpiredError");
3162
+ chunkL6DXCKVQ_cjs.__name(_ChangesExpiredError, "ChangesExpiredError");
2807
3163
  var ChangesExpiredError = _ChangesExpiredError;
2808
3164
  function expiredReasonOf(named) {
2809
3165
  for (const reason of Object.values(EXPIRED_REASONS2)) {
@@ -2811,7 +3167,7 @@ function expiredReasonOf(named) {
2811
3167
  }
2812
3168
  return "unknown";
2813
3169
  }
2814
- chunkMWMSFIWN_cjs.__name(expiredReasonOf, "expiredReasonOf");
3170
+ chunkL6DXCKVQ_cjs.__name(expiredReasonOf, "expiredReasonOf");
2815
3171
  async function* pollChanges(http, options = {}) {
2816
3172
  const { signal } = options;
2817
3173
  let since = options.since;
@@ -2857,7 +3213,7 @@ async function* pollChanges(http, options = {}) {
2857
3213
  }
2858
3214
  }
2859
3215
  }
2860
- chunkMWMSFIWN_cjs.__name(pollChanges, "pollChanges");
3216
+ chunkL6DXCKVQ_cjs.__name(pollChanges, "pollChanges");
2861
3217
  async function readChangesHead(http, options = {}) {
2862
3218
  const response = await http.send("/v1/changes", "get", {
2863
3219
  query: {},
@@ -2872,7 +3228,7 @@ async function readChangesHead(http, options = {}) {
2872
3228
  }
2873
3229
  return page.nextCursor;
2874
3230
  }
2875
- chunkMWMSFIWN_cjs.__name(readChangesHead, "readChangesHead");
3231
+ chunkL6DXCKVQ_cjs.__name(readChangesHead, "readChangesHead");
2876
3232
  async function pollOnce(http, since, options) {
2877
3233
  const query = {};
2878
3234
  if (since !== void 0) query.since = since;
@@ -2885,18 +3241,18 @@ async function pollOnce(http, since, options) {
2885
3241
  ...options.signal === void 0 ? {} : { signal: options.signal }
2886
3242
  });
2887
3243
  }
2888
- chunkMWMSFIWN_cjs.__name(pollOnce, "pollOnce");
3244
+ chunkL6DXCKVQ_cjs.__name(pollOnce, "pollOnce");
2889
3245
 
2890
3246
  // src/errors/live-errors.ts
2891
3247
  var _LiveEdgeError = class _LiveEdgeError extends SDKError {
2892
3248
  constructor(message, end, retry, options = {}) {
2893
3249
  super(message, options.statusCode, options.cause, options.context);
2894
- chunkMWMSFIWN_cjs.__publicField(this, "code", "LIVE_EDGE_ENDED");
2895
- chunkMWMSFIWN_cjs.__publicField(this, "retryable");
2896
- chunkMWMSFIWN_cjs.__publicField(this, "end");
2897
- chunkMWMSFIWN_cjs.__publicField(this, "retry");
3250
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "LIVE_EDGE_ENDED");
3251
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable");
3252
+ chunkL6DXCKVQ_cjs.__publicField(this, "end");
3253
+ chunkL6DXCKVQ_cjs.__publicField(this, "retry");
2898
3254
  /** A refused poll's `Retry-After`, in milliseconds, where it carried a readable one. */
2899
- chunkMWMSFIWN_cjs.__publicField(this, "retryAfterMs");
3255
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryAfterMs");
2900
3256
  this.end = end;
2901
3257
  this.retry = retry;
2902
3258
  this.retryable = retry !== "stop";
@@ -2906,7 +3262,7 @@ var _LiveEdgeError = class _LiveEdgeError extends SDKError {
2906
3262
  return this.message;
2907
3263
  }
2908
3264
  };
2909
- chunkMWMSFIWN_cjs.__name(_LiveEdgeError, "LiveEdgeError");
3265
+ chunkL6DXCKVQ_cjs.__name(_LiveEdgeError, "LiveEdgeError");
2910
3266
  var LiveEdgeError = _LiveEdgeError;
2911
3267
 
2912
3268
  // src/config/live-url.ts
@@ -2929,7 +3285,7 @@ function liveEdgeAddress(config) {
2929
3285
  message: `Live updates need the address of RelyIO\u2019s live edge, and this client cannot derive it: \`baseUrl\` is not RelyIO\u2019s API (${Object.keys(LIVE_EDGE_OF_API).join(", ")}). Set \`liveUrl\` in createClient() to the live edge this API belongs with. Nothing was sent.`
2930
3286
  };
2931
3287
  }
2932
- chunkMWMSFIWN_cjs.__name(liveEdgeAddress, "liveEdgeAddress");
3288
+ chunkL6DXCKVQ_cjs.__name(liveEdgeAddress, "liveEdgeAddress");
2933
3289
  function readLiveUrl(liveUrl) {
2934
3290
  let url;
2935
3291
  try {
@@ -2949,7 +3305,7 @@ function readLiveUrl(liveUrl) {
2949
3305
  url.hash = "";
2950
3306
  return { ok: true, url };
2951
3307
  }
2952
- chunkMWMSFIWN_cjs.__name(readLiveUrl, "readLiveUrl");
3308
+ chunkL6DXCKVQ_cjs.__name(readLiveUrl, "readLiveUrl");
2953
3309
  function originOf(baseUrl) {
2954
3310
  try {
2955
3311
  return new URL(baseUrl).origin;
@@ -2957,11 +3313,11 @@ function originOf(baseUrl) {
2957
3313
  return void 0;
2958
3314
  }
2959
3315
  }
2960
- chunkMWMSFIWN_cjs.__name(originOf, "originOf");
3316
+ chunkL6DXCKVQ_cjs.__name(originOf, "originOf");
2961
3317
 
2962
3318
  // src/changes/live-edge.ts
2963
3319
  var LIVE_KEEPALIVE_INTERVAL_MS = 3e4;
2964
- var LIVE_SOCKET_OPEN_TIMEOUT_MS = chunk6PTRZP5U_cjs.VISITOR_POLL_INTERVAL_MS;
3320
+ var LIVE_SOCKET_OPEN_TIMEOUT_MS = chunkNN45CSPZ_cjs.VISITOR_POLL_INTERVAL_MS;
2965
3321
  var LIVE_POLLS_BEFORE_SOCKET = 4;
2966
3322
  async function* subscribeLiveEdge(client, options = {}) {
2967
3323
  const { signal } = options;
@@ -2978,14 +3334,14 @@ async function* subscribeLiveEdge(client, options = {}) {
2978
3334
  if (polled === "aborted") return;
2979
3335
  }
2980
3336
  }
2981
- chunkMWMSFIWN_cjs.__name(subscribeLiveEdge, "subscribeLiveEdge");
3337
+ chunkL6DXCKVQ_cjs.__name(subscribeLiveEdge, "subscribeLiveEdge");
2982
3338
  var SOCKET_CONNECTING = 0;
2983
3339
  var SOCKET_OPEN = 1;
2984
3340
  function runtimeWebSocket() {
2985
3341
  const candidate = globalThis.WebSocket;
2986
3342
  return typeof candidate === "function" ? candidate : void 0;
2987
3343
  }
2988
- chunkMWMSFIWN_cjs.__name(runtimeWebSocket, "runtimeWebSocket");
3344
+ chunkL6DXCKVQ_cjs.__name(runtimeWebSocket, "runtimeWebSocket");
2989
3345
  function openSocket(client, url) {
2990
3346
  const Socket = client.webSocket ?? runtimeWebSocket();
2991
3347
  if (Socket === void 0) return void 0;
@@ -2995,7 +3351,7 @@ function openSocket(client, url) {
2995
3351
  return void 0;
2996
3352
  }
2997
3353
  }
2998
- chunkMWMSFIWN_cjs.__name(openSocket, "openSocket");
3354
+ chunkL6DXCKVQ_cjs.__name(openSocket, "openSocket");
2999
3355
  async function* followSocket(socket, reach, options) {
3000
3356
  const { signal } = options;
3001
3357
  const inbox = socketInbox(socket, signal);
@@ -3031,12 +3387,12 @@ async function* followSocket(socket, reach, options) {
3031
3387
  return "unopened";
3032
3388
  }
3033
3389
  case "message": {
3034
- if (event.data === chunk6PTRZP5U_cjs.VISITOR_KEEPALIVE.response) continue;
3035
- const frame = typeof event.data === "string" ? chunk6PTRZP5U_cjs.parseVisitorFrame(event.data) : null;
3390
+ if (event.data === chunkNN45CSPZ_cjs.VISITOR_KEEPALIVE.response) continue;
3391
+ const frame = typeof event.data === "string" ? chunkNN45CSPZ_cjs.parseVisitorFrame(event.data) : null;
3036
3392
  if (frame === null)
3037
3393
  throw unreadable(`a frame the wire does not declare: ${sample(event.data)}`);
3038
3394
  switch (frame.type) {
3039
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.opened: {
3395
+ case chunkNN45CSPZ_cjs.VISITOR_FRAMES.opened: {
3040
3396
  caughtUp = true;
3041
3397
  inbox.caughtUp();
3042
3398
  reach.position = frame.cursor;
@@ -3044,7 +3400,7 @@ async function* followSocket(socket, reach, options) {
3044
3400
  options.reached?.(frame.cursor);
3045
3401
  continue;
3046
3402
  }
3047
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.changes: {
3403
+ case chunkNN45CSPZ_cjs.VISITOR_FRAMES.changes: {
3048
3404
  const prior = reach.position;
3049
3405
  if (prior === void 0) throw unreadable("changes before the socket had a position");
3050
3406
  for (const change of changesOf(frame.changes, frame.cursor, prior)) {
@@ -3055,7 +3411,7 @@ async function* followSocket(socket, reach, options) {
3055
3411
  if (frame.changes.length === 0) options.reached?.(frame.cursor);
3056
3412
  continue;
3057
3413
  }
3058
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.resync: {
3414
+ case chunkNN45CSPZ_cjs.VISITOR_FRAMES.resync: {
3059
3415
  await expire(frame.reason, frame.cursor, options);
3060
3416
  if (isAborted(signal)) return "aborted";
3061
3417
  reach.position = frame.cursor;
@@ -3070,19 +3426,19 @@ async function* followSocket(socket, reach, options) {
3070
3426
  inbox.dispose();
3071
3427
  }
3072
3428
  }
3073
- chunkMWMSFIWN_cjs.__name(followSocket, "followSocket");
3429
+ chunkL6DXCKVQ_cjs.__name(followSocket, "followSocket");
3074
3430
  function socketInbox(socket, signal) {
3075
3431
  const events = [];
3076
3432
  let wake;
3077
3433
  let disposed = false;
3078
3434
  let heard = true;
3079
3435
  let keepalive;
3080
- const rouse = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => {
3436
+ const rouse = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => {
3081
3437
  const waking = wake;
3082
3438
  wake = void 0;
3083
3439
  waking?.();
3084
3440
  }, "rouse");
3085
- const push = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((event) => {
3441
+ const push = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((event) => {
3086
3442
  if (disposed) return;
3087
3443
  events.push(event);
3088
3444
  rouse();
@@ -3127,7 +3483,7 @@ function socketInbox(socket, signal) {
3127
3483
  return;
3128
3484
  }
3129
3485
  heard = false;
3130
- if (socket.readyState === SOCKET_OPEN) socket.send(chunk6PTRZP5U_cjs.VISITOR_KEEPALIVE.request);
3486
+ if (socket.readyState === SOCKET_OPEN) socket.send(chunkNN45CSPZ_cjs.VISITOR_KEEPALIVE.request);
3131
3487
  }, LIVE_KEEPALIVE_INTERVAL_MS);
3132
3488
  },
3133
3489
  caughtUp() {
@@ -3145,7 +3501,7 @@ function socketInbox(socket, signal) {
3145
3501
  }
3146
3502
  };
3147
3503
  }
3148
- chunkMWMSFIWN_cjs.__name(socketInbox, "socketInbox");
3504
+ chunkL6DXCKVQ_cjs.__name(socketInbox, "socketInbox");
3149
3505
  function closedBy(code, reason) {
3150
3506
  const retry = closeRetryOf(code);
3151
3507
  const meaning = hasOwn(CLOSE_MEANING, code) ? CLOSE_MEANING[code] : code < 4e3 ? "the connection dropped" : "a refusal this version of the SDK does not know";
@@ -3156,26 +3512,26 @@ function closedBy(code, reason) {
3156
3512
  retry
3157
3513
  );
3158
3514
  }
3159
- chunkMWMSFIWN_cjs.__name(closedBy, "closedBy");
3515
+ chunkL6DXCKVQ_cjs.__name(closedBy, "closedBy");
3160
3516
  var AFTER_A_CLOSE = {
3161
3517
  stop: "The same request would be refused again, so it was not retried.",
3162
3518
  retry: "Reconnecting from the last cursor after a short back-off.",
3163
3519
  "back-off": "Retrying after a back-off of at least a minute, without polling, which the same admission refuses."
3164
3520
  };
3165
3521
  function closeRetryOf(code) {
3166
- if (hasOwn(chunk6PTRZP5U_cjs.VISITOR_CLOSE_RETRY, code)) return chunk6PTRZP5U_cjs.VISITOR_CLOSE_RETRY[code];
3522
+ if (hasOwn(chunkNN45CSPZ_cjs.VISITOR_CLOSE_RETRY, code)) return chunkNN45CSPZ_cjs.VISITOR_CLOSE_RETRY[code];
3167
3523
  return code < 4e3 ? "retry" : "stop";
3168
3524
  }
3169
- chunkMWMSFIWN_cjs.__name(closeRetryOf, "closeRetryOf");
3525
+ chunkL6DXCKVQ_cjs.__name(closeRetryOf, "closeRetryOf");
3170
3526
  var CLOSE_MEANING = {
3171
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.requestInvalid]: "the edge could not read the request \u2014 a malformed cursor or filter",
3172
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.keyRefused]: "the key is not a publishable key the edge accepts \u2014 unknown, revoked or expired",
3173
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.originRefused]: "this page\u2019s origin is not on the publishable key\u2019s allowed origins",
3174
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.datasetRefused]: "`dataset` names no dataset the key reaches",
3175
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.unavailable]: "the edge could not serve this connection just now \u2014 it could not reach what it needed",
3176
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.allowanceReached]: "the project holds as many live connections as its plan allows",
3177
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.addressLimitReached]: "this address holds as many live connections to the project as one address may",
3178
- [chunk6PTRZP5U_cjs.VISITOR_CLOSE_CODES.ceilingReached]: "the project is at its safety ceiling of live connections"
3527
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.requestInvalid]: "the edge could not read the request \u2014 a malformed cursor or filter",
3528
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.keyRefused]: "the key is not a publishable key the edge accepts \u2014 unknown, revoked or expired",
3529
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.originRefused]: "this page\u2019s origin is not on the publishable key\u2019s allowed origins",
3530
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.datasetRefused]: "`dataset` names no dataset the key reaches",
3531
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.unavailable]: "the edge could not serve this connection just now \u2014 it could not reach what it needed",
3532
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.allowanceReached]: "the project holds as many live connections as its plan allows",
3533
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.addressLimitReached]: "this address holds as many live connections to the project as one address may",
3534
+ [chunkNN45CSPZ_cjs.VISITOR_CLOSE_CODES.ceilingReached]: "the project is at its safety ceiling of live connections"
3179
3535
  };
3180
3536
  async function* followPolls(client, request, reach, options) {
3181
3537
  const { signal } = options;
@@ -3203,11 +3559,11 @@ async function* followPolls(client, request, reach, options) {
3203
3559
  if (starting) options.reached?.(answer.cursor);
3204
3560
  }
3205
3561
  starting = false;
3206
- await sleep(chunk6PTRZP5U_cjs.VISITOR_POLL_INTERVAL_MS, signal);
3562
+ await sleep(chunkNN45CSPZ_cjs.VISITOR_POLL_INTERVAL_MS, signal);
3207
3563
  }
3208
3564
  return isAborted(signal) ? "aborted" : "socket";
3209
3565
  }
3210
- chunkMWMSFIWN_cjs.__name(followPolls, "followPolls");
3566
+ chunkL6DXCKVQ_cjs.__name(followPolls, "followPolls");
3211
3567
  async function pollOnce2(client, request, since, signal) {
3212
3568
  if (isAborted(signal)) return void 0;
3213
3569
  const url = edgeUrl(request, since, "poll", client.clientId);
@@ -3218,7 +3574,7 @@ async function pollOnce2(client, request, since, signal) {
3218
3574
  timedOut = true;
3219
3575
  controller.abort();
3220
3576
  }, client.timeout);
3221
- const onAbort = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => controller.abort(), "onAbort");
3577
+ const onAbort = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => controller.abort(), "onAbort");
3222
3578
  signal?.addEventListener("abort", onAbort, { once: true });
3223
3579
  try {
3224
3580
  let response;
@@ -3245,7 +3601,7 @@ async function pollOnce2(client, request, since, signal) {
3245
3601
  }
3246
3602
  const body = parseJson(text);
3247
3603
  if (!response.ok) throw refusedPoll(response, body, context);
3248
- const answer = chunk6PTRZP5U_cjs.readVisitorPollAnswer(isRecord(body) ? body["data"] : void 0);
3604
+ const answer = chunkNN45CSPZ_cjs.readVisitorPollAnswer(isRecord(body) ? body["data"] : void 0);
3249
3605
  if (answer === null)
3250
3606
  throw unreadable(`a poll answer the wire does not declare: ${sample(text)}`);
3251
3607
  return answer;
@@ -3254,7 +3610,7 @@ async function pollOnce2(client, request, since, signal) {
3254
3610
  signal?.removeEventListener("abort", onAbort);
3255
3611
  }
3256
3612
  }
3257
- chunkMWMSFIWN_cjs.__name(pollOnce2, "pollOnce");
3613
+ chunkL6DXCKVQ_cjs.__name(pollOnce2, "pollOnce");
3258
3614
  function refusedPoll(response, body, context) {
3259
3615
  const headers = {};
3260
3616
  response.headers.forEach((value, name) => {
@@ -3265,13 +3621,13 @@ function refusedPoll(response, body, context) {
3265
3621
  { ...context, method: "GET" }
3266
3622
  );
3267
3623
  const refusal = readError(body);
3268
- if (refusal === void 0 || !hasOwn(chunk6PTRZP5U_cjs.VISITOR_POLL_RETRY, refusal.code)) return mapped;
3624
+ if (refusal === void 0 || !hasOwn(chunkNN45CSPZ_cjs.VISITOR_POLL_RETRY, refusal.code)) return mapped;
3269
3625
  const code = refusal.code;
3270
3626
  const retryAfterMs = parseRetryAfterMs(headerValue(headers, "Retry-After"), Date.now());
3271
3627
  return new LiveEdgeError(
3272
3628
  `The live edge refused a poll (${code}): ${refusal.messages[0] ?? mapped.message}`,
3273
3629
  { kind: "refused", code },
3274
- chunk6PTRZP5U_cjs.VISITOR_POLL_RETRY[code],
3630
+ chunkNN45CSPZ_cjs.VISITOR_POLL_RETRY[code],
3275
3631
  {
3276
3632
  statusCode: response.status,
3277
3633
  cause: mapped,
@@ -3280,7 +3636,7 @@ function refusedPoll(response, body, context) {
3280
3636
  }
3281
3637
  );
3282
3638
  }
3283
- chunkMWMSFIWN_cjs.__name(refusedPoll, "refusedPoll");
3639
+ chunkL6DXCKVQ_cjs.__name(refusedPoll, "refusedPoll");
3284
3640
  function edgeRequest(client, filter) {
3285
3641
  const key = client.apiKey;
3286
3642
  if (key === void 0 || !isPublishableKey(key)) {
@@ -3296,24 +3652,24 @@ function edgeRequest(client, filter) {
3296
3652
  ids: filter.ids
3297
3653
  };
3298
3654
  }
3299
- chunkMWMSFIWN_cjs.__name(edgeRequest, "edgeRequest");
3655
+ chunkL6DXCKVQ_cjs.__name(edgeRequest, "edgeRequest");
3300
3656
  function edgeUrl(request, since, transport, clientId) {
3301
3657
  const url = new URL(request.base.href);
3302
- url.pathname = `${url.pathname.replace(/\/+$/, "")}${chunk6PTRZP5U_cjs.VISITOR_LIVE_PATH}`;
3658
+ url.pathname = `${url.pathname.replace(/\/+$/, "")}${chunkNN45CSPZ_cjs.VISITOR_LIVE_PATH}`;
3303
3659
  if (transport === "socket") url.protocol = url.protocol === "http:" ? "ws:" : "wss:";
3304
3660
  const query = new URLSearchParams();
3305
- if (request.key !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.key, request.key);
3661
+ if (request.key !== void 0) query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.key, request.key);
3306
3662
  if (request.dataset !== void 0 && request.dataset !== "") {
3307
- query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.dataset, request.dataset);
3663
+ query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.dataset, request.dataset);
3308
3664
  }
3309
- if (since !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.since, since);
3310
- if (request.types !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.types, request.types.join(","));
3311
- if (request.ids !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.ids, request.ids.join(","));
3312
- if (transport === "poll" && clientId !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.client, clientId);
3665
+ if (since !== void 0) query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.since, since);
3666
+ if (request.types !== void 0) query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.types, request.types.join(","));
3667
+ if (request.ids !== void 0) query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.ids, request.ids.join(","));
3668
+ if (transport === "poll" && clientId !== void 0) query.set(chunkNN45CSPZ_cjs.VISITOR_QUERY.client, clientId);
3313
3669
  url.search = query.toString();
3314
3670
  return url.href;
3315
3671
  }
3316
- chunkMWMSFIWN_cjs.__name(edgeUrl, "edgeUrl");
3672
+ chunkL6DXCKVQ_cjs.__name(edgeUrl, "edgeUrl");
3317
3673
  function changesOf(changes, cursor, prior) {
3318
3674
  const last = changes.length - 1;
3319
3675
  return changes.map((change, index) => ({
@@ -3325,14 +3681,14 @@ function changesOf(changes, cursor, prior) {
3325
3681
  fresh: cursor
3326
3682
  }));
3327
3683
  }
3328
- chunkMWMSFIWN_cjs.__name(changesOf, "changesOf");
3684
+ chunkL6DXCKVQ_cjs.__name(changesOf, "changesOf");
3329
3685
  async function expire(reason, cursor, options) {
3330
3686
  const expired = ChangesExpiredError.resync(reason, cursor);
3331
3687
  const onExpired = options.onExpired ?? "throw";
3332
3688
  if (onExpired === "throw") throw expired;
3333
3689
  if (typeof onExpired === "function") await onExpired(expired);
3334
3690
  }
3335
- chunkMWMSFIWN_cjs.__name(expire, "expire");
3691
+ chunkL6DXCKVQ_cjs.__name(expire, "expire");
3336
3692
  function unreadable(what) {
3337
3693
  return new LiveEdgeError(
3338
3694
  `The live edge sent ${what}. This version of the SDK cannot follow it, so it stopped.`,
@@ -3340,13 +3696,13 @@ function unreadable(what) {
3340
3696
  "stop"
3341
3697
  );
3342
3698
  }
3343
- chunkMWMSFIWN_cjs.__name(unreadable, "unreadable");
3699
+ chunkL6DXCKVQ_cjs.__name(unreadable, "unreadable");
3344
3700
  var NEEDS_PUBLISHABLE_KEY = `Live updates at RelyIO\u2019s edge need a publishable key (\`${PUBLISHABLE_KEY_PREFIX}\u2026\`), and this client holds none. A secret or preview key is never sent to the edge; on a server, follow \`changes()\` with it instead. Nothing was sent.`;
3345
3701
  function sample(value) {
3346
3702
  const text = typeof value === "string" ? value : `(${typeof value})`;
3347
3703
  return text.length > 200 ? `${text.slice(0, 200)}\u2026` : text;
3348
3704
  }
3349
- chunkMWMSFIWN_cjs.__name(sample, "sample");
3705
+ chunkL6DXCKVQ_cjs.__name(sample, "sample");
3350
3706
  function parseJson(text) {
3351
3707
  try {
3352
3708
  return JSON.parse(text);
@@ -3354,15 +3710,41 @@ function parseJson(text) {
3354
3710
  return void 0;
3355
3711
  }
3356
3712
  }
3357
- chunkMWMSFIWN_cjs.__name(parseJson, "parseJson");
3713
+ chunkL6DXCKVQ_cjs.__name(parseJson, "parseJson");
3358
3714
  function isRecord(value) {
3359
3715
  return typeof value === "object" && value !== null && !Array.isArray(value);
3360
3716
  }
3361
- chunkMWMSFIWN_cjs.__name(isRecord, "isRecord");
3717
+ chunkL6DXCKVQ_cjs.__name(isRecord, "isRecord");
3362
3718
  function hasOwn(object, key) {
3363
3719
  return Object.prototype.hasOwnProperty.call(object, key);
3364
3720
  }
3365
- chunkMWMSFIWN_cjs.__name(hasOwn, "hasOwn");
3721
+ chunkL6DXCKVQ_cjs.__name(hasOwn, "hasOwn");
3722
+
3723
+ // src/content/functions-client.ts
3724
+ var FUNCTION_CALL_TIMEOUT_MS = 31e4;
3725
+ async function callFunction(http, name, input, options) {
3726
+ return await http.fetchPayload("/v1/functions/{name}", "post", {
3727
+ path: { name },
3728
+ body: { input },
3729
+ headers: {
3730
+ ...readHeaders({ dataset: options.dataset }),
3731
+ ...options.idempotencyKey === void 0 ? {} : { [chunkNN45CSPZ_cjs.HEADER_IDEMPOTENCY_KEY.name]: options.idempotencyKey }
3732
+ },
3733
+ timeout: options.timeout ?? FUNCTION_CALL_TIMEOUT_MS,
3734
+ ...signalOf(options)
3735
+ });
3736
+ }
3737
+ chunkL6DXCKVQ_cjs.__name(callFunction, "callFunction");
3738
+ function functionsAccessor(http) {
3739
+ return new Proxy({}, {
3740
+ get: /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((_target, property) => {
3741
+ if (typeof property !== "string" || property === "then") return void 0;
3742
+ const call = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((input = {}, options = {}) => callFunction(http(), property, input, options), "call");
3743
+ return call;
3744
+ }, "get")
3745
+ });
3746
+ }
3747
+ chunkL6DXCKVQ_cjs.__name(functionsAccessor, "functionsAccessor");
3366
3748
 
3367
3749
  // src/search/search-options.ts
3368
3750
  function scopeOf(contentType) {
@@ -3370,36 +3752,36 @@ function scopeOf(contentType) {
3370
3752
  if (typeof contentType === "string") return { contentType };
3371
3753
  return { contentTypes: [...contentType] };
3372
3754
  }
3373
- chunkMWMSFIWN_cjs.__name(scopeOf, "scopeOf");
3755
+ chunkL6DXCKVQ_cjs.__name(scopeOf, "scopeOf");
3374
3756
  function selectedFields(select) {
3375
3757
  if (select === void 0 || select.length === 0) return {};
3376
3758
  return { fields: Object.fromEntries(select.map((field) => [field, field])) };
3377
3759
  }
3378
- chunkMWMSFIWN_cjs.__name(selectedFields, "selectedFields");
3760
+ chunkL6DXCKVQ_cjs.__name(selectedFields, "selectedFields");
3379
3761
  function localeOf(own, client) {
3380
3762
  const locale = own ?? client;
3381
3763
  return locale === void 0 || locale === "" ? {} : { locale };
3382
3764
  }
3383
- chunkMWMSFIWN_cjs.__name(localeOf, "localeOf");
3765
+ chunkL6DXCKVQ_cjs.__name(localeOf, "localeOf");
3384
3766
  function whereOf(where) {
3385
3767
  if (where === void 0) return {};
3386
3768
  refuseMetadataConditions(where);
3387
3769
  return Object.keys(where).length === 0 ? {} : { where };
3388
3770
  }
3389
- chunkMWMSFIWN_cjs.__name(whereOf, "whereOf");
3771
+ chunkL6DXCKVQ_cjs.__name(whereOf, "whereOf");
3390
3772
  function given(options) {
3391
3773
  return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0));
3392
3774
  }
3393
- chunkMWMSFIWN_cjs.__name(given, "given");
3775
+ chunkL6DXCKVQ_cjs.__name(given, "given");
3394
3776
  function transportOf(options) {
3395
3777
  const headers = readHeaders(options);
3396
3778
  return {
3397
3779
  ...signalOf(options),
3398
3780
  ...headers === void 0 ? {} : { headers },
3399
- ...typeof options.fresh === "string" ? { query: { [chunk6PTRZP5U_cjs.FRESH_PARAMETER]: options.fresh } } : {}
3781
+ ...typeof options.fresh === "string" ? { query: { [chunkNN45CSPZ_cjs.FRESH_PARAMETER]: options.fresh } } : {}
3400
3782
  };
3401
3783
  }
3402
- chunkMWMSFIWN_cjs.__name(transportOf, "transportOf");
3784
+ chunkL6DXCKVQ_cjs.__name(transportOf, "transportOf");
3403
3785
  async function runSearch(http, q, options, clientLocale) {
3404
3786
  const sort = options.sort === void 0 ? [] : Object.entries(options.sort).flatMap(
3405
3787
  ([field, direction]) => direction === void 0 ? [] : [{ field, direction }]
@@ -3433,7 +3815,7 @@ async function runSearch(http, q, options, clientLocale) {
3433
3815
  );
3434
3816
  return response.body;
3435
3817
  }
3436
- chunkMWMSFIWN_cjs.__name(runSearch, "runSearch");
3818
+ chunkL6DXCKVQ_cjs.__name(runSearch, "runSearch");
3437
3819
  async function runAutocomplete(http, q, options, clientLocale) {
3438
3820
  const body = {
3439
3821
  q,
@@ -3451,7 +3833,7 @@ async function runAutocomplete(http, q, options, clientLocale) {
3451
3833
  );
3452
3834
  return response.body;
3453
3835
  }
3454
- chunkMWMSFIWN_cjs.__name(runAutocomplete, "runAutocomplete");
3836
+ chunkL6DXCKVQ_cjs.__name(runAutocomplete, "runAutocomplete");
3455
3837
  async function runSimilar(http, source, options, clientLocale) {
3456
3838
  const body = {
3457
3839
  source,
@@ -3467,7 +3849,7 @@ async function runSimilar(http, source, options, clientLocale) {
3467
3849
  );
3468
3850
  return response.body;
3469
3851
  }
3470
- chunkMWMSFIWN_cjs.__name(runSimilar, "runSimilar");
3852
+ chunkL6DXCKVQ_cjs.__name(runSimilar, "runSimilar");
3471
3853
 
3472
3854
  // src/batch/batch-operations.ts
3473
3855
  var VERBS = ["create", "update", "replace", "delete", "singleton"];
@@ -3490,7 +3872,7 @@ async function runBatch(http, operations, options, clientLocale) {
3490
3872
  });
3491
3873
  return response.body;
3492
3874
  }
3493
- chunkMWMSFIWN_cjs.__name(runBatch, "runBatch");
3875
+ chunkL6DXCKVQ_cjs.__name(runBatch, "runBatch");
3494
3876
  function operationOf(operation, index, clientLocale) {
3495
3877
  const named = VERBS.filter((verb2) => operation[verb2] !== void 0);
3496
3878
  const verb = named[0];
@@ -3506,7 +3888,7 @@ function operationOf(operation, index, clientLocale) {
3506
3888
  ...parentId === void 0 ? {} : { parentId },
3507
3889
  ...sortOrder === void 0 ? {} : { sortOrder }
3508
3890
  };
3509
- const located = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((locale) => locale === void 0 ? {} : { locale }, "located");
3891
+ const located = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((locale) => locale === void 0 ? {} : { locale }, "located");
3510
3892
  switch (verb) {
3511
3893
  case "create": {
3512
3894
  return {
@@ -3546,7 +3928,7 @@ function operationOf(operation, index, clientLocale) {
3546
3928
  }
3547
3929
  }
3548
3930
  }
3549
- chunkMWMSFIWN_cjs.__name(operationOf, "operationOf");
3931
+ chunkL6DXCKVQ_cjs.__name(operationOf, "operationOf");
3550
3932
  function targetOf(operation, clientLocale) {
3551
3933
  if (operation.entry !== void 0) return versionCheckOf(operation.entry);
3552
3934
  if (operation.id === void 0) {
@@ -3557,7 +3939,7 @@ function targetOf(operation, clientLocale) {
3557
3939
  const locale = callLocale(operation.locale, clientLocale);
3558
3940
  return { id: operation.id, ...locale === void 0 ? {} : { locale } };
3559
3941
  }
3560
- chunkMWMSFIWN_cjs.__name(targetOf, "targetOf");
3942
+ chunkL6DXCKVQ_cjs.__name(targetOf, "targetOf");
3561
3943
 
3562
3944
  // src/queries/query-call.ts
3563
3945
  async function runAdhocQuery(http, query, clientLocale) {
@@ -3577,7 +3959,7 @@ async function runAdhocQuery(http, query, clientLocale) {
3577
3959
  const terms = {};
3578
3960
  if (query.cursor !== void 0) terms.cursor = query.cursor;
3579
3961
  writeLocale(terms, query.locale ?? clientLocale);
3580
- if (typeof query.fresh === "string") terms[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = query.fresh;
3962
+ if (typeof query.fresh === "string") terms[chunkNN45CSPZ_cjs.FRESH_PARAMETER] = query.fresh;
3581
3963
  const parameters = { ...query.params };
3582
3964
  const body = {
3583
3965
  query: {
@@ -3597,7 +3979,7 @@ async function runAdhocQuery(http, query, clientLocale) {
3597
3979
  });
3598
3980
  return response.body;
3599
3981
  }
3600
- chunkMWMSFIWN_cjs.__name(runAdhocQuery, "runAdhocQuery");
3982
+ chunkL6DXCKVQ_cjs.__name(runAdhocQuery, "runAdhocQuery");
3601
3983
  function offsetOf(page, limit) {
3602
3984
  if (limit === void 0 || !Number.isInteger(page) || page < 1) {
3603
3985
  throw new ValidationError(
@@ -3607,12 +3989,12 @@ function offsetOf(page, limit) {
3607
3989
  }
3608
3990
  return (page - 1) * limit;
3609
3991
  }
3610
- chunkMWMSFIWN_cjs.__name(offsetOf, "offsetOf");
3992
+ chunkL6DXCKVQ_cjs.__name(offsetOf, "offsetOf");
3611
3993
  async function runNamedQuery(http, name, options, clientLocale) {
3612
3994
  const locale = options.locale ?? clientLocale;
3613
3995
  const terms = {};
3614
3996
  if (locale !== void 0 && locale !== "") terms.locale = locale;
3615
- if (typeof options.fresh === "string") terms[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = options.fresh;
3997
+ if (typeof options.fresh === "string") terms[chunkNN45CSPZ_cjs.FRESH_PARAMETER] = options.fresh;
3616
3998
  const headers = readHeaders(options);
3617
3999
  const response = await http.send(
3618
4000
  "/v1/queries/{name}",
@@ -3627,17 +4009,17 @@ async function runNamedQuery(http, name, options, clientLocale) {
3627
4009
  );
3628
4010
  return response.body;
3629
4011
  }
3630
- chunkMWMSFIWN_cjs.__name(runNamedQuery, "runNamedQuery");
4012
+ chunkL6DXCKVQ_cjs.__name(runNamedQuery, "runNamedQuery");
3631
4013
 
3632
4014
  // src/config/dev-detection.ts
3633
4015
  function sandboxStateOf(resolution) {
3634
4016
  return resolution.state === "active" ? resolution.sandbox : resolution;
3635
4017
  }
3636
- chunkMWMSFIWN_cjs.__name(sandboxStateOf, "sandboxStateOf");
4018
+ chunkL6DXCKVQ_cjs.__name(sandboxStateOf, "sandboxStateOf");
3637
4019
  function getProcess() {
3638
4020
  return typeof process !== "undefined" ? process : void 0;
3639
4021
  }
3640
- chunkMWMSFIWN_cjs.__name(getProcess, "getProcess");
4022
+ chunkL6DXCKVQ_cjs.__name(getProcess, "getProcess");
3641
4023
  function getBuiltin(proc, id) {
3642
4024
  if (proc == null || typeof proc.getBuiltinModule !== "function") return null;
3643
4025
  try {
@@ -3646,13 +4028,13 @@ function getBuiltin(proc, id) {
3646
4028
  return null;
3647
4029
  }
3648
4030
  }
3649
- chunkMWMSFIWN_cjs.__name(getBuiltin, "getBuiltin");
4031
+ chunkL6DXCKVQ_cjs.__name(getBuiltin, "getBuiltin");
3650
4032
  function isProduction(proc) {
3651
4033
  return proc?.env?.NODE_ENV === "production";
3652
4034
  }
3653
- chunkMWMSFIWN_cjs.__name(isProduction, "isProduction");
4035
+ chunkL6DXCKVQ_cjs.__name(isProduction, "isProduction");
3654
4036
  function resolveFromEnv(proc, now) {
3655
- const verdict = chunkLSRPMNPT_cjs.parseDevEnv(proc?.env, now);
4037
+ const verdict = chunkZO6QDYJG_cjs.parseDevEnv(proc?.env, now);
3656
4038
  switch (verdict.state) {
3657
4039
  case "active":
3658
4040
  return {
@@ -3674,7 +4056,7 @@ function resolveFromEnv(proc, now) {
3674
4056
  return { state: "absent" };
3675
4057
  }
3676
4058
  }
3677
- chunkMWMSFIWN_cjs.__name(resolveFromEnv, "resolveFromEnv");
4059
+ chunkL6DXCKVQ_cjs.__name(resolveFromEnv, "resolveFromEnv");
3678
4060
  function resolveFromFile(proc, now) {
3679
4061
  if (proc == null || typeof proc.cwd !== "function") return { state: "absent" };
3680
4062
  const fs = getBuiltin(proc, "node:fs");
@@ -3682,7 +4064,7 @@ function resolveFromFile(proc, now) {
3682
4064
  if (fs == null || path == null) return { state: "absent" };
3683
4065
  let dir = proc.cwd();
3684
4066
  for (; ; ) {
3685
- const candidate = path.join(dir, chunkLSRPMNPT_cjs.DEV_CONTEXT_DIR, chunkLSRPMNPT_cjs.DEV_CONTEXT_FILENAME);
4067
+ const candidate = path.join(dir, chunkZO6QDYJG_cjs.DEV_CONTEXT_DIR, chunkZO6QDYJG_cjs.DEV_CONTEXT_FILENAME);
3686
4068
  let raw = null;
3687
4069
  try {
3688
4070
  if (fs.existsSync(candidate)) raw = fs.readFileSync(candidate, "utf8");
@@ -3690,7 +4072,7 @@ function resolveFromFile(proc, now) {
3690
4072
  return { state: "absent" };
3691
4073
  }
3692
4074
  if (raw !== null) {
3693
- const verdict = chunkLSRPMNPT_cjs.parseDevContextFile(raw, now);
4075
+ const verdict = chunkZO6QDYJG_cjs.parseDevContextFile(raw, now);
3694
4076
  switch (verdict.state) {
3695
4077
  case "active":
3696
4078
  return {
@@ -3718,7 +4100,7 @@ function resolveFromFile(proc, now) {
3718
4100
  }
3719
4101
  return { state: "absent" };
3720
4102
  }
3721
- chunkMWMSFIWN_cjs.__name(resolveFromFile, "resolveFromFile");
4103
+ chunkL6DXCKVQ_cjs.__name(resolveFromFile, "resolveFromFile");
3722
4104
  function resolveDevOverride(dev) {
3723
4105
  if (dev === false) return { state: "disabled" };
3724
4106
  const proc = getProcess();
@@ -3728,18 +4110,18 @@ function resolveDevOverride(dev) {
3728
4110
  if (fromEnv.state !== "absent") return fromEnv;
3729
4111
  return resolveFromFile(proc, now);
3730
4112
  }
3731
- chunkMWMSFIWN_cjs.__name(resolveDevOverride, "resolveDevOverride");
4113
+ chunkL6DXCKVQ_cjs.__name(resolveDevOverride, "resolveDevOverride");
3732
4114
 
3733
4115
  // src/config/preview-environment.ts
3734
4116
  function readPreviewAtRequest() {
3735
4117
  const env = typeof process === "undefined" ? void 0 : process.env;
3736
- return chunk6PTRZP5U_cjs.previewAtRequest(isEnvironment(env) ? env : {});
4118
+ return chunk7I3SC7SV_cjs.previewAtRequest(isEnvironment(env) ? env : {});
3737
4119
  }
3738
- chunkMWMSFIWN_cjs.__name(readPreviewAtRequest, "readPreviewAtRequest");
4120
+ chunkL6DXCKVQ_cjs.__name(readPreviewAtRequest, "readPreviewAtRequest");
3739
4121
  function isEnvironment(value) {
3740
4122
  return typeof value === "object" && value !== null;
3741
4123
  }
3742
- chunkMWMSFIWN_cjs.__name(isEnvironment, "isEnvironment");
4124
+ chunkL6DXCKVQ_cjs.__name(isEnvironment, "isEnvironment");
3743
4125
 
3744
4126
  // src/config/types.ts
3745
4127
  var DEFAULT_CONFIG = {
@@ -3782,6 +4164,9 @@ function validateConfig(config) {
3782
4164
  if (config.webSocket != null && typeof config.webSocket !== "function") {
3783
4165
  throw new Error("webSocket must be a WebSocket class");
3784
4166
  }
4167
+ if (config.getToken != null && typeof config.getToken !== "function") {
4168
+ throw new Error("getToken must be a function that answers the End user\u2019s token, or null");
4169
+ }
3785
4170
  if (config.timeout != null) assertRequestTimeout(config.timeout);
3786
4171
  if (config.retryAttempts != null && !(Number.isInteger(config.retryAttempts) && config.retryAttempts >= 1)) {
3787
4172
  throw new Error(
@@ -3789,27 +4174,27 @@ function validateConfig(config) {
3789
4174
  );
3790
4175
  }
3791
4176
  }
3792
- chunkMWMSFIWN_cjs.__name(validateConfig, "validateConfig");
4177
+ chunkL6DXCKVQ_cjs.__name(validateConfig, "validateConfig");
3793
4178
  var devOverrideNotified = false;
3794
4179
  function resolveConfig(userConfig) {
3795
4180
  validateConfig(userConfig);
3796
4181
  return withHandshake(withDefaults(DEFAULT_CONFIG, userConfig, DEFAULT_CONFIG));
3797
4182
  }
3798
- chunkMWMSFIWN_cjs.__name(resolveConfig, "resolveConfig");
4183
+ chunkL6DXCKVQ_cjs.__name(resolveConfig, "resolveConfig");
3799
4184
  function resolveConfigUpdate(configured, update) {
3800
4185
  validateConfig(update);
3801
4186
  const base = update.apiKey === void 0 ? configured : withoutKeyHeader(configured);
3802
4187
  return withHandshake(withDefaults(base, update, DEFAULT_CONFIG));
3803
4188
  }
3804
- chunkMWMSFIWN_cjs.__name(resolveConfigUpdate, "resolveConfigUpdate");
4189
+ chunkL6DXCKVQ_cjs.__name(resolveConfigUpdate, "resolveConfigUpdate");
3805
4190
  function withConfiguredKey(configured, apiKey) {
3806
4191
  return { ...withoutKeyHeader(configured), apiKey };
3807
4192
  }
3808
- chunkMWMSFIWN_cjs.__name(withConfiguredKey, "withConfiguredKey");
4193
+ chunkL6DXCKVQ_cjs.__name(withConfiguredKey, "withConfiguredKey");
3809
4194
  function withoutKeyHeader(configured) {
3810
4195
  return { ...configured, headers: layerHeaders(configured.headers, { [API_KEY_HEADER]: null }) };
3811
4196
  }
3812
- chunkMWMSFIWN_cjs.__name(withoutKeyHeader, "withoutKeyHeader");
4197
+ chunkL6DXCKVQ_cjs.__name(withoutKeyHeader, "withoutKeyHeader");
3813
4198
  function withHandshake(configured) {
3814
4199
  const dev = resolveDevOverride(configured.dev);
3815
4200
  const merged = withDefaults(
@@ -3837,13 +4222,13 @@ function withHandshake(configured) {
3837
4222
  }
3838
4223
  return { config: merged, sandbox: sandboxStateOf(dev), configured };
3839
4224
  }
3840
- chunkMWMSFIWN_cjs.__name(withHandshake, "withHandshake");
4225
+ chunkL6DXCKVQ_cjs.__name(withHandshake, "withHandshake");
3841
4226
  var previewNotified = false;
3842
4227
  function withPreview(configured) {
3843
4228
  if (configured.dataset !== void 0 || !isPreviewKey(configured.apiKey)) return configured;
3844
4229
  const preview = readPreviewAtRequest();
3845
4230
  if (preview.state !== "preview") return configured;
3846
- const dataset = chunk6PTRZP5U_cjs.previewDatasetSlug(preview.branch);
4231
+ const dataset = chunkNN45CSPZ_cjs.previewDatasetSlug(preview.branch);
3847
4232
  noteDerivedPreview(dataset);
3848
4233
  if (!previewNotified) {
3849
4234
  previewNotified = true;
@@ -3853,7 +4238,7 @@ function withPreview(configured) {
3853
4238
  }
3854
4239
  return { ...configured, dataset };
3855
4240
  }
3856
- chunkMWMSFIWN_cjs.__name(withPreview, "withPreview");
4241
+ chunkL6DXCKVQ_cjs.__name(withPreview, "withPreview");
3857
4242
  function withDefaults(base, given2, defaults) {
3858
4243
  const merged = new Map(Object.entries(base));
3859
4244
  const givenValues = new Map(Object.entries(given2 ?? {}));
@@ -3876,11 +4261,11 @@ function withDefaults(base, given2, defaults) {
3876
4261
  }
3877
4262
  return Object.fromEntries(merged);
3878
4263
  }
3879
- chunkMWMSFIWN_cjs.__name(withDefaults, "withDefaults");
4264
+ chunkL6DXCKVQ_cjs.__name(withDefaults, "withDefaults");
3880
4265
  function isOptionBag(value) {
3881
4266
  return typeof value === "object" && value !== null && !Array.isArray(value);
3882
4267
  }
3883
- chunkMWMSFIWN_cjs.__name(isOptionBag, "isOptionBag");
4268
+ chunkL6DXCKVQ_cjs.__name(isOptionBag, "isOptionBag");
3884
4269
 
3885
4270
  // src/client/create-client.ts
3886
4271
  var _TypedRelyIOClient = class _TypedRelyIOClient {
@@ -3889,31 +4274,78 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
3889
4274
  * The one HTTP client every sub-client sends through. `updateConfig()` and `setApiKey()` change it
3890
4275
  * in place rather than replacing it, so a sub-client taken before either sends through the change.
3891
4276
  */
3892
- chunkMWMSFIWN_cjs.__publicField(this, "httpClient");
3893
- chunkMWMSFIWN_cjs.__publicField(this, "config");
4277
+ chunkL6DXCKVQ_cjs.__publicField(this, "httpClient");
4278
+ chunkL6DXCKVQ_cjs.__publicField(this, "config");
3894
4279
  /**
3895
4280
  * The configuration as `createClient()`, `setApiKey()` and `updateConfig()` gave it, before the
3896
4281
  * `relyio dev` handshake: what the next update is laid over, and what `with()` starts from.
3897
4282
  */
3898
- chunkMWMSFIWN_cjs.__publicField(this, "configured");
3899
- chunkMWMSFIWN_cjs.__publicField(this, "_sandbox");
3900
- chunkMWMSFIWN_cjs.__publicField(this, "_schema");
4283
+ chunkL6DXCKVQ_cjs.__publicField(this, "configured");
4284
+ chunkL6DXCKVQ_cjs.__publicField(this, "_sandbox");
4285
+ chunkL6DXCKVQ_cjs.__publicField(this, "_schema");
3901
4286
  /**
3902
4287
  * The client's locale as it is when a call is made. Every sub-client and builder is handed this
3903
4288
  * rather than a copy of the locale, so one taken before `updateConfig({ locale })` sends the new
3904
4289
  * locale, or none after `locale: null` (REL-1453).
3905
4290
  */
3906
- chunkMWMSFIWN_cjs.__publicField(this, "currentLocale", /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => this.defaults.locale ?? (this.parent === void 0 ? this.config.locale : this.parent.currentLocale()), "currentLocale"));
4291
+ chunkL6DXCKVQ_cjs.__publicField(this, "currentLocale", /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => this.defaults.locale ?? (this.parent === void 0 ? this.config.locale : this.parent.currentLocale()), "currentLocale"));
3907
4292
  /**
3908
4293
  * The client `with()` was called on, for a client it made: whose key, base URL and configuration
3909
4294
  * this one reads with as they are when each request is sent. `undefined` for a client
3910
4295
  * `createClient()` made, which reads its own.
3911
4296
  */
3912
- chunkMWMSFIWN_cjs.__publicField(this, "parent");
3913
- /** What `with()` gave this client over its parent's: the locale and dataset it names, and no other. */
3914
- chunkMWMSFIWN_cjs.__publicField(this, "defaults", {});
4297
+ chunkL6DXCKVQ_cjs.__publicField(this, "parent");
4298
+ /**
4299
+ * What `with()` gave this client over its parent's: the locale, dataset and End user's token
4300
+ * function it names, and no other.
4301
+ */
4302
+ chunkL6DXCKVQ_cjs.__publicField(this, "defaults", {});
3915
4303
  /** The live edge's poll client id: chosen once, when first needed, and kept for this client's life. */
3916
- chunkMWMSFIWN_cjs.__publicField(this, "_liveClientId");
4304
+ chunkL6DXCKVQ_cjs.__publicField(this, "_liveClientId");
4305
+ /**
4306
+ * The Records of one Record type (spec 1, REL-3771): `create`, `list`, `get`, `update`, `delete`.
4307
+ * Type-safe when a schema is provided — the names autocomplete its `recordTypes` and the fields
4308
+ * are the type's. `relyio.records.batch([...])` writes Records of any types in one transaction,
4309
+ * all or none (REL-3774).
4310
+ *
4311
+ * A Record is an app's data, written by your server with a secret key and live the moment it
4312
+ * lands. A publishable key reads the Records a Record type's read Policy grants it (spec 4,
4313
+ * REL-3883), and writes them only for the End user whose token it carries, as the type's write
4314
+ * Policy allows (REL-3884); with no token it writes nothing (`PUBLISHABLE_KEY_REFUSED`).
4315
+ *
4316
+ * @example
4317
+ * ```typescript
4318
+ * const order = await relyio.records('order').create({ shopperEmail: 'ada@example.com', total: 19 })
4319
+ * const { data: orders } = await relyio.records('order').list({ where: { status: 'paid' } })
4320
+ * await relyio.records.batch([
4321
+ * { op: 'decrement', type: 'inventory', where: { product: mugId }, field: 'available', by: 1 },
4322
+ * { op: 'create', type: 'order', fields: { shopperEmail: 'ada@example.com', total: 19 } },
4323
+ * ])
4324
+ * ```
4325
+ */
4326
+ chunkL6DXCKVQ_cjs.__publicField(this, "records", Object.assign(
4327
+ (recordType) => new RecordsClient(this.httpClient, recordType),
4328
+ {
4329
+ // Read when called, never when made: `with()` and `updateConfig()` move `httpClient`
4330
+ batch: /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((operations, options) => sendRecordBatch(this.httpClient, operations, options), "batch")
4331
+ }
4332
+ // The one function both call signatures describe; the cast restates the schema's typing of its
4333
+ // argument and answer, as `content()` does, and widens nothing it is called with.
4334
+ ));
4335
+ /**
4336
+ * The project's Functions, by name (spec 2, REL-3821): `relyio.functions.checkout({ cartId })`
4337
+ * runs the Function `checkout` that the key's Branch runs, on the key's Dataset, and answers its
4338
+ * output. Call it from your server with a secret key; a run that failed throws
4339
+ * `FunctionRunFailedError` and one past five minutes `FunctionRunTimedOutError`, each naming the
4340
+ * run. Never retried: a Function may write.
4341
+ *
4342
+ * @example
4343
+ * ```typescript
4344
+ * const { orderId } = (await relyio.functions.checkout({ cartId })) as { orderId: string }
4345
+ * ```
4346
+ */
4347
+ // Read when called, never when made: `with()` and `updateConfig()` move `httpClient`
4348
+ chunkL6DXCKVQ_cjs.__publicField(this, "functions", functionsAccessor(() => this.httpClient));
3917
4349
  const { schema, ...clientConfig } = config;
3918
4350
  this._schema = schema;
3919
4351
  const resolved = resolveConfig(clientConfig);
@@ -3957,7 +4389,7 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
3957
4389
  * its own.
3958
4390
  */
3959
4391
  get query() {
3960
- const call = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((target, options = {}) => typeof target === "string" ? runNamedQuery(this.httpClient, target, options, this.currentLocale()) : runAdhocQuery(this.httpClient, target, this.currentLocale()), "call");
4392
+ const call = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((target, options = {}) => typeof target === "string" ? runNamedQuery(this.httpClient, target, options, this.currentLocale()) : runAdhocQuery(this.httpClient, target, this.currentLocale()), "call");
3961
4393
  return call;
3962
4394
  }
3963
4395
  // ============================================================================
@@ -4363,6 +4795,9 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
4363
4795
  * const { data } = await staging.content('post').list({ limit: 10 })
4364
4796
  *
4365
4797
  * const french = relyio.with({ locale: 'fr-FR' }) // ← autocompletes the schema's locales
4798
+ *
4799
+ * // Every request this one sends carries the signed-in End user's token (REL-3882)
4800
+ * const visitor = relyio.with({ getToken: () => session.getToken() })
4366
4801
  * ```
4367
4802
  */
4368
4803
  with(defaults) {
@@ -4376,14 +4811,16 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
4376
4811
  }
4377
4812
  /** Make this client one `with()` made from `parent`: see {@link with}. */
4378
4813
  follow(parent, defaults) {
4379
- const { locale, dataset } = defaults;
4814
+ const { locale, dataset, getToken } = defaults;
4380
4815
  this.parent = parent;
4381
4816
  this.defaults = {
4382
4817
  ...locale === void 0 ? {} : { locale },
4383
- ...dataset === void 0 ? {} : { dataset }
4818
+ ...dataset === void 0 ? {} : { dataset },
4819
+ ...getToken === void 0 ? {} : { getToken }
4384
4820
  };
4385
4821
  this.httpClient = parent.httpClient.withHeaders(
4386
- dataset === void 0 ? {} : { [DATASET_HEADER]: dataset }
4822
+ dataset === void 0 ? {} : { [DATASET_HEADER]: dataset },
4823
+ getToken === void 0 ? {} : { getToken }
4387
4824
  );
4388
4825
  }
4389
4826
  /**
@@ -4414,12 +4851,12 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
4414
4851
  return locales.map((locale) => ({ ...locale, default: locale.code === defaultLocale }));
4415
4852
  }
4416
4853
  };
4417
- chunkMWMSFIWN_cjs.__name(_TypedRelyIOClient, "TypedRelyIOClient");
4854
+ chunkL6DXCKVQ_cjs.__name(_TypedRelyIOClient, "TypedRelyIOClient");
4418
4855
  var TypedRelyIOClient = _TypedRelyIOClient;
4419
4856
  function createClient(config) {
4420
4857
  return new TypedRelyIOClient(config);
4421
4858
  }
4422
- chunkMWMSFIWN_cjs.__name(createClient, "createClient");
4859
+ chunkL6DXCKVQ_cjs.__name(createClient, "createClient");
4423
4860
  function randomClientId() {
4424
4861
  const bytes = new Uint8Array(16);
4425
4862
  const random = globalThis.crypto;
@@ -4432,7 +4869,7 @@ function randomClientId() {
4432
4869
  }
4433
4870
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
4434
4871
  }
4435
- chunkMWMSFIWN_cjs.__name(randomClientId, "randomClientId");
4872
+ chunkL6DXCKVQ_cjs.__name(randomClientId, "randomClientId");
4436
4873
 
4437
4874
  exports.AssetClient = AssetClient;
4438
4875
  exports.AssetFileBuilder = AssetFileBuilder;
@@ -4443,9 +4880,13 @@ exports.ChangesExpiredError = ChangesExpiredError;
4443
4880
  exports.ConnectionError = ConnectionError;
4444
4881
  exports.ContentClient = ContentClient;
4445
4882
  exports.DefaultRetryPolicy = DefaultRetryPolicy;
4883
+ exports.EndUserTokenInvalidError = EndUserTokenInvalidError;
4446
4884
  exports.ErrorMapper = ErrorMapper;
4447
4885
  exports.FileUploadError = FileUploadError;
4448
4886
  exports.FileValidationError = FileValidationError;
4887
+ exports.FunctionContainersBusyError = FunctionContainersBusyError;
4888
+ exports.FunctionRunFailedError = FunctionRunFailedError;
4889
+ exports.FunctionRunTimedOutError = FunctionRunTimedOutError;
4449
4890
  exports.HttpClient = HttpClient;
4450
4891
  exports.InvalidApiKeyError = InvalidApiKeyError;
4451
4892
  exports.InvalidPayloadError = InvalidPayloadError;
@@ -4459,8 +4900,10 @@ exports.PREVIEW_KEY_PREFIX = PREVIEW_KEY_PREFIX;
4459
4900
  exports.PUBLISHABLE_KEY_PREFIX = PUBLISHABLE_KEY_PREFIX;
4460
4901
  exports.PayloadTooLargeError = PayloadTooLargeError;
4461
4902
  exports.PlanFeatureUnavailableError = PlanFeatureUnavailableError;
4903
+ exports.PublishableKeyRefusedError = PublishableKeyRefusedError;
4462
4904
  exports.RateLimitError = RateLimitError;
4463
4905
  exports.ReadOnlyKeyError = ReadOnlyKeyError;
4906
+ exports.RecordsClient = RecordsClient;
4464
4907
  exports.ResourceConflictError = ResourceConflictError;
4465
4908
  exports.ResourceExpiredError = ResourceExpiredError;
4466
4909
  exports.ResourceNotFoundError = ResourceNotFoundError;
@@ -4484,10 +4927,11 @@ exports.isPublishableKey = isPublishableKey;
4484
4927
  exports.isReplaySafe = isReplaySafe;
4485
4928
  exports.isResourceNotFound = isResourceNotFound;
4486
4929
  exports.matchRoute = matchRoute;
4930
+ exports.refusedOperationOf = refusedOperationOf;
4487
4931
  exports.retryPolicyFor = retryPolicyFor;
4488
4932
  exports.serviceInstructedDelayMs = serviceInstructedDelayMs;
4489
4933
  exports.sleep = sleep;
4490
4934
  exports.validateFile = validateFile;
4491
4935
  exports.versionCheckOf = versionCheckOf;
4492
- //# sourceMappingURL=chunk-6E22GYPB.cjs.map
4493
- //# sourceMappingURL=chunk-6E22GYPB.cjs.map
4936
+ //# sourceMappingURL=chunk-P23G5NXD.cjs.map
4937
+ //# sourceMappingURL=chunk-P23G5NXD.cjs.map