@relyio/sdk 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/automations/index.cjs +70 -0
  3. package/dist/automations/index.d.cts +1309 -0
  4. package/dist/automations/index.d.ts +1309 -0
  5. package/dist/automations/index.js +5 -0
  6. package/dist/{chunk-RSHMA4KT.cjs → chunk-2SPPU2WG.cjs} +68 -68
  7. package/dist/chunk-7I3SC7SV.cjs +40 -0
  8. package/dist/chunk-DI6KFDBO.js +43 -0
  9. package/dist/chunk-EDE2H37D.js +686 -0
  10. package/dist/chunk-HDHBYYEY.js +36 -0
  11. package/dist/{chunk-6E22GYPB.cjs → chunk-IFKF72VJ.cjs} +705 -320
  12. package/dist/chunk-L6DXCKVQ.cjs +50 -0
  13. package/dist/chunk-LSI26ZN2.cjs +535 -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-R6E4HE7R.js +520 -0
  17. package/dist/chunk-SHSK7UUY.cjs +706 -0
  18. package/dist/{chunk-BBUB7C2Z.js → chunk-W2A4OTCI.js} +3 -3
  19. package/dist/chunk-W7JFHSFM.js +18718 -0
  20. package/dist/{chunk-5UMY6CS4.js → chunk-ZAKEY6DY.js} +3 -3
  21. package/dist/chunk-ZAMAR3X2.cjs +18759 -0
  22. package/dist/{chunk-VS2DEUTN.js → chunk-ZHTJ7GXH.js} +387 -8
  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-NEQDrvdq.d.cts} +3342 -805
  29. package/dist/{define-content-type-BGoQxqLf.d.ts → define-content-type-fb-WCD5e.d.ts} +3342 -805
  30. package/dist/{define-schema-DgCX9YB7.d.ts → define-schema-DZhtvLiK.d.cts} +157 -10
  31. package/dist/{define-schema-DkXwpp0I.d.cts → define-schema-Dlwh6l_J.d.ts} +157 -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 +80 -0
  35. package/dist/extensions/index.d.cts +792 -0
  36. package/dist/extensions/index.d.ts +792 -0
  37. package/dist/extensions/index.js +76 -0
  38. package/dist/functions/index.cjs +68 -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 +59 -0
  42. package/dist/{index-DaMZ4FQ_.d.ts → index-C4LqrNd1.d.ts} +1 -1
  43. package/dist/{index-Bp4AiNT3.d.cts → index-Dnmt_UOo.d.cts} +1 -1
  44. package/dist/{index-DxRmKPrR.d.cts → index-DwHcL6x5.d.cts} +83 -428
  45. package/dist/{index-BBp8_tn9.d.ts → index-M3luH06A.d.ts} +83 -428
  46. package/dist/index.cjs +204 -185
  47. package/dist/index.d.cts +93 -13
  48. package/dist/index.d.ts +93 -13
  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-B53i97A9.d.ts +677 -0
  55. package/dist/register-BYCs0FpF.d.cts +677 -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 +62 -34
  61. package/dist/schema/index.d.cts +127 -5
  62. package/dist/schema/index.d.ts +127 -5
  63. package/dist/schema/index.js +2 -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 chunkSHSK7UUY_cjs = require('./chunk-SHSK7UUY.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 cannot read or write Records or run Functions", 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 cannot reach Records or Functions. Call them 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,72 @@ 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;
332
397
 
333
398
  // src/errors/network-errors.ts
334
399
  var _NetworkError = class _NetworkError extends SDKError {
335
400
  constructor(message = "Network request failed", statusCode, cause, context) {
336
401
  super(message, statusCode, cause, context);
337
- chunkMWMSFIWN_cjs.__publicField(this, "code", "NETWORK_ERROR");
338
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
402
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "NETWORK_ERROR");
403
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
339
404
  }
340
405
  getUserMessage() {
341
406
  return "Network connection failed. Please check your internet connection and try again.";
342
407
  }
343
408
  };
344
- chunkMWMSFIWN_cjs.__name(_NetworkError, "NetworkError");
409
+ chunkL6DXCKVQ_cjs.__name(_NetworkError, "NetworkError");
345
410
  var NetworkError = _NetworkError;
346
411
  var _TimeoutError = class _TimeoutError extends SDKError {
347
412
  /**
@@ -350,27 +415,27 @@ var _TimeoutError = class _TimeoutError extends SDKError {
350
415
  */
351
416
  constructor(message = "Request timed out", timeout, statusCode, cause, context) {
352
417
  super(message, statusCode, cause, { ...context, timeout });
353
- chunkMWMSFIWN_cjs.__publicField(this, "code", "TIMEOUT_ERROR");
354
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
418
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "TIMEOUT_ERROR");
419
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
355
420
  }
356
421
  getUserMessage() {
357
422
  const timeout = this.context?.timeout;
358
423
  return `Request timed out${timeout != null ? ` after ${timeout}ms` : ""}. Please try again.`;
359
424
  }
360
425
  };
361
- chunkMWMSFIWN_cjs.__name(_TimeoutError, "TimeoutError");
426
+ chunkL6DXCKVQ_cjs.__name(_TimeoutError, "TimeoutError");
362
427
  var TimeoutError = _TimeoutError;
363
428
  var _ConnectionError = class _ConnectionError extends SDKError {
364
429
  constructor(message = "Connection failed", statusCode, cause, context) {
365
430
  super(message, statusCode, cause, context);
366
- chunkMWMSFIWN_cjs.__publicField(this, "code", "CONNECTION_ERROR");
367
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", true);
431
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "CONNECTION_ERROR");
432
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", true);
368
433
  }
369
434
  getUserMessage() {
370
435
  return "Failed to connect to RelyIO servers. Please check your connection and try again.";
371
436
  }
372
437
  };
373
- chunkMWMSFIWN_cjs.__name(_ConnectionError, "ConnectionError");
438
+ chunkL6DXCKVQ_cjs.__name(_ConnectionError, "ConnectionError");
374
439
  var ConnectionError = _ConnectionError;
375
440
 
376
441
  // src/errors/validation-errors.ts
@@ -382,8 +447,8 @@ var _BaseValidationError = class _BaseValidationError extends SDKError {
382
447
  */
383
448
  constructor(message = "Validation failed", violations = [], statusCode = 400, cause, context) {
384
449
  super(message, statusCode, cause, { ...context, violations });
385
- chunkMWMSFIWN_cjs.__publicField(this, "retryable", false);
386
- chunkMWMSFIWN_cjs.__publicField(this, "violations");
450
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable", false);
451
+ chunkL6DXCKVQ_cjs.__publicField(this, "violations");
387
452
  this.violations = violations;
388
453
  }
389
454
  getUserMessage() {
@@ -415,26 +480,26 @@ var _BaseValidationError = class _BaseValidationError extends SDKError {
415
480
  return this.violations.map((v) => `${v.field}: ${v.message}`).join("\n");
416
481
  }
417
482
  };
418
- chunkMWMSFIWN_cjs.__name(_BaseValidationError, "BaseValidationError");
483
+ chunkL6DXCKVQ_cjs.__name(_BaseValidationError, "BaseValidationError");
419
484
  var BaseValidationError = _BaseValidationError;
420
485
  var _ValidationError = class _ValidationError extends BaseValidationError {
421
486
  constructor() {
422
487
  super(...arguments);
423
- chunkMWMSFIWN_cjs.__publicField(this, "code", "VALIDATION_ERROR");
488
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "VALIDATION_ERROR");
424
489
  }
425
490
  };
426
- chunkMWMSFIWN_cjs.__name(_ValidationError, "ValidationError");
491
+ chunkL6DXCKVQ_cjs.__name(_ValidationError, "ValidationError");
427
492
  var ValidationError = _ValidationError;
428
493
  var _InvalidPayloadError = class _InvalidPayloadError extends BaseValidationError {
429
494
  constructor(message = "Invalid payload", violations = [], cause, context) {
430
495
  super(message, violations, 400, cause, context);
431
- chunkMWMSFIWN_cjs.__publicField(this, "code", "INVALID_PAYLOAD");
496
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "INVALID_PAYLOAD");
432
497
  }
433
498
  getUserMessage() {
434
499
  return "The request payload is invalid. Please check your data and try again.";
435
500
  }
436
501
  };
437
- chunkMWMSFIWN_cjs.__name(_InvalidPayloadError, "InvalidPayloadError");
502
+ chunkL6DXCKVQ_cjs.__name(_InvalidPayloadError, "InvalidPayloadError");
438
503
  var InvalidPayloadError = _InvalidPayloadError;
439
504
 
440
505
  // ../../platform/api-contract/dist/client/index.js
