@withgateway/sdk 0.4.0 → 0.9.1
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/dist/agents/index.d.mts +573 -0
- package/dist/agents/index.d.ts +573 -0
- package/dist/agents/index.js +1443 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/index.mjs +1394 -0
- package/dist/agents/index.mjs.map +1 -0
- package/dist/apiError-DHpfbmdx.d.mts +17 -0
- package/dist/apiError-DHpfbmdx.d.ts +17 -0
- package/dist/cli.js +5655 -1890
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +5769 -2005
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +3 -1
- package/dist/files/index.d.ts +3 -1
- package/dist/files/index.js +418 -120
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +418 -120
- package/dist/files/index.mjs.map +1 -1
- package/dist/hooks/index.js +346 -136
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +346 -136
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-DUHmS74p.d.ts → index-DIN14Lhg.d.ts} +27 -4
- package/dist/{index-mJhG3vZU.d.mts → index-DuB-eQ0Z.d.mts} +27 -4
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +2862 -438
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2820 -431
- package/dist/index.mjs.map +1 -1
- package/dist/media-CQUC7TkS.d.mts +39 -0
- package/dist/media-DQnBloaX.d.ts +39 -0
- package/dist/replay/index.d.mts +1 -1
- package/dist/replay/index.d.ts +1 -1
- package/dist/replay/index.js.map +1 -1
- package/dist/replay/index.mjs.map +1 -1
- package/dist/traces/index.d.mts +3 -1
- package/dist/traces/index.d.ts +3 -1
- package/dist/traces/index.js +418 -120
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +418 -120
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +3 -2
- package/dist/tracing/index.d.ts +3 -2
- package/dist/tracing/index.js +257 -16
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +257 -16
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/transport-CpRe7zgd.d.mts +123 -0
- package/dist/transport-CpRe7zgd.d.ts +123 -0
- package/dist/worlds/index.d.mts +2086 -1749
- package/dist/worlds/index.d.ts +2086 -1749
- package/dist/worlds/index.js +1471 -269
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1466 -265
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +6 -1
- package/runtime/gatewaysdk/environment/_bundle.py +4 -6
- package/runtime/gatewaysdk/environment/_world.py +24 -1
- package/runtime/gatewaysdk/environment/bundle_manifest.py +243 -0
- package/runtime/gatewaysdk/environment/runtime.py +45 -2
- package/runtime/gatewaysdk/environment/schema/__main__.py +2 -2
- package/runtime/gatewaysdk/environment/schema/_slack_fidelity.py +8 -23
- package/runtime/gatewaysdk/environment/schema/api.py +27 -7
- package/runtime/gatewaysdk/environment/schema/assertions.py +7 -1
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +2 -0
- package/runtime/gatewaysdk/environment/schema/call_capture.py +13 -1
- package/runtime/gatewaysdk/environment/schema/call_log.py +66 -0
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +6 -0
- package/runtime/gatewaysdk/environment/schema/compiler.py +4 -1
- package/runtime/gatewaysdk/environment/schema/conform.py +32 -8
- package/runtime/gatewaysdk/environment/schema/connector.py +5 -0
- package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +2 -1
- package/runtime/gatewaysdk/environment/schema/connectors/github/api/handlers.py +217 -58
- package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +9 -19
- package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_webhooks.json +10 -2
- package/runtime/gatewaysdk/environment/schema/connectors/github/tests/webhooks.json +47 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/world.json +21 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/api/handlers.py +185 -18
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/connector.toml +29 -14
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/provenance.json +43 -12
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_webhooks.json +2 -2
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/scope.toml +4 -17
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/tests/webhooks.json +107 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/vendor-openapi.json +1 -1
- package/runtime/gatewaysdk/environment/schema/connectors/linear/api/handlers.py +85 -1
- package/runtime/gatewaysdk/environment/schema/connectors/linear/connector.toml +19 -31
- package/runtime/gatewaysdk/environment/schema/connectors/linear/provenance.json +18 -8
- package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/webhooks.json +19 -3
- package/runtime/gatewaysdk/environment/schema/connectors/linear/tests/test_webhooks.py +71 -0
- package/runtime/gatewaysdk/environment/schema/database/base.py +2 -2
- package/runtime/gatewaysdk/environment/schema/database/guard.py +2 -1
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +27 -1
- package/runtime/gatewaysdk/environment/schema/host.py +74 -11
- package/runtime/gatewaysdk/environment/schema/host_browser.py +48 -0
- package/runtime/gatewaysdk/environment/schema/host_control.py +33 -2
- package/runtime/gatewaysdk/environment/schema/host_handoff.py +4 -1
- package/runtime/gatewaysdk/environment/schema/host_requests.py +14 -0
- package/runtime/gatewaysdk/environment/schema/host_session.py +13 -2
- package/runtime/gatewaysdk/environment/schema/host_surfaces.py +6 -0
- package/runtime/gatewaysdk/environment/schema/host_versions.py +96 -19
- package/runtime/gatewaysdk/environment/schema/journal.py +10 -4
- package/runtime/gatewaysdk/environment/schema/local.py +33 -7
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +20 -5
- package/runtime/gatewaysdk/environment/schema/page_checks.py +123 -0
- package/runtime/gatewaysdk/environment/schema/platform.py +33 -480
- package/runtime/gatewaysdk/environment/schema/platform_templates.py +332 -0
- package/runtime/gatewaysdk/environment/schema/request_ledger.py +4 -1
- package/runtime/gatewaysdk/environment/schema/run_parameters.py +25 -0
- package/runtime/gatewaysdk/environment/schema/runtime.py +49 -4
- package/runtime/gatewaysdk/environment/schema/scaffold.py +369 -218
- package/runtime/gatewaysdk/environment/schema/session_files.py +13 -2
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +1 -1
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONNECTORS.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +20 -24
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +11 -11
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +9 -9
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +45 -12
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +40 -9
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +17 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/new-world-sandbox.md +1 -1
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/ui-map.md +3 -2
- package/runtime/gatewaysdk/environment/schema/slack.py +55 -10
- package/runtime/gatewaysdk/environment/schema/snapshot.py +30 -4
- package/runtime/gatewaysdk/environment/schema/tasks.py +25 -2
- package/runtime/gatewaysdk/environment/schema/template_record.py +131 -0
- package/runtime/gatewaysdk/environment/schema/tools_world.py +26 -5
- package/runtime/gatewaysdk/environment/schema/ui.py +54 -33
- package/runtime/gatewaysdk/environment/schema/ui_interactions.py +419 -0
- package/runtime/gatewaysdk/environment/schema/ui_recorder.js +895 -0
- package/runtime/gatewaysdk/environment/schema/ui_replay.py +366 -0
- package/runtime/gatewaysdk/environment/schema/ui_replay_record.LICENSE +25 -0
- package/runtime/gatewaysdk/environment/schema/ui_replay_record.js +109 -0
- package/runtime/gatewaysdk/environment/schema/validation.py +10 -1
- package/runtime/gatewaysdk/environment/schema/verbs.py +6 -0
- package/runtime/gatewaysdk/environment/schema/webhooks.py +687 -0
- package/runtime/gatewaysdk/environment/schema/worker.py +5 -1
- package/runtime/gatewaysdk/environment/schema/workers.py +8 -1
- package/runtime/gatewaysdk/environment/schema/world_host.py +64 -18
- package/runtime/gatewaysdk/environment/schema/world_tests.py +74 -0
- package/runtime/gatewaysdk/environment/secret_values.py +1 -1
- package/runtime/gatewaysdk/environment/world.py +34 -43
- package/runtime/gatewaysdk/environment/world_session_contract.py +7 -34
- package/skills/benchmarks-getting-started/SKILL.md +1 -1
- package/skills/connector-schema-authoring/CONNECTORS.md +3 -3
- package/skills/connector-schema-authoring/SKILL.md +20 -24
- package/skills/connector-schema-authoring/connector-worlds.md +155 -13
- package/skills/connector-schema-authoring/world-schema.md +36 -29
- package/skills/world-data-ingestion/SKILL.md +11 -11
- package/skills/worlds-getting-started/SKILL.md +9 -9
- package/skills/worlds-getting-started/references/cli-mcp-map.md +45 -12
- package/skills/worlds-getting-started/references/gotchas.md +40 -9
- package/skills/worlds-getting-started/references/journal-checks.md +17 -2
- package/skills/worlds-getting-started/references/new-world-sandbox.md +1 -1
- package/skills/worlds-getting-started/references/ui-map.md +3 -2
- package/dist/media-BIApiPzS.d.mts +0 -102
- package/dist/media-BIApiPzS.d.ts +0 -102
package/dist/hooks/index.js
CHANGED
|
@@ -1331,172 +1331,382 @@ function mirrorHandle(handle, identity) {
|
|
|
1331
1331
|
var fs = __toESM(require("fs"));
|
|
1332
1332
|
|
|
1333
1333
|
// src/cli/platform/worldData/toml.ts
|
|
1334
|
+
var TomlDateTime = class {
|
|
1335
|
+
constructor(text) {
|
|
1336
|
+
this.text = text;
|
|
1337
|
+
}
|
|
1338
|
+
text;
|
|
1339
|
+
toString() {
|
|
1340
|
+
return this.text;
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1334
1343
|
var TomlError = class extends Error {
|
|
1335
1344
|
};
|
|
1336
1345
|
function parseToml(text) {
|
|
1337
|
-
|
|
1338
|
-
let current = root;
|
|
1339
|
-
const lines = joinContinuations(text);
|
|
1340
|
-
for (const [number, rawLine] of lines.entries()) {
|
|
1341
|
-
const line = stripComment(rawLine).trim();
|
|
1342
|
-
if (!line) continue;
|
|
1343
|
-
const arrayTable = /^\[\[\s*([^\]]+?)\s*\]\]$/.exec(line);
|
|
1344
|
-
if (arrayTable) {
|
|
1345
|
-
const parent = tableAt(root, keyPath(arrayTable[1]).slice(0, -1));
|
|
1346
|
-
const name = keyPath(arrayTable[1]).at(-1);
|
|
1347
|
-
const list = parent[name] ??= [];
|
|
1348
|
-
if (!Array.isArray(list)) throw new TomlError(`line ${number + 1}: ${name} is not an array of tables`);
|
|
1349
|
-
current = {};
|
|
1350
|
-
list.push(current);
|
|
1351
|
-
continue;
|
|
1352
|
-
}
|
|
1353
|
-
const table = /^\[\s*([^\]]+?)\s*\]$/.exec(line);
|
|
1354
|
-
if (table) {
|
|
1355
|
-
current = tableAt(root, keyPath(table[1]));
|
|
1356
|
-
continue;
|
|
1357
|
-
}
|
|
1358
|
-
const eq = line.indexOf("=");
|
|
1359
|
-
if (eq === -1) throw new TomlError(`line ${number + 1}: expected key = value`);
|
|
1360
|
-
const key2 = unquoteKey(line.slice(0, eq).trim());
|
|
1361
|
-
const [value, rest] = readValue(line.slice(eq + 1).trim(), number + 1);
|
|
1362
|
-
if (rest.trim()) throw new TomlError(`line ${number + 1}: unexpected text after value`);
|
|
1363
|
-
current[key2] = value;
|
|
1364
|
-
}
|
|
1365
|
-
return root;
|
|
1346
|
+
return new TomlReader(text).read();
|
|
1366
1347
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1348
|
+
var BARE_KEY = /^[A-Za-z0-9_-]+$/;
|
|
1349
|
+
var CONTROL = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/;
|
|
1350
|
+
var COMMENT_CONTROL = /[\x00-\x08\x0a-\x1f\x7f]/;
|
|
1351
|
+
var DEC_INT = /^[+-]?(?:0|[1-9](?:_?\d)*)$/;
|
|
1352
|
+
var RADIX_INT = [
|
|
1353
|
+
[/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/, 16],
|
|
1354
|
+
[/^0o[0-7](?:_?[0-7])*$/, 8],
|
|
1355
|
+
[/^0b[01](?:_?[01])*$/, 2]
|
|
1356
|
+
];
|
|
1357
|
+
var FLOAT = /^[+-]?(?:0|[1-9](?:_?\d)*)(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?$/;
|
|
1358
|
+
var SPECIAL_FLOAT = /^([+-]?)(inf|nan)$/;
|
|
1359
|
+
var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))?)?/;
|
|
1360
|
+
var LOCAL_TIME = /^(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?/;
|
|
1361
|
+
var INLINE = /* @__PURE__ */ new WeakSet();
|
|
1362
|
+
var newTable = () => /* @__PURE__ */ Object.create(null);
|
|
1363
|
+
var own = (table, key2) => Object.prototype.hasOwnProperty.call(table, key2) ? table[key2] : void 0;
|
|
1364
|
+
var isTomlTable = (value) => value !== void 0 && typeof value === "object" && Object.getPrototypeOf(value) === null;
|
|
1365
|
+
var stripBlank = (text) => text.replace(/^[ \t]+|[ \t]+$/g, "");
|
|
1366
|
+
var TomlReader = class {
|
|
1367
|
+
constructor(text) {
|
|
1368
|
+
this.text = text;
|
|
1369
|
+
}
|
|
1370
|
+
text;
|
|
1371
|
+
root = newTable();
|
|
1372
|
+
current = this.root;
|
|
1373
|
+
defined = /* @__PURE__ */ new WeakSet();
|
|
1374
|
+
byHeader = /* @__PURE__ */ new WeakSet();
|
|
1375
|
+
byDottedKey = /* @__PURE__ */ new WeakSet();
|
|
1376
|
+
tableArrays = /* @__PURE__ */ new WeakSet();
|
|
1377
|
+
read() {
|
|
1378
|
+
for (const { text, line } of logicalLines(this.text)) this.statement(stripBlank(text), line);
|
|
1379
|
+
return this.root;
|
|
1380
|
+
}
|
|
1381
|
+
statement(text, line) {
|
|
1382
|
+
if (!text) return;
|
|
1383
|
+
const arrayTable = /^\[\[[ \t]*(.+?)[ \t]*\]\]$/.exec(text);
|
|
1384
|
+
if (arrayTable) return this.arrayTable(keyPath(arrayTable[1], line), line);
|
|
1385
|
+
const header = /^\[[ \t]*(.+?)[ \t]*\]$/.exec(text);
|
|
1386
|
+
if (header) return this.header(keyPath(header[1], line), line);
|
|
1387
|
+
const eq = outsideQuotes(text, "=");
|
|
1388
|
+
if (eq === -1) throw new TomlError(`line ${line}: expected key = value`);
|
|
1389
|
+
const path4 = keyPath(text.slice(0, eq), line);
|
|
1390
|
+
const [value, rest] = readValue(text.slice(eq + 1), line);
|
|
1391
|
+
if (stripBlank(rest)) throw new TomlError(`line ${line}: unexpected text after value`);
|
|
1392
|
+
assign(this.descend(this.current, path4.slice(0, -1), line, "key"), path4, value, line);
|
|
1393
|
+
}
|
|
1394
|
+
header(path4, line) {
|
|
1395
|
+
const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
|
|
1396
|
+
const name = path4.at(-1);
|
|
1397
|
+
const table = own(parent, name) ?? newTable();
|
|
1398
|
+
const fresh = isTomlTable(table) && !INLINE.has(table) && !this.byDottedKey.has(table) && !this.defined.has(table);
|
|
1399
|
+
if (!fresh) throw new TomlError(`line ${line}: [${path4.join(".")}] is defined twice`);
|
|
1400
|
+
parent[name] = table;
|
|
1401
|
+
this.open(table);
|
|
1402
|
+
}
|
|
1403
|
+
arrayTable(path4, line) {
|
|
1404
|
+
const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
|
|
1405
|
+
const name = path4.at(-1);
|
|
1406
|
+
const existing = own(parent, name);
|
|
1407
|
+
if (existing !== void 0 && !(Array.isArray(existing) && this.tableArrays.has(existing)))
|
|
1408
|
+
throw new TomlError(`line ${line}: ${path4.join(".")} is not an array of tables`);
|
|
1409
|
+
const list = existing ?? [];
|
|
1410
|
+
this.tableArrays.add(list);
|
|
1411
|
+
parent[name] = list;
|
|
1412
|
+
const table = newTable();
|
|
1413
|
+
list.push(table);
|
|
1414
|
+
this.open(table);
|
|
1415
|
+
}
|
|
1416
|
+
open(table) {
|
|
1417
|
+
this.defined.add(table);
|
|
1418
|
+
this.byHeader.add(table);
|
|
1419
|
+
this.current = table;
|
|
1420
|
+
}
|
|
1421
|
+
descend(from, parts2, line, via) {
|
|
1422
|
+
let node = from;
|
|
1423
|
+
for (const part of parts2) {
|
|
1424
|
+
const next = own(node, part);
|
|
1425
|
+
node = next === void 0 ? this.make(node, part, via) : this.enter(next, part, line, via);
|
|
1426
|
+
}
|
|
1427
|
+
return node;
|
|
1428
|
+
}
|
|
1429
|
+
make(parent, part, via) {
|
|
1430
|
+
const table = newTable();
|
|
1431
|
+
(via === "header" ? this.byHeader : this.byDottedKey).add(table);
|
|
1432
|
+
parent[part] = table;
|
|
1433
|
+
return table;
|
|
1434
|
+
}
|
|
1435
|
+
enter(value, part, line, via) {
|
|
1436
|
+
const target = via === "header" && Array.isArray(value) && this.tableArrays.has(value) ? value.at(-1) : value;
|
|
1437
|
+
const open = isTomlTable(target) && !INLINE.has(target) && !(via === "key" && this.defined.has(target));
|
|
1438
|
+
if (!open) throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
|
|
1439
|
+
if (via === "key") this.byDottedKey.add(target);
|
|
1440
|
+
return target;
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
function assign(table, path4, value, line) {
|
|
1444
|
+
const key2 = path4.at(-1);
|
|
1445
|
+
if (own(table, key2) !== void 0) throw new TomlError(`line ${line}: key ${path4.join(".")} is defined twice`);
|
|
1446
|
+
table[key2] = value;
|
|
1373
1447
|
}
|
|
1374
|
-
function
|
|
1375
|
-
let node =
|
|
1448
|
+
function inlineAt(table, parts2, line) {
|
|
1449
|
+
let node = table;
|
|
1376
1450
|
for (const part of parts2) {
|
|
1377
|
-
const next = node
|
|
1378
|
-
if (
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
} else if (typeof next !== "object") throw new TomlError(`${part} is not a table`);
|
|
1383
|
-
else node = next;
|
|
1451
|
+
const next = own(node, part) ?? newTable();
|
|
1452
|
+
if (!isTomlTable(next) || INLINE.has(next))
|
|
1453
|
+
throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
|
|
1454
|
+
node[part] = next;
|
|
1455
|
+
node = next;
|
|
1384
1456
|
}
|
|
1385
1457
|
return node;
|
|
1386
1458
|
}
|
|
1387
|
-
function
|
|
1388
|
-
const
|
|
1389
|
-
let
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
if (depth > 0) {
|
|
1396
|
-
pending = line;
|
|
1397
|
-
continue;
|
|
1398
|
-
}
|
|
1399
|
-
pending = "";
|
|
1400
|
-
out.push(line);
|
|
1459
|
+
function keyPath(text, line) {
|
|
1460
|
+
const parts2 = [];
|
|
1461
|
+
let rest = text;
|
|
1462
|
+
for (; ; ) {
|
|
1463
|
+
const dot = outsideQuotes(rest, ".");
|
|
1464
|
+
parts2.push(readKey(stripBlank(dot === -1 ? rest : rest.slice(0, dot)), line));
|
|
1465
|
+
if (dot === -1) return parts2;
|
|
1466
|
+
rest = rest.slice(dot + 1);
|
|
1401
1467
|
}
|
|
1402
|
-
if (pending) out.push(pending);
|
|
1403
|
-
return out;
|
|
1404
1468
|
}
|
|
1405
|
-
function
|
|
1406
|
-
|
|
1469
|
+
function readKey(part, line) {
|
|
1470
|
+
const quote = openingQuote(part, 0);
|
|
1471
|
+
if (quote === null && BARE_KEY.test(part)) return part;
|
|
1472
|
+
const read = quote?.length === 1 ? readString(part, line) : null;
|
|
1473
|
+
if (!read || read[1] !== "") throw new TomlError(`line ${line}: \`${part}\` is not a key; quote it`);
|
|
1474
|
+
return read[0];
|
|
1475
|
+
}
|
|
1476
|
+
function outsideQuotes(text, char) {
|
|
1407
1477
|
let quote = null;
|
|
1408
|
-
for (let i = 0; i <
|
|
1409
|
-
const c =
|
|
1478
|
+
for (let i = 0; i < text.length; i++) {
|
|
1479
|
+
const c = text[i];
|
|
1410
1480
|
if (quote) {
|
|
1411
1481
|
if (c === "\\" && quote === '"') i++;
|
|
1412
1482
|
else if (c === quote) quote = null;
|
|
1413
1483
|
continue;
|
|
1414
1484
|
}
|
|
1415
1485
|
if (c === '"' || c === "'") quote = c;
|
|
1416
|
-
else if (c ===
|
|
1417
|
-
else if (c === "]" || c === "}") depth--;
|
|
1486
|
+
else if (c === char) return i;
|
|
1418
1487
|
}
|
|
1419
|
-
return
|
|
1488
|
+
return -1;
|
|
1420
1489
|
}
|
|
1421
|
-
function
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1490
|
+
function openingQuote(text, i) {
|
|
1491
|
+
const c = text[i];
|
|
1492
|
+
if (c !== '"' && c !== "'") return null;
|
|
1493
|
+
return text.startsWith(c.repeat(3), i) ? c.repeat(3) : c;
|
|
1494
|
+
}
|
|
1495
|
+
function quoteRun(text, i, quote, line) {
|
|
1496
|
+
let run = 0;
|
|
1497
|
+
while (text[i + run] === quote) run++;
|
|
1498
|
+
if (run > 5) throw new TomlError(`line ${line}: too many quotes close a multi-line string`);
|
|
1499
|
+
return run;
|
|
1500
|
+
}
|
|
1501
|
+
var LogicalLines = class {
|
|
1502
|
+
constructor(text) {
|
|
1503
|
+
this.text = text;
|
|
1504
|
+
}
|
|
1505
|
+
text;
|
|
1506
|
+
out = [];
|
|
1507
|
+
brackets = [];
|
|
1508
|
+
buffer = "";
|
|
1509
|
+
start = 1;
|
|
1510
|
+
line = 1;
|
|
1511
|
+
quote = null;
|
|
1512
|
+
i = 0;
|
|
1513
|
+
split() {
|
|
1514
|
+
if (this.text.startsWith("\uFEFF")) throw new TomlError("line 1: a byte order mark is not TOML");
|
|
1515
|
+
for (; this.i < this.text.length; this.i++) this.step(this.text[this.i]);
|
|
1516
|
+
if (this.quote) throw new TomlError(`line ${this.start}: unterminated string`);
|
|
1517
|
+
if (this.brackets.length > 0) throw new TomlError(`line ${this.start}: a bracket or brace is never closed`);
|
|
1518
|
+
this.out.push({ text: this.buffer, line: this.start });
|
|
1519
|
+
return this.out;
|
|
1520
|
+
}
|
|
1521
|
+
step(c) {
|
|
1522
|
+
if (c === "\n") this.line++;
|
|
1523
|
+
if (this.quote) return this.inString(c, this.quote);
|
|
1524
|
+
if (c === "#") return this.skipComment();
|
|
1525
|
+
const opened = openingQuote(this.text, this.i);
|
|
1526
|
+
if (opened) return this.openString(opened);
|
|
1527
|
+
this.outside(c);
|
|
1528
|
+
}
|
|
1529
|
+
inString(c, quote) {
|
|
1530
|
+
if (c === "\n" && quote.length === 1) throw new TomlError(`line ${this.line - 1}: unterminated string`);
|
|
1531
|
+
if (c === "\\" && quote.startsWith('"')) return this.escape();
|
|
1532
|
+
if (this.text.startsWith(quote, this.i)) return this.closeString(quote);
|
|
1533
|
+
this.buffer += c;
|
|
1534
|
+
}
|
|
1535
|
+
escape() {
|
|
1536
|
+
const next = this.text[this.i + 1] ?? "";
|
|
1537
|
+
this.buffer += "\\" + next;
|
|
1538
|
+
if (next === "\n") this.line++;
|
|
1539
|
+
this.i++;
|
|
1540
|
+
}
|
|
1541
|
+
openString(opened) {
|
|
1542
|
+
this.quote = opened;
|
|
1543
|
+
this.buffer += opened;
|
|
1544
|
+
this.i += opened.length - 1;
|
|
1545
|
+
}
|
|
1546
|
+
closeString(quote) {
|
|
1547
|
+
const run = quote.length === 3 ? quoteRun(this.text, this.i, quote[0], this.line) : 1;
|
|
1548
|
+
this.buffer += this.text.slice(this.i, this.i + run);
|
|
1549
|
+
this.i += run - 1;
|
|
1550
|
+
this.quote = null;
|
|
1551
|
+
}
|
|
1552
|
+
skipComment() {
|
|
1553
|
+
for (; this.i + 1 < this.text.length && this.text[this.i + 1] !== "\n"; this.i++)
|
|
1554
|
+
this.commentCharacter(this.text[this.i + 1]);
|
|
1555
|
+
}
|
|
1556
|
+
commentCharacter(c) {
|
|
1557
|
+
const lineEnd = c === "\r" && this.text[this.i + 2] === "\n";
|
|
1558
|
+
if (!lineEnd && COMMENT_CONTROL.test(c))
|
|
1559
|
+
throw new TomlError(`line ${this.line}: a comment holds a control character`);
|
|
1560
|
+
}
|
|
1561
|
+
outside(c) {
|
|
1562
|
+
if (c === "[" || c === "{") this.brackets.push(c);
|
|
1563
|
+
if (c === "]" || c === "}") this.brackets.pop();
|
|
1564
|
+
if (c === "\n" && this.brackets.at(-1) === "{")
|
|
1565
|
+
throw new TomlError(`line ${this.line - 1}: an inline table must be on one line`);
|
|
1566
|
+
if (c === "\n" && this.brackets.length === 0) return this.endLine();
|
|
1567
|
+
this.buffer += c;
|
|
1568
|
+
}
|
|
1569
|
+
endLine() {
|
|
1570
|
+
this.out.push({ text: this.buffer.replace(/\r$/, ""), line: this.start });
|
|
1571
|
+
this.buffer = "";
|
|
1572
|
+
this.start = this.line;
|
|
1432
1573
|
}
|
|
1433
|
-
|
|
1574
|
+
};
|
|
1575
|
+
function logicalLines(text) {
|
|
1576
|
+
return new LogicalLines(text).split();
|
|
1434
1577
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
} else if (e !== void 0 && e in map) out += map[e];
|
|
1449
|
-
else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
|
|
1450
|
-
continue;
|
|
1451
|
-
}
|
|
1452
|
-
if (c === '"') return [out, s.slice(i + 1)];
|
|
1578
|
+
var ESCAPES = { n: "\n", t: " ", r: "\r", '"': '"', "\\": "\\", b: "\b", f: "\f" };
|
|
1579
|
+
function unicodeEscape(body, at, width, line) {
|
|
1580
|
+
const digits = body.slice(at, at + width);
|
|
1581
|
+
const code = /^[0-9A-Fa-f]+$/.test(digits) && digits.length === width ? parseInt(digits, 16) : -1;
|
|
1582
|
+
const scalar = code >= 0 && code <= 1114111 && (code < 55296 || code > 57343);
|
|
1583
|
+
if (!scalar) throw new TomlError(`line ${line}: \\${width === 4 ? "u" : "U"}${digits} is not a Unicode scalar value`);
|
|
1584
|
+
return String.fromCodePoint(code);
|
|
1585
|
+
}
|
|
1586
|
+
function decodeBasic(body, line, multiline) {
|
|
1587
|
+
let out = "";
|
|
1588
|
+
for (let i = 0; i < body.length; i++) {
|
|
1589
|
+
const c = body[i];
|
|
1590
|
+
if (c !== "\\") {
|
|
1453
1591
|
out += c;
|
|
1592
|
+
continue;
|
|
1593
|
+
}
|
|
1594
|
+
const e = body[++i];
|
|
1595
|
+
if (multiline && /^[ \t]*\r?\n/.test(body.slice(i))) {
|
|
1596
|
+
while (i + 1 < body.length && /[ \t\r\n]/.test(body[i + 1])) i++;
|
|
1597
|
+
continue;
|
|
1454
1598
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
if (
|
|
1460
|
-
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1599
|
+
if (e === "u" || e === "U") {
|
|
1600
|
+
const width = e === "u" ? 4 : 8;
|
|
1601
|
+
out += unicodeEscape(body, i + 1, width, line);
|
|
1602
|
+
i += width;
|
|
1603
|
+
} else if (e !== void 0 && e in ESCAPES) out += ESCAPES[e];
|
|
1604
|
+
else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
|
|
1605
|
+
}
|
|
1606
|
+
return out;
|
|
1607
|
+
}
|
|
1608
|
+
function checkControls(body, line, multiline) {
|
|
1609
|
+
const broken = CONTROL.test(body) || (multiline ? /\r(?!\n)/.test(body) : /[\r\n]/.test(body));
|
|
1610
|
+
if (broken) throw new TomlError(`line ${line}: a string holds a control character`);
|
|
1611
|
+
}
|
|
1612
|
+
function readString(s, line) {
|
|
1613
|
+
const quote = openingQuote(s, 0);
|
|
1614
|
+
if (!quote) return null;
|
|
1615
|
+
let end = quote.length;
|
|
1616
|
+
for (; end < s.length; end++) {
|
|
1617
|
+
if (quote.startsWith('"') && s[end] === "\\") {
|
|
1618
|
+
end++;
|
|
1619
|
+
continue;
|
|
1473
1620
|
}
|
|
1621
|
+
if (s.startsWith(quote, end)) break;
|
|
1622
|
+
}
|
|
1623
|
+
if (end >= s.length) throw new TomlError(`line ${line}: unterminated string`);
|
|
1624
|
+
if (quote.length === 3) end += quoteRun(s, end, quote[0], line) - 3;
|
|
1625
|
+
const raw = s.slice(quote.length, end);
|
|
1626
|
+
const multiline = quote.length === 3;
|
|
1627
|
+
const body = multiline ? raw.replace(/^\r?\n/, "") : raw;
|
|
1628
|
+
checkControls(body, line, multiline);
|
|
1629
|
+
const text = quote.startsWith('"') ? decodeBasic(body, line, multiline) : body;
|
|
1630
|
+
return [text, s.slice(end + quote.length)];
|
|
1631
|
+
}
|
|
1632
|
+
function readArray(s, line) {
|
|
1633
|
+
const items = [];
|
|
1634
|
+
let rest = s.slice(1);
|
|
1635
|
+
for (; ; ) {
|
|
1636
|
+
rest = rest.replace(/^[ \t\r\n]+/, "");
|
|
1637
|
+
if (rest.startsWith("]")) return [items, rest.slice(1)];
|
|
1638
|
+
const [item, after] = readValue(rest, line);
|
|
1639
|
+
items.push(item);
|
|
1640
|
+
rest = after.replace(/^[ \t\r\n]+/, "");
|
|
1641
|
+
if (rest.startsWith(",")) rest = rest.slice(1);
|
|
1642
|
+
else if (!rest.startsWith("]")) throw new TomlError(`line ${line}: expected , or ] in array`);
|
|
1474
1643
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1644
|
+
}
|
|
1645
|
+
function readInlineTable(s, line) {
|
|
1646
|
+
const table = newTable();
|
|
1647
|
+
let rest = s.slice(1).replace(/^[ \t]+/, "");
|
|
1648
|
+
if (rest.startsWith("}")) {
|
|
1649
|
+
INLINE.add(table);
|
|
1650
|
+
return [table, rest.slice(1)];
|
|
1651
|
+
}
|
|
1652
|
+
for (; ; ) {
|
|
1653
|
+
const eq = outsideQuotes(rest, "=");
|
|
1654
|
+
if (eq === -1) throw new TomlError(`line ${line}: expected key = value in inline table`);
|
|
1655
|
+
const path4 = keyPath(rest.slice(0, eq), line);
|
|
1656
|
+
const [value, after] = readValue(rest.slice(eq + 1), line);
|
|
1657
|
+
assign(inlineAt(table, path4.slice(0, -1), line), path4, value, line);
|
|
1658
|
+
rest = after.replace(/^[ \t]+/, "");
|
|
1659
|
+
if (rest.startsWith("}")) {
|
|
1660
|
+
INLINE.add(table);
|
|
1661
|
+
return [table, rest.slice(1)];
|
|
1489
1662
|
}
|
|
1663
|
+
if (!rest.startsWith(",")) throw new TomlError(`line ${line}: expected , or } in inline table`);
|
|
1664
|
+
rest = rest.slice(1).replace(/^[ \t]+/, "");
|
|
1665
|
+
if (rest.startsWith("}")) throw new TomlError(`line ${line}: an inline table takes no trailing comma`);
|
|
1490
1666
|
}
|
|
1491
|
-
|
|
1667
|
+
}
|
|
1668
|
+
function inRange(value, low, high) {
|
|
1669
|
+
return value === void 0 || Number(value) >= low && Number(value) <= high;
|
|
1670
|
+
}
|
|
1671
|
+
function readDateTime(s, line) {
|
|
1672
|
+
const full = DATE_TIME.exec(s);
|
|
1673
|
+
const time = full ? null : LOCAL_TIME.exec(s);
|
|
1674
|
+
const match = full ?? time;
|
|
1675
|
+
if (!match) return null;
|
|
1676
|
+
const [y, mo, d, h, mi, se, oh, om] = full ? full.slice(1) : [void 0, void 0, void 0, ...time.slice(1)];
|
|
1677
|
+
const day = y === void 0 ? null : new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));
|
|
1678
|
+
const dateOk = day === null || day.getUTCMonth() === Number(mo) - 1 && day.getUTCDate() === Number(d);
|
|
1679
|
+
const timeOk = inRange(h, 0, 23) && inRange(mi, 0, 59) && inRange(se, 0, 59) && inRange(oh, 0, 23) && inRange(om, 0, 59);
|
|
1680
|
+
if (!dateOk || !timeOk) throw new TomlError(`line ${line}: ${match[0]} is not a valid date or time`);
|
|
1681
|
+
return [new TomlDateTime(match[0]), s.slice(match[0].length)];
|
|
1682
|
+
}
|
|
1683
|
+
function readNumber(token) {
|
|
1684
|
+
const plain = token.replace(/_/g, "");
|
|
1685
|
+
if (DEC_INT.test(token)) return Number(plain);
|
|
1686
|
+
for (const [pattern, radix] of RADIX_INT) if (pattern.test(token)) return parseInt(plain.slice(2), radix);
|
|
1687
|
+
if (FLOAT.test(token) && /[.eE]/.test(token)) return Number(plain);
|
|
1688
|
+
const special = SPECIAL_FLOAT.exec(token);
|
|
1689
|
+
if (!special) return null;
|
|
1690
|
+
if (special[2] === "nan") return NaN;
|
|
1691
|
+
return special[1] === "-" ? -Infinity : Infinity;
|
|
1692
|
+
}
|
|
1693
|
+
function readValue(text, line) {
|
|
1694
|
+
const s = text.replace(/^[ \t]+/, "");
|
|
1695
|
+
const string = readString(s, line);
|
|
1696
|
+
if (string) return string;
|
|
1697
|
+
if (s.startsWith("[")) return readArray(s, line);
|
|
1698
|
+
if (s.startsWith("{")) return readInlineTable(s, line);
|
|
1699
|
+
const date = readDateTime(s, line);
|
|
1700
|
+
if (date) return date;
|
|
1701
|
+
const scalar = /^([^,\]}\s#]+)/.exec(s);
|
|
1492
1702
|
if (!scalar) throw new TomlError(`line ${line}: expected a value`);
|
|
1493
1703
|
const token = scalar[1];
|
|
1494
1704
|
const rest = s.slice(token.length);
|
|
1495
1705
|
if (token === "true") return [true, rest];
|
|
1496
1706
|
if (token === "false") return [false, rest];
|
|
1497
|
-
|
|
1498
|
-
if (
|
|
1499
|
-
|
|
1707
|
+
const number = readNumber(token);
|
|
1708
|
+
if (number === null) throw new TomlError(`line ${line}: unsupported value ${token}`);
|
|
1709
|
+
return [number, rest];
|
|
1500
1710
|
}
|
|
1501
1711
|
|
|
1502
1712
|
// src/hooks/events.ts
|
|
@@ -2199,7 +2409,7 @@ function loadHookConfig(file) {
|
|
|
2199
2409
|
}
|
|
2200
2410
|
return parseHookConfig(data, file);
|
|
2201
2411
|
}
|
|
2202
|
-
var isObject2 = (v) => typeof v === "object" && v !== null &&
|
|
2412
|
+
var isObject2 = (v) => typeof v === "object" && v !== null && [null, Object.prototype].includes(Object.getPrototypeOf(v));
|
|
2203
2413
|
function parseHookConfig(data, source) {
|
|
2204
2414
|
const where = source ?? "config";
|
|
2205
2415
|
if (!isObject2(data))
|
|
@@ -3541,8 +3751,8 @@ function readConnection(root) {
|
|
|
3541
3751
|
};
|
|
3542
3752
|
}
|
|
3543
3753
|
return {
|
|
3544
|
-
slug: connector.slug
|
|
3545
|
-
baseUrl: (connector.base_url
|
|
3754
|
+
slug: typeof connector.slug === "string" ? connector.slug : path2.basename(root),
|
|
3755
|
+
baseUrl: (typeof connector.base_url === "string" ? connector.base_url : "").replace(/\/+$/, ""),
|
|
3546
3756
|
scheme: carrier.scheme,
|
|
3547
3757
|
carrier,
|
|
3548
3758
|
...typeof auth.secret_env === "string" ? { secretEnv: auth.secret_env } : {},
|