@withgateway/sdk 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cli.js +3971 -2338
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3950 -2318
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +214 -41
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +206 -35
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-DAb-FCMg.d.ts → index-DUHmS74p.d.ts} +3 -13
- package/dist/{index-D6oi1TWE.d.mts → index-mJhG3vZU.d.mts} +3 -13
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1456 -564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1433 -557
- package/dist/index.mjs.map +1 -1
- package/dist/{media-CbcAfQvd.d.mts → media-BIApiPzS.d.mts} +21 -2
- package/dist/{media-CbcAfQvd.d.ts → media-BIApiPzS.d.ts} +21 -2
- package/dist/traces/index.d.mts +1 -1
- package/dist/traces/index.d.ts +1 -1
- package/dist/traces/index.js +211 -38
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +203 -32
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +2 -2
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/index.js +96 -21
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +96 -21
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +300 -123
- package/dist/worlds/index.d.ts +300 -123
- package/dist/worlds/index.js +1385 -508
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1377 -501
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_bundle.py +2 -27
- package/runtime/gatewaysdk/environment/_materialize.py +49 -69
- package/runtime/gatewaysdk/environment/_world.py +122 -197
- package/runtime/gatewaysdk/environment/backing.py +137 -0
- package/runtime/gatewaysdk/environment/core.py +1 -1
- package/runtime/gatewaysdk/environment/legacy_sqlite.py +301 -0
- package/runtime/gatewaysdk/environment/reward_keys.py +25 -0
- package/runtime/gatewaysdk/environment/runtime.py +8 -13
- package/runtime/gatewaysdk/environment/schema/__init__.py +4 -4
- package/runtime/gatewaysdk/environment/schema/admin_routes.py +86 -0
- package/runtime/gatewaysdk/environment/schema/api.py +266 -515
- package/runtime/gatewaysdk/environment/schema/batch.py +42 -37
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +17 -5
- package/runtime/gatewaysdk/environment/schema/call_log.py +291 -0
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +344 -0
- package/runtime/gatewaysdk/environment/schema/cast.py +31 -4
- package/runtime/gatewaysdk/environment/schema/compiler.py +334 -158
- package/runtime/gatewaysdk/environment/schema/conform.py +8 -12
- package/runtime/gatewaysdk/environment/schema/connector.py +27 -62
- package/runtime/gatewaysdk/environment/schema/data.py +50 -207
- package/runtime/gatewaysdk/environment/schema/database/__init__.py +24 -0
- package/runtime/gatewaysdk/environment/schema/database/audit.py +121 -0
- package/runtime/gatewaysdk/environment/schema/database/base.py +995 -0
- package/runtime/gatewaysdk/environment/schema/database/budget.py +33 -0
- package/runtime/gatewaysdk/environment/schema/database/connections.py +101 -0
- package/runtime/gatewaysdk/environment/schema/database/engines.py +8 -0
- package/runtime/gatewaysdk/environment/schema/database/guard.py +208 -0
- package/runtime/gatewaysdk/environment/schema/database/ingest.py +154 -0
- package/runtime/gatewaysdk/environment/schema/database/matching.py +58 -0
- package/runtime/gatewaysdk/environment/schema/database/provenance.py +30 -0
- package/runtime/gatewaysdk/environment/schema/database/rows.py +53 -0
- package/runtime/gatewaysdk/environment/schema/database/runtime_rows.py +39 -0
- package/runtime/gatewaysdk/environment/schema/database/sqlite.py +367 -0
- package/runtime/gatewaysdk/environment/schema/domain_migration.py +236 -0
- package/runtime/gatewaysdk/environment/schema/envelope.py +169 -0
- package/runtime/gatewaysdk/environment/schema/extract.py +6 -13
- package/runtime/gatewaysdk/environment/schema/grading.py +45 -30
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +142 -12
- package/runtime/gatewaysdk/environment/schema/host.py +158 -250
- package/runtime/gatewaysdk/environment/schema/lanes.py +53 -0
- package/runtime/gatewaysdk/environment/schema/local.py +44 -71
- package/runtime/gatewaysdk/environment/schema/mapping.py +5 -25
- package/runtime/gatewaysdk/environment/schema/openapi_import.py +112 -73
- package/runtime/gatewaysdk/environment/schema/openapi_paging.py +147 -0
- package/runtime/gatewaysdk/environment/schema/openapi_payloads.py +288 -0
- package/runtime/gatewaysdk/environment/schema/openapi_routes.py +97 -102
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +113 -30
- package/runtime/gatewaysdk/environment/schema/platform.py +124 -178
- package/runtime/gatewaysdk/environment/schema/platform_import.py +2 -3
- package/runtime/gatewaysdk/environment/schema/platform_query.py +61 -5
- package/runtime/gatewaysdk/environment/schema/primary_key.py +61 -0
- package/runtime/gatewaysdk/environment/schema/proof.py +19 -12
- package/runtime/gatewaysdk/environment/schema/runtime.py +77 -160
- package/runtime/gatewaysdk/environment/schema/served_names.py +58 -0
- package/runtime/gatewaysdk/environment/schema/session_files.py +166 -0
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +2 -2
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +22 -14
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +29 -3
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +16 -16
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +18 -18
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +15 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/slack.py +4 -8
- package/runtime/gatewaysdk/environment/schema/snapshot.py +385 -129
- package/runtime/gatewaysdk/environment/schema/store_contract.py +8 -14
- package/runtime/gatewaysdk/environment/schema/tasks.py +140 -55
- package/runtime/gatewaysdk/environment/schema/tools_world.py +110 -87
- package/runtime/gatewaysdk/environment/schema/ui.py +24 -5
- package/runtime/gatewaysdk/environment/schema/ui_static/app.js +100 -130
- package/runtime/gatewaysdk/environment/schema/ui_static/index.html +1 -8
- package/runtime/gatewaysdk/environment/schema/validation.py +166 -40
- package/runtime/gatewaysdk/environment/schema/workers.py +142 -57
- package/runtime/gatewaysdk/environment/schema/world_sql.py +81 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +71 -39
- package/runtime/gatewaysdk/environment/score.py +57 -0
- package/runtime/gatewaysdk/environment/secret_values.py +36 -0
- package/runtime/gatewaysdk/environment/world.py +42 -3
- package/runtime/gatewaysdk/environment/world_session_contract.py +32 -5
- package/skills/benchmarks-getting-started/SKILL.md +2 -2
- package/skills/connector-schema-authoring/SKILL.md +22 -14
- package/skills/connector-schema-authoring/connector-worlds.md +26 -10
- package/skills/connector-schema-authoring/world-schema.md +111 -51
- package/skills/world-data-ingestion/ROWS.md +29 -3
- package/skills/world-data-ingestion/SKILL.md +16 -16
- package/skills/worlds-getting-started/SKILL.md +18 -18
- package/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
- package/skills/worlds-getting-started/references/gotchas.md +15 -0
- package/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/store.py +0 -1013
package/dist/tracing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-
|
|
2
|
-
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-
|
|
1
|
+
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-mJhG3vZU.mjs';
|
|
2
|
+
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-BIApiPzS.mjs';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import '../scores/index.mjs';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
package/dist/tracing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-
|
|
2
|
-
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-
|
|
1
|
+
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-DUHmS74p.js';
|
|
2
|
+
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-BIApiPzS.js';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import '../scores/index.js';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
package/dist/tracing/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports2, module2) {
|
|
30
30
|
module2.exports = {
|
|
31
31
|
name: "@withgateway/sdk",
|
|
32
|
-
version: "0.3.
|
|
32
|
+
version: "0.3.3",
|
|
33
33
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
34
34
|
main: "./dist/index.js",
|
|
35
35
|
module: "./dist/index.mjs",
|
|
@@ -1204,22 +1204,52 @@ async function registerBuild(params) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
|
|
1207
|
-
// src/tracing/
|
|
1208
|
-
var
|
|
1207
|
+
// src/tracing/prerequisites.ts
|
|
1208
|
+
var GATEWAY_ENV = {
|
|
1209
1209
|
HOST: "GATEWAY_HOST",
|
|
1210
1210
|
PUBLIC_KEY: "GATEWAY_PUBLIC_KEY",
|
|
1211
1211
|
SECRET_KEY: "GATEWAY_SECRET_KEY",
|
|
1212
|
+
API_KEY: "GATEWAY_API_KEY",
|
|
1212
1213
|
ENDPOINT: "GATEWAY_OTLP_ENDPOINT"
|
|
1213
1214
|
};
|
|
1214
|
-
var
|
|
1215
|
-
var
|
|
1216
|
-
|
|
1217
|
-
|
|
1215
|
+
var OTLP_TRACES_PATH = "/api/public/otel/v1/traces";
|
|
1216
|
+
var OPENTELEMETRY_PEERS = {
|
|
1217
|
+
"@opentelemetry/api": "1.9.0",
|
|
1218
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.222.0",
|
|
1219
|
+
"@opentelemetry/resources": "2.11.0",
|
|
1220
|
+
"@opentelemetry/sdk-trace-base": "2.11.0",
|
|
1221
|
+
"@opentelemetry/sdk-trace-node": "2.11.0"
|
|
1218
1222
|
};
|
|
1223
|
+
var PINNED_PEERS = Object.entries(OPENTELEMETRY_PEERS).map(([name, version]) => `${name}@${version}`).join(" ");
|
|
1224
|
+
var MODULE_NOT_FOUND = /* @__PURE__ */ new Set(["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"]);
|
|
1219
1225
|
function getEnv(key) {
|
|
1220
1226
|
const value = process.env[key];
|
|
1221
1227
|
return value ? value : void 0;
|
|
1222
1228
|
}
|
|
1229
|
+
function isGatewayConfigured() {
|
|
1230
|
+
return !!(getEnv(GATEWAY_ENV.HOST) && getEnv(GATEWAY_ENV.PUBLIC_KEY) && getEnv(GATEWAY_ENV.SECRET_KEY));
|
|
1231
|
+
}
|
|
1232
|
+
var OpenTelemetryMissing = class _OpenTelemetryMissing extends Error {
|
|
1233
|
+
constructor() {
|
|
1234
|
+
super(
|
|
1235
|
+
`OpenTelemetry packages not found. Install them next to @withgateway/sdk, at the versions it is tested with:
|
|
1236
|
+
npm install ${PINNED_PEERS}
|
|
1237
|
+
npm install -g ${PINNED_PEERS} (the gateway CLI, when it was installed with npm install -g)`
|
|
1238
|
+
);
|
|
1239
|
+
this.name = "OpenTelemetryMissing";
|
|
1240
|
+
}
|
|
1241
|
+
static explains(error) {
|
|
1242
|
+
if (error instanceof _OpenTelemetryMissing) return true;
|
|
1243
|
+
const { code, message } = error ?? {};
|
|
1244
|
+
return MODULE_NOT_FOUND.has(String(code)) && String(message).includes("@opentelemetry/");
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/tracing/init.ts
|
|
1249
|
+
var state = {
|
|
1250
|
+
initialized: false,
|
|
1251
|
+
provider: null
|
|
1252
|
+
};
|
|
1223
1253
|
function log(message, ...args) {
|
|
1224
1254
|
if (state.debug) {
|
|
1225
1255
|
console.log(`[gatewaysdk.tracing] ${message}`, ...args);
|
|
@@ -1229,10 +1259,10 @@ function warn(message, ...args) {
|
|
|
1229
1259
|
console.warn(`[gatewaysdk.tracing] ${message}`, ...args);
|
|
1230
1260
|
}
|
|
1231
1261
|
function buildProvider(config, logFn) {
|
|
1232
|
-
const host = config.host ?? getEnv(
|
|
1233
|
-
const publicKey = config.publicKey ?? getEnv(
|
|
1234
|
-
const secretKey = config.secretKey ?? getEnv(
|
|
1235
|
-
const endpoint = config.endpoint ?? getEnv(
|
|
1262
|
+
const host = config.host ?? getEnv(GATEWAY_ENV.HOST);
|
|
1263
|
+
const publicKey = config.publicKey ?? getEnv(GATEWAY_ENV.PUBLIC_KEY);
|
|
1264
|
+
const secretKey = config.secretKey ?? getEnv(GATEWAY_ENV.SECRET_KEY);
|
|
1265
|
+
const endpoint = config.endpoint ?? getEnv(GATEWAY_ENV.ENDPOINT) ?? (host ? `${host.replace(/\/$/, "")}${OTLP_TRACES_PATH}` : void 0);
|
|
1236
1266
|
const missing = [];
|
|
1237
1267
|
if (!host) missing.push("host (or GATEWAY_HOST env var)");
|
|
1238
1268
|
if (!publicKey) missing.push("publicKey (or GATEWAY_PUBLIC_KEY env var)");
|
|
@@ -1269,9 +1299,7 @@ function buildProvider(config, logFn) {
|
|
|
1269
1299
|
ATTR_SERVICE_NAME = "service.name";
|
|
1270
1300
|
}
|
|
1271
1301
|
} catch {
|
|
1272
|
-
throw new
|
|
1273
|
-
"OpenTelemetry packages not found. Install them with:\nnpm install @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http @opentelemetry/resources"
|
|
1274
|
-
);
|
|
1302
|
+
throw new OpenTelemetryMissing();
|
|
1275
1303
|
}
|
|
1276
1304
|
const resourceAttrs = {
|
|
1277
1305
|
[ATTR_SERVICE_NAME]: config.serviceName ?? "gatewaysdk-tracing"
|
|
@@ -1477,12 +1505,6 @@ async function shutdown() {
|
|
|
1477
1505
|
function isInitialized() {
|
|
1478
1506
|
return state.initialized;
|
|
1479
1507
|
}
|
|
1480
|
-
function isGatewayConfigured() {
|
|
1481
|
-
const host = getEnv(ENV_VARS.HOST);
|
|
1482
|
-
const publicKey = getEnv(ENV_VARS.PUBLIC_KEY);
|
|
1483
|
-
const secretKey = getEnv(ENV_VARS.SECRET_KEY);
|
|
1484
|
-
return !!(host && publicKey && secretKey);
|
|
1485
|
-
}
|
|
1486
1508
|
|
|
1487
1509
|
// src/tracing/observe.ts
|
|
1488
1510
|
var import_api3 = require("@opentelemetry/api");
|
|
@@ -1810,6 +1832,56 @@ var UnreachableError = class extends Error {
|
|
|
1810
1832
|
route;
|
|
1811
1833
|
failure;
|
|
1812
1834
|
};
|
|
1835
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1836
|
+
var RetryPolicy = class _RetryPolicy {
|
|
1837
|
+
constructor(delaysMs, wait = sleep, budgetMs = Number.POSITIVE_INFINITY, now = Date.now) {
|
|
1838
|
+
this.delaysMs = delaysMs;
|
|
1839
|
+
this.wait = wait;
|
|
1840
|
+
this.budgetMs = budgetMs;
|
|
1841
|
+
this.now = now;
|
|
1842
|
+
}
|
|
1843
|
+
delaysMs;
|
|
1844
|
+
wait;
|
|
1845
|
+
budgetMs;
|
|
1846
|
+
now;
|
|
1847
|
+
static NONE = new _RetryPolicy([]);
|
|
1848
|
+
/** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
|
|
1849
|
+
* within the budget plus one request timeout. */
|
|
1850
|
+
static FILING = new _RetryPolicy([250, 500, 1e3, 2e3, 4e3, 8e3, 16e3, 3e4], sleep, 3e5);
|
|
1851
|
+
static TRANSIENT_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
1852
|
+
async run(attempt) {
|
|
1853
|
+
const started = this.now();
|
|
1854
|
+
for (let tries = 0; ; tries += 1) {
|
|
1855
|
+
const outcome = await Attempt.of(attempt);
|
|
1856
|
+
const delayMs = this.delaysMs[tries];
|
|
1857
|
+
const spent = delayMs === void 0 || this.now() - started + delayMs >= this.budgetMs;
|
|
1858
|
+
if (!outcome.transient || spent) return outcome.settle();
|
|
1859
|
+
await this.wait(delayMs);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
var Attempt = class _Attempt {
|
|
1864
|
+
constructor(reply, error, transient) {
|
|
1865
|
+
this.reply = reply;
|
|
1866
|
+
this.error = error;
|
|
1867
|
+
this.transient = transient;
|
|
1868
|
+
}
|
|
1869
|
+
reply;
|
|
1870
|
+
error;
|
|
1871
|
+
transient;
|
|
1872
|
+
static async of(attempt) {
|
|
1873
|
+
try {
|
|
1874
|
+
const reply = await attempt();
|
|
1875
|
+
return new _Attempt(reply, null, RetryPolicy.TRANSIENT_STATUSES.has(reply.status));
|
|
1876
|
+
} catch (error) {
|
|
1877
|
+
return new _Attempt(null, error, error instanceof UnreachableError);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
settle() {
|
|
1881
|
+
if (this.reply) return this.reply;
|
|
1882
|
+
throw this.error;
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1813
1885
|
var PlatformTransport = class {
|
|
1814
1886
|
constructor(endpoint, timeoutMs = platformTimeoutMs()) {
|
|
1815
1887
|
this.endpoint = endpoint;
|
|
@@ -1823,6 +1895,9 @@ var PlatformTransport = class {
|
|
|
1823
1895
|
}
|
|
1824
1896
|
async send(method, route, body, opts = {}) {
|
|
1825
1897
|
const timeoutMs = this.budget(opts.timeoutMs);
|
|
1898
|
+
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route, body, timeoutMs));
|
|
1899
|
+
}
|
|
1900
|
+
async once(method, route, body, timeoutMs) {
|
|
1826
1901
|
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
1827
1902
|
const controller = new AbortController();
|
|
1828
1903
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -1905,7 +1980,7 @@ var MediaUploader = class _MediaUploader {
|
|
|
1905
1980
|
put;
|
|
1906
1981
|
maxBytes;
|
|
1907
1982
|
/** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
|
|
1908
|
-
* `GATEWAY_SECRET_KEY`
|
|
1983
|
+
* `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
|
|
1909
1984
|
static fromEnv(env = process.env) {
|
|
1910
1985
|
const host = env.GATEWAY_HOST;
|
|
1911
1986
|
const publicKey = env.GATEWAY_PUBLIC_KEY;
|