@@ -442,11 +507,11 @@ var _a;
442
507
  var ContractBodyError = (_a = class extends Error {
443
508
  constructor(message, body) {
444
509
  super(message);
445
- chunkMWMSFIWN_cjs.__publicField(this, "body");
510
+ chunkL6DXCKVQ_cjs.__publicField(this, "body");
446
511
  this.name = "ContractBodyError";
447
512
  this.body = body;
448
513
  }
449
- }, chunkMWMSFIWN_cjs.__name(_a, "ContractBodyError"), _a);
514
+ }, chunkL6DXCKVQ_cjs.__name(_a, "ContractBodyError"), _a);
450
515
  function describe(body) {
451
516
  try {
452
517
  return JSON.stringify(body)?.slice(0, 200) ?? String(body);
@@ -454,7 +519,7 @@ function describe(body) {
454
519
  return String(body);
455
520
  }
456
521
  }
457
- chunkMWMSFIWN_cjs.__name(describe, "describe");
522
+ chunkL6DXCKVQ_cjs.__name(describe, "describe");
458
523
  function readPayload(body) {
459
524
  if (typeof body !== "object" || body === null || !("data" in body)) {
460
525
  throw new ContractBodyError(
@@ -464,7 +529,7 @@ function readPayload(body) {
464
529
  }
465
530
  return body.data;
466
531
  }
467
- chunkMWMSFIWN_cjs.__name(readPayload, "readPayload");
532
+ chunkL6DXCKVQ_cjs.__name(readPayload, "readPayload");
468
533
  function readError(body) {
469
534
  if (typeof body !== "object" || body === null || !("error" in body)) return void 0;
470
535
  const error = body.error;
@@ -478,7 +543,7 @@ function readError(body) {
478
543
  ..."details" in error ? { details: error.details } : {}
479
544
  };
480
545
  }
481
- chunkMWMSFIWN_cjs.__name(readError, "readError");
546
+ chunkL6DXCKVQ_cjs.__name(readError, "readError");
482
547
 
483
548
  // src/http/retry-after.ts
484
549
  function headerValue(headers, name) {
@@ -489,7 +554,7 @@ function headerValue(headers, name) {
489
554
  }
490
555
  return void 0;
491
556
  }
492
- chunkMWMSFIWN_cjs.__name(headerValue, "headerValue");
557
+ chunkL6DXCKVQ_cjs.__name(headerValue, "headerValue");
493
558
  function parseRetryAfterMs(value, nowMs) {
494
559
  if (value === void 0) return void 0;
495
560
  const trimmed = value.trim();
@@ -502,7 +567,7 @@ function parseRetryAfterMs(value, nowMs) {
502
567
  if (Number.isNaN(at)) return void 0;
503
568
  return Math.max(0, at - nowMs);
504
569
  }
505
- chunkMWMSFIWN_cjs.__name(parseRetryAfterMs, "parseRetryAfterMs");
570
+ chunkL6DXCKVQ_cjs.__name(parseRetryAfterMs, "parseRetryAfterMs");
506
571
 
507
572
  // src/errors/error-mapper.ts
508
573
  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 +581,7 @@ var _ErrorMapper = class _ErrorMapper {
516
581
  return new NetworkError(`HTTP ${status}: ${statusText}`.trim(), status, void 0, context);
517
582
  }
518
583
  const retryAfterMs = parseRetryAfterMs(
519
- headerValue(headers, chunk6PTRZP5U_cjs.HEADER_RETRY_AFTER.name),
584
+ headerValue(headers, chunkSHSK7UUY_cjs.HEADER_RETRY_AFTER.name),
520
585
  Date.now()
521
586
  );
522
587
  return this.fromContractCode(refusal, status, context, retryAfterMs);
@@ -536,6 +601,9 @@ var _ErrorMapper = class _ErrorMapper {
536
601
  case "READ_ONLY_KEY": {
537
602
  return new ReadOnlyKeyError(message, context);
538
603
  }
604
+ case "PUBLISHABLE_KEY_REFUSED": {
605
+ return new PublishableKeyRefusedError(message, context);
606
+ }
539
607
  case "PLAN_FEATURE_UNAVAILABLE": {
540
608
  return new PlanFeatureUnavailableError(message, detailString(refusal, "feature"), context);
541
609
  }
@@ -579,7 +647,8 @@ var _ErrorMapper = class _ErrorMapper {
579
647
  return new ResourceConflictError(guidance, 409, void 0, {
580
648
  ...context,
581
649
  // 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).
650
+ // `release-locked`, `slug-taken` or `value-taken` from the Content API (REL-2446,
651
+ // REL-3767).
583
652
  blockage,
584
653
  expectedVersion,
585
654
  actualVersion: detailNumber(refusal, "actualVersion"),
@@ -616,6 +685,32 @@ var _ErrorMapper = class _ErrorMapper {
616
685
  retryAfterMs
617
686
  );
618
687
  }
688
+ case "FUNCTION_RUN_FAILED": {
689
+ return new FunctionRunFailedError(
690
+ message,
691
+ {
692
+ runId: detailString(refusal, "runId"),
693
+ failure: detailString(refusal, "failure"),
694
+ runError: runErrorOf(refusal)
695
+ },
696
+ context
697
+ );
698
+ }
699
+ case "FUNCTION_RUN_TIMED_OUT": {
700
+ return new FunctionRunTimedOutError(
701
+ message,
702
+ { runId: detailString(refusal, "runId"), waitedMs: detailNumber(refusal, "waitedMs") },
703
+ context
704
+ );
705
+ }
706
+ case "FUNCTION_CONTAINERS_BUSY": {
707
+ return new FunctionContainersBusyError(
708
+ message,
709
+ detailString(refusal, "function"),
710
+ context,
711
+ retryAfterMs
712
+ );
713
+ }
619
714
  case "INTERNAL_ERROR": {
620
715
  return new ServerError(message, status, context);
621
716
  }
@@ -657,29 +752,36 @@ var _ErrorMapper = class _ErrorMapper {
657
752
  return error.name === "TypeError" && error.message.includes("fetch") || error.message.includes("timeout") || error.message.includes("Network Error") || error.message.includes("ECONNREFUSED");
658
753
  }
659
754
  };
660
- chunkMWMSFIWN_cjs.__name(_ErrorMapper, "ErrorMapper");
755
+ chunkL6DXCKVQ_cjs.__name(_ErrorMapper, "ErrorMapper");
661
756
  var ErrorMapper = _ErrorMapper;
662
757
  function knownCode(refusal) {
663
758
  return typeof refusal.code === "string" ? refusal.code : void 0;
664
759
  }
665
- chunkMWMSFIWN_cjs.__name(knownCode, "knownCode");
760
+ chunkL6DXCKVQ_cjs.__name(knownCode, "knownCode");
666
761
  function detailBag(refusal) {
667
762
  if (knownCode(refusal) === void 0) return void 0;
668
763
  const details = refusal.details;
669
764
  if (typeof details !== "object" || details === null) return void 0;
670
765
  return details;
671
766
  }
672
- chunkMWMSFIWN_cjs.__name(detailBag, "detailBag");
767
+ chunkL6DXCKVQ_cjs.__name(detailBag, "detailBag");
673
768
  function detailString(refusal, key) {
674
769
  const value = detailBag(refusal)?.[key];
675
770
  return typeof value === "string" ? value : void 0;
676
771
  }
677
- chunkMWMSFIWN_cjs.__name(detailString, "detailString");
772
+ chunkL6DXCKVQ_cjs.__name(detailString, "detailString");
678
773
  function detailNumber(refusal, key) {
679
774
  const value = detailBag(refusal)?.[key];
680
775
  return typeof value === "number" ? value : void 0;
681
776
  }
682
- chunkMWMSFIWN_cjs.__name(detailNumber, "detailNumber");
777
+ chunkL6DXCKVQ_cjs.__name(detailNumber, "detailNumber");
778
+ function runErrorOf(refusal) {
779
+ const error = detailBag(refusal)?.error;
780
+ if (typeof error !== "object" || error === null) return void 0;
781
+ const { name, message } = error;
782
+ return typeof name === "string" && typeof message === "string" ? { name, message } : void 0;
783
+ }
784
+ chunkL6DXCKVQ_cjs.__name(runErrorOf, "runErrorOf");
683
785
  function blockageOf(refusal) {
684
786
  const blockage = detailBag(refusal)?.blockage;
685
787
  if (typeof blockage !== "object" || blockage === null) return void 0;
@@ -688,7 +790,7 @@ function blockageOf(refusal) {
688
790
  const named = typeof facts === "object" && facts !== null && !Array.isArray(facts) ? facts : {};
689
791
  return { kind, facts: named };
690
792
  }
691
- chunkMWMSFIWN_cjs.__name(blockageOf, "blockageOf");
793
+ chunkL6DXCKVQ_cjs.__name(blockageOf, "blockageOf");
692
794
  function violationsOf(refusal) {
693
795
  const issues = detailBag(refusal)?.issues;
694
796
  if (!Array.isArray(issues)) return [];
@@ -699,7 +801,7 @@ function violationsOf(refusal) {
699
801
  path: issue.path === "" ? void 0 : issue.path.split(".")
700
802
  }));
701
803
  }
702
- chunkMWMSFIWN_cjs.__name(violationsOf, "violationsOf");
804
+ chunkL6DXCKVQ_cjs.__name(violationsOf, "violationsOf");
703
805
 
704
806
  // src/http/api-routes.ts
705
807
  function fillPath(template, params) {
@@ -721,12 +823,23 @@ function fillPath(template, params) {
721
823
  }
722
824
  return filled;
723
825
  }
724
- chunkMWMSFIWN_cjs.__name(fillPath, "fillPath");
826
+ chunkL6DXCKVQ_cjs.__name(fillPath, "fillPath");
725
827
  var DECLARED_PATHS = {
726
828
  "/health": true,
727
829
  "/health/cache": true,
728
830
  "/health/live": true,
729
831
  "/health/ready": true,
832
+ "/internal/functions/runs/{runId}/actions": true,
833
+ "/internal/functions/runs/{runId}/bundle": true,
834
+ "/internal/functions/runs/{runId}/content": true,
835
+ "/internal/functions/runs/{runId}/outcome": true,
836
+ "/internal/functions/runs/{runId}/recorded": true,
837
+ "/internal/functions/runs/{runId}/records/batch": true,
838
+ "/internal/functions/runs/{runId}/records/file": true,
839
+ "/internal/functions/runs/{runId}/records/read": true,
840
+ "/internal/functions/tasks/{taskId}/run": true,
841
+ "/internal/functions/test-runs/{projectId}/{name}": true,
842
+ "/internal/functions/tool-calls/{projectId}/{name}": true,
730
843
  "/internal/live/visitor-feed/{projectId}/{datasetId}/changes": true,
731
844
  "/internal/live/visitor-key": true,
732
845
  "/internal/media/claim": true,
@@ -763,6 +876,11 @@ var DECLARED_PATHS = {
763
876
  "/v1/project": true,
764
877
  "/v1/queries/{name}": true,
765
878
  "/v1/query": true,
879
+ "/v1/functions/{name}": true,
880
+ "/v1/records/batch": true,
881
+ "/v1/records/{recordType}": true,
882
+ "/v1/records/{recordType}/files": true,
883
+ "/v1/records/{recordType}/{uid}": true,
766
884
  "/v1/search": true,
767
885
  "/v1/search/autocomplete": true,
768
886
  "/v1/search/similar": true,
@@ -784,7 +902,7 @@ function compile(path) {
784
902
  });
785
903
  return { path, segments };
786
904
  }
787
- chunkMWMSFIWN_cjs.__name(compile, "compile");
905
+ chunkL6DXCKVQ_cjs.__name(compile, "compile");
788
906
  function byRouterPrecedence(a, b) {
789
907
  const shared = Math.min(a.segments.length, b.segments.length);
790
908
  for (let index = 0; index < shared; index += 1) {
@@ -794,7 +912,7 @@ function byRouterPrecedence(a, b) {
794
912
  }
795
913
  return 0;
796
914
  }
797
- chunkMWMSFIWN_cjs.__name(byRouterPrecedence, "byRouterPrecedence");
915
+ chunkL6DXCKVQ_cjs.__name(byRouterPrecedence, "byRouterPrecedence");
798
916
  var COMPILED_ROUTES = Object.keys(DECLARED_PATHS).map(compile).sort(byRouterPrecedence);
799
917
  function matchRoute(url, options = {}) {
800
918
  const parsed = new URL(url, "http://relative.invalid");
@@ -822,7 +940,7 @@ function matchRoute(url, options = {}) {
822
940
  }
823
941
  return null;
824
942
  }
825
- chunkMWMSFIWN_cjs.__name(matchRoute, "matchRoute");
943
+ chunkL6DXCKVQ_cjs.__name(matchRoute, "matchRoute");
826
944
  function readQuery(searchParams) {
827
945
  const query = {};
828
946
  for (const key of new Set(searchParams.keys())) {
@@ -831,7 +949,7 @@ function readQuery(searchParams) {
831
949
  }
832
950
  return query;
833
951
  }
834
- chunkMWMSFIWN_cjs.__name(readQuery, "readQuery");
952
+ chunkL6DXCKVQ_cjs.__name(readQuery, "readQuery");
835
953
 
836
954
  // src/errors/instructed-delay.ts
837
955
  function serviceInstructedDelayMs(error, nowMs) {
@@ -846,7 +964,7 @@ function serviceInstructedDelayMs(error, nowMs) {
846
964
  const wait = resetAtMs - nowMs;
847
965
  return wait > 0 ? wait : void 0;
848
966
  }
849
- chunkMWMSFIWN_cjs.__name(serviceInstructedDelayMs, "serviceInstructedDelayMs");
967
+ chunkL6DXCKVQ_cjs.__name(serviceInstructedDelayMs, "serviceInstructedDelayMs");
850
968
 
851
969
  // src/http/retry-policy.ts
852
970
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
@@ -859,9 +977,9 @@ var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
859
977
  ]);
860
978
  function isReplaySafe(request) {
861
979
  if (IDEMPOTENT_METHODS.has(request.method.toUpperCase())) return true;
862
- return headerValue(request.headers, chunk6PTRZP5U_cjs.HEADER_IDEMPOTENCY_KEY.name) !== void 0;
980
+ return headerValue(request.headers, chunkSHSK7UUY_cjs.HEADER_IDEMPOTENCY_KEY.name) !== void 0;
863
981
  }
864
- chunkMWMSFIWN_cjs.__name(isReplaySafe, "isReplaySafe");
982
+ chunkL6DXCKVQ_cjs.__name(isReplaySafe, "isReplaySafe");
865
983
  var UNREACHABLE_CODES = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOTFOUND"]);
866
984
  function isUnreachableHost(error, depth = 0) {
867
985
  if (depth > 4 || typeof error !== "object" || error === null) return false;
@@ -872,10 +990,10 @@ function isUnreachableHost(error, depth = 0) {
872
990
  }
873
991
  return isUnreachableHost(cause, depth + 1);
874
992
  }
875
- chunkMWMSFIWN_cjs.__name(isUnreachableHost, "isUnreachableHost");
993
+ chunkL6DXCKVQ_cjs.__name(isUnreachableHost, "isUnreachableHost");
876
994
  var _DefaultRetryPolicy = class _DefaultRetryPolicy {
877
995
  constructor(config) {
878
- chunkMWMSFIWN_cjs.__publicField(this, "config");
996
+ chunkL6DXCKVQ_cjs.__publicField(this, "config");
879
997
  this.config = config;
880
998
  }
881
999
  shouldRetry(attempt, error, request) {
@@ -892,7 +1010,7 @@ var _DefaultRetryPolicy = class _DefaultRetryPolicy {
892
1010
  return this.config.jitter ? delay * (0.5 + Math.random() * 0.5) : delay;
893
1011
  }
894
1012
  };
895
- chunkMWMSFIWN_cjs.__name(_DefaultRetryPolicy, "DefaultRetryPolicy");
1013
+ chunkL6DXCKVQ_cjs.__name(_DefaultRetryPolicy, "DefaultRetryPolicy");
896
1014
  var DefaultRetryPolicy = _DefaultRetryPolicy;
897
1015
  function retryPolicyFor(maxAttempts) {
898
1016
  return new DefaultRetryPolicy({
@@ -903,7 +1021,7 @@ function retryPolicyFor(maxAttempts) {
903
1021
  jitter: true
904
1022
  });
905
1023
  }
906
- chunkMWMSFIWN_cjs.__name(retryPolicyFor, "retryPolicyFor");
1024
+ chunkL6DXCKVQ_cjs.__name(retryPolicyFor, "retryPolicyFor");
907
1025
 
908
1026
  // src/config/preview-read.ts
909
1027
  var derived = /* @__PURE__ */ new Set();
@@ -912,19 +1030,19 @@ var announced = /* @__PURE__ */ new Set();
912
1030
  function noteDerivedPreview(dataset) {
913
1031
  derived.add(dataset);
914
1032
  }
915
- chunkMWMSFIWN_cjs.__name(noteDerivedPreview, "noteDerivedPreview");
1033
+ chunkL6DXCKVQ_cjs.__name(noteDerivedPreview, "noteDerivedPreview");
916
1034
  function isDerivedPreview(dataset) {
917
1035
  return derived.has(dataset);
918
1036
  }
919
- chunkMWMSFIWN_cjs.__name(isDerivedPreview, "isDerivedPreview");
1037
+ chunkL6DXCKVQ_cjs.__name(isDerivedPreview, "isDerivedPreview");
920
1038
  function isUnknownPreview(dataset) {
921
1039
  const since = unknown.get(dataset);
922
1040
  if (since === void 0) return false;
923
- if (Date.now() - since < chunk6PTRZP5U_cjs.UNKNOWN_PREVIEW_RECHECK_MS) return true;
1041
+ if (Date.now() - since < chunk7I3SC7SV_cjs.UNKNOWN_PREVIEW_RECHECK_MS) return true;
924
1042
  unknown.delete(dataset);
925
1043
  return false;
926
1044
  }
927
- chunkMWMSFIWN_cjs.__name(isUnknownPreview, "isUnknownPreview");
1045
+ chunkL6DXCKVQ_cjs.__name(isUnknownPreview, "isUnknownPreview");
928
1046
  function rememberUnknownPreview(dataset) {
929
1047
  unknown.set(dataset, Date.now());
930
1048
  if (announced.has(dataset)) return;
@@ -933,11 +1051,11 @@ function rememberUnknownPreview(dataset) {
933
1051
  `[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
1052
  );
935
1053
  }
936
- chunkMWMSFIWN_cjs.__name(rememberUnknownPreview, "rememberUnknownPreview");
1054
+ chunkL6DXCKVQ_cjs.__name(rememberUnknownPreview, "rememberUnknownPreview");
937
1055
  function answersUnknownDataset(error, dataset) {
938
1056
  return error instanceof ResourceNotFoundError && error.context?.resourceType === "dataset" && error.context.resourceId === dataset;
939
1057
  }
940
- chunkMWMSFIWN_cjs.__name(answersUnknownDataset, "answersUnknownDataset");
1058
+ chunkL6DXCKVQ_cjs.__name(answersUnknownDataset, "answersUnknownDataset");
941
1059
 
942
1060
  // src/http/abortable-sleep.ts
943
1061
  function sleep(ms, signal) {
@@ -946,7 +1064,7 @@ function sleep(ms, signal) {
946
1064
  resolve();
947
1065
  return;
948
1066
  }
949
- const done = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => {
1067
+ const done = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => {
950
1068
  clearTimeout(timer);
951
1069
  signal?.removeEventListener("abort", done);
952
1070
  resolve();
@@ -955,37 +1073,37 @@ function sleep(ms, signal) {
955
1073
  signal?.addEventListener("abort", done, { once: true });
956
1074
  });
957
1075
  }
958
- chunkMWMSFIWN_cjs.__name(sleep, "sleep");
1076
+ chunkL6DXCKVQ_cjs.__name(sleep, "sleep");
959
1077
  function isAborted(signal) {
960
1078
  return signal?.aborted === true;
961
1079
  }
962
- chunkMWMSFIWN_cjs.__name(isAborted, "isAborted");
1080
+ chunkL6DXCKVQ_cjs.__name(isAborted, "isAborted");
963
1081
 
964
1082
  // src/http/request-timeout.ts
965
1083
  var MAX_TIMER_DELAY_MS = 2147483647;
966
1084
  function isTimerDelay(value) {
967
1085
  return typeof value === "number" && value >= 1 && value <= MAX_TIMER_DELAY_MS;
968
1086
  }
969
- chunkMWMSFIWN_cjs.__name(isTimerDelay, "isTimerDelay");
1087
+ chunkL6DXCKVQ_cjs.__name(isTimerDelay, "isTimerDelay");
970
1088
  function assertRequestTimeout(timeout) {
971
1089
  if (isTimerDelay(timeout)) return;
972
1090
  throw new Error(
973
1091
  `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
1092
  );
975
1093
  }
976
- chunkMWMSFIWN_cjs.__name(assertRequestTimeout, "assertRequestTimeout");
1094
+ chunkL6DXCKVQ_cjs.__name(assertRequestTimeout, "assertRequestTimeout");
977
1095
 
978
1096
  // src/http/http-client.ts
979
1097
  var _HttpClient = class _HttpClient {
980
1098
  constructor(config) {
981
1099
  /** What every request reads off the configuration, derived by {@link configure} and nowhere else. */
982
- chunkMWMSFIWN_cjs.__publicField(this, "connection");
1100
+ chunkL6DXCKVQ_cjs.__publicField(this, "connection");
983
1101
  /**
984
1102
  * Set on a view {@link withHeaders} made: the client every request is sent through, and the
985
1103
  * headers laid beneath each request's own. A view keeps no connection of its own that matters —
986
1104
  * everything it is asked to change, it changes on that client.
987
1105
  */
988
- chunkMWMSFIWN_cjs.__publicField(this, "view");
1106
+ chunkL6DXCKVQ_cjs.__publicField(this, "view");
989
1107
  this.connection = connectionFor(config);
990
1108
  this.announce();
991
1109
  }
@@ -994,7 +1112,7 @@ var _HttpClient = class _HttpClient {
994
1112
  baseUrl: this.connection.baseUrl,
995
1113
  timeout: this.connection.timeout,
996
1114
  retryAttempts: this.connection.config.retryAttempts,
997
- environment: chunkTZL374LS_cjs.isBrowser() ? "browser" : "node"
1115
+ environment: chunkM7MWNV3Q_cjs.isBrowser() ? "browser" : "node"
998
1116
  });
999
1117
  }
1000
1118
  /**
@@ -1146,7 +1264,7 @@ var _HttpClient = class _HttpClient {
1146
1264
  timedOut = true;
1147
1265
  controller.abort();
1148
1266
  }, config.timeout ?? this.connection.timeout);
1149
- const onCallerAbort = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => controller.abort(), "onCallerAbort");
1267
+ const onCallerAbort = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => controller.abort(), "onCallerAbort");
1150
1268
  caller?.addEventListener("abort", onCallerAbort, { once: true });
1151
1269
  try {
1152
1270
  const filteredHeaders = this.filterHeadersForBrowser(config.headers ?? {});
@@ -1159,7 +1277,7 @@ var _HttpClient = class _HttpClient {
1159
1277
  // runtime has no cookie jar for the mode to govern, so the field is left off and the
1160
1278
  // runtime's default stands; that includes Deno 1.x, whose global is a `window` with no
1161
1279
  // `document`. A Web Worker gets that default too: it has cookies but no `window`.
1162
- ...chunkTZL374LS_cjs.isBrowser() && {
1280
+ ...chunkM7MWNV3Q_cjs.isBrowser() && {
1163
1281
  credentials: credentialsModeFor(this.connection.config.browser.includeCredentials)
1164
1282
  }
1165
1283
  };
@@ -1212,7 +1330,7 @@ var _HttpClient = class _HttpClient {
1212
1330
  }
1213
1331
  );
1214
1332
  const { onCorsError } = this.connection.config.browser;
1215
- if (chunkTZL374LS_cjs.isBrowser() && onCorsError) {
1333
+ if (chunkM7MWNV3Q_cjs.isBrowser() && onCorsError) {
1216
1334
  try {
1217
1335
  onCorsError(corsError, {
1218
1336
  url: config.url,
@@ -1239,7 +1357,7 @@ var _HttpClient = class _HttpClient {
1239
1357
  * spellings, so `Origin` and `User-Agent` — how people write them — reached `fetch` (REL-1409).
1240
1358
  */
1241
1359
  filterHeadersForBrowser(headers) {
1242
- if (!chunkTZL374LS_cjs.isBrowser()) return headers;
1360
+ if (!chunkM7MWNV3Q_cjs.isBrowser()) return headers;
1243
1361
  return Object.fromEntries(
1244
1362
  Object.entries(headers).filter(
1245
1363
  ([name]) => !BROWSER_CONTROLLED_HEADERS.has(name.toLowerCase())
@@ -1327,7 +1445,7 @@ var _HttpClient = class _HttpClient {
1327
1445
  }
1328
1446
  }
1329
1447
  };
1330
- chunkMWMSFIWN_cjs.__name(_HttpClient, "HttpClient");
1448
+ chunkL6DXCKVQ_cjs.__name(_HttpClient, "HttpClient");
1331
1449
  var HttpClient = _HttpClient;
1332
1450
  var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1333
1451
  /**
@@ -1387,7 +1505,7 @@ var _ControlledHttpClient = class _ControlledHttpClient extends HttpClient {
1387
1505
  };
1388
1506
  }
1389
1507
  };
1390
- chunkMWMSFIWN_cjs.__name(_ControlledHttpClient, "ControlledHttpClient");
1508
+ chunkL6DXCKVQ_cjs.__name(_ControlledHttpClient, "ControlledHttpClient");
1391
1509
  var ControlledHttpClient = _ControlledHttpClient;
1392
1510
  var API_KEY_HEADER = "X-API-Key";
1393
1511
  var DATASET_HEADER = "X-RelyIO-Dataset";
@@ -1395,7 +1513,7 @@ function derivedPreviewIn(headers) {
1395
1513
  const dataset = headerValue(headers, DATASET_HEADER);
1396
1514
  return dataset !== void 0 && isDerivedPreview(dataset) ? dataset : void 0;
1397
1515
  }
1398
- chunkMWMSFIWN_cjs.__name(derivedPreviewIn, "derivedPreviewIn");
1516
+ chunkL6DXCKVQ_cjs.__name(derivedPreviewIn, "derivedPreviewIn");
1399
1517
  var BROWSER_CONTROLLED_HEADERS = /* @__PURE__ */ new Set([
1400
1518
  "user-agent",
1401
1519
  "referer",
@@ -1413,7 +1531,7 @@ function connectionFor(config) {
1413
1531
  [DATASET_HEADER]: config.dataset,
1414
1532
  // Only outside a browser, which controls this header. "A browser" is the core's one
1415
1533
  // 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"}`
1534
+ "User-Agent": chunkM7MWNV3Q_cjs.isBrowser() ? void 0 : `RelyIO-SDK/${globalWithVersion.__VERSION__ ?? "0.0.0"}`
1417
1535
  }
1418
1536
  );
1419
1537
  return {
@@ -1427,7 +1545,7 @@ function connectionFor(config) {
1427
1545
  retryPolicy: retryPolicyFor(config.retryAttempts)
1428
1546
  };
1429
1547
  }
1430
- chunkMWMSFIWN_cjs.__name(connectionFor, "connectionFor");
1548
+ chunkL6DXCKVQ_cjs.__name(connectionFor, "connectionFor");
1431
1549
  function layerHeaders(base, over) {
1432
1550
  const layered = { ...base };
1433
1551
  for (const [name, value] of Object.entries(over ?? {})) {
@@ -1440,62 +1558,62 @@ function layerHeaders(base, over) {
1440
1558
  }
1441
1559
  return layered;
1442
1560
  }
1443
- chunkMWMSFIWN_cjs.__name(layerHeaders, "layerHeaders");
1561
+ chunkL6DXCKVQ_cjs.__name(layerHeaders, "layerHeaders");
1444
1562
  function presentKey(value) {
1445
1563
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
1446
1564
  }
1447
- chunkMWMSFIWN_cjs.__name(presentKey, "presentKey");
1565
+ chunkL6DXCKVQ_cjs.__name(presentKey, "presentKey");
1448
1566
  function credentialsModeFor(includeCredentials) {
1449
1567
  return includeCredentials ? "include" : "same-origin";
1450
1568
  }
1451
- chunkMWMSFIWN_cjs.__name(credentialsModeFor, "credentialsModeFor");
1569
+ chunkL6DXCKVQ_cjs.__name(credentialsModeFor, "credentialsModeFor");
1452
1570
 
1453
1571
  // src/http/write-options.ts
1454
1572
  function versionCheckOf(entry) {
1455
1573
  const { id, locale, version, sharedVersion } = entry._metadata;
1456
- return { id, locale, ifMatch: chunk6PTRZP5U_cjs.entityTag({ entryUid: id, locale, version, sharedVersion }) };
1574
+ return { id, locale, ifMatch: chunkSHSK7UUY_cjs.entityTag({ entryUid: id, locale, version, sharedVersion }) };
1457
1575
  }
1458
- chunkMWMSFIWN_cjs.__name(versionCheckOf, "versionCheckOf");
1576
+ chunkL6DXCKVQ_cjs.__name(versionCheckOf, "versionCheckOf");
1459
1577
  function mintIdempotencyKey() {
1460
1578
  const webCrypto = globalThis.crypto;
1461
1579
  if (typeof webCrypto?.randomUUID !== "function") return void 0;
1462
1580
  return webCrypto.randomUUID();
1463
1581
  }
1464
- chunkMWMSFIWN_cjs.__name(mintIdempotencyKey, "mintIdempotencyKey");
1582
+ chunkL6DXCKVQ_cjs.__name(mintIdempotencyKey, "mintIdempotencyKey");
1465
1583
  function writeHeaders(options) {
1466
1584
  const headers = {};
1467
1585
  if (options?.ifMatch !== void 0) {
1468
- headers[chunk6PTRZP5U_cjs.HEADER_IF_MATCH.name] = options.ifMatch;
1586
+ headers[chunkSHSK7UUY_cjs.HEADER_IF_MATCH.name] = options.ifMatch;
1469
1587
  }
1470
1588
  const idempotencyKey = options?.idempotencyKey ?? mintIdempotencyKey();
1471
1589
  if (idempotencyKey !== void 0) {
1472
- headers[chunk6PTRZP5U_cjs.HEADER_IDEMPOTENCY_KEY.name] = idempotencyKey;
1590
+ headers[chunkSHSK7UUY_cjs.HEADER_IDEMPOTENCY_KEY.name] = idempotencyKey;
1473
1591
  }
1474
1592
  return Object.keys(headers).length > 0 ? headers : void 0;
1475
1593
  }
1476
- chunkMWMSFIWN_cjs.__name(writeHeaders, "writeHeaders");
1594
+ chunkL6DXCKVQ_cjs.__name(writeHeaders, "writeHeaders");
1477
1595
 
1478
1596
  // src/content/client-locale.ts
1479
1597
  function callLocale(named, clientLocale) {
1480
1598
  if (named !== void 0) return named;
1481
1599
  return clientLocale === void 0 || clientLocale === "" ? void 0 : clientLocale;
1482
1600
  }
1483
- chunkMWMSFIWN_cjs.__name(callLocale, "callLocale");
1601
+ chunkL6DXCKVQ_cjs.__name(callLocale, "callLocale");
1484
1602
  function readClientLocale(locale) {
1485
1603
  return typeof locale === "function" ? locale : () => locale;
1486
1604
  }
1487
- chunkMWMSFIWN_cjs.__name(readClientLocale, "readClientLocale");
1605
+ chunkL6DXCKVQ_cjs.__name(readClientLocale, "readClientLocale");
1488
1606
 
1489
1607
  // src/content/read-terms.ts
1490
1608
  function writeChildrenQuery(params, options) {
1491
1609
  params.children = options.depth === void 0 ? "true" : `${options.depth}`;
1492
1610
  if (options.limit !== void 0) params.childrenLimit = options.limit;
1493
1611
  }
1494
- chunkMWMSFIWN_cjs.__name(writeChildrenQuery, "writeChildrenQuery");
1612
+ chunkL6DXCKVQ_cjs.__name(writeChildrenQuery, "writeChildrenQuery");
1495
1613
  function namesMetadata(key) {
1496
1614
  return key === "_metadata" || key.startsWith("_metadata.");
1497
1615
  }
1498
- chunkMWMSFIWN_cjs.__name(namesMetadata, "namesMetadata");
1616
+ chunkL6DXCKVQ_cjs.__name(namesMetadata, "namesMetadata");
1499
1617
  function refuseMetadataConditions(conditions) {
1500
1618
  const named = Object.keys(conditions).filter(namesMetadata);
1501
1619
  if (named.length === 0) return;
@@ -1508,7 +1626,7 @@ function refuseMetadataConditions(conditions) {
1508
1626
  }))
1509
1627
  );
1510
1628
  }
1511
- chunkMWMSFIWN_cjs.__name(refuseMetadataConditions, "refuseMetadataConditions");
1629
+ chunkL6DXCKVQ_cjs.__name(refuseMetadataConditions, "refuseMetadataConditions");
1512
1630
 
1513
1631
  // src/content/read-options.ts
1514
1632
  function listQuery(options, clientLocale) {
@@ -1532,7 +1650,7 @@ function listQuery(options, clientLocale) {
1532
1650
  writeReadTerms(query, options, clientLocale);
1533
1651
  return query;
1534
1652
  }
1535
- chunkMWMSFIWN_cjs.__name(listQuery, "listQuery");
1653
+ chunkL6DXCKVQ_cjs.__name(listQuery, "listQuery");
1536
1654
  function childrenQuery(options, clientLocale) {
1537
1655
  const query = {};
1538
1656
  if (options.limit !== void 0) query.limit = options.limit;
@@ -1541,34 +1659,34 @@ function childrenQuery(options, clientLocale) {
1541
1659
  writeReadTerms(query, options, clientLocale);
1542
1660
  return query;
1543
1661
  }
1544
- chunkMWMSFIWN_cjs.__name(childrenQuery, "childrenQuery");
1662
+ chunkL6DXCKVQ_cjs.__name(childrenQuery, "childrenQuery");
1545
1663
  function entryQuery(options, clientLocale) {
1546
1664
  const query = {};
1547
1665
  writeReadTerms(query, options, clientLocale);
1548
1666
  return query;
1549
1667
  }
1550
- chunkMWMSFIWN_cjs.__name(entryQuery, "entryQuery");
1668
+ chunkL6DXCKVQ_cjs.__name(entryQuery, "entryQuery");
1551
1669
  function documentQuery(options, clientLocale) {
1552
1670
  const query = {};
1553
1671
  writeDocumentTerms(query, options, clientLocale);
1554
1672
  return query;
1555
1673
  }
1556
- chunkMWMSFIWN_cjs.__name(documentQuery, "documentQuery");
1674
+ chunkL6DXCKVQ_cjs.__name(documentQuery, "documentQuery");
1557
1675
  function writeReadTerms(query, options, clientLocale) {
1558
1676
  writeDocumentTerms(query, options, clientLocale);
1559
1677
  if (options.children !== void 0) {
1560
1678
  writeChildrenQuery(query, options.children === true ? {} : options.children);
1561
1679
  }
1562
1680
  }
1563
- chunkMWMSFIWN_cjs.__name(writeReadTerms, "writeReadTerms");
1681
+ chunkL6DXCKVQ_cjs.__name(writeReadTerms, "writeReadTerms");
1564
1682
  function writeDocumentTerms(query, options, clientLocale) {
1565
1683
  if (options.include !== void 0 && options.include.length > 0) {
1566
1684
  query.include = options.include.join(",");
1567
1685
  }
1568
1686
  writeLocale(query, options.locale ?? clientLocale);
1569
- if (typeof options.fresh === "string") query[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = options.fresh;
1687
+ if (typeof options.fresh === "string") query[chunkSHSK7UUY_cjs.FRESH_PARAMETER] = options.fresh;
1570
1688
  }
1571
- chunkMWMSFIWN_cjs.__name(writeDocumentTerms, "writeDocumentTerms");
1689
+ chunkL6DXCKVQ_cjs.__name(writeDocumentTerms, "writeDocumentTerms");
1572
1690
  function writeLocale(query, locale) {
1573
1691
  if (locale === void 0) return;
1574
1692
  if (typeof locale === "string") {
@@ -1583,18 +1701,18 @@ function writeLocale(query, locale) {
1583
1701
  }
1584
1702
  query.locales = locale.join(",");
1585
1703
  }
1586
- chunkMWMSFIWN_cjs.__name(writeLocale, "writeLocale");
1704
+ chunkL6DXCKVQ_cjs.__name(writeLocale, "writeLocale");
1587
1705
  function signalOf(options) {
1588
1706
  return options.signal === void 0 ? {} : { signal: options.signal };
1589
1707
  }
1590
- chunkMWMSFIWN_cjs.__name(signalOf, "signalOf");
1708
+ chunkL6DXCKVQ_cjs.__name(signalOf, "signalOf");
1591
1709
  function readHeaders(options) {
1592
1710
  const headers = {};
1593
1711
  if (options.dataset !== void 0) headers[DATASET_HEADER] = options.dataset;
1594
1712
  if (options.fresh === true) headers["Cache-Control"] = "no-cache";
1595
1713
  return Object.keys(headers).length > 0 ? headers : void 0;
1596
1714
  }
1597
- chunkMWMSFIWN_cjs.__name(readHeaders, "readHeaders");
1715
+ chunkL6DXCKVQ_cjs.__name(readHeaders, "readHeaders");
1598
1716
 
1599
1717
  // src/content/entry-handle.ts
1600
1718
  var _EntryHandle = class _EntryHandle {
@@ -1607,7 +1725,7 @@ var _EntryHandle = class _EntryHandle {
1607
1725
  this.httpClient = httpClient;
1608
1726
  this.typeName = typeName;
1609
1727
  /** The client's locale, asked on every call rather than copied when this handle was taken. */
1610
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
1728
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
1611
1729
  this.clientLocale = readClientLocale(locale);
1612
1730
  }
1613
1731
  /**
@@ -1730,7 +1848,7 @@ var _EntryHandle = class _EntryHandle {
1730
1848
  });
1731
1849
  }
1732
1850
  };
1733
- chunkMWMSFIWN_cjs.__name(_EntryHandle, "EntryHandle");
1851
+ chunkL6DXCKVQ_cjs.__name(_EntryHandle, "EntryHandle");
1734
1852
  var EntryHandle = _EntryHandle;
1735
1853
 
1736
1854
  // src/content/content-client.ts
@@ -1853,15 +1971,15 @@ var _ContentClient = class _ContentClient extends EntryHandle {
1853
1971
  return response.body;
1854
1972
  }
1855
1973
  };
1856
- chunkMWMSFIWN_cjs.__name(_ContentClient, "ContentClient");
1974
+ chunkL6DXCKVQ_cjs.__name(_ContentClient, "ContentClient");
1857
1975
  var ContentClient = _ContentClient;
1858
1976
 
1859
1977
  // src/errors/file-errors.ts
1860
1978
  var _FileUploadError = class _FileUploadError extends SDKError {
1861
1979
  constructor(code, message, options = {}) {
1862
1980
  super(message, options.statusCode, options.cause, { ...options.context, fileErrorCode: code });
1863
- chunkMWMSFIWN_cjs.__publicField(this, "code");
1864
- chunkMWMSFIWN_cjs.__publicField(this, "retryable");
1981
+ chunkL6DXCKVQ_cjs.__publicField(this, "code");
1982
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable");
1865
1983
  this.code = code;
1866
1984
  this.retryable = options.retriable ?? false;
1867
1985
  }
@@ -1869,19 +1987,19 @@ var _FileUploadError = class _FileUploadError extends SDKError {
1869
1987
  return this.message;
1870
1988
  }
1871
1989
  };
1872
- chunkMWMSFIWN_cjs.__name(_FileUploadError, "FileUploadError");
1990
+ chunkL6DXCKVQ_cjs.__name(_FileUploadError, "FileUploadError");
1873
1991
  var FileUploadError = _FileUploadError;
1874
1992
  var _FileValidationError = class _FileValidationError extends BaseValidationError {
1875
1993
  constructor(message, violations = [], cause) {
1876
1994
  super(message, violations, 400, cause);
1877
- chunkMWMSFIWN_cjs.__publicField(this, "code", "FILE_VALIDATION_ERROR");
1995
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "FILE_VALIDATION_ERROR");
1878
1996
  }
1879
1997
  getUserMessage() {
1880
1998
  if (this.violations.length === 1) return this.violations[0]?.message ?? this.message;
1881
1999
  return this.message;
1882
2000
  }
1883
2001
  };
1884
- chunkMWMSFIWN_cjs.__name(_FileValidationError, "FileValidationError");
2002
+ chunkL6DXCKVQ_cjs.__name(_FileValidationError, "FileValidationError");
1885
2003
  var FileValidationError = _FileValidationError;
1886
2004
  function validateFile(file, constraints = {}) {
1887
2005
  const violations = [];
@@ -1904,7 +2022,7 @@ function validateFile(file, constraints = {}) {
1904
2022
  }
1905
2023
  return violations;
1906
2024
  }
1907
- chunkMWMSFIWN_cjs.__name(validateFile, "validateFile");
2025
+ chunkL6DXCKVQ_cjs.__name(validateFile, "validateFile");
1908
2026
 
1909
2027
  // src/errors/file-error-codes.ts
1910
2028
  var FILE_ERROR_CODES = [
@@ -1934,11 +2052,11 @@ function assertWaitOptions(options) {
1934
2052
  );
1935
2053
  }
1936
2054
  }
1937
- chunkMWMSFIWN_cjs.__name(assertWaitOptions, "assertWaitOptions");
2055
+ chunkL6DXCKVQ_cjs.__name(assertWaitOptions, "assertWaitOptions");
1938
2056
  function hasText(value) {
1939
2057
  return value != null && value !== "";
1940
2058
  }
1941
- chunkMWMSFIWN_cjs.__name(hasText, "hasText");
2059
+ chunkL6DXCKVQ_cjs.__name(hasText, "hasText");
1942
2060
  function processingFailure(subject, stored) {
1943
2061
  const storedCode = stored?.code;
1944
2062
  const code = FILE_ERROR_CODES.find((known) => known === storedCode) ?? "PROCESSING_FAILED";
@@ -1951,7 +2069,7 @@ function processingFailure(subject, stored) {
1951
2069
  }
1952
2070
  );
1953
2071
  }
1954
- chunkMWMSFIWN_cjs.__name(processingFailure, "processingFailure");
2072
+ chunkL6DXCKVQ_cjs.__name(processingFailure, "processingFailure");
1955
2073
  async function computeSha256Hex(blob) {
1956
2074
  try {
1957
2075
  const subtle = globalThis.crypto?.subtle;
@@ -1965,7 +2083,7 @@ async function computeSha256Hex(blob) {
1965
2083
  return void 0;
1966
2084
  }
1967
2085
  }
1968
- chunkMWMSFIWN_cjs.__name(computeSha256Hex, "computeSha256Hex");
2086
+ chunkL6DXCKVQ_cjs.__name(computeSha256Hex, "computeSha256Hex");
1969
2087
  var _AssetFileBuilder = class _AssetFileBuilder {
1970
2088
  /**
1971
2089
  * @param locale - The client's locale, sent when a call names none: the function
@@ -1976,7 +2094,7 @@ var _AssetFileBuilder = class _AssetFileBuilder {
1976
2094
  this.assetType = assetType;
1977
2095
  this.entryUid = entryUid;
1978
2096
  /** The client's locale, asked on every call rather than copied when this builder was taken. */
1979
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2097
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
1980
2098
  this.clientLocale = readClientLocale(locale);
1981
2099
  }
1982
2100
  /**
@@ -2233,7 +2351,7 @@ var _AssetFileBuilder = class _AssetFileBuilder {
2233
2351
  }
2234
2352
  }
2235
2353
  };
2236
- chunkMWMSFIWN_cjs.__name(_AssetFileBuilder, "AssetFileBuilder");
2354
+ chunkL6DXCKVQ_cjs.__name(_AssetFileBuilder, "AssetFileBuilder");
2237
2355
  var AssetFileBuilder = _AssetFileBuilder;
2238
2356
  var _AssetUploadBuilder = class _AssetUploadBuilder {
2239
2357
  /**
@@ -2244,19 +2362,19 @@ var _AssetUploadBuilder = class _AssetUploadBuilder {
2244
2362
  this.httpClient = httpClient;
2245
2363
  this.assetType = assetType;
2246
2364
  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);
2365
+ chunkL6DXCKVQ_cjs.__publicField(this, "_fileName");
2366
+ chunkL6DXCKVQ_cjs.__publicField(this, "_visibility");
2367
+ chunkL6DXCKVQ_cjs.__publicField(this, "_locale");
2368
+ chunkL6DXCKVQ_cjs.__publicField(this, "_publish");
2369
+ chunkL6DXCKVQ_cjs.__publicField(this, "_content", {});
2370
+ chunkL6DXCKVQ_cjs.__publicField(this, "_slug");
2371
+ chunkL6DXCKVQ_cjs.__publicField(this, "_waitForReady", false);
2372
+ chunkL6DXCKVQ_cjs.__publicField(this, "_waitOptions", {});
2373
+ chunkL6DXCKVQ_cjs.__publicField(this, "_onProgress");
2374
+ chunkL6DXCKVQ_cjs.__publicField(this, "_validate");
2375
+ chunkL6DXCKVQ_cjs.__publicField(this, "_maxPartRetries", 3);
2258
2376
  /** The client's locale, read once when the upload starts. */
2259
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2377
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
2260
2378
  this.clientLocale = readClientLocale(locale);
2261
2379
  }
2262
2380
  /** Subscribe to client → storage upload progress (single PUT + multipart). */
@@ -2492,7 +2610,7 @@ var _AssetUploadBuilder = class _AssetUploadBuilder {
2492
2610
  this._onProgress({ phase: "upload", loaded, total, progress });
2493
2611
  }
2494
2612
  };
2495
- chunkMWMSFIWN_cjs.__name(_AssetUploadBuilder, "AssetUploadBuilder");
2613
+ chunkL6DXCKVQ_cjs.__name(_AssetUploadBuilder, "AssetUploadBuilder");
2496
2614
  var AssetUploadBuilder = _AssetUploadBuilder;
2497
2615
  var _AssetClient = class _AssetClient extends EntryHandle {
2498
2616
  /**
@@ -2523,14 +2641,14 @@ var _AssetClient = class _AssetClient extends EntryHandle {
2523
2641
  return new AssetUploadBuilder(this.httpClient, this.typeName, file, this.clientLocale);
2524
2642
  }
2525
2643
  };
2526
- chunkMWMSFIWN_cjs.__name(_AssetClient, "AssetClient");
2644
+ chunkL6DXCKVQ_cjs.__name(_AssetClient, "AssetClient");
2527
2645
  var AssetClient = _AssetClient;
2528
2646
  function isAssetEntry(entry) {
2529
2647
  if (entry == null || typeof entry !== "object") return false;
2530
2648
  const metadata = entry._metadata;
2531
2649
  return metadata?.entryType === "asset";
2532
2650
  }
2533
- chunkMWMSFIWN_cjs.__name(isAssetEntry, "isAssetEntry");
2651
+ chunkL6DXCKVQ_cjs.__name(isAssetEntry, "isAssetEntry");
2534
2652
 
2535
2653
  // src/content/document-handle.ts
2536
2654
  var _DocumentHandle = class _DocumentHandle {
@@ -2543,7 +2661,7 @@ var _DocumentHandle = class _DocumentHandle {
2543
2661
  this.httpClient = httpClient;
2544
2662
  this.name = name;
2545
2663
  /** The client's locale, asked on every call rather than copied when this handle was taken. */
2546
- chunkMWMSFIWN_cjs.__publicField(this, "clientLocale");
2664
+ chunkL6DXCKVQ_cjs.__publicField(this, "clientLocale");
2547
2665
  this.clientLocale = readClientLocale(locale);
2548
2666
  }
2549
2667
  async update(...args) {
@@ -2603,16 +2721,16 @@ var _DocumentHandle = class _DocumentHandle {
2603
2721
  return writeHeaders({ idempotencyKey: options?.idempotencyKey, ifMatch: write.ifMatch });
2604
2722
  }
2605
2723
  };
2606
- chunkMWMSFIWN_cjs.__name(_DocumentHandle, "DocumentHandle");
2724
+ chunkL6DXCKVQ_cjs.__name(_DocumentHandle, "DocumentHandle");
2607
2725
  var DocumentHandle = _DocumentHandle;
2608
2726
  function isCheckedUpdate(args) {
2609
2727
  return isRead(args[0]);
2610
2728
  }
2611
- chunkMWMSFIWN_cjs.__name(isCheckedUpdate, "isCheckedUpdate");
2729
+ chunkL6DXCKVQ_cjs.__name(isCheckedUpdate, "isCheckedUpdate");
2612
2730
  function isRead(value) {
2613
2731
  return "_metadata" in value && typeof value._metadata === "object" && value._metadata !== null;
2614
2732
  }
2615
- chunkMWMSFIWN_cjs.__name(isRead, "isRead");
2733
+ chunkL6DXCKVQ_cjs.__name(isRead, "isRead");
2616
2734
 
2617
2735
  // src/content/singleton-client.ts
2618
2736
  var _SingletonClient = class _SingletonClient extends DocumentHandle {
@@ -2670,7 +2788,7 @@ var _SingletonClient = class _SingletonClient extends DocumentHandle {
2670
2788
  });
2671
2789
  }
2672
2790
  };
2673
- chunkMWMSFIWN_cjs.__name(_SingletonClient, "SingletonClient");
2791
+ chunkL6DXCKVQ_cjs.__name(_SingletonClient, "SingletonClient");
2674
2792
  var SingletonClient = _SingletonClient;
2675
2793
 
2676
2794
  // src/content/settings-client.ts
@@ -2743,9 +2861,202 @@ var _SettingsClient = class _SettingsClient extends DocumentHandle {
2743
2861
  });
2744
2862
  }
2745
2863
  };
2746
- chunkMWMSFIWN_cjs.__name(_SettingsClient, "SettingsClient");
2864
+ chunkL6DXCKVQ_cjs.__name(_SettingsClient, "SettingsClient");
2747
2865
  var SettingsClient = _SettingsClient;
2748
2866
 
2867
+ // src/content/records-client.ts
2868
+ function isMissingRecord(error) {
2869
+ return error instanceof ResourceNotFoundError && error.context?.resourceType === "record";
2870
+ }
2871
+ chunkL6DXCKVQ_cjs.__name(isMissingRecord, "isMissingRecord");
2872
+ var _RecordsClient = class _RecordsClient {
2873
+ constructor(httpClient, recordType) {
2874
+ this.httpClient = httpClient;
2875
+ this.recordType = recordType;
2876
+ }
2877
+ /**
2878
+ * Store a Record, live the moment it lands. Values that break the Record type's fields are
2879
+ * refused with `ValidationError` naming each field, and nothing is stored. Values a unique set of
2880
+ * the type claims, held by another Record, are refused with `ResourceConflictError` — its
2881
+ * `blockage` is `{ kind: 'value-taken', facts: { fields, recordId } }` (REL-3782).
2882
+ */
2883
+ async create(fields, options = {}) {
2884
+ return this.httpClient.fetchPayload(
2885
+ "/v1/records/{recordType}",
2886
+ "post",
2887
+ {
2888
+ path: { recordType: this.recordType },
2889
+ body: { fields },
2890
+ headers: readHeaders(options),
2891
+ ...signalOf(options)
2892
+ }
2893
+ );
2894
+ }
2895
+ /** One page of the Records `where` keeps, newest first unless `sort` names one key. */
2896
+ async list(options = {}) {
2897
+ const response = await this.httpClient.send(
2898
+ "/v1/records/{recordType}",
2899
+ "get",
2900
+ {
2901
+ path: { recordType: this.recordType },
2902
+ query: {
2903
+ ...options.where === void 0 ? {} : { filters: JSON.stringify(options.where) },
2904
+ ...options.sort === void 0 ? {} : { sort: options.sort },
2905
+ ...options.limit === void 0 ? {} : { limit: options.limit },
2906
+ ...options.cursor === void 0 ? {} : { cursor: options.cursor },
2907
+ ...options.count === true ? { count: "true" } : {},
2908
+ ...options.facets === void 0 || options.facets.length === 0 ? {} : { facets: options.facets.join(",") },
2909
+ ...includeQuery(options)
2910
+ },
2911
+ headers: readHeaders(options),
2912
+ ...signalOf(options)
2913
+ }
2914
+ );
2915
+ return response.body;
2916
+ }
2917
+ /**
2918
+ * Upload a File for one of this Record type's file fields (REL-3824), and answer what a create or
2919
+ * update sets the field to. The bytes go straight to object storage at the address the upload
2920
+ * names, never through RelyIO; a File outside the field's `accept` or over its `maxSize` is
2921
+ * refused with `ValidationError` naming the field before any byte is sent. An upload no write
2922
+ * names within a day is deleted with its bytes. Server-side only, as every Record call is.
2923
+ *
2924
+ * @example
2925
+ * ```typescript
2926
+ * const invoice = await relyio.records('order').upload('invoice', pdfBytes, {
2927
+ * name: 'invoice-1001.pdf',
2928
+ * type: 'application/pdf',
2929
+ * })
2930
+ * await relyio.records('order').update(id, { invoice }, { revision })
2931
+ * ```
2932
+ */
2933
+ async upload(field, bytes, options) {
2934
+ const size = bytes instanceof Blob ? bytes.size : bytes.byteLength;
2935
+ const upload = await this.httpClient.fetchPayload("/v1/records/{recordType}/files", "post", {
2936
+ path: { recordType: this.recordType },
2937
+ body: { field, name: options.name, type: options.type, size },
2938
+ headers: readHeaders(options),
2939
+ ...signalOf(options)
2940
+ });
2941
+ const response = await HttpClient.transfer(this.httpClient, upload.url, {
2942
+ method: upload.method,
2943
+ headers: upload.headers,
2944
+ body: bytes,
2945
+ ...signalOf(options)
2946
+ });
2947
+ if (!response.ok) {
2948
+ throw new FileUploadError(
2949
+ "INTERNAL",
2950
+ `Upload failed (${response.status} ${response.statusText}) for ${this.recordType}.${field}`,
2951
+ { retriable: response.status >= 500, statusCode: response.status }
2952
+ );
2953
+ }
2954
+ return { upload: upload.id };
2955
+ }
2956
+ /**
2957
+ * One Record by its id, or `null` when none is stored. A Record type nobody deployed throws
2958
+ * `ResourceNotFoundError` naming it, so it never reads as a missing Record.
2959
+ */
2960
+ async get(id, options = {}) {
2961
+ try {
2962
+ return await this.httpClient.fetchPayload(
2963
+ "/v1/records/{recordType}/{uid}",
2964
+ "get",
2965
+ {
2966
+ path: { recordType: this.recordType, uid: id },
2967
+ query: includeQuery(options),
2968
+ headers: readHeaders(options),
2969
+ ...signalOf(options)
2970
+ }
2971
+ );
2972
+ } catch (error) {
2973
+ if (isMissingRecord(error)) return null;
2974
+ throw error;
2975
+ }
2976
+ }
2977
+ /**
2978
+ * Change the fields named, against the revision the change was made on, and answer the Record at
2979
+ * its next revision. A field given `null` is removed; one not named keeps its value. A Record
2980
+ * written since `revision` is refused with `ResourceConflictError` — its `blockage` is
2981
+ * `{ kind: 'revision-stale', facts: { changedFields } }` — and nothing is written. Values that
2982
+ * break the Record type are refused with `ValidationError` naming each field, and values another
2983
+ * Record holds under a unique set with `ResourceConflictError`, its blockage `value-taken`.
2984
+ *
2985
+ * @example
2986
+ * ```typescript
2987
+ * const order = await relyio.records('order').get(id)
2988
+ * await relyio.records('order').update(id, { status: 'shipped' }, {
2989
+ * revision: order._metadata.revision,
2990
+ * })
2991
+ * ```
2992
+ */
2993
+ async update(id, fields, options) {
2994
+ return this.httpClient.fetchPayload(
2995
+ "/v1/records/{recordType}/{uid}",
2996
+ "patch",
2997
+ {
2998
+ path: { recordType: this.recordType, uid: id },
2999
+ body: { fields },
3000
+ headers: { ...readHeaders(options), "If-Match": `"${options.revision}"` },
3001
+ ...signalOf(options)
3002
+ }
3003
+ );
3004
+ }
3005
+ /**
3006
+ * Remove a Record. Another Record holding it through a reference declared to block its delete —
3007
+ * the default — is refused with `ResourceConflictError`, its `blockage`
3008
+ * (`{ kind: 'referenced', facts: { referrers } }`) naming each; one declared `nullify` is cleared.
3009
+ */
3010
+ async delete(id, options = {}) {
3011
+ await this.httpClient.send(
3012
+ "/v1/records/{recordType}/{uid}",
3013
+ "delete",
3014
+ {
3015
+ path: { recordType: this.recordType, uid: id },
3016
+ headers: readHeaders(options),
3017
+ ...signalOf(options)
3018
+ }
3019
+ );
3020
+ }
3021
+ };
3022
+ chunkL6DXCKVQ_cjs.__name(_RecordsClient, "RecordsClient");
3023
+ var RecordsClient = _RecordsClient;
3024
+ function includeQuery(options) {
3025
+ return {
3026
+ ...options.include === void 0 || options.include.length === 0 ? {} : { include: options.include.join(",") },
3027
+ ...options.locale === void 0 ? {} : { locale: options.locale }
3028
+ };
3029
+ }
3030
+ chunkL6DXCKVQ_cjs.__name(includeQuery, "includeQuery");
3031
+
3032
+ // src/content/record-batch.ts
3033
+ async function sendRecordBatch(httpClient, operations, options = {}) {
3034
+ const { idempotencyKey, ...call } = options;
3035
+ return httpClient.fetchPayload(
3036
+ "/v1/records/batch",
3037
+ "post",
3038
+ {
3039
+ body: { operations },
3040
+ headers: { ...readHeaders(call), ...writeHeaders({ idempotencyKey }) },
3041
+ ...signalOf(call)
3042
+ }
3043
+ );
3044
+ }
3045
+ chunkL6DXCKVQ_cjs.__name(sendRecordBatch, "sendRecordBatch");
3046
+ var OPERATION_PATH = /^operations\[(\d+)\]/;
3047
+ function refusedOperationOf(error) {
3048
+ if (typeof error !== "object" || error === null) return void 0;
3049
+ const { context, violations } = error;
3050
+ const operation = context?.blockage?.facts?.operation;
3051
+ if (typeof operation === "number") return operation;
3052
+ for (const violation of violations ?? []) {
3053
+ const match = typeof violation.field === "string" ? OPERATION_PATH.exec(violation.field) : null;
3054
+ if (match?.[1] !== void 0) return Number(match[1]);
3055
+ }
3056
+ return void 0;
3057
+ }
3058
+ chunkL6DXCKVQ_cjs.__name(refusedOperationOf, "refusedOperationOf");
3059
+
2749
3060
  // src/changes/changes.ts
2750
3061
  var CHANGES_POLL_TIMEOUT_MS = 25e3 + 5e3;
2751
3062
  var EXPIRED_REASONS2 = {
@@ -2759,14 +3070,14 @@ var _ChangesExpiredError = class _ChangesExpiredError extends ResourceExpiredErr
2759
3070
  /** The base class's signature, so `withContext` can rebuild one; then the position resynced to. */
2760
3071
  constructor(message, statusCode = 410, cause, context, fresh) {
2761
3072
  super(message, statusCode, cause, context);
2762
- chunkMWMSFIWN_cjs.__publicField(this, "reason");
3073
+ chunkL6DXCKVQ_cjs.__publicField(this, "reason");
2763
3074
  /**
2764
3075
  * The position the feed resynced to, which a refetch of everything names as `?_fresh`, as a
2765
3076
  * change's {@link FeedChange.fresh} is named: the head a `/v1/changes` resync took, or the cursor
2766
3077
  * the edge's `feed.resync` sent. `undefined` when there was no resync to take one — the error was
2767
3078
  * thrown (`onExpired: 'throw'`) — and on an error a caller built itself.
2768
3079
  */
2769
- chunkMWMSFIWN_cjs.__publicField(this, "fresh");
3080
+ chunkL6DXCKVQ_cjs.__publicField(this, "fresh");
2770
3081
  this.name = "ChangesExpiredError";
2771
3082
  this.reason = expiredReasonOf(context?.reason);
2772
3083
  this.fresh = fresh;
@@ -2803,7 +3114,7 @@ var _ChangesExpiredError = class _ChangesExpiredError extends ResourceExpiredErr
2803
3114
  );
2804
3115
  }
2805
3116
  };
2806
- chunkMWMSFIWN_cjs.__name(_ChangesExpiredError, "ChangesExpiredError");
3117
+ chunkL6DXCKVQ_cjs.__name(_ChangesExpiredError, "ChangesExpiredError");
2807
3118
  var ChangesExpiredError = _ChangesExpiredError;
2808
3119
  function expiredReasonOf(named) {
2809
3120
  for (const reason of Object.values(EXPIRED_REASONS2)) {
@@ -2811,7 +3122,7 @@ function expiredReasonOf(named) {
2811
3122
  }
2812
3123
  return "unknown";
2813
3124
  }
2814
- chunkMWMSFIWN_cjs.__name(expiredReasonOf, "expiredReasonOf");
3125
+ chunkL6DXCKVQ_cjs.__name(expiredReasonOf, "expiredReasonOf");
2815
3126
  async function* pollChanges(http, options = {}) {
2816
3127
  const { signal } = options;
2817
3128
  let since = options.since;
@@ -2857,7 +3168,7 @@ async function* pollChanges(http, options = {}) {
2857
3168
  }
2858
3169
  }
2859
3170
  }
2860
- chunkMWMSFIWN_cjs.__name(pollChanges, "pollChanges");
3171
+ chunkL6DXCKVQ_cjs.__name(pollChanges, "pollChanges");
2861
3172
  async function readChangesHead(http, options = {}) {
2862
3173
  const response = await http.send("/v1/changes", "get", {
2863
3174
  query: {},
@@ -2872,7 +3183,7 @@ async function readChangesHead(http, options = {}) {
2872
3183
  }
2873
3184
  return page.nextCursor;
2874
3185
  }
2875
- chunkMWMSFIWN_cjs.__name(readChangesHead, "readChangesHead");
3186
+ chunkL6DXCKVQ_cjs.__name(readChangesHead, "readChangesHead");
2876
3187
  async function pollOnce(http, since, options) {
2877
3188
  const query = {};
2878
3189
  if (since !== void 0) query.since = since;
@@ -2885,18 +3196,18 @@ async function pollOnce(http, since, options) {
2885
3196
  ...options.signal === void 0 ? {} : { signal: options.signal }
2886
3197
  });
2887
3198
  }
2888
- chunkMWMSFIWN_cjs.__name(pollOnce, "pollOnce");
3199
+ chunkL6DXCKVQ_cjs.__name(pollOnce, "pollOnce");
2889
3200
 
2890
3201
  // src/errors/live-errors.ts
2891
3202
  var _LiveEdgeError = class _LiveEdgeError extends SDKError {
2892
3203
  constructor(message, end, retry, options = {}) {
2893
3204
  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");
3205
+ chunkL6DXCKVQ_cjs.__publicField(this, "code", "LIVE_EDGE_ENDED");
3206
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryable");
3207
+ chunkL6DXCKVQ_cjs.__publicField(this, "end");
3208
+ chunkL6DXCKVQ_cjs.__publicField(this, "retry");
2898
3209
  /** A refused poll's `Retry-After`, in milliseconds, where it carried a readable one. */
2899
- chunkMWMSFIWN_cjs.__publicField(this, "retryAfterMs");
3210
+ chunkL6DXCKVQ_cjs.__publicField(this, "retryAfterMs");
2900
3211
  this.end = end;
2901
3212
  this.retry = retry;
2902
3213
  this.retryable = retry !== "stop";
@@ -2906,7 +3217,7 @@ var _LiveEdgeError = class _LiveEdgeError extends SDKError {
2906
3217
  return this.message;
2907
3218
  }
2908
3219
  };
2909
- chunkMWMSFIWN_cjs.__name(_LiveEdgeError, "LiveEdgeError");
3220
+ chunkL6DXCKVQ_cjs.__name(_LiveEdgeError, "LiveEdgeError");
2910
3221
  var LiveEdgeError = _LiveEdgeError;
2911
3222
 
2912
3223
  // src/config/live-url.ts
@@ -2929,7 +3240,7 @@ function liveEdgeAddress(config) {
2929
3240
  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
3241
  };
2931
3242
  }
2932
- chunkMWMSFIWN_cjs.__name(liveEdgeAddress, "liveEdgeAddress");
3243
+ chunkL6DXCKVQ_cjs.__name(liveEdgeAddress, "liveEdgeAddress");
2933
3244
  function readLiveUrl(liveUrl) {
2934
3245
  let url;
2935
3246
  try {
@@ -2949,7 +3260,7 @@ function readLiveUrl(liveUrl) {
2949
3260
  url.hash = "";
2950
3261
  return { ok: true, url };
2951
3262
  }
2952
- chunkMWMSFIWN_cjs.__name(readLiveUrl, "readLiveUrl");
3263
+ chunkL6DXCKVQ_cjs.__name(readLiveUrl, "readLiveUrl");
2953
3264
  function originOf(baseUrl) {
2954
3265
  try {
2955
3266
  return new URL(baseUrl).origin;
@@ -2957,11 +3268,11 @@ function originOf(baseUrl) {
2957
3268
  return void 0;
2958
3269
  }
2959
3270
  }
2960
- chunkMWMSFIWN_cjs.__name(originOf, "originOf");
3271
+ chunkL6DXCKVQ_cjs.__name(originOf, "originOf");
2961
3272
 
2962
3273
  // src/changes/live-edge.ts
2963
3274
  var LIVE_KEEPALIVE_INTERVAL_MS = 3e4;
2964
- var LIVE_SOCKET_OPEN_TIMEOUT_MS = chunk6PTRZP5U_cjs.VISITOR_POLL_INTERVAL_MS;
3275
+ var LIVE_SOCKET_OPEN_TIMEOUT_MS = chunkSHSK7UUY_cjs.VISITOR_POLL_INTERVAL_MS;
2965
3276
  var LIVE_POLLS_BEFORE_SOCKET = 4;
2966
3277
  async function* subscribeLiveEdge(client, options = {}) {
2967
3278
  const { signal } = options;
@@ -2978,14 +3289,14 @@ async function* subscribeLiveEdge(client, options = {}) {
2978
3289
  if (polled === "aborted") return;
2979
3290
  }
2980
3291
  }
2981
- chunkMWMSFIWN_cjs.__name(subscribeLiveEdge, "subscribeLiveEdge");
3292
+ chunkL6DXCKVQ_cjs.__name(subscribeLiveEdge, "subscribeLiveEdge");
2982
3293
  var SOCKET_CONNECTING = 0;
2983
3294
  var SOCKET_OPEN = 1;
2984
3295
  function runtimeWebSocket() {
2985
3296
  const candidate = globalThis.WebSocket;
2986
3297
  return typeof candidate === "function" ? candidate : void 0;
2987
3298
  }
2988
- chunkMWMSFIWN_cjs.__name(runtimeWebSocket, "runtimeWebSocket");
3299
+ chunkL6DXCKVQ_cjs.__name(runtimeWebSocket, "runtimeWebSocket");
2989
3300
  function openSocket(client, url) {
2990
3301
  const Socket = client.webSocket ?? runtimeWebSocket();
2991
3302
  if (Socket === void 0) return void 0;
@@ -2995,7 +3306,7 @@ function openSocket(client, url) {
2995
3306
  return void 0;
2996
3307
  }
2997
3308
  }
2998
- chunkMWMSFIWN_cjs.__name(openSocket, "openSocket");
3309
+ chunkL6DXCKVQ_cjs.__name(openSocket, "openSocket");
2999
3310
  async function* followSocket(socket, reach, options) {
3000
3311
  const { signal } = options;
3001
3312
  const inbox = socketInbox(socket, signal);
@@ -3031,12 +3342,12 @@ async function* followSocket(socket, reach, options) {
3031
3342
  return "unopened";
3032
3343
  }
3033
3344
  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;
3345
+ if (event.data === chunkSHSK7UUY_cjs.VISITOR_KEEPALIVE.response) continue;
3346
+ const frame = typeof event.data === "string" ? chunkSHSK7UUY_cjs.parseVisitorFrame(event.data) : null;
3036
3347
  if (frame === null)
3037
3348
  throw unreadable(`a frame the wire does not declare: ${sample(event.data)}`);
3038
3349
  switch (frame.type) {
3039
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.opened: {
3350
+ case chunkSHSK7UUY_cjs.VISITOR_FRAMES.opened: {
3040
3351
  caughtUp = true;
3041
3352
  inbox.caughtUp();
3042
3353
  reach.position = frame.cursor;
@@ -3044,7 +3355,7 @@ async function* followSocket(socket, reach, options) {
3044
3355
  options.reached?.(frame.cursor);
3045
3356
  continue;
3046
3357
  }
3047
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.changes: {
3358
+ case chunkSHSK7UUY_cjs.VISITOR_FRAMES.changes: {
3048
3359
  const prior = reach.position;
3049
3360
  if (prior === void 0) throw unreadable("changes before the socket had a position");
3050
3361
  for (const change of changesOf(frame.changes, frame.cursor, prior)) {
@@ -3055,7 +3366,7 @@ async function* followSocket(socket, reach, options) {
3055
3366
  if (frame.changes.length === 0) options.reached?.(frame.cursor);
3056
3367
  continue;
3057
3368
  }
3058
- case chunk6PTRZP5U_cjs.VISITOR_FRAMES.resync: {
3369
+ case chunkSHSK7UUY_cjs.VISITOR_FRAMES.resync: {
3059
3370
  await expire(frame.reason, frame.cursor, options);
3060
3371
  if (isAborted(signal)) return "aborted";
3061
3372
  reach.position = frame.cursor;
@@ -3070,19 +3381,19 @@ async function* followSocket(socket, reach, options) {
3070
3381
  inbox.dispose();
3071
3382
  }
3072
3383
  }
3073
- chunkMWMSFIWN_cjs.__name(followSocket, "followSocket");
3384
+ chunkL6DXCKVQ_cjs.__name(followSocket, "followSocket");
3074
3385
  function socketInbox(socket, signal) {
3075
3386
  const events = [];
3076
3387
  let wake;
3077
3388
  let disposed = false;
3078
3389
  let heard = true;
3079
3390
  let keepalive;
3080
- const rouse = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => {
3391
+ const rouse = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => {
3081
3392
  const waking = wake;
3082
3393
  wake = void 0;
3083
3394
  waking?.();
3084
3395
  }, "rouse");
3085
- const push = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((event) => {
3396
+ const push = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((event) => {
3086
3397
  if (disposed) return;
3087
3398
  events.push(event);
3088
3399
  rouse();
@@ -3127,7 +3438,7 @@ function socketInbox(socket, signal) {
3127
3438
  return;
3128
3439
  }
3129
3440
  heard = false;
3130
- if (socket.readyState === SOCKET_OPEN) socket.send(chunk6PTRZP5U_cjs.VISITOR_KEEPALIVE.request);
3441
+ if (socket.readyState === SOCKET_OPEN) socket.send(chunkSHSK7UUY_cjs.VISITOR_KEEPALIVE.request);
3131
3442
  }, LIVE_KEEPALIVE_INTERVAL_MS);
3132
3443
  },
3133
3444
  caughtUp() {
@@ -3145,7 +3456,7 @@ function socketInbox(socket, signal) {
3145
3456
  }
3146
3457
  };
3147
3458
  }
3148
- chunkMWMSFIWN_cjs.__name(socketInbox, "socketInbox");
3459
+ chunkL6DXCKVQ_cjs.__name(socketInbox, "socketInbox");
3149
3460
  function closedBy(code, reason) {
3150
3461
  const retry = closeRetryOf(code);
3151
3462
  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 +3467,26 @@ function closedBy(code, reason) {
3156
3467
  retry
3157
3468
  );
3158
3469
  }
3159
- chunkMWMSFIWN_cjs.__name(closedBy, "closedBy");
3470
+ chunkL6DXCKVQ_cjs.__name(closedBy, "closedBy");
3160
3471
  var AFTER_A_CLOSE = {
3161
3472
  stop: "The same request would be refused again, so it was not retried.",
3162
3473
  retry: "Reconnecting from the last cursor after a short back-off.",
3163
3474
  "back-off": "Retrying after a back-off of at least a minute, without polling, which the same admission refuses."
3164
3475
  };
3165
3476
  function closeRetryOf(code) {
3166
- if (hasOwn(chunk6PTRZP5U_cjs.VISITOR_CLOSE_RETRY, code)) return chunk6PTRZP5U_cjs.VISITOR_CLOSE_RETRY[code];
3477
+ if (hasOwn(chunkSHSK7UUY_cjs.VISITOR_CLOSE_RETRY, code)) return chunkSHSK7UUY_cjs.VISITOR_CLOSE_RETRY[code];
3167
3478
  return code < 4e3 ? "retry" : "stop";
3168
3479
  }
3169
- chunkMWMSFIWN_cjs.__name(closeRetryOf, "closeRetryOf");
3480
+ chunkL6DXCKVQ_cjs.__name(closeRetryOf, "closeRetryOf");
3170
3481
  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"
3482
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.requestInvalid]: "the edge could not read the request \u2014 a malformed cursor or filter",
3483
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.keyRefused]: "the key is not a publishable key the edge accepts \u2014 unknown, revoked or expired",
3484
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.originRefused]: "this page\u2019s origin is not on the publishable key\u2019s allowed origins",
3485
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.datasetRefused]: "`dataset` names no dataset the key reaches",
3486
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.unavailable]: "the edge could not serve this connection just now \u2014 it could not reach what it needed",
3487
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.allowanceReached]: "the project holds as many live connections as its plan allows",
3488
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.addressLimitReached]: "this address holds as many live connections to the project as one address may",
3489
+ [chunkSHSK7UUY_cjs.VISITOR_CLOSE_CODES.ceilingReached]: "the project is at its safety ceiling of live connections"
3179
3490
  };
3180
3491
  async function* followPolls(client, request, reach, options) {
3181
3492
  const { signal } = options;
@@ -3203,11 +3514,11 @@ async function* followPolls(client, request, reach, options) {
3203
3514
  if (starting) options.reached?.(answer.cursor);
3204
3515
  }
3205
3516
  starting = false;
3206
- await sleep(chunk6PTRZP5U_cjs.VISITOR_POLL_INTERVAL_MS, signal);
3517
+ await sleep(chunkSHSK7UUY_cjs.VISITOR_POLL_INTERVAL_MS, signal);
3207
3518
  }
3208
3519
  return isAborted(signal) ? "aborted" : "socket";
3209
3520
  }
3210
- chunkMWMSFIWN_cjs.__name(followPolls, "followPolls");
3521
+ chunkL6DXCKVQ_cjs.__name(followPolls, "followPolls");
3211
3522
  async function pollOnce2(client, request, since, signal) {
3212
3523
  if (isAborted(signal)) return void 0;
3213
3524
  const url = edgeUrl(request, since, "poll", client.clientId);
@@ -3218,7 +3529,7 @@ async function pollOnce2(client, request, since, signal) {
3218
3529
  timedOut = true;
3219
3530
  controller.abort();
3220
3531
  }, client.timeout);
3221
- const onAbort = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => controller.abort(), "onAbort");
3532
+ const onAbort = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => controller.abort(), "onAbort");
3222
3533
  signal?.addEventListener("abort", onAbort, { once: true });
3223
3534
  try {
3224
3535
  let response;
@@ -3245,7 +3556,7 @@ async function pollOnce2(client, request, since, signal) {
3245
3556
  }
3246
3557
  const body = parseJson(text);
3247
3558
  if (!response.ok) throw refusedPoll(response, body, context);
3248
- const answer = chunk6PTRZP5U_cjs.readVisitorPollAnswer(isRecord(body) ? body["data"] : void 0);
3559
+ const answer = chunkSHSK7UUY_cjs.readVisitorPollAnswer(isRecord(body) ? body["data"] : void 0);
3249
3560
  if (answer === null)
3250
3561
  throw unreadable(`a poll answer the wire does not declare: ${sample(text)}`);
3251
3562
  return answer;
@@ -3254,7 +3565,7 @@ async function pollOnce2(client, request, since, signal) {
3254
3565
  signal?.removeEventListener("abort", onAbort);
3255
3566
  }
3256
3567
  }
3257
- chunkMWMSFIWN_cjs.__name(pollOnce2, "pollOnce");
3568
+ chunkL6DXCKVQ_cjs.__name(pollOnce2, "pollOnce");
3258
3569
  function refusedPoll(response, body, context) {
3259
3570
  const headers = {};
3260
3571
  response.headers.forEach((value, name) => {
@@ -3265,13 +3576,13 @@ function refusedPoll(response, body, context) {
3265
3576
  { ...context, method: "GET" }
3266
3577
  );
3267
3578
  const refusal = readError(body);
3268
- if (refusal === void 0 || !hasOwn(chunk6PTRZP5U_cjs.VISITOR_POLL_RETRY, refusal.code)) return mapped;
3579
+ if (refusal === void 0 || !hasOwn(chunkSHSK7UUY_cjs.VISITOR_POLL_RETRY, refusal.code)) return mapped;
3269
3580
  const code = refusal.code;
3270
3581
  const retryAfterMs = parseRetryAfterMs(headerValue(headers, "Retry-After"), Date.now());
3271
3582
  return new LiveEdgeError(
3272
3583
  `The live edge refused a poll (${code}): ${refusal.messages[0] ?? mapped.message}`,
3273
3584
  { kind: "refused", code },
3274
- chunk6PTRZP5U_cjs.VISITOR_POLL_RETRY[code],
3585
+ chunkSHSK7UUY_cjs.VISITOR_POLL_RETRY[code],
3275
3586
  {
3276
3587
  statusCode: response.status,
3277
3588
  cause: mapped,
@@ -3280,7 +3591,7 @@ function refusedPoll(response, body, context) {
3280
3591
  }
3281
3592
  );
3282
3593
  }
3283
- chunkMWMSFIWN_cjs.__name(refusedPoll, "refusedPoll");
3594
+ chunkL6DXCKVQ_cjs.__name(refusedPoll, "refusedPoll");
3284
3595
  function edgeRequest(client, filter) {
3285
3596
  const key = client.apiKey;
3286
3597
  if (key === void 0 || !isPublishableKey(key)) {
@@ -3296,24 +3607,24 @@ function edgeRequest(client, filter) {
3296
3607
  ids: filter.ids
3297
3608
  };
3298
3609
  }
3299
- chunkMWMSFIWN_cjs.__name(edgeRequest, "edgeRequest");
3610
+ chunkL6DXCKVQ_cjs.__name(edgeRequest, "edgeRequest");
3300
3611
  function edgeUrl(request, since, transport, clientId) {
3301
3612
  const url = new URL(request.base.href);
3302
- url.pathname = `${url.pathname.replace(/\/+$/, "")}${chunk6PTRZP5U_cjs.VISITOR_LIVE_PATH}`;
3613
+ url.pathname = `${url.pathname.replace(/\/+$/, "")}${chunkSHSK7UUY_cjs.VISITOR_LIVE_PATH}`;
3303
3614
  if (transport === "socket") url.protocol = url.protocol === "http:" ? "ws:" : "wss:";
3304
3615
  const query = new URLSearchParams();
3305
- if (request.key !== void 0) query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.key, request.key);
3616
+ if (request.key !== void 0) query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.key, request.key);
3306
3617
  if (request.dataset !== void 0 && request.dataset !== "") {
3307
- query.set(chunk6PTRZP5U_cjs.VISITOR_QUERY.dataset, request.dataset);
3618
+ query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.dataset, request.dataset);
3308
3619
  }
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);
3620
+ if (since !== void 0) query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.since, since);
3621
+ if (request.types !== void 0) query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.types, request.types.join(","));
3622
+ if (request.ids !== void 0) query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.ids, request.ids.join(","));
3623
+ if (transport === "poll" && clientId !== void 0) query.set(chunkSHSK7UUY_cjs.VISITOR_QUERY.client, clientId);
3313
3624
  url.search = query.toString();
3314
3625
  return url.href;
3315
3626
  }
3316
- chunkMWMSFIWN_cjs.__name(edgeUrl, "edgeUrl");
3627
+ chunkL6DXCKVQ_cjs.__name(edgeUrl, "edgeUrl");
3317
3628
  function changesOf(changes, cursor, prior) {
3318
3629
  const last = changes.length - 1;
3319
3630
  return changes.map((change, index) => ({
@@ -3325,14 +3636,14 @@ function changesOf(changes, cursor, prior) {
3325
3636
  fresh: cursor
3326
3637
  }));
3327
3638
  }
3328
- chunkMWMSFIWN_cjs.__name(changesOf, "changesOf");
3639
+ chunkL6DXCKVQ_cjs.__name(changesOf, "changesOf");
3329
3640
  async function expire(reason, cursor, options) {
3330
3641
  const expired = ChangesExpiredError.resync(reason, cursor);
3331
3642
  const onExpired = options.onExpired ?? "throw";
3332
3643
  if (onExpired === "throw") throw expired;
3333
3644
  if (typeof onExpired === "function") await onExpired(expired);
3334
3645
  }
3335
- chunkMWMSFIWN_cjs.__name(expire, "expire");
3646
+ chunkL6DXCKVQ_cjs.__name(expire, "expire");
3336
3647
  function unreadable(what) {
3337
3648
  return new LiveEdgeError(
3338
3649
  `The live edge sent ${what}. This version of the SDK cannot follow it, so it stopped.`,
@@ -3340,13 +3651,13 @@ function unreadable(what) {
3340
3651
  "stop"
3341
3652
  );
3342
3653
  }
3343
- chunkMWMSFIWN_cjs.__name(unreadable, "unreadable");
3654
+ chunkL6DXCKVQ_cjs.__name(unreadable, "unreadable");
3344
3655
  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
3656
  function sample(value) {
3346
3657
  const text = typeof value === "string" ? value : `(${typeof value})`;
3347
3658
  return text.length > 200 ? `${text.slice(0, 200)}\u2026` : text;
3348
3659
  }
3349
- chunkMWMSFIWN_cjs.__name(sample, "sample");
3660
+ chunkL6DXCKVQ_cjs.__name(sample, "sample");
3350
3661
  function parseJson(text) {
3351
3662
  try {
3352
3663
  return JSON.parse(text);
@@ -3354,15 +3665,41 @@ function parseJson(text) {
3354
3665
  return void 0;
3355
3666
  }
3356
3667
  }
3357
- chunkMWMSFIWN_cjs.__name(parseJson, "parseJson");
3668
+ chunkL6DXCKVQ_cjs.__name(parseJson, "parseJson");
3358
3669
  function isRecord(value) {
3359
3670
  return typeof value === "object" && value !== null && !Array.isArray(value);
3360
3671
  }
3361
- chunkMWMSFIWN_cjs.__name(isRecord, "isRecord");
3672
+ chunkL6DXCKVQ_cjs.__name(isRecord, "isRecord");
3362
3673
  function hasOwn(object, key) {
3363
3674
  return Object.prototype.hasOwnProperty.call(object, key);
3364
3675
  }
3365
- chunkMWMSFIWN_cjs.__name(hasOwn, "hasOwn");
3676
+ chunkL6DXCKVQ_cjs.__name(hasOwn, "hasOwn");
3677
+
3678
+ // src/content/functions-client.ts
3679
+ var FUNCTION_CALL_TIMEOUT_MS = 31e4;
3680
+ async function callFunction(http, name, input, options) {
3681
+ return await http.fetchPayload("/v1/functions/{name}", "post", {
3682
+ path: { name },
3683
+ body: { input },
3684
+ headers: {
3685
+ ...readHeaders({ dataset: options.dataset }),
3686
+ ...options.idempotencyKey === void 0 ? {} : { [chunkSHSK7UUY_cjs.HEADER_IDEMPOTENCY_KEY.name]: options.idempotencyKey }
3687
+ },
3688
+ timeout: options.timeout ?? FUNCTION_CALL_TIMEOUT_MS,
3689
+ ...signalOf(options)
3690
+ });
3691
+ }
3692
+ chunkL6DXCKVQ_cjs.__name(callFunction, "callFunction");
3693
+ function functionsAccessor(http) {
3694
+ return new Proxy({}, {
3695
+ get: /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((_target, property) => {
3696
+ if (typeof property !== "string" || property === "then") return void 0;
3697
+ const call = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((input = {}, options = {}) => callFunction(http(), property, input, options), "call");
3698
+ return call;
3699
+ }, "get")
3700
+ });
3701
+ }
3702
+ chunkL6DXCKVQ_cjs.__name(functionsAccessor, "functionsAccessor");
3366
3703
 
3367
3704
  // src/search/search-options.ts
3368
3705
  function scopeOf(contentType) {
@@ -3370,36 +3707,36 @@ function scopeOf(contentType) {
3370
3707
  if (typeof contentType === "string") return { contentType };
3371
3708
  return { contentTypes: [...contentType] };
3372
3709
  }
3373
- chunkMWMSFIWN_cjs.__name(scopeOf, "scopeOf");
3710
+ chunkL6DXCKVQ_cjs.__name(scopeOf, "scopeOf");
3374
3711
  function selectedFields(select) {
3375
3712
  if (select === void 0 || select.length === 0) return {};
3376
3713
  return { fields: Object.fromEntries(select.map((field) => [field, field])) };
3377
3714
  }
3378
- chunkMWMSFIWN_cjs.__name(selectedFields, "selectedFields");
3715
+ chunkL6DXCKVQ_cjs.__name(selectedFields, "selectedFields");
3379
3716
  function localeOf(own, client) {
3380
3717
  const locale = own ?? client;
3381
3718
  return locale === void 0 || locale === "" ? {} : { locale };
3382
3719
  }
3383
- chunkMWMSFIWN_cjs.__name(localeOf, "localeOf");
3720
+ chunkL6DXCKVQ_cjs.__name(localeOf, "localeOf");
3384
3721
  function whereOf(where) {
3385
3722
  if (where === void 0) return {};
3386
3723
  refuseMetadataConditions(where);
3387
3724
  return Object.keys(where).length === 0 ? {} : { where };
3388
3725
  }
3389
- chunkMWMSFIWN_cjs.__name(whereOf, "whereOf");
3726
+ chunkL6DXCKVQ_cjs.__name(whereOf, "whereOf");
3390
3727
  function given(options) {
3391
3728
  return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0));
3392
3729
  }
3393
- chunkMWMSFIWN_cjs.__name(given, "given");
3730
+ chunkL6DXCKVQ_cjs.__name(given, "given");
3394
3731
  function transportOf(options) {
3395
3732
  const headers = readHeaders(options);
3396
3733
  return {
3397
3734
  ...signalOf(options),
3398
3735
  ...headers === void 0 ? {} : { headers },
3399
- ...typeof options.fresh === "string" ? { query: { [chunk6PTRZP5U_cjs.FRESH_PARAMETER]: options.fresh } } : {}
3736
+ ...typeof options.fresh === "string" ? { query: { [chunkSHSK7UUY_cjs.FRESH_PARAMETER]: options.fresh } } : {}
3400
3737
  };
3401
3738
  }
3402
- chunkMWMSFIWN_cjs.__name(transportOf, "transportOf");
3739
+ chunkL6DXCKVQ_cjs.__name(transportOf, "transportOf");
3403
3740
  async function runSearch(http, q, options, clientLocale) {
3404
3741
  const sort = options.sort === void 0 ? [] : Object.entries(options.sort).flatMap(
3405
3742
  ([field, direction]) => direction === void 0 ? [] : [{ field, direction }]
@@ -3433,7 +3770,7 @@ async function runSearch(http, q, options, clientLocale) {
3433
3770
  );
3434
3771
  return response.body;
3435
3772
  }
3436
- chunkMWMSFIWN_cjs.__name(runSearch, "runSearch");
3773
+ chunkL6DXCKVQ_cjs.__name(runSearch, "runSearch");
3437
3774
  async function runAutocomplete(http, q, options, clientLocale) {
3438
3775
  const body = {
3439
3776
  q,
@@ -3451,7 +3788,7 @@ async function runAutocomplete(http, q, options, clientLocale) {
3451
3788
  );
3452
3789
  return response.body;
3453
3790
  }
3454
- chunkMWMSFIWN_cjs.__name(runAutocomplete, "runAutocomplete");
3791
+ chunkL6DXCKVQ_cjs.__name(runAutocomplete, "runAutocomplete");
3455
3792
  async function runSimilar(http, source, options, clientLocale) {
3456
3793
  const body = {
3457
3794
  source,
@@ -3467,7 +3804,7 @@ async function runSimilar(http, source, options, clientLocale) {
3467
3804
  );
3468
3805
  return response.body;
3469
3806
  }
3470
- chunkMWMSFIWN_cjs.__name(runSimilar, "runSimilar");
3807
+ chunkL6DXCKVQ_cjs.__name(runSimilar, "runSimilar");
3471
3808
 
3472
3809
  // src/batch/batch-operations.ts
3473
3810
  var VERBS = ["create", "update", "replace", "delete", "singleton"];
@@ -3490,7 +3827,7 @@ async function runBatch(http, operations, options, clientLocale) {
3490
3827
  });
3491
3828
  return response.body;
3492
3829
  }
3493
- chunkMWMSFIWN_cjs.__name(runBatch, "runBatch");
3830
+ chunkL6DXCKVQ_cjs.__name(runBatch, "runBatch");
3494
3831
  function operationOf(operation, index, clientLocale) {
3495
3832
  const named = VERBS.filter((verb2) => operation[verb2] !== void 0);
3496
3833
  const verb = named[0];
@@ -3506,7 +3843,7 @@ function operationOf(operation, index, clientLocale) {
3506
3843
  ...parentId === void 0 ? {} : { parentId },
3507
3844
  ...sortOrder === void 0 ? {} : { sortOrder }
3508
3845
  };
3509
- const located = /* @__PURE__ */ chunkMWMSFIWN_cjs.__name((locale) => locale === void 0 ? {} : { locale }, "located");
3846
+ const located = /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((locale) => locale === void 0 ? {} : { locale }, "located");
3510
3847
  switch (verb) {
3511
3848
  case "create": {
3512
3849
  return {
@@ -3546,7 +3883,7 @@ function operationOf(operation, index, clientLocale) {
3546
3883
  }
3547
3884
  }
3548
3885
  }
3549
- chunkMWMSFIWN_cjs.__name(operationOf, "operationOf");
3886
+ chunkL6DXCKVQ_cjs.__name(operationOf, "operationOf");
3550
3887
  function targetOf(operation, clientLocale) {
3551
3888
  if (operation.entry !== void 0) return versionCheckOf(operation.entry);
3552
3889
  if (operation.id === void 0) {
@@ -3557,7 +3894,7 @@ function targetOf(operation, clientLocale) {
3557
3894
  const locale = callLocale(operation.locale, clientLocale);
3558
3895
  return { id: operation.id, ...locale === void 0 ? {} : { locale } };
3559
3896
  }
3560
- chunkMWMSFIWN_cjs.__name(targetOf, "targetOf");
3897
+ chunkL6DXCKVQ_cjs.__name(targetOf, "targetOf");
3561
3898
 
3562
3899
  // src/queries/query-call.ts
3563
3900
  async function runAdhocQuery(http, query, clientLocale) {
@@ -3577,7 +3914,7 @@ async function runAdhocQuery(http, query, clientLocale) {
3577
3914
  const terms = {};
3578
3915
  if (query.cursor !== void 0) terms.cursor = query.cursor;
3579
3916
  writeLocale(terms, query.locale ?? clientLocale);
3580
- if (typeof query.fresh === "string") terms[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = query.fresh;
3917
+ if (typeof query.fresh === "string") terms[chunkSHSK7UUY_cjs.FRESH_PARAMETER] = query.fresh;
3581
3918
  const parameters = { ...query.params };
3582
3919
  const body = {
3583
3920
  query: {
@@ -3597,7 +3934,7 @@ async function runAdhocQuery(http, query, clientLocale) {
3597
3934
  });
3598
3935
  return response.body;
3599
3936
  }
3600
- chunkMWMSFIWN_cjs.__name(runAdhocQuery, "runAdhocQuery");
3937
+ chunkL6DXCKVQ_cjs.__name(runAdhocQuery, "runAdhocQuery");
3601
3938
  function offsetOf(page, limit) {
3602
3939
  if (limit === void 0 || !Number.isInteger(page) || page < 1) {
3603
3940
  throw new ValidationError(
@@ -3607,12 +3944,12 @@ function offsetOf(page, limit) {
3607
3944
  }
3608
3945
  return (page - 1) * limit;
3609
3946
  }
3610
- chunkMWMSFIWN_cjs.__name(offsetOf, "offsetOf");
3947
+ chunkL6DXCKVQ_cjs.__name(offsetOf, "offsetOf");
3611
3948
  async function runNamedQuery(http, name, options, clientLocale) {
3612
3949
  const locale = options.locale ?? clientLocale;
3613
3950
  const terms = {};
3614
3951
  if (locale !== void 0 && locale !== "") terms.locale = locale;
3615
- if (typeof options.fresh === "string") terms[chunk6PTRZP5U_cjs.FRESH_PARAMETER] = options.fresh;
3952
+ if (typeof options.fresh === "string") terms[chunkSHSK7UUY_cjs.FRESH_PARAMETER] = options.fresh;
3616
3953
  const headers = readHeaders(options);
3617
3954
  const response = await http.send(
3618
3955
  "/v1/queries/{name}",
@@ -3627,17 +3964,17 @@ async function runNamedQuery(http, name, options, clientLocale) {
3627
3964
  );
3628
3965
  return response.body;
3629
3966
  }
3630
- chunkMWMSFIWN_cjs.__name(runNamedQuery, "runNamedQuery");
3967
+ chunkL6DXCKVQ_cjs.__name(runNamedQuery, "runNamedQuery");
3631
3968
 
3632
3969
  // src/config/dev-detection.ts
3633
3970
  function sandboxStateOf(resolution) {
3634
3971
  return resolution.state === "active" ? resolution.sandbox : resolution;
3635
3972
  }
3636
- chunkMWMSFIWN_cjs.__name(sandboxStateOf, "sandboxStateOf");
3973
+ chunkL6DXCKVQ_cjs.__name(sandboxStateOf, "sandboxStateOf");
3637
3974
  function getProcess() {
3638
3975
  return typeof process !== "undefined" ? process : void 0;
3639
3976
  }
3640
- chunkMWMSFIWN_cjs.__name(getProcess, "getProcess");
3977
+ chunkL6DXCKVQ_cjs.__name(getProcess, "getProcess");
3641
3978
  function getBuiltin(proc, id) {
3642
3979
  if (proc == null || typeof proc.getBuiltinModule !== "function") return null;
3643
3980
  try {
@@ -3646,13 +3983,13 @@ function getBuiltin(proc, id) {
3646
3983
  return null;
3647
3984
  }
3648
3985
  }
3649
- chunkMWMSFIWN_cjs.__name(getBuiltin, "getBuiltin");
3986
+ chunkL6DXCKVQ_cjs.__name(getBuiltin, "getBuiltin");
3650
3987
  function isProduction(proc) {
3651
3988
  return proc?.env?.NODE_ENV === "production";
3652
3989
  }
3653
- chunkMWMSFIWN_cjs.__name(isProduction, "isProduction");
3990
+ chunkL6DXCKVQ_cjs.__name(isProduction, "isProduction");
3654
3991
  function resolveFromEnv(proc, now) {
3655
- const verdict = chunkLSRPMNPT_cjs.parseDevEnv(proc?.env, now);
3992
+ const verdict = chunkZO6QDYJG_cjs.parseDevEnv(proc?.env, now);
3656
3993
  switch (verdict.state) {
3657
3994
  case "active":
3658
3995
  return {
@@ -3674,7 +4011,7 @@ function resolveFromEnv(proc, now) {
3674
4011
  return { state: "absent" };
3675
4012
  }
3676
4013
  }
3677
- chunkMWMSFIWN_cjs.__name(resolveFromEnv, "resolveFromEnv");
4014
+ chunkL6DXCKVQ_cjs.__name(resolveFromEnv, "resolveFromEnv");
3678
4015
  function resolveFromFile(proc, now) {
3679
4016
  if (proc == null || typeof proc.cwd !== "function") return { state: "absent" };
3680
4017
  const fs = getBuiltin(proc, "node:fs");
@@ -3682,7 +4019,7 @@ function resolveFromFile(proc, now) {
3682
4019
  if (fs == null || path == null) return { state: "absent" };
3683
4020
  let dir = proc.cwd();
3684
4021
  for (; ; ) {
3685
- const candidate = path.join(dir, chunkLSRPMNPT_cjs.DEV_CONTEXT_DIR, chunkLSRPMNPT_cjs.DEV_CONTEXT_FILENAME);
4022
+ const candidate = path.join(dir, chunkZO6QDYJG_cjs.DEV_CONTEXT_DIR, chunkZO6QDYJG_cjs.DEV_CONTEXT_FILENAME);
3686
4023
  let raw = null;
3687
4024
  try {
3688
4025
  if (fs.existsSync(candidate)) raw = fs.readFileSync(candidate, "utf8");
@@ -3690,7 +4027,7 @@ function resolveFromFile(proc, now) {
3690
4027
  return { state: "absent" };
3691
4028
  }
3692
4029
  if (raw !== null) {
3693
- const verdict = chunkLSRPMNPT_cjs.parseDevContextFile(raw, now);
4030
+ const verdict = chunkZO6QDYJG_cjs.parseDevContextFile(raw, now);
3694
4031
  switch (verdict.state) {
3695
4032
  case "active":
3696
4033
  return {
@@ -3718,7 +4055,7 @@ function resolveFromFile(proc, now) {
3718
4055
  }
3719
4056
  return { state: "absent" };
3720
4057
  }
3721
- chunkMWMSFIWN_cjs.__name(resolveFromFile, "resolveFromFile");
4058
+ chunkL6DXCKVQ_cjs.__name(resolveFromFile, "resolveFromFile");
3722
4059
  function resolveDevOverride(dev) {
3723
4060
  if (dev === false) return { state: "disabled" };
3724
4061
  const proc = getProcess();
@@ -3728,18 +4065,18 @@ function resolveDevOverride(dev) {
3728
4065
  if (fromEnv.state !== "absent") return fromEnv;
3729
4066
  return resolveFromFile(proc, now);
3730
4067
  }
3731
- chunkMWMSFIWN_cjs.__name(resolveDevOverride, "resolveDevOverride");
4068
+ chunkL6DXCKVQ_cjs.__name(resolveDevOverride, "resolveDevOverride");
3732
4069
 
3733
4070
  // src/config/preview-environment.ts
3734
4071
  function readPreviewAtRequest() {
3735
4072
  const env = typeof process === "undefined" ? void 0 : process.env;
3736
- return chunk6PTRZP5U_cjs.previewAtRequest(isEnvironment(env) ? env : {});
4073
+ return chunk7I3SC7SV_cjs.previewAtRequest(isEnvironment(env) ? env : {});
3737
4074
  }
3738
- chunkMWMSFIWN_cjs.__name(readPreviewAtRequest, "readPreviewAtRequest");
4075
+ chunkL6DXCKVQ_cjs.__name(readPreviewAtRequest, "readPreviewAtRequest");
3739
4076
  function isEnvironment(value) {
3740
4077
  return typeof value === "object" && value !== null;
3741
4078
  }
3742
- chunkMWMSFIWN_cjs.__name(isEnvironment, "isEnvironment");
4079
+ chunkL6DXCKVQ_cjs.__name(isEnvironment, "isEnvironment");
3743
4080
 
3744
4081
  // src/config/types.ts
3745
4082
  var DEFAULT_CONFIG = {
@@ -3789,27 +4126,27 @@ function validateConfig(config) {
3789
4126
  );
3790
4127
  }
3791
4128
  }
3792
- chunkMWMSFIWN_cjs.__name(validateConfig, "validateConfig");
4129
+ chunkL6DXCKVQ_cjs.__name(validateConfig, "validateConfig");
3793
4130
  var devOverrideNotified = false;
3794
4131
  function resolveConfig(userConfig) {
3795
4132
  validateConfig(userConfig);
3796
4133
  return withHandshake(withDefaults(DEFAULT_CONFIG, userConfig, DEFAULT_CONFIG));
3797
4134
  }
3798
- chunkMWMSFIWN_cjs.__name(resolveConfig, "resolveConfig");
4135
+ chunkL6DXCKVQ_cjs.__name(resolveConfig, "resolveConfig");
3799
4136
  function resolveConfigUpdate(configured, update) {
3800
4137
  validateConfig(update);
3801
4138
  const base = update.apiKey === void 0 ? configured : withoutKeyHeader(configured);
3802
4139
  return withHandshake(withDefaults(base, update, DEFAULT_CONFIG));
3803
4140
  }
3804
- chunkMWMSFIWN_cjs.__name(resolveConfigUpdate, "resolveConfigUpdate");
4141
+ chunkL6DXCKVQ_cjs.__name(resolveConfigUpdate, "resolveConfigUpdate");
3805
4142
  function withConfiguredKey(configured, apiKey) {
3806
4143
  return { ...withoutKeyHeader(configured), apiKey };
3807
4144
  }
3808
- chunkMWMSFIWN_cjs.__name(withConfiguredKey, "withConfiguredKey");
4145
+ chunkL6DXCKVQ_cjs.__name(withConfiguredKey, "withConfiguredKey");
3809
4146
  function withoutKeyHeader(configured) {
3810
4147
  return { ...configured, headers: layerHeaders(configured.headers, { [API_KEY_HEADER]: null }) };
3811
4148
  }
3812
- chunkMWMSFIWN_cjs.__name(withoutKeyHeader, "withoutKeyHeader");
4149
+ chunkL6DXCKVQ_cjs.__name(withoutKeyHeader, "withoutKeyHeader");
3813
4150
  function withHandshake(configured) {
3814
4151
  const dev = resolveDevOverride(configured.dev);
3815
4152
  const merged = withDefaults(
@@ -3837,13 +4174,13 @@ function withHandshake(configured) {
3837
4174
  }
3838
4175
  return { config: merged, sandbox: sandboxStateOf(dev), configured };
3839
4176
  }
3840
- chunkMWMSFIWN_cjs.__name(withHandshake, "withHandshake");
4177
+ chunkL6DXCKVQ_cjs.__name(withHandshake, "withHandshake");
3841
4178
  var previewNotified = false;
3842
4179
  function withPreview(configured) {
3843
4180
  if (configured.dataset !== void 0 || !isPreviewKey(configured.apiKey)) return configured;
3844
4181
  const preview = readPreviewAtRequest();
3845
4182
  if (preview.state !== "preview") return configured;
3846
- const dataset = chunk6PTRZP5U_cjs.previewDatasetSlug(preview.branch);
4183
+ const dataset = chunkSHSK7UUY_cjs.previewDatasetSlug(preview.branch);
3847
4184
  noteDerivedPreview(dataset);
3848
4185
  if (!previewNotified) {
3849
4186
  previewNotified = true;
@@ -3853,7 +4190,7 @@ function withPreview(configured) {
3853
4190
  }
3854
4191
  return { ...configured, dataset };
3855
4192
  }
3856
- chunkMWMSFIWN_cjs.__name(withPreview, "withPreview");
4193
+ chunkL6DXCKVQ_cjs.__name(withPreview, "withPreview");
3857
4194
  function withDefaults(base, given2, defaults) {
3858
4195
  const merged = new Map(Object.entries(base));
3859
4196
  const givenValues = new Map(Object.entries(given2 ?? {}));
@@ -3876,11 +4213,11 @@ function withDefaults(base, given2, defaults) {
3876
4213
  }
3877
4214
  return Object.fromEntries(merged);
3878
4215
  }
3879
- chunkMWMSFIWN_cjs.__name(withDefaults, "withDefaults");
4216
+ chunkL6DXCKVQ_cjs.__name(withDefaults, "withDefaults");
3880
4217
  function isOptionBag(value) {
3881
4218
  return typeof value === "object" && value !== null && !Array.isArray(value);
3882
4219
  }
3883
- chunkMWMSFIWN_cjs.__name(isOptionBag, "isOptionBag");
4220
+ chunkL6DXCKVQ_cjs.__name(isOptionBag, "isOptionBag");
3884
4221
 
3885
4222
  // src/client/create-client.ts
3886
4223
  var _TypedRelyIOClient = class _TypedRelyIOClient {
@@ -3889,31 +4226,73 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
3889
4226
  * The one HTTP client every sub-client sends through. `updateConfig()` and `setApiKey()` change it
3890
4227
  * in place rather than replacing it, so a sub-client taken before either sends through the change.
3891
4228
  */
3892
- chunkMWMSFIWN_cjs.__publicField(this, "httpClient");
3893
- chunkMWMSFIWN_cjs.__publicField(this, "config");
4229
+ chunkL6DXCKVQ_cjs.__publicField(this, "httpClient");
4230
+ chunkL6DXCKVQ_cjs.__publicField(this, "config");
3894
4231
  /**
3895
4232
  * The configuration as `createClient()`, `setApiKey()` and `updateConfig()` gave it, before the
3896
4233
  * `relyio dev` handshake: what the next update is laid over, and what `with()` starts from.
3897
4234
  */
3898
- chunkMWMSFIWN_cjs.__publicField(this, "configured");
3899
- chunkMWMSFIWN_cjs.__publicField(this, "_sandbox");
3900
- chunkMWMSFIWN_cjs.__publicField(this, "_schema");
4235
+ chunkL6DXCKVQ_cjs.__publicField(this, "configured");
4236
+ chunkL6DXCKVQ_cjs.__publicField(this, "_sandbox");
4237
+ chunkL6DXCKVQ_cjs.__publicField(this, "_schema");
3901
4238
  /**
3902
4239
  * The client's locale as it is when a call is made. Every sub-client and builder is handed this
3903
4240
  * rather than a copy of the locale, so one taken before `updateConfig({ locale })` sends the new
3904
4241
  * locale, or none after `locale: null` (REL-1453).
3905
4242
  */
3906
- chunkMWMSFIWN_cjs.__publicField(this, "currentLocale", /* @__PURE__ */ chunkMWMSFIWN_cjs.__name(() => this.defaults.locale ?? (this.parent === void 0 ? this.config.locale : this.parent.currentLocale()), "currentLocale"));
4243
+ chunkL6DXCKVQ_cjs.__publicField(this, "currentLocale", /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name(() => this.defaults.locale ?? (this.parent === void 0 ? this.config.locale : this.parent.currentLocale()), "currentLocale"));
3907
4244
  /**
3908
4245
  * The client `with()` was called on, for a client it made: whose key, base URL and configuration
3909
4246
  * this one reads with as they are when each request is sent. `undefined` for a client
3910
4247
  * `createClient()` made, which reads its own.
3911
4248
  */
3912
- chunkMWMSFIWN_cjs.__publicField(this, "parent");
4249
+ chunkL6DXCKVQ_cjs.__publicField(this, "parent");
3913
4250
  /** What `with()` gave this client over its parent's: the locale and dataset it names, and no other. */
3914
- chunkMWMSFIWN_cjs.__publicField(this, "defaults", {});
4251
+ chunkL6DXCKVQ_cjs.__publicField(this, "defaults", {});
3915
4252
  /** 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");
4253
+ chunkL6DXCKVQ_cjs.__publicField(this, "_liveClientId");
4254
+ /**
4255
+ * The Records of one Record type (spec 1, REL-3771): `create`, `list`, `get`, `update`, `delete`.
4256
+ * Type-safe when a schema is provided — the names autocomplete its `recordTypes` and the fields
4257
+ * are the type's. `relyio.records.batch([...])` writes Records of any types in one transaction,
4258
+ * all or none (REL-3774).
4259
+ *
4260
+ * A Record is an app's data, written by your server with a secret key and live the moment it
4261
+ * lands; a publishable key is refused on every Record route (`PUBLISHABLE_KEY_REFUSED`).
4262
+ *
4263
+ * @example
4264
+ * ```typescript
4265
+ * const order = await relyio.records('order').create({ shopperEmail: 'ada@example.com', total: 19 })
4266
+ * const { data: orders } = await relyio.records('order').list({ where: { status: 'paid' } })
4267
+ * await relyio.records.batch([
4268
+ * { op: 'decrement', type: 'inventory', where: { product: mugId }, field: 'available', by: 1 },
4269
+ * { op: 'create', type: 'order', fields: { shopperEmail: 'ada@example.com', total: 19 } },
4270
+ * ])
4271
+ * ```
4272
+ */
4273
+ chunkL6DXCKVQ_cjs.__publicField(this, "records", Object.assign(
4274
+ (recordType) => new RecordsClient(this.httpClient, recordType),
4275
+ {
4276
+ // Read when called, never when made: `with()` and `updateConfig()` move `httpClient`
4277
+ batch: /* @__PURE__ */ chunkL6DXCKVQ_cjs.__name((operations, options) => sendRecordBatch(this.httpClient, operations, options), "batch")
4278
+ }
4279
+ // The one function both call signatures describe; the cast restates the schema's typing of its
4280
+ // argument and answer, as `content()` does, and widens nothing it is called with.
4281
+ ));
4282
+ /**
4283
+ * The project's Functions, by name (spec 2, REL-3821): `relyio.functions.checkout({ cartId })`
4284
+ * runs the Function `checkout` that the key's Branch runs, on the key's Dataset, and answers its
4285
+ * output. Call it from your server with a secret key; a run that failed throws
4286
+ * `FunctionRunFailedError` and one past five minutes `FunctionRunTimedOutError`, each naming the
4287
+ * run. Never retried: a Function may write.
4288
+ *
4289
+ * @example
4290
+ * ```typescript
4291
+ * const { orderId } = (await relyio.functions.checkout({ cartId })) as { orderId: string }
4292
+ * ```
4293
+ */
4294
+ // Read when called, never when made: `with()` and `updateConfig()` move `httpClient`
4295
+ chunkL6DXCKVQ_cjs.__publicField(this, "functions", functionsAccessor(() => this.httpClient));
3917
4296
  const { schema, ...clientConfig } = config;
3918
4297
  this._schema = schema;
3919
4298
  const resolved = resolveConfig(clientConfig);
@@ -3957,7 +4336,7 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
3957
4336
  * its own.
3958
4337
  */
3959
4338
  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");
4339
+ 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
4340
  return call;
3962
4341
  }
3963
4342
  // ============================================================================
@@ -4414,12 +4793,12 @@ var _TypedRelyIOClient = class _TypedRelyIOClient {
4414
4793
  return locales.map((locale) => ({ ...locale, default: locale.code === defaultLocale }));
4415
4794
  }
4416
4795
  };
4417
- chunkMWMSFIWN_cjs.__name(_TypedRelyIOClient, "TypedRelyIOClient");
4796
+ chunkL6DXCKVQ_cjs.__name(_TypedRelyIOClient, "TypedRelyIOClient");
4418
4797
  var TypedRelyIOClient = _TypedRelyIOClient;
4419
4798
  function createClient(config) {
4420
4799
  return new TypedRelyIOClient(config);
4421
4800
  }
4422
- chunkMWMSFIWN_cjs.__name(createClient, "createClient");
4801
+ chunkL6DXCKVQ_cjs.__name(createClient, "createClient");
4423
4802
  function randomClientId() {
4424
4803
  const bytes = new Uint8Array(16);
4425
4804
  const random = globalThis.crypto;
@@ -4432,7 +4811,7 @@ function randomClientId() {
4432
4811
  }
4433
4812
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
4434
4813
  }
4435
- chunkMWMSFIWN_cjs.__name(randomClientId, "randomClientId");
4814
+ chunkL6DXCKVQ_cjs.__name(randomClientId, "randomClientId");
4436
4815
 
4437
4816
  exports.AssetClient = AssetClient;
4438
4817
  exports.AssetFileBuilder = AssetFileBuilder;
@@ -4446,6 +4825,9 @@ exports.DefaultRetryPolicy = DefaultRetryPolicy;
4446
4825
  exports.ErrorMapper = ErrorMapper;
4447
4826
  exports.FileUploadError = FileUploadError;
4448
4827
  exports.FileValidationError = FileValidationError;
4828
+ exports.FunctionContainersBusyError = FunctionContainersBusyError;
4829
+ exports.FunctionRunFailedError = FunctionRunFailedError;
4830
+ exports.FunctionRunTimedOutError = FunctionRunTimedOutError;
4449
4831
  exports.HttpClient = HttpClient;
4450
4832
  exports.InvalidApiKeyError = InvalidApiKeyError;
4451
4833
  exports.InvalidPayloadError = InvalidPayloadError;
@@ -4459,8 +4841,10 @@ exports.PREVIEW_KEY_PREFIX = PREVIEW_KEY_PREFIX;
4459
4841
  exports.PUBLISHABLE_KEY_PREFIX = PUBLISHABLE_KEY_PREFIX;
4460
4842
  exports.PayloadTooLargeError = PayloadTooLargeError;
4461
4843
  exports.PlanFeatureUnavailableError = PlanFeatureUnavailableError;
4844
+ exports.PublishableKeyRefusedError = PublishableKeyRefusedError;
4462
4845
  exports.RateLimitError = RateLimitError;
4463
4846
  exports.ReadOnlyKeyError = ReadOnlyKeyError;
4847
+ exports.RecordsClient = RecordsClient;
4464
4848
  exports.ResourceConflictError = ResourceConflictError;
4465
4849
  exports.ResourceExpiredError = ResourceExpiredError;
4466
4850
  exports.ResourceNotFoundError = ResourceNotFoundError;
@@ -4484,10 +4868,11 @@ exports.isPublishableKey = isPublishableKey;
4484
4868
  exports.isReplaySafe = isReplaySafe;
4485
4869
  exports.isResourceNotFound = isResourceNotFound;
4486
4870
  exports.matchRoute = matchRoute;
4871
+ exports.refusedOperationOf = refusedOperationOf;
4487
4872
  exports.retryPolicyFor = retryPolicyFor;
4488
4873
  exports.serviceInstructedDelayMs = serviceInstructedDelayMs;
4489
4874
  exports.sleep = sleep;
4490
4875
  exports.validateFile = validateFile;
4491
4876
  exports.versionCheckOf = versionCheckOf;
4492
- //# sourceMappingURL=chunk-6E22GYPB.cjs.map
4493
- //# sourceMappingURL=chunk-6E22GYPB.cjs.map
4877
+ //# sourceMappingURL=chunk-IFKF72VJ.cjs.map
4878
+ //# sourceMappingURL=chunk-IFKF72VJ.cjs.map