@xanots/sdk 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +48 -5
- package/dist/.build-fingerprint +1 -1
- package/dist/{agent-file-refresh-QNKN5RYD.js → agent-file-refresh-GQWAAOBV.js} +4 -4
- package/dist/bin.js +12 -11
- package/dist/{branch-commands-2BLOC2GR.js → branch-commands-5KMPAAZV.js} +7 -7
- package/dist/bundle.d.ts +218 -0
- package/dist/bundle.js +143 -0
- package/dist/{capture-4WVJY4DQ.js → capture-YLUVAITI.js} +2 -2
- package/dist/chunk-2VTJSI6X.js +192 -0
- package/dist/{chunk-5XZ744TS.js → chunk-2ZCUO2UG.js} +1 -1
- package/dist/{chunk-OYMR5AMJ.js → chunk-3LQGF2WS.js} +2 -2
- package/dist/{chunk-WP4OZZV4.js → chunk-3VFCKHOB.js} +2 -2
- package/dist/{chunk-XHEXOES3.js → chunk-5YDINUAP.js} +1 -1
- package/dist/{chunk-LU7TRWMC.js → chunk-6VNRMKFJ.js} +2 -2
- package/dist/{chunk-CTD5ZCV6.js → chunk-7WRJPKGK.js} +2 -2
- package/dist/{chunk-3INK4Y4E.js → chunk-AE3PDSDS.js} +1 -1
- package/dist/{chunk-5YCQ2QHH.js → chunk-AG5GCZDD.js} +2 -2
- package/dist/{chunk-DBFU47BJ.js → chunk-AOFFKSJC.js} +2 -2
- package/dist/{chunk-TCFIPDB3.js → chunk-AVGDL6RB.js} +1 -1
- package/dist/{chunk-4BXJGVZ3.js → chunk-DCMANKMX.js} +2 -69
- package/dist/{chunk-WHOJWOSV.js → chunk-EETVJZAZ.js} +1 -1
- package/dist/chunk-EHP3WPEG.js +21 -0
- package/dist/{chunk-W24FJHPD.js → chunk-ELK7UALJ.js} +3 -3
- package/dist/{chunk-VNQM3V2C.js → chunk-EXENFOWE.js} +2 -2
- package/dist/{chunk-P6TAVLOX.js → chunk-GSP2BY4F.js} +17 -10
- package/dist/{chunk-AIZKXUNP.js → chunk-IMLYGQK6.js} +2 -2
- package/dist/{chunk-LBYWGMOA.js → chunk-N74KDCBD.js} +176 -42
- package/dist/{chunk-3IGNIP6R.js → chunk-NDP7OUPS.js} +1 -1
- package/dist/chunk-OHX6MIUZ.js +184 -0
- package/dist/{chunk-EQW3YT5U.js → chunk-P6PVBQL6.js} +2 -2
- package/dist/{chunk-I7DQDJAM.js → chunk-PLE5QQOZ.js} +55 -56
- package/dist/chunk-PR7OXHGZ.js +70 -0
- package/dist/{chunk-VKSOTZK3.js → chunk-QYSQ3UDO.js} +160 -8
- package/dist/{chunk-ZQ2PKR6R.js → chunk-RQ3FXV4K.js} +2 -2
- package/dist/{chunk-Q77KNEUL.js → chunk-RQNMTDXD.js} +1703 -2
- package/dist/{chunk-QKM4U5UK.js → chunk-TJS2AF5Y.js} +2 -2
- package/dist/{chunk-DIA7CT7J.js → chunk-V5Y7D4LH.js} +11 -2
- package/dist/{chunk-KA6G2L7U.js → chunk-VK26K7AY.js} +3 -3
- package/dist/{chunk-YYFXVYPX.js → chunk-VPAWRBK5.js} +12 -16
- package/dist/{chunk-5R73LFWK.js → chunk-VRNZ2NVV.js} +7 -7
- package/dist/{chunk-ACCBOMCB.js → chunk-XT3XQ4PF.js} +32 -27
- package/dist/{chunk-7JDT4PBU.js → chunk-XWFRNJMQ.js} +5 -179
- package/dist/{chunk-7ZYW652H.js → chunk-YHS6VVLJ.js} +2 -2
- package/dist/{chunk-75Z74TA7.js → chunk-YX22LKQE.js} +2 -2
- package/dist/{chunk-F6CYJ7TN.js → chunk-Z2ZIE5CO.js} +2 -2
- package/dist/cli.d.ts +13 -6
- package/dist/cli.js +11 -10
- package/dist/codegen-command-Y2SPMAUW.js +47 -0
- package/dist/codegen.d.ts +5 -4
- package/dist/codegen.js +2 -2
- package/dist/{completion-WF46272M.js → completion-HJU5QEFB.js} +2 -2
- package/dist/{deploy-command-QTIVA22A.js → deploy-command-XHS5PKPV.js} +20 -19
- package/dist/{ephemeral-command-U4AQ3TXX.js → ephemeral-command-2NKPEXUU.js} +8 -8
- package/dist/index.d.ts +88 -102
- package/dist/index.js +13 -12
- package/dist/init-command-23FFNUFT.js +32 -0
- package/dist/internal.d.ts +10 -16
- package/dist/internal.js +76 -54
- package/dist/io-UBDMMDH6.js +12 -0
- package/dist/{live-diff-IXKBVG4K.js → live-diff-HCOTN5WC.js} +3 -3
- package/dist/{lock-GFXD6G2E.js → lock-HQ4KARU2.js} +3 -2
- package/dist/{lock-commands-DQ7CUMIV.js → lock-commands-WCRC56ME.js} +12 -11
- package/dist/{login-command-Z6CHTA57.js → login-command-P7LXD5TE.js} +6 -6
- package/dist/{loop-D5NPL4VH.js → loop-IC5ISSYB.js} +3 -3
- package/dist/{marketplace-command-P4IPLJ6J.js → marketplace-command-T6JCHW7J.js} +4 -4
- package/dist/{meta-client-K2J4XH64.js → meta-client-LKRKR3L2.js} +4 -4
- package/dist/node.d.ts +6 -5
- package/dist/node.js +18 -17
- package/dist/{preflight-command-GZ2GE5RN.js → preflight-command-TZWPHBXY.js} +17 -16
- package/dist/{profile-command-LJSBDV2L.js → profile-command-WBNSMQSI.js} +3 -3
- package/dist/{release-command-YUBTNHVX.js → release-command-WEFYRTCI.js} +27 -26
- package/dist/response-D6xGLEIn.d.ts +839 -0
- package/dist/{routes-manifest-PWZHDOI5.js → routes-manifest-5ZFKUQWA.js} +2 -2
- package/dist/{runtime-V4C3AC3A.js → runtime-LSLIDALK.js} +1 -1
- package/dist/scaffold.d.ts +16 -8
- package/dist/scaffold.js +7 -11
- package/dist/{static-host-3WMV7IZO.js → static-host-4JDQCHUW.js} +1 -1
- package/dist/{status-command-AL47VG7H.js → status-command-VARULAR5.js} +4 -4
- package/dist/{store-BG1UPZ3Z.d.ts → store-DAnUIi1T.d.ts} +95 -87
- package/dist/{test-command-YAZLKLGQ.js → test-command-YCAR4O35.js} +7 -7
- package/dist/{upgrade-command-FB5QJ363.js → upgrade-command-GYEIMJBG.js} +16 -16
- package/dist/{workspace-2COHDBM3.js → workspace-33KHFLX3.js} +2 -2
- package/dist/{workspace-command-43P42FBP.js → workspace-command-2ZTGT26W.js} +28 -27
- package/dist/{workspace-export-DURY5WYL.js → workspace-export-MLYTYZS5.js} +3 -3
- package/dist/{response-CVAE2kMj.d.ts → xdo-ODuJklk6.d.ts} +28 -860
- package/guides/authoring.md +11 -2
- package/guides/typed-frontend.md +5 -5
- package/llms/filters.md +11 -10
- package/llms/kinds-core.md +1 -1
- package/llms/statements-data.md +6 -3
- package/llms/values.md +1 -1
- package/llms-full.txt +53 -42
- package/llms.txt +34 -27
- package/manifest.json +6 -2
- package/package.json +7 -2
- package/dist/chunk-ANUDXFEX.js +0 -881
- package/dist/chunk-JGCWTCA7.js +0 -95
- package/dist/chunk-YBC3IKMF.js +0 -845
- package/dist/codegen-command-GB3H2KQ7.js +0 -46
- package/dist/init-command-MAXULNAD.js +0 -33
- package/dist/io-M7XZEMK7.js +0 -11
|
@@ -2,7 +2,17 @@ import {
|
|
|
2
2
|
assertPathParamInputs,
|
|
3
3
|
fillPathParams,
|
|
4
4
|
parsePathParams
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EETVJZAZ.js";
|
|
6
|
+
import {
|
|
7
|
+
appNamesByGuid,
|
|
8
|
+
deriveGuid,
|
|
9
|
+
deriveQueryGuid,
|
|
10
|
+
getLockedCanonical,
|
|
11
|
+
lockKey,
|
|
12
|
+
lockNameForObject,
|
|
13
|
+
queryGroupComponent,
|
|
14
|
+
resolveRef
|
|
15
|
+
} from "./chunk-XWFRNJMQ.js";
|
|
6
16
|
import {
|
|
7
17
|
COLUMN_CONTEXT,
|
|
8
18
|
INPUT_CONTEXT,
|
|
@@ -12,18 +22,10 @@ import {
|
|
|
12
22
|
encodeStatement,
|
|
13
23
|
rawResponseItems,
|
|
14
24
|
registerStatement
|
|
15
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2ZCUO2UG.js";
|
|
16
26
|
import {
|
|
17
|
-
appNamesByGuid,
|
|
18
|
-
deriveGuid,
|
|
19
|
-
deriveQueryGuid,
|
|
20
|
-
getLockedCanonical,
|
|
21
|
-
lockKey,
|
|
22
|
-
lockNameForObject,
|
|
23
|
-
queryGroupComponent,
|
|
24
|
-
resolveRef,
|
|
25
27
|
sha1Bytes
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-OHX6MIUZ.js";
|
|
27
29
|
|
|
28
30
|
// src/types/xdo.ts
|
|
29
31
|
var TAGS = [
|
|
@@ -137,7 +139,7 @@ var DiagnosticBag = class {
|
|
|
137
139
|
* a guard. But the audience for this SDK is largely an agent that never reads
|
|
138
140
|
* stderr, and CI has no way to notice a message nobody fails on. `strict`
|
|
139
141
|
* gives a pipeline one switch that turns "printed something" into "did not
|
|
140
|
-
* ship"
|
|
142
|
+
* ship".
|
|
141
143
|
*
|
|
142
144
|
* Scope: the diagnostics an EXPORT collects. A guard that runs while a
|
|
143
145
|
* statement is being built ({@link emitDiagnostic}) has already had its say by
|
|
@@ -287,15 +289,41 @@ function barePatternRefusal(value) {
|
|
|
287
289
|
if (isValidPcreLiteral(value.value)) return null;
|
|
288
290
|
return `${JSON.stringify(value.value)} is a BARE regex pattern. PHP \`preg_*\` reads the first character as the delimiter, so the engine matches nothing for every input \u2014 the assertion or precondition built on it fails (or passes) against text that plainly should not. Build it with c.regex(${JSON.stringify(value.value)}) instead of c.text(...), which wraps and escapes it into a valid PCRE literal`;
|
|
289
291
|
}
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
292
|
+
var REGEX_SUBJECT_SLOT = {
|
|
293
|
+
regex_test: 0,
|
|
294
|
+
regex_match: 0,
|
|
295
|
+
regex_match_all: 0,
|
|
296
|
+
regex_matches: 0,
|
|
297
|
+
regex_replace: 1,
|
|
298
|
+
regex_get_all_matches: 0,
|
|
299
|
+
regex_get_first_match: 0
|
|
300
|
+
};
|
|
301
|
+
var REGEX_PATTERN_FILTERS = new Set(Object.keys(REGEX_SUBJECT_SLOT));
|
|
302
|
+
var REGEX_METACHARACTERS = /[\\^$.|?*+()[\]{}]/;
|
|
303
|
+
function readablePattern(value) {
|
|
304
|
+
if (!value || value.tag !== "const") return null;
|
|
305
|
+
if (Array.isArray(value.filters) && value.filters.length > 0) return null;
|
|
306
|
+
return isValidPcreLiteral(value.value) ? value.value : null;
|
|
307
|
+
}
|
|
308
|
+
function reversedOperandRefusal(pattern, subject) {
|
|
309
|
+
const misplaced = readablePattern(subject);
|
|
310
|
+
if (misplaced === null || !REGEX_METACHARACTERS.test(misplaced)) return null;
|
|
311
|
+
if (readablePattern(pattern) !== null) return null;
|
|
312
|
+
return `the OPERANDS are reversed. ${JSON.stringify(misplaced)} is a delimiter-wrapped regex pattern sitting in the SUBJECT slot, which means the pattern and the text it tests were written the other way round. The regex family is pattern-piped \u2014 the piped value is the PATTERN and the argument is the text matched against it, the reverse of every other filter \u2014 so this runs the subject as a pattern and answers false for every input, with HTTP 200 and no error. Swap them: pipe the c.regex(...) pattern and pass the subject as the argument`;
|
|
313
|
+
}
|
|
314
|
+
function reversedRegexOperands(v2) {
|
|
315
|
+
const chain = Array.isArray(v2.filters) ? v2.filters : [];
|
|
316
|
+
for (const [i, applied] of chain.entries()) {
|
|
317
|
+
const slot = REGEX_SUBJECT_SLOT[applied.name];
|
|
318
|
+
if (slot === void 0) continue;
|
|
319
|
+
const pattern = { value: v2.value, tag: v2.tag, filters: chain.slice(0, i) };
|
|
320
|
+
const message = reversedOperandRefusal(pattern, applied.arg?.[slot]);
|
|
321
|
+
if (message !== null) {
|
|
322
|
+
return { filter: applied.name, slot, subject: applied.arg?.[slot]?.value ?? "", message };
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
299
327
|
function intLiteral(n) {
|
|
300
328
|
if (typeof n === "bigint") return String(n);
|
|
301
329
|
if (typeof n === "string") {
|
|
@@ -346,7 +374,7 @@ var c = {
|
|
|
346
374
|
* A `number` that is not an integer, or is past `Number.MAX_SAFE_INTEGER`,
|
|
347
375
|
* **throws**: by the time such a literal reaches here its precision is already
|
|
348
376
|
* gone, so encoding it would write a value the caller did not type. The throw
|
|
349
|
-
* names the string form.
|
|
377
|
+
* names the string form.
|
|
350
378
|
*/
|
|
351
379
|
int(n) {
|
|
352
380
|
return val(intLiteral(n), "const:int");
|
|
@@ -394,7 +422,7 @@ var c = {
|
|
|
394
422
|
* null** the engine writes into a `db.*` statement's `@meta` slot —
|
|
395
423
|
* `c.null("const:obj")` → `{tag:"const:obj", value:"null"}`, 16 of them across
|
|
396
424
|
* eight ordinary queries in the survey corpus, which had no spelling and came
|
|
397
|
-
* back as `rawValue
|
|
425
|
+
* back as `rawValue`.
|
|
398
426
|
*
|
|
399
427
|
* ⚠ Not the same bytes as `c.obj(null)`, which is the BLANK object
|
|
400
428
|
* (`value: ""`). Both evaluate to null — the engine JSON-decodes the stored
|
|
@@ -410,7 +438,7 @@ var c = {
|
|
|
410
438
|
* (`fl.regex_test`/`regex_match`/`regex_replace`/…). Xano runs PHP `preg_*`, so
|
|
411
439
|
* the pattern MUST be delimiter-wrapped — a bare `c.text("^…$")` is an invalid
|
|
412
440
|
* PCRE and the filter then matches *nothing* for every input, so a precondition
|
|
413
|
-
* built on it silently rejects all values
|
|
441
|
+
* built on it silently rejects all values. This wraps the raw
|
|
414
442
|
* pattern in `/…/`, escapes any interior `/`, and appends `flags`, so the result
|
|
415
443
|
* is always valid; `withFilters` rejects a bare `c.text` pattern and points here.
|
|
416
444
|
*
|
|
@@ -438,8 +466,13 @@ var c = {
|
|
|
438
466
|
* `text("now") |to_epoch_ms` chain; both evaluate to the same epoch-ms number
|
|
439
467
|
* on a live engine, and both persist verbatim, but the native tag is what the
|
|
440
468
|
* editor writes and needs no filter to get there. Chain math onto it as usual:
|
|
441
|
-
* `withFilters(c.now(), fl.epochms_add_ms(c.int(-maxAgeMs)))`.
|
|
442
|
-
*
|
|
469
|
+
* `withFilters(c.now(), fl.epochms_add_ms(c.int(-maxAgeMs)))`.
|
|
470
|
+
*
|
|
471
|
+
* Inside an `obj()` the tag is flattened into an expression string, where the
|
|
472
|
+
* identifier `now` alone is the STRING "now" — so `obj()` writes the
|
|
473
|
+
* `now|to_epochms` coercion that restores this tag's meaning. A `c.now()` used
|
|
474
|
+
* as a FILTER ARGUMENT there is refused: the coercion cannot be written in
|
|
475
|
+
* that position. Hoist it with `s.set_var` and `ref()` it.
|
|
443
476
|
*/
|
|
444
477
|
now() {
|
|
445
478
|
return val("now", "const:epochms");
|
|
@@ -450,7 +483,6 @@ var c = {
|
|
|
450
483
|
* compile error and throws at runtime — it would serialize as internal
|
|
451
484
|
* representation the engine can't decode. For a computed/multi-key object
|
|
452
485
|
* response use a record of values (`response: { key: value }`), not `c.obj`.
|
|
453
|
-
* See issue #42.
|
|
454
486
|
*
|
|
455
487
|
* Called with no argument it is the **empty object**, `{}` — the same default
|
|
456
488
|
* the editor gives a new object variable, and the only empty form current
|
|
@@ -467,7 +499,7 @@ var c = {
|
|
|
467
499
|
* same bytes instead of being quietly re-pointed at `{}`.
|
|
468
500
|
*
|
|
469
501
|
* A **populated** object is stored the way the editor stores one: an empty
|
|
470
|
-
* `{}` base carrying one `set` filter per key
|
|
502
|
+
* `{}` base carrying one `set` filter per key. It is NOT a
|
|
471
503
|
* populated JSON string — that form fails the request at runtime, see
|
|
472
504
|
* {@link objSetFilters}.
|
|
473
505
|
*
|
|
@@ -488,7 +520,7 @@ var c = {
|
|
|
488
520
|
/**
|
|
489
521
|
* Array constant → JSON-string value with `tag:"const:array"`. Takes **plain
|
|
490
522
|
* JSON literals only** — like {@link obj}, a nested tagged value is a compile
|
|
491
|
-
* error and throws at runtime.
|
|
523
|
+
* error and throws at runtime.
|
|
492
524
|
*/
|
|
493
525
|
array(a) {
|
|
494
526
|
assertPlainJson(a);
|
|
@@ -665,6 +697,16 @@ function withFilters(value, ...filters) {
|
|
|
665
697
|
`withFilters: argument ${malformed} of the filter chain is not a filter \u2014 got ${JSON.stringify(got) ?? String(got)}. Each entry must come from an \`fl.*\` factory (or \`filter(name, ...)\`), which returns \`{name, arg, disabled}\`. A tagged value is not a filter: to pipe one value through another, pass it as a filter ARGUMENT (\`fl.concat(other)\`), not as a chain member.`
|
|
666
698
|
);
|
|
667
699
|
}
|
|
700
|
+
const reversed = reversedRegexOperands({
|
|
701
|
+
value: value.value,
|
|
702
|
+
tag: value.tag,
|
|
703
|
+
filters: [...value.filters, ...added]
|
|
704
|
+
});
|
|
705
|
+
if (reversed) {
|
|
706
|
+
throw new Error(
|
|
707
|
+
`Regex filter \`${reversed.filter}\`: ${reversed.message} \u2014 \`withFilters(c.regex(\u2026), fl.${reversed.filter}(${reversed.slot === 0 ? "" : "\u2026, "}subject))\`. Naming the argument says which slot is which: \`fl.${reversed.filter}({ subject: \u2026 })\`. (issue #298)`
|
|
708
|
+
);
|
|
709
|
+
}
|
|
668
710
|
const pipedIsBarePattern = barePatternRefusal(value) !== null;
|
|
669
711
|
const offending = pipedIsBarePattern ? added.find((filter2) => REGEX_PATTERN_FILTERS.has(filter2.name)) : void 0;
|
|
670
712
|
if (offending) {
|
|
@@ -1312,7 +1354,7 @@ var f = {
|
|
|
1312
1354
|
* bytes, and a map does not preserve it.
|
|
1313
1355
|
*
|
|
1314
1356
|
* Without this there is no way to author a structured JSON column at all
|
|
1315
|
-
|
|
1357
|
+
*.
|
|
1316
1358
|
*/
|
|
1317
1359
|
json(options = {}) {
|
|
1318
1360
|
return descriptor("json", { ...options });
|
|
@@ -1382,9 +1424,8 @@ var f = {
|
|
|
1382
1424
|
* instead: `f.tableRef("tweets", { type: "int" })`. Identity guids derive
|
|
1383
1425
|
* from `(type, name)`, so the name form resolves to the same guid.
|
|
1384
1426
|
*
|
|
1385
|
-
* Byte-verified whole-object against a persisted table readback
|
|
1386
|
-
*
|
|
1387
|
-
* `test/conformance/kinds-corpus.test.ts`): the `@` method carries
|
|
1427
|
+
* Byte-verified whole-object against a persisted table readback: the `@`
|
|
1428
|
+
* method carries
|
|
1388
1429
|
* `disabled:false`, sits last in `methods`, and its `dbo=` arg is the target
|
|
1389
1430
|
* table's payload guid.
|
|
1390
1431
|
*
|
|
@@ -1431,7 +1472,7 @@ var input = {
|
|
|
1431
1472
|
* password on **both** signup and login, let the `f.password` *column* hash on write,
|
|
1432
1473
|
* and pass the plaintext straight to `check_password`. See the auth recipe in the
|
|
1433
1474
|
* README. Reach for `input.password` only when you specifically want bind-time hashing
|
|
1434
|
-
* and are not also comparing it with `check_password
|
|
1475
|
+
* and are not also comparing it with `check_password`.
|
|
1435
1476
|
*/
|
|
1436
1477
|
password: makeInput("password"),
|
|
1437
1478
|
/**
|
|
@@ -1559,8 +1600,86 @@ function encodeInput(name, descriptor2) {
|
|
|
1559
1600
|
// src/values/obj.ts
|
|
1560
1601
|
var IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1561
1602
|
function serializeValue(v2, path) {
|
|
1603
|
+
const record = objSetRecord(v2, path);
|
|
1604
|
+
if (record) return record;
|
|
1605
|
+
const nowExpr = serializeEpochMs(v2);
|
|
1606
|
+
if (nowExpr !== null) return nowExpr + serializeFilters(v2, path);
|
|
1562
1607
|
return serializeAtom(v2, path) + serializeFilters(v2, path);
|
|
1563
1608
|
}
|
|
1609
|
+
function serializeEpochMs(v2) {
|
|
1610
|
+
if (v2.tag !== "const:epochms") return null;
|
|
1611
|
+
if (v2.value !== "now") return null;
|
|
1612
|
+
return "now|to_epochms";
|
|
1613
|
+
}
|
|
1614
|
+
function objSetRecord(v2, path) {
|
|
1615
|
+
if (v2.tag !== "const:obj") return null;
|
|
1616
|
+
if (v2.value === "") {
|
|
1617
|
+
throw new Error(
|
|
1618
|
+
`obj(): \`${path}\` is \`c.obj(null)\`, the legacy BLANK object form \u2014 the engine evaluates it to null, not to {}. Write \`c.null()\` for the null, or \`c.obj()\` for an empty object.`
|
|
1619
|
+
);
|
|
1620
|
+
}
|
|
1621
|
+
if (v2.value !== "{}") {
|
|
1622
|
+
const parsed = parseJson(v2.value);
|
|
1623
|
+
if (parsed === NOT_JSON) return null;
|
|
1624
|
+
return serializeJson(parsed, path) + serializeFilters(v2, path);
|
|
1625
|
+
}
|
|
1626
|
+
const parts = [];
|
|
1627
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1628
|
+
let i = 0;
|
|
1629
|
+
for (; i < v2.filters.length; i++) {
|
|
1630
|
+
const f2 = v2.filters[i];
|
|
1631
|
+
if (f2.name !== "set" || f2.disabled || f2.arg.length !== 2) break;
|
|
1632
|
+
const [pathArg, member] = f2.arg;
|
|
1633
|
+
if (pathArg.tag !== "const" || pathArg.filters.length > 0) break;
|
|
1634
|
+
const bracketed = pathArg.value.startsWith("[");
|
|
1635
|
+
const key = parseSetPath(pathArg.value);
|
|
1636
|
+
if (!IDENT.test(key)) {
|
|
1637
|
+
if (!bracketed) break;
|
|
1638
|
+
throw new Error(
|
|
1639
|
+
`obj(): key "${key}" inside the \`c.obj\` at \`${path}\` must be a bare identifier ([A-Za-z_][A-Za-z0-9_]*) \u2014 XanoScript object keys aren't quoted.`
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
if (keys.has(key)) break;
|
|
1643
|
+
keys.add(key);
|
|
1644
|
+
parts.push(`${key}: ${serializeValue(member, `${path}.${key}`)}`);
|
|
1645
|
+
}
|
|
1646
|
+
const rendered = parts.length === 0 ? "{}" : `{ ${parts.join(", ")} }`;
|
|
1647
|
+
const rest = { ...v2, filters: v2.filters.slice(i) };
|
|
1648
|
+
return rendered + serializeFilters(rest, path);
|
|
1649
|
+
}
|
|
1650
|
+
function parseSetPath(stored) {
|
|
1651
|
+
const bracketed = /^\["(.*)"\]$/s.exec(stored);
|
|
1652
|
+
return bracketed ? bracketed[1].replace(/\\(["\\])/g, "$1") : stored;
|
|
1653
|
+
}
|
|
1654
|
+
var NOT_JSON = /* @__PURE__ */ Symbol("not-json");
|
|
1655
|
+
function parseJson(text) {
|
|
1656
|
+
try {
|
|
1657
|
+
return JSON.parse(text);
|
|
1658
|
+
} catch {
|
|
1659
|
+
return NOT_JSON;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function serializeJson(value, path) {
|
|
1663
|
+
if (value === null) return "null";
|
|
1664
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
1665
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
1666
|
+
if (typeof value === "number") return Number.isFinite(value) ? String(value) : "null";
|
|
1667
|
+
if (Array.isArray(value)) {
|
|
1668
|
+
return `[${value.map((el, i) => serializeJson(el, `${path}[${i}]`)).join(", ")}]`;
|
|
1669
|
+
}
|
|
1670
|
+
if (typeof value === "object") {
|
|
1671
|
+
const parts = Object.entries(value).map(([key, member]) => {
|
|
1672
|
+
if (!IDENT.test(key)) {
|
|
1673
|
+
throw new Error(
|
|
1674
|
+
`obj(): key "${key}" at \`${path}\` must be a bare identifier ([A-Za-z_][A-Za-z0-9_]*) \u2014 XanoScript object keys aren't quoted.`
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
return `${key}: ${serializeJson(member, `${path}.${key}`)}`;
|
|
1678
|
+
});
|
|
1679
|
+
return parts.length === 0 ? "{}" : `{ ${parts.join(", ")} }`;
|
|
1680
|
+
}
|
|
1681
|
+
return "null";
|
|
1682
|
+
}
|
|
1564
1683
|
function serializeFilters(v2, path) {
|
|
1565
1684
|
let out2 = "";
|
|
1566
1685
|
for (const f2 of v2.filters) {
|
|
@@ -1608,15 +1727,28 @@ function serializeAtom(v2, path) {
|
|
|
1608
1727
|
// renders `$env.STRIPE_KEY`.
|
|
1609
1728
|
case "setting":
|
|
1610
1729
|
return `$env.${v2.value}`;
|
|
1611
|
-
// The engine's native current-time constant
|
|
1612
|
-
//
|
|
1613
|
-
//
|
|
1730
|
+
// The engine's native current-time constant reaches this function ONLY as a
|
|
1731
|
+
// filter argument — a member position is answered by `serializeEpochMs`
|
|
1732
|
+
// above. There it is unwritable: the value needs a leading `|to_epochms` to
|
|
1733
|
+
// evaluate as a time at all (see `serializeEpochMs`), and inside an argument
|
|
1734
|
+
// a trailing `|` binds to the whole value rather than to the argument, which
|
|
1735
|
+
// is the same wall a pre-filtered argument hits.
|
|
1614
1736
|
case "const:epochms":
|
|
1615
|
-
|
|
1737
|
+
throw new Error(
|
|
1738
|
+
`obj(): \`${path}\` is \`c.now()\` used as a FILTER ARGUMENT. In an expression the current-time constant has to carry a \`|to_epochms\` coercion, and a \`|\` inside an argument binds to the whole value instead \u2014 so this cannot be written without changing what it means. Compute it in a prior step (\`s.set_var("now", c.now())\`) and reference it with \`ref("now")\`.`
|
|
1739
|
+
);
|
|
1740
|
+
// `c.array([…])` stores plain JSON, and the literal grammar spells the same
|
|
1741
|
+
// list — so it renders to the identical bytes a bare `[…]` member does. The
|
|
1742
|
+
// bare form always worked and this one used to throw, which made the empty
|
|
1743
|
+
// list (`c.array([])`) an export failure with no named way through (#295).
|
|
1744
|
+
case "const:array": {
|
|
1745
|
+
const parsed = parseJson(v2.value);
|
|
1746
|
+
if (parsed !== NOT_JSON) return serializeJson(parsed, path);
|
|
1616
1747
|
break;
|
|
1748
|
+
}
|
|
1617
1749
|
}
|
|
1618
1750
|
throw new Error(
|
|
1619
|
-
`obj(): value tag "${v2.tag}" at \`${path}\` isn't supported in a dynamic object literal yet. Supported: inp(), ref(), auth(), col(), env()/setting()/sys.*, c.now(),
|
|
1751
|
+
`obj(): value tag "${v2.tag}" at \`${path}\` isn't supported in a dynamic object literal yet. Supported: inp(), ref(), auth(), col(), env()/setting()/sys.*, c.now(), c.text/int/decimal/bool/null, and c.obj()/c.array() \u2014 each optionally carrying a filter chain. A constant record or list can also be written bare: \`{ a: 1 }\`, \`[]\`.`
|
|
1620
1752
|
);
|
|
1621
1753
|
}
|
|
1622
1754
|
function serializeMember(m, path) {
|
|
@@ -1683,7 +1815,7 @@ var slotted = (name, argNames, required, capped = true) => (...args) => {
|
|
|
1683
1815
|
const hole = argNames.slice(0, last).findIndex((n) => named[n] === void 0);
|
|
1684
1816
|
if (hole !== -1) {
|
|
1685
1817
|
throw new Error(
|
|
1686
|
-
`fl.${name}: \`${argNames[hole]}\` is omitted but \`${argNames[last]}\` is supplied. Filter arguments are positional even in this form \u2014 the engine reads them by slot, so one in the middle cannot be skipped. Supply \`${argNames[hole]}\` too
|
|
1818
|
+
`fl.${name}: \`${argNames[hole]}\` is omitted but \`${argNames[last]}\` is supplied. Filter arguments are positional even in this form \u2014 the engine reads them by slot, so one in the middle cannot be skipped. Supply \`${argNames[hole]}\` too.`
|
|
1687
1819
|
);
|
|
1688
1820
|
}
|
|
1689
1821
|
assertArity(name, argNames, required, last + 1);
|
|
@@ -1692,7 +1824,7 @@ var slotted = (name, argNames, required, capped = true) => (...args) => {
|
|
|
1692
1824
|
var assertArity = (name, argNames, required, got) => {
|
|
1693
1825
|
if (got >= required) return;
|
|
1694
1826
|
throw new Error(
|
|
1695
|
-
`fl.${name} needs ${required} argument(s) \u2014 ${argNames.slice(0, required).join(", ")} \u2014 but got ${got}. Filter arguments are positional and the engine refuses a short call, so a missing one cannot be inferred \u2014 not even where the filter's own documentation calls it optional. Some filters accept omission from the END and some require every argument regardless; which is which is probed, not declared
|
|
1827
|
+
`fl.${name} needs ${required} argument(s) \u2014 ${argNames.slice(0, required).join(", ")} \u2014 but got ${got}. Filter arguments are positional and the engine refuses a short call, so a missing one cannot be inferred \u2014 not even where the filter's own documentation calls it optional. Some filters accept omission from the END and some require every argument regardless; which is which is probed, not declared.`
|
|
1696
1828
|
);
|
|
1697
1829
|
};
|
|
1698
1830
|
var assertMaxArity = (name, argNames, got) => {
|
|
@@ -4006,6 +4138,8 @@ export {
|
|
|
4006
4138
|
DiagnosticBag,
|
|
4007
4139
|
isTaggedValue,
|
|
4008
4140
|
barePatternRefusal,
|
|
4141
|
+
reversedOperandRefusal,
|
|
4142
|
+
reversedRegexOperands,
|
|
4009
4143
|
c,
|
|
4010
4144
|
ref,
|
|
4011
4145
|
inp,
|
|
@@ -4117,4 +4251,4 @@ export {
|
|
|
4117
4251
|
serializeBundle,
|
|
4118
4252
|
emitBundle
|
|
4119
4253
|
};
|
|
4120
|
-
//# sourceMappingURL=chunk-
|
|
4254
|
+
//# sourceMappingURL=chunk-N74KDCBD.js.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// src/util/hash.ts
|
|
2
|
+
var utf8 = new TextEncoder();
|
|
3
|
+
function toBytes(input) {
|
|
4
|
+
return typeof input === "string" ? utf8.encode(input) : input;
|
|
5
|
+
}
|
|
6
|
+
function md5Bytes(input) {
|
|
7
|
+
const msg = toBytes(input);
|
|
8
|
+
const len = msg.length;
|
|
9
|
+
const withPad = (len + 8 >>> 6) + 1;
|
|
10
|
+
const words = new Int32Array(withPad * 16);
|
|
11
|
+
for (let i = 0; i < len; i++) {
|
|
12
|
+
const idx = i >> 2;
|
|
13
|
+
words[idx] = words[idx] | msg[i] << i % 4 * 8;
|
|
14
|
+
}
|
|
15
|
+
const padIdx = len >> 2;
|
|
16
|
+
words[padIdx] = words[padIdx] | 128 << len % 4 * 8;
|
|
17
|
+
words[words.length - 2] = len * 8;
|
|
18
|
+
let a = 1732584193, b = -271733879, c = -1732584194, d = 271733878;
|
|
19
|
+
const add = (x, y) => x + y | 0;
|
|
20
|
+
const rol = (n, s) => n << s | n >>> 32 - s;
|
|
21
|
+
const cmn = (q, a0, b0, x, s, t) => add(rol(add(add(a0, q), add(x, t)), s), b0);
|
|
22
|
+
const ff = (a0, b0, c0, d0, x, s, t) => cmn(b0 & c0 | ~b0 & d0, a0, b0, x, s, t);
|
|
23
|
+
const gg = (a0, b0, c0, d0, x, s, t) => cmn(b0 & d0 | c0 & ~d0, a0, b0, x, s, t);
|
|
24
|
+
const hh = (a0, b0, c0, d0, x, s, t) => cmn(b0 ^ c0 ^ d0, a0, b0, x, s, t);
|
|
25
|
+
const ii = (a0, b0, c0, d0, x, s, t) => cmn(c0 ^ (b0 | ~d0), a0, b0, x, s, t);
|
|
26
|
+
for (let i = 0; i < words.length; i += 16) {
|
|
27
|
+
const oa = a, ob = b, oc = c, od = d;
|
|
28
|
+
const w = (j) => words[i + j];
|
|
29
|
+
a = ff(a, b, c, d, w(0), 7, -680876936);
|
|
30
|
+
d = ff(d, a, b, c, w(1), 12, -389564586);
|
|
31
|
+
c = ff(c, d, a, b, w(2), 17, 606105819);
|
|
32
|
+
b = ff(b, c, d, a, w(3), 22, -1044525330);
|
|
33
|
+
a = ff(a, b, c, d, w(4), 7, -176418897);
|
|
34
|
+
d = ff(d, a, b, c, w(5), 12, 1200080426);
|
|
35
|
+
c = ff(c, d, a, b, w(6), 17, -1473231341);
|
|
36
|
+
b = ff(b, c, d, a, w(7), 22, -45705983);
|
|
37
|
+
a = ff(a, b, c, d, w(8), 7, 1770035416);
|
|
38
|
+
d = ff(d, a, b, c, w(9), 12, -1958414417);
|
|
39
|
+
c = ff(c, d, a, b, w(10), 17, -42063);
|
|
40
|
+
b = ff(b, c, d, a, w(11), 22, -1990404162);
|
|
41
|
+
a = ff(a, b, c, d, w(12), 7, 1804603682);
|
|
42
|
+
d = ff(d, a, b, c, w(13), 12, -40341101);
|
|
43
|
+
c = ff(c, d, a, b, w(14), 17, -1502002290);
|
|
44
|
+
b = ff(b, c, d, a, w(15), 22, 1236535329);
|
|
45
|
+
a = gg(a, b, c, d, w(1), 5, -165796510);
|
|
46
|
+
d = gg(d, a, b, c, w(6), 9, -1069501632);
|
|
47
|
+
c = gg(c, d, a, b, w(11), 14, 643717713);
|
|
48
|
+
b = gg(b, c, d, a, w(0), 20, -373897302);
|
|
49
|
+
a = gg(a, b, c, d, w(5), 5, -701558691);
|
|
50
|
+
d = gg(d, a, b, c, w(10), 9, 38016083);
|
|
51
|
+
c = gg(c, d, a, b, w(15), 14, -660478335);
|
|
52
|
+
b = gg(b, c, d, a, w(4), 20, -405537848);
|
|
53
|
+
a = gg(a, b, c, d, w(9), 5, 568446438);
|
|
54
|
+
d = gg(d, a, b, c, w(14), 9, -1019803690);
|
|
55
|
+
c = gg(c, d, a, b, w(3), 14, -187363961);
|
|
56
|
+
b = gg(b, c, d, a, w(8), 20, 1163531501);
|
|
57
|
+
a = gg(a, b, c, d, w(13), 5, -1444681467);
|
|
58
|
+
d = gg(d, a, b, c, w(2), 9, -51403784);
|
|
59
|
+
c = gg(c, d, a, b, w(7), 14, 1735328473);
|
|
60
|
+
b = gg(b, c, d, a, w(12), 20, -1926607734);
|
|
61
|
+
a = hh(a, b, c, d, w(5), 4, -378558);
|
|
62
|
+
d = hh(d, a, b, c, w(8), 11, -2022574463);
|
|
63
|
+
c = hh(c, d, a, b, w(11), 16, 1839030562);
|
|
64
|
+
b = hh(b, c, d, a, w(14), 23, -35309556);
|
|
65
|
+
a = hh(a, b, c, d, w(1), 4, -1530992060);
|
|
66
|
+
d = hh(d, a, b, c, w(4), 11, 1272893353);
|
|
67
|
+
c = hh(c, d, a, b, w(7), 16, -155497632);
|
|
68
|
+
b = hh(b, c, d, a, w(10), 23, -1094730640);
|
|
69
|
+
a = hh(a, b, c, d, w(13), 4, 681279174);
|
|
70
|
+
d = hh(d, a, b, c, w(0), 11, -358537222);
|
|
71
|
+
c = hh(c, d, a, b, w(3), 16, -722521979);
|
|
72
|
+
b = hh(b, c, d, a, w(6), 23, 76029189);
|
|
73
|
+
a = hh(a, b, c, d, w(9), 4, -640364487);
|
|
74
|
+
d = hh(d, a, b, c, w(12), 11, -421815835);
|
|
75
|
+
c = hh(c, d, a, b, w(15), 16, 530742520);
|
|
76
|
+
b = hh(b, c, d, a, w(2), 23, -995338651);
|
|
77
|
+
a = ii(a, b, c, d, w(0), 6, -198630844);
|
|
78
|
+
d = ii(d, a, b, c, w(7), 10, 1126891415);
|
|
79
|
+
c = ii(c, d, a, b, w(14), 15, -1416354905);
|
|
80
|
+
b = ii(b, c, d, a, w(5), 21, -57434055);
|
|
81
|
+
a = ii(a, b, c, d, w(12), 6, 1700485571);
|
|
82
|
+
d = ii(d, a, b, c, w(3), 10, -1894986606);
|
|
83
|
+
c = ii(c, d, a, b, w(10), 15, -1051523);
|
|
84
|
+
b = ii(b, c, d, a, w(1), 21, -2054922799);
|
|
85
|
+
a = ii(a, b, c, d, w(8), 6, 1873313359);
|
|
86
|
+
d = ii(d, a, b, c, w(15), 10, -30611744);
|
|
87
|
+
c = ii(c, d, a, b, w(6), 15, -1560198380);
|
|
88
|
+
b = ii(b, c, d, a, w(13), 21, 1309151649);
|
|
89
|
+
a = ii(a, b, c, d, w(4), 6, -145523070);
|
|
90
|
+
d = ii(d, a, b, c, w(11), 10, -1120210379);
|
|
91
|
+
c = ii(c, d, a, b, w(2), 15, 718787259);
|
|
92
|
+
b = ii(b, c, d, a, w(9), 21, -343485551);
|
|
93
|
+
a = add(a, oa);
|
|
94
|
+
b = add(b, ob);
|
|
95
|
+
c = add(c, oc);
|
|
96
|
+
d = add(d, od);
|
|
97
|
+
}
|
|
98
|
+
const out = new Uint8Array(16);
|
|
99
|
+
[a, b, c, d].forEach((word, wi) => {
|
|
100
|
+
for (let j = 0; j < 4; j++) out[wi * 4 + j] = word >>> j * 8 & 255;
|
|
101
|
+
});
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
function md5Hex(input) {
|
|
105
|
+
return toHex(md5Bytes(input));
|
|
106
|
+
}
|
|
107
|
+
function sha1Bytes(input) {
|
|
108
|
+
const msg = toBytes(input);
|
|
109
|
+
const len = msg.length;
|
|
110
|
+
const withLen = len + 9;
|
|
111
|
+
const blocks = Math.ceil(withLen / 64);
|
|
112
|
+
const total = blocks * 64;
|
|
113
|
+
const buf = new Uint8Array(total);
|
|
114
|
+
buf.set(msg);
|
|
115
|
+
buf[len] = 128;
|
|
116
|
+
const bitLen = len * 8;
|
|
117
|
+
buf[total - 4] = bitLen >>> 24 & 255;
|
|
118
|
+
buf[total - 3] = bitLen >>> 16 & 255;
|
|
119
|
+
buf[total - 2] = bitLen >>> 8 & 255;
|
|
120
|
+
buf[total - 1] = bitLen & 255;
|
|
121
|
+
let h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878, h4 = -1009589776;
|
|
122
|
+
const w = new Int32Array(80);
|
|
123
|
+
const rol = (n, s) => n << s | n >>> 32 - s;
|
|
124
|
+
for (let i = 0; i < total; i += 64) {
|
|
125
|
+
for (let j = 0; j < 16; j++) {
|
|
126
|
+
const k = i + j * 4;
|
|
127
|
+
w[j] = buf[k] << 24 | buf[k + 1] << 16 | buf[k + 2] << 8 | buf[k + 3];
|
|
128
|
+
}
|
|
129
|
+
for (let j = 16; j < 80; j++) w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
|
|
130
|
+
let a = h0, b = h1, c = h2, d = h3, e = h4;
|
|
131
|
+
for (let j = 0; j < 80; j++) {
|
|
132
|
+
let f, k;
|
|
133
|
+
if (j < 20) {
|
|
134
|
+
f = b & c | ~b & d;
|
|
135
|
+
k = 1518500249;
|
|
136
|
+
} else if (j < 40) {
|
|
137
|
+
f = b ^ c ^ d;
|
|
138
|
+
k = 1859775393;
|
|
139
|
+
} else if (j < 60) {
|
|
140
|
+
f = b & c | b & d | c & d;
|
|
141
|
+
k = -1894007588;
|
|
142
|
+
} else {
|
|
143
|
+
f = b ^ c ^ d;
|
|
144
|
+
k = -899497514;
|
|
145
|
+
}
|
|
146
|
+
const t = rol(a, 5) + f + e + k + w[j] | 0;
|
|
147
|
+
e = d;
|
|
148
|
+
d = c;
|
|
149
|
+
c = rol(b, 30);
|
|
150
|
+
b = a;
|
|
151
|
+
a = t;
|
|
152
|
+
}
|
|
153
|
+
h0 = h0 + a | 0;
|
|
154
|
+
h1 = h1 + b | 0;
|
|
155
|
+
h2 = h2 + c | 0;
|
|
156
|
+
h3 = h3 + d | 0;
|
|
157
|
+
h4 = h4 + e | 0;
|
|
158
|
+
}
|
|
159
|
+
const out = new Uint8Array(20);
|
|
160
|
+
[h0, h1, h2, h3, h4].forEach((h, hi) => {
|
|
161
|
+
out[hi * 4] = h >>> 24 & 255;
|
|
162
|
+
out[hi * 4 + 1] = h >>> 16 & 255;
|
|
163
|
+
out[hi * 4 + 2] = h >>> 8 & 255;
|
|
164
|
+
out[hi * 4 + 3] = h & 255;
|
|
165
|
+
});
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
function toHex(bytes) {
|
|
169
|
+
let s = "";
|
|
170
|
+
for (const b of bytes) s += b.toString(16).padStart(2, "0");
|
|
171
|
+
return s;
|
|
172
|
+
}
|
|
173
|
+
function randomBytes(n) {
|
|
174
|
+
const out = new Uint8Array(n);
|
|
175
|
+
globalThis.crypto.getRandomValues(out);
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
md5Hex,
|
|
181
|
+
sha1Bytes,
|
|
182
|
+
randomBytes
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=chunk-OHX6MIUZ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeTransportFailure,
|
|
3
3
|
httpFailure
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NDP7OUPS.js";
|
|
5
5
|
|
|
6
6
|
// src/deploy/branch.ts
|
|
7
7
|
var BRANCH_TIMEOUT_MS = 3e4;
|
|
@@ -156,4 +156,4 @@ export {
|
|
|
156
156
|
assertBranchAbsent,
|
|
157
157
|
requireBranch
|
|
158
158
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
159
|
+
//# sourceMappingURL=chunk-P6PVBQL6.js.map
|