@onlyworlds/sdk 4.123.1 → 4.123.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/CHANGELOG.md +12 -0
- package/dist/{chunk-F2OJWWDO.js → chunk-HML3HS3U.js} +7 -1
- package/dist/index.js +46 -39
- package/dist/waymark.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.123.3] - 2026-10-31
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **A value in a request path that is not one segment is refused before anything is sent.** 4.122.1 escaped every path value, but the API decodes an escaped slash before it routes: `get('character', '<id>%2Fhidden')` and an id carrying `/` still reached another route (`/character/<id>/hidden`). Every type, id, link field and account-route id (world, seat, link, member, key, token, file, proposal) is now checked first: a type is a lower-case word, every other value letters, digits, `_`, `.` and `-`, not starting with a dot or a dash. Anything else is a `TypeError` naming the value, and nothing is sent; what passes is still escaped. Every id the API serves passes. A test reads every request path in the client's source and fails on one that does not go through the check.
|
|
13
|
+
|
|
14
|
+
## [4.123.2] - 2026-10-31
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`openersFor` refuses a link that opens no app.** A tools list row whose `open` template uses `javascript:`, `data:`, `vbscript:`, `file:`, `blob:` or `about:` (in any case), or does not begin with its scheme, is a `TypeError` naming the row, where it was drawn as a row a press would run. The tools list's own check refuses these too; this holds the reader to it for a list that skipped the check (the `tools` option, a served copy). Four cases in the shared openers fixture (61).
|
|
19
|
+
|
|
8
20
|
## [4.123.1] - 2026-10-31
|
|
9
21
|
|
|
10
22
|
### Changed
|
|
@@ -1242,9 +1242,15 @@ var OFFLINE = "Needs a connection";
|
|
|
1242
1242
|
var fail = (what) => {
|
|
1243
1243
|
throw new TypeError(`openersFor: ${what}`);
|
|
1244
1244
|
};
|
|
1245
|
+
var NO_APP = ["javascript", "data", "vbscript", "file", "blob", "about"];
|
|
1246
|
+
var SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/;
|
|
1245
1247
|
function templateOf(row, key, v) {
|
|
1246
1248
|
if (v === void 0 || v === null) return null;
|
|
1247
|
-
|
|
1249
|
+
if (typeof v !== "string") fail(`tool ${row}: open.${key} is a link template or null`);
|
|
1250
|
+
const scheme = SCHEME.exec(v)?.[1].toLowerCase();
|
|
1251
|
+
if (scheme === void 0) fail(`tool ${row}: open.${key} begins with its scheme`);
|
|
1252
|
+
if (NO_APP.includes(scheme)) fail(`tool ${row}: open.${key} is a ${scheme}: link, which opens no app`);
|
|
1253
|
+
return v;
|
|
1248
1254
|
}
|
|
1249
1255
|
function openersFor(tools, kind, address, surface) {
|
|
1250
1256
|
if (!Array.isArray(tools)) fail("tools is the tools list's rows, an array");
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
trimWhiteSpace,
|
|
38
38
|
typeWord,
|
|
39
39
|
unknownKey
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-HML3HS3U.js";
|
|
41
41
|
|
|
42
42
|
// src/v2/keyed-id.ts
|
|
43
43
|
var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
|
|
@@ -816,7 +816,7 @@ var OwV2Client = class {
|
|
|
816
816
|
throw new TypeError("worldLenses: resolve is true or false. Nothing was sent.");
|
|
817
817
|
}
|
|
818
818
|
const query = buildQuery({ resolve: opts.resolve, read_as: opts.readAs });
|
|
819
|
-
return this.request("GET", `/world/${
|
|
819
|
+
return this.request("GET", `/world/${seg("worldId", worldId)}/lenses`, { query, accountToken: "path" });
|
|
820
820
|
}
|
|
821
821
|
async me() {
|
|
822
822
|
if (this.keyKind === "account") {
|
|
@@ -858,7 +858,7 @@ var OwV2Client = class {
|
|
|
858
858
|
...params.filter,
|
|
859
859
|
as: params.viewAs
|
|
860
860
|
}, new Set(Object.keys(params.filter ?? {})));
|
|
861
|
-
return this.request("GET", `/${
|
|
861
|
+
return this.request("GET", `/${seg("type", type)}/`, { query, worldRead: true, ...withSignal(params.signal) });
|
|
862
862
|
}
|
|
863
863
|
async draught(characterId, policy = {}) {
|
|
864
864
|
only("draught", policy, ["components", "mode", "asOf", "undated", "since", "budget", "depth", "compact", "lens"]);
|
|
@@ -876,7 +876,7 @@ var OwV2Client = class {
|
|
|
876
876
|
compact: policy.compact,
|
|
877
877
|
lens: policy.lens
|
|
878
878
|
});
|
|
879
|
-
return this.request("GET", `/character/${
|
|
879
|
+
return this.request("GET", `/character/${seg("characterId", characterId)}/context`, { query, worldRead: true });
|
|
880
880
|
}
|
|
881
881
|
/**
|
|
882
882
|
* Cursor-walk every page of a type. Politeness: uses config pageSize. On a client with `world`
|
|
@@ -903,7 +903,7 @@ var OwV2Client = class {
|
|
|
903
903
|
async get(type, id, opts = {}) {
|
|
904
904
|
only("get", opts, ["expand", "fields", "viewAs", "signal"]);
|
|
905
905
|
const query = buildQuery({ expand: opts.expand?.join(","), fields: opts.fields?.join(","), as: opts.viewAs });
|
|
906
|
-
return this.request("GET", `/${
|
|
906
|
+
return this.request("GET", `/${seg("type", type)}/${seg("id", id)}/`, { query, worldRead: true, ...withSignal(opts.signal) });
|
|
907
907
|
}
|
|
908
908
|
/**
|
|
909
909
|
* POST /{type}/ -- create one element, minting an id on the client when you leave id out.
|
|
@@ -922,7 +922,7 @@ var OwV2Client = class {
|
|
|
922
922
|
if (body.id === void 0 || body.id === null || body.id === "") {
|
|
923
923
|
body.id = opts.idempotencyKey ? keyedId(opts.idempotencyKey, 0) : mintUuid();
|
|
924
924
|
}
|
|
925
|
-
return this.request("POST", `/${
|
|
925
|
+
return this.request("POST", `/${seg("type", type)}/`, {
|
|
926
926
|
write: true,
|
|
927
927
|
elementWrite: true,
|
|
928
928
|
body,
|
|
@@ -938,7 +938,7 @@ var OwV2Client = class {
|
|
|
938
938
|
*/
|
|
939
939
|
async upsert(type, id, element) {
|
|
940
940
|
refuseKnownOf(element, "upsert");
|
|
941
|
-
return this.request("PUT", `/${
|
|
941
|
+
return this.request("PUT", `/${seg("type", type)}/${seg("id", id)}/`, { write: true, elementWrite: true, proposable: true, body: sanitizePayload(element) });
|
|
942
942
|
}
|
|
943
943
|
/**
|
|
944
944
|
* PATCH /{type}/{id}/ -- partial update. DESTRUCTIVE on sent fields: arrays
|
|
@@ -958,7 +958,7 @@ var OwV2Client = class {
|
|
|
958
958
|
async patch(type, id, partial, opts = {}) {
|
|
959
959
|
only("patch", opts, ["ifMatch"]);
|
|
960
960
|
refuseKnownOf(partial, "patch");
|
|
961
|
-
return this.request("PATCH", `/${
|
|
961
|
+
return this.request("PATCH", `/${seg("type", type)}/${seg("id", id)}/`, { write: true, elementWrite: true, proposable: true, body: sanitizePayload(partial), ifMatch: opts.ifMatch });
|
|
962
962
|
}
|
|
963
963
|
/**
|
|
964
964
|
* DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
|
|
@@ -972,7 +972,7 @@ var OwV2Client = class {
|
|
|
972
972
|
*/
|
|
973
973
|
async delete(type, id, opts = {}) {
|
|
974
974
|
only("delete", opts, ["ifMatch"]);
|
|
975
|
-
await this.request("DELETE", `/${
|
|
975
|
+
await this.request("DELETE", `/${seg("type", type)}/${seg("id", id)}/`, { write: true, elementWrite: true, allowEmpty: true, ifMatch: opts.ifMatch });
|
|
976
976
|
}
|
|
977
977
|
/**
|
|
978
978
|
* POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
|
|
@@ -985,7 +985,7 @@ var OwV2Client = class {
|
|
|
985
985
|
async editLinks(type, id, field, edit, opts = {}) {
|
|
986
986
|
only("editLinks", opts, ["ifMatch"]);
|
|
987
987
|
only("editLinks", edit, ["add", "remove"], "The edit is { add?: string[], remove?: string[] }.");
|
|
988
|
-
return this.request("POST", `/${
|
|
988
|
+
return this.request("POST", `/${seg("type", type)}/${seg("id", id)}/links/${seg("field", field)}`, { write: true, elementWrite: true, proposable: true, body: edit, ifMatch: opts.ifMatch });
|
|
989
989
|
}
|
|
990
990
|
/**
|
|
991
991
|
* POST /{type}/{id}/adopt with {member} -- change who made an element.
|
|
@@ -1001,7 +1001,7 @@ var OwV2Client = class {
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
async adopt(type, id, member) {
|
|
1003
1003
|
if (typeof member !== "string" || member === "") throw new TypeError('adopt: member must be a membership id or "owner"');
|
|
1004
|
-
return this.request("POST", `/${
|
|
1004
|
+
return this.request("POST", `/${seg("type", type)}/${seg("id", id)}/adopt`, { write: true, elementWrite: true, body: { member } });
|
|
1005
1005
|
}
|
|
1006
1006
|
// -- Bulk ----------------------------------------------------------------
|
|
1007
1007
|
/**
|
|
@@ -1241,7 +1241,7 @@ var OwV2Client = class {
|
|
|
1241
1241
|
* are not in its body, its `change_seq` or /changes.
|
|
1242
1242
|
*/
|
|
1243
1243
|
async listFiles(type, id) {
|
|
1244
|
-
const page = await this.request("GET", `/${
|
|
1244
|
+
const page = await this.request("GET", `/${seg("type", type)}/${seg("id", id)}/files`);
|
|
1245
1245
|
return page.data ?? [];
|
|
1246
1246
|
}
|
|
1247
1247
|
/**
|
|
@@ -1281,7 +1281,7 @@ var OwV2Client = class {
|
|
|
1281
1281
|
const kind = req.kind ?? requireFileKind(name);
|
|
1282
1282
|
const body = { name, kind, size };
|
|
1283
1283
|
if (req.label !== void 0) body.label = req.label;
|
|
1284
|
-
return this.request("POST", `/${
|
|
1284
|
+
return this.request("POST", `/${seg("type", type)}/${seg("id", id)}/files`, { body, write: true });
|
|
1285
1285
|
}
|
|
1286
1286
|
/**
|
|
1287
1287
|
* Attach one file to an element: a ticket from the API (createFileTicket), then the bytes
|
|
@@ -1360,7 +1360,7 @@ var OwV2Client = class {
|
|
|
1360
1360
|
* key that may read the element.
|
|
1361
1361
|
*/
|
|
1362
1362
|
async fileDownloadLink(type, id, fileId) {
|
|
1363
|
-
return this.request("GET", `/${
|
|
1363
|
+
return this.request("GET", `/${seg("type", type)}/${seg("id", id)}/files/${seg("fileId", fileId)}/download`);
|
|
1364
1364
|
}
|
|
1365
1365
|
/**
|
|
1366
1366
|
* DELETE /{type}/{id}/files/{fileId} -- remove a file for real: it leaves the lists and
|
|
@@ -1370,7 +1370,7 @@ var OwV2Client = class {
|
|
|
1370
1370
|
* Deleting an element removes its files too.
|
|
1371
1371
|
*/
|
|
1372
1372
|
async removeFile(type, id, fileId) {
|
|
1373
|
-
await this.request("DELETE", `/${
|
|
1373
|
+
await this.request("DELETE", `/${seg("type", type)}/${seg("id", id)}/files/${seg("fileId", fileId)}`);
|
|
1374
1374
|
}
|
|
1375
1375
|
// -- Joining a world by link ----------------------------------
|
|
1376
1376
|
/**
|
|
@@ -1592,7 +1592,7 @@ var OwV2Client = class {
|
|
|
1592
1592
|
if (opts.preview !== void 0) body.preview = opts.preview;
|
|
1593
1593
|
if (opts.maxUses !== void 0) body.max_uses = opts.maxUses;
|
|
1594
1594
|
if (opts.characters !== void 0) body.characters = opts.characters;
|
|
1595
|
-
return this.request("POST", `/account/worlds/${
|
|
1595
|
+
return this.request("POST", `/account/worlds/${seg("worldId", worldId)}/links`, { body });
|
|
1596
1596
|
}
|
|
1597
1597
|
/**
|
|
1598
1598
|
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
@@ -1603,7 +1603,7 @@ var OwV2Client = class {
|
|
|
1603
1603
|
if (this.keyKind !== "account") {
|
|
1604
1604
|
throw new TypeError("listWorldLinks needs an account token (ow_a_): only the world's owner sees its links");
|
|
1605
1605
|
}
|
|
1606
|
-
const page = await this.request("GET", `/account/worlds/${
|
|
1606
|
+
const page = await this.request("GET", `/account/worlds/${seg("worldId", worldId)}/links`);
|
|
1607
1607
|
return page.data;
|
|
1608
1608
|
}
|
|
1609
1609
|
/**
|
|
@@ -1616,7 +1616,7 @@ var OwV2Client = class {
|
|
|
1616
1616
|
if (this.keyKind !== "account") {
|
|
1617
1617
|
throw new TypeError("revokeWorldLink needs an account token (ow_a_): only the world's owner revokes links");
|
|
1618
1618
|
}
|
|
1619
|
-
await this.request("DELETE", `/account/worlds/${
|
|
1619
|
+
await this.request("DELETE", `/account/worlds/${seg("worldId", worldId)}/links/${seg("linkId", linkId)}`);
|
|
1620
1620
|
}
|
|
1621
1621
|
// -- Seats for your own AI ------------------------------
|
|
1622
1622
|
/**
|
|
@@ -1638,7 +1638,7 @@ var OwV2Client = class {
|
|
|
1638
1638
|
const body = { name: opts.name };
|
|
1639
1639
|
if (opts.role !== void 0) body.role = opts.role;
|
|
1640
1640
|
if (opts.character !== void 0) body.character = opts.character;
|
|
1641
|
-
return this.request("POST", `/account/worlds/${
|
|
1641
|
+
return this.request("POST", `/account/worlds/${seg("worldId", worldId)}/seats`, { body });
|
|
1642
1642
|
}
|
|
1643
1643
|
/**
|
|
1644
1644
|
* GET /account/worlds/{worldId}/seats -- the live agent seats you can see: your own AI's, or,
|
|
@@ -1648,7 +1648,7 @@ var OwV2Client = class {
|
|
|
1648
1648
|
if (this.keyKind !== "account") {
|
|
1649
1649
|
throw new TypeError("listSeats needs an account token (ow_a_)");
|
|
1650
1650
|
}
|
|
1651
|
-
const page = await this.request("GET", `/account/worlds/${
|
|
1651
|
+
const page = await this.request("GET", `/account/worlds/${seg("worldId", worldId)}/seats`);
|
|
1652
1652
|
return page.data;
|
|
1653
1653
|
}
|
|
1654
1654
|
/**
|
|
@@ -1662,7 +1662,7 @@ var OwV2Client = class {
|
|
|
1662
1662
|
if (this.keyKind !== "account") {
|
|
1663
1663
|
throw new TypeError("rekeySeat needs an account token (ow_a_)");
|
|
1664
1664
|
}
|
|
1665
|
-
return this.request("POST", `/account/worlds/${
|
|
1665
|
+
return this.request("POST", `/account/worlds/${seg("worldId", worldId)}/seats/${seg("seatId", seatId)}/key`);
|
|
1666
1666
|
}
|
|
1667
1667
|
/**
|
|
1668
1668
|
* DELETE /account/worlds/{worldId}/seats/{seatId} -- remove an agent seat: its sponsor or the
|
|
@@ -1673,7 +1673,7 @@ var OwV2Client = class {
|
|
|
1673
1673
|
if (this.keyKind !== "account") {
|
|
1674
1674
|
throw new TypeError("removeSeat needs an account token (ow_a_)");
|
|
1675
1675
|
}
|
|
1676
|
-
await this.request("DELETE", `/account/worlds/${
|
|
1676
|
+
await this.request("DELETE", `/account/worlds/${seg("worldId", worldId)}/seats/${seg("seatId", seatId)}`);
|
|
1677
1677
|
}
|
|
1678
1678
|
/**
|
|
1679
1679
|
* PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row
|
|
@@ -1701,7 +1701,7 @@ var OwV2Client = class {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
return this.request(
|
|
1703
1703
|
"PATCH",
|
|
1704
|
-
`/account/worlds/${
|
|
1704
|
+
`/account/worlds/${seg("worldId", worldId)}/members/${seg("memberId", memberId)}`,
|
|
1705
1705
|
{ body: { lenses: lensIds } }
|
|
1706
1706
|
);
|
|
1707
1707
|
}
|
|
@@ -1714,11 +1714,11 @@ var OwV2Client = class {
|
|
|
1714
1714
|
* lists, search, counts and the link arrays that name it. 204, no body. No Idempotency-Key.
|
|
1715
1715
|
*/
|
|
1716
1716
|
async hide(type, id) {
|
|
1717
|
-
await this.request("PUT", `/${
|
|
1717
|
+
await this.request("PUT", `/${seg("type", type)}/${seg("id", id)}/hidden`, { body: {}, allowEmpty: true });
|
|
1718
1718
|
}
|
|
1719
1719
|
/** DELETE /{type}/{id}/hidden -- clear the mark; an element that is not hidden stays as it is. 204. */
|
|
1720
1720
|
async unhide(type, id) {
|
|
1721
|
-
await this.request("DELETE", `/${
|
|
1721
|
+
await this.request("DELETE", `/${seg("type", type)}/${seg("id", id)}/hidden`, { allowEmpty: true });
|
|
1722
1722
|
}
|
|
1723
1723
|
/**
|
|
1724
1724
|
* GET /world/hidden -- every hidden element of the world, newest first: `{type, id, set_at,
|
|
@@ -1813,7 +1813,7 @@ var OwV2Client = class {
|
|
|
1813
1813
|
* Returns the row and the element as written.
|
|
1814
1814
|
*/
|
|
1815
1815
|
async acceptProposal(type, id, pid) {
|
|
1816
|
-
return this.request("POST", `${proposalsPath(type, id)}/${
|
|
1816
|
+
return this.request("POST", `${proposalsPath(type, id)}/${seg("pid", pid)}/accept`, { elementWrite: true });
|
|
1817
1817
|
}
|
|
1818
1818
|
/**
|
|
1819
1819
|
* POST /{type}/{id}/proposals/{pid}/decline -- the row turns declined, with an optional
|
|
@@ -1823,7 +1823,7 @@ var OwV2Client = class {
|
|
|
1823
1823
|
async declineProposal(type, id, pid, opts = {}) {
|
|
1824
1824
|
only("declineProposal", opts, ["reason"]);
|
|
1825
1825
|
const body = opts.reason !== void 0 ? { reason: opts.reason } : void 0;
|
|
1826
|
-
const out = await this.request("POST", `${proposalsPath(type, id)}/${
|
|
1826
|
+
const out = await this.request("POST", `${proposalsPath(type, id)}/${seg("pid", pid)}/decline`, { body });
|
|
1827
1827
|
return out.proposal;
|
|
1828
1828
|
}
|
|
1829
1829
|
/**
|
|
@@ -1832,7 +1832,7 @@ var OwV2Client = class {
|
|
|
1832
1832
|
* any other key a 404; a decided row a 422.
|
|
1833
1833
|
*/
|
|
1834
1834
|
async withdrawProposal(type, id, pid) {
|
|
1835
|
-
await this.request("DELETE", `${proposalsPath(type, id)}/${
|
|
1835
|
+
await this.request("DELETE", `${proposalsPath(type, id)}/${seg("pid", pid)}`, { allowEmpty: true });
|
|
1836
1836
|
}
|
|
1837
1837
|
/**
|
|
1838
1838
|
* POST /{type}/{id}/review -- settle a new element written as proposed, one carrying
|
|
@@ -1856,7 +1856,7 @@ var OwV2Client = class {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
const body = { decision: opts.decision };
|
|
1858
1858
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
1859
|
-
const path = `/${
|
|
1859
|
+
const path = `/${seg("type", type)}/${seg("id", id)}/review`;
|
|
1860
1860
|
const answer = await this.request("POST", path, { elementWrite: true, body });
|
|
1861
1861
|
const settled = opts.decision === "accept" ? "element" : "deleted";
|
|
1862
1862
|
if (answer === null || typeof answer !== "object" || !(settled in answer)) {
|
|
@@ -1929,7 +1929,7 @@ var OwV2Client = class {
|
|
|
1929
1929
|
if (opts.scope !== void 0) body.scope = opts.scope;
|
|
1930
1930
|
if (opts.name !== void 0) body.name = opts.name;
|
|
1931
1931
|
if (opts.keep !== void 0) body.keep = opts.keep;
|
|
1932
|
-
return this.request("POST", `/account/worlds/${
|
|
1932
|
+
return this.request("POST", `/account/worlds/${seg("worldId", worldId)}/keys`, { body });
|
|
1933
1933
|
}
|
|
1934
1934
|
/**
|
|
1935
1935
|
* DELETE /account/worlds/{worldId}/keys/{keyId} -- revoke a world key, by the `id` mintWorldKey
|
|
@@ -1950,7 +1950,7 @@ var OwV2Client = class {
|
|
|
1950
1950
|
const send = {};
|
|
1951
1951
|
if (opts.signal !== void 0) send.signal = opts.signal;
|
|
1952
1952
|
if (opts.keepalive !== void 0) send.keepalive = opts.keepalive;
|
|
1953
|
-
await this.request("DELETE", `/account/worlds/${
|
|
1953
|
+
await this.request("DELETE", `/account/worlds/${seg("worldId", worldId)}/keys/${seg("keyId", keyId)}`, send);
|
|
1954
1954
|
}
|
|
1955
1955
|
/**
|
|
1956
1956
|
* GET /account/tokens -- the account's tokens, each by name and last four, never the token
|
|
@@ -1985,7 +1985,7 @@ var OwV2Client = class {
|
|
|
1985
1985
|
const send = {};
|
|
1986
1986
|
if (opts.signal !== void 0) send.signal = opts.signal;
|
|
1987
1987
|
if (opts.keepalive !== void 0) send.keepalive = opts.keepalive;
|
|
1988
|
-
await this.request("DELETE", `/account/tokens/${
|
|
1988
|
+
await this.request("DELETE", `/account/tokens/${seg("tokenId", tokenId)}`, send);
|
|
1989
1989
|
}
|
|
1990
1990
|
// -- Sign in with OnlyWorlds (OAuth 2.1 code + PKCE) ----------------------
|
|
1991
1991
|
/**
|
|
@@ -2172,8 +2172,15 @@ var HeadPollState = class {
|
|
|
2172
2172
|
};
|
|
2173
2173
|
var READ_ONLY_FIELDS = ["world", "type", "created_at", "updated_at", "change_seq", "known_of"];
|
|
2174
2174
|
var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin", "counts"];
|
|
2175
|
+
var PATH_TYPE = /^[a-z][a-z0-9_]*$/;
|
|
2176
|
+
var PATH_VALUE = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/;
|
|
2177
|
+
function seg(name, value) {
|
|
2178
|
+
const ok = typeof value === "string" && (name === "type" ? PATH_TYPE : PATH_VALUE).test(value);
|
|
2179
|
+
if (!ok) throw new TypeError(`${name} ${JSON.stringify(value)} is not one path segment. Nothing was sent.`);
|
|
2180
|
+
return encodeURIComponent(value);
|
|
2181
|
+
}
|
|
2175
2182
|
function proposalsPath(type, id) {
|
|
2176
|
-
return `/${
|
|
2183
|
+
return `/${seg("type", type)}/${seg("id", id)}/proposals`;
|
|
2177
2184
|
}
|
|
2178
2185
|
async function proposedFromResponse(res, method, path) {
|
|
2179
2186
|
const body = await readJsonBody(res);
|
|
@@ -3843,7 +3850,7 @@ function pathFault(name) {
|
|
|
3843
3850
|
if (name.includes("\\")) return "holds a backslash";
|
|
3844
3851
|
if (name.startsWith("/")) return "is absolute";
|
|
3845
3852
|
if (/^[A-Za-z]:/.test(name)) return "names a drive";
|
|
3846
|
-
if (name.split("/").some((
|
|
3853
|
+
if (name.split("/").some((seg2) => seg2 === "" || seg2 === "." || seg2 === "..")) return "has an empty, . or .. segment";
|
|
3847
3854
|
return null;
|
|
3848
3855
|
}
|
|
3849
3856
|
var RESERVED = /* @__PURE__ */ new Set([
|
|
@@ -3855,15 +3862,15 @@ var RESERVED = /* @__PURE__ */ new Set([
|
|
|
3855
3862
|
]);
|
|
3856
3863
|
var BAD_CHAR = /[<>:"|?*\p{Cc}]/u;
|
|
3857
3864
|
function nameFault(name) {
|
|
3858
|
-
for (const
|
|
3859
|
-
if (BAD_CHAR.test(
|
|
3860
|
-
if (
|
|
3861
|
-
if (RESERVED.has(
|
|
3865
|
+
for (const seg2 of name.split("/")) {
|
|
3866
|
+
if (BAD_CHAR.test(seg2)) return `segment ${JSON.stringify(seg2)} holds a reserved or control character`;
|
|
3867
|
+
if (seg2.endsWith(".") || seg2.endsWith(" ")) return `segment ${JSON.stringify(seg2)} ends in a dot or a space`;
|
|
3868
|
+
if (RESERVED.has(seg2.split(".")[0].toUpperCase())) return `segment ${JSON.stringify(seg2)} is a Windows device name`;
|
|
3862
3869
|
}
|
|
3863
3870
|
return null;
|
|
3864
3871
|
}
|
|
3865
3872
|
function isJunk(path) {
|
|
3866
|
-
return path.split("/").some((
|
|
3873
|
+
return path.split("/").some((seg2) => seg2 === "__MACOSX" || seg2 === ".DS_Store" || seg2 === "Thumbs.db");
|
|
3867
3874
|
}
|
|
3868
3875
|
function foldName(name) {
|
|
3869
3876
|
return simpleCaseFold(nfc(name));
|
package/dist/waymark.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openersFor,
|
|
7
7
|
refuseUnknownOptions,
|
|
8
8
|
typeWord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HML3HS3U.js";
|
|
10
10
|
|
|
11
11
|
// src/waymark/glyphs.ts
|
|
12
12
|
var MARK_PATH = "M48.8 0.0 43.8 0.4 39.0 1.2 36.0 2.0 33.2 2.9 29.3 4.5 24.8 6.8 20.6 9.5 17.0 12.4 13.6 15.7 10.4 19.4 7.8 23.1 5.8 26.6 4.5 29.3 3.3 32.1 1.8 36.8 0.8 41.2 0.1 46.3 0.0 51.1 0.4 56.2 1.2 61.0 2.0 63.9 2.9 66.8 4.5 70.7 6.8 75.2 9.5 79.4 12.4 82.9 15.7 86.3 19.4 89.5 23.1 92.1 26.6 94.2 29.3 95.5 32.1 96.7 36.8 98.2 41.2 99.2 46.3 99.8 51.1 100.0 56.2 99.6 61.0 98.8 63.9 98.0 66.8 97.1 70.7 95.5 75.2 93.2 79.4 90.4 82.9 87.6 86.3 84.3 89.5 80.5 92.1 76.9 94.2 73.4 95.5 70.7 96.7 67.9 98.2 63.2 99.2 58.7 99.8 53.7 100.0 48.8 99.6 43.8 98.6 38.4 97.1 33.2 95.5 29.3 93.2 24.8 90.4 20.6 87.6 17.0 84.3 13.6 80.5 10.4 76.9 7.8 73.4 5.8 70.7 4.5 67.9 3.3 63.2 1.8 58.7 0.8 53.7 0.1ZM77.5 80.7 74.1 83.4 70.7 85.7 67.0 87.5 64.5 88.6 64.1 88.7 65.7 86.3 67.1 83.9 68.7 80.7 69.9 77.6 72.7 78.5 73.0 78.4ZM22.5 80.7 25.6 79.0 27.3 78.3 30.0 77.6 31.3 80.7 32.8 83.9 34.2 86.3 35.9 88.7 32.9 87.5 29.3 85.7 25.8 83.4ZM51.2 74.5 55.1 74.7 59.9 75.2 64.2 76.0 67.5 76.9 66.0 80.5 64.2 84.0 62.0 87.4 59.6 90.1 55.1 90.9 52.2 91.2 51.2 91.1ZM48.7 74.5 48.8 91.1 47.7 91.2 44.9 90.9 40.3 90.1 38.2 87.8 36.3 85.0 34.2 81.2 32.5 77.0 35.8 76.0 40.5 75.2 44.5 74.7ZM91.1 51.2 91.1 52.9 90.8 56.3 90.1 59.7 89.3 62.5 88.5 64.8 87.2 67.7 85.7 70.7 83.9 73.4 82.0 75.9 79.4 78.9 76.3 77.2 73.8 76.1 76.2 68.8 77.8 62.7 78.7 56.8 79.0 51.2ZM55.8 51.2 67.7 51.2 67.6 55.1 67.2 59.0 66.7 61.5 65.7 65.0 61.0 64.2 55.7 63.6ZM32.5 51.2 44.5 51.2 44.4 63.6 39.7 64.1 34.5 65.0 33.5 61.3 32.9 58.1 32.5 54.2ZM8.8 51.2 21.0 51.2 21.0 53.3 21.4 56.6 22.7 64.0 23.8 68.4 25.0 72.1 26.6 75.9 23.7 77.2 20.6 78.9 18.5 76.7 16.5 74.1 14.8 71.5 13.4 69.1 12.1 66.3 11.0 63.6 10.1 60.5 9.4 57.3 8.9 53.5 8.8 51.3ZM36.2 27.0 39.5 27.5 44.5 28.2 44.4 48.8 32.4 48.7 32.8 44.5 33.6 39.1 35.0 32.0ZM63.9 26.9 65.2 32.1 66.6 39.2 67.4 44.8 67.7 48.7 55.8 48.8 55.7 28.1 60.5 27.5ZM74.8 23.4 76.9 22.5 79.4 21.1 82.0 24.0 84.8 27.8 86.2 30.3 87.5 32.9 88.6 35.4 89.5 38.1 90.3 41.2 90.8 44.0 91.1 47.0 91.1 48.8 79.0 48.7 78.7 44.6 78.0 39.3 76.5 31.2 74.7 23.5ZM25.5 23.5 25.5 23.7 24.5 26.8 23.7 30.2 22.4 36.6 21.5 42.5 21.1 48.7 8.8 48.8 8.8 47.0 9.2 43.7 9.8 40.8 10.5 38.1 11.5 35.2 12.4 32.9 13.8 30.2 15.2 27.8 17.9 24.0 20.6 21.1 23.1 22.5ZM64.1 11.3 67.0 12.4 70.7 14.3 74.1 16.5 77.5 19.3 75.6 20.3 73.2 21.5 70.0 22.6 68.7 19.2 67.1 16.1 65.7 13.6ZM35.9 11.3 34.2 13.6 32.8 16.1 31.3 19.2 30.0 22.5 27.9 21.9 26.4 21.3 22.5 19.3 25.8 16.5 29.3 14.3 32.9 12.4 35.4 11.4ZM51.2 8.8 52.2 8.8 55.1 9.0 59.6 9.9 61.7 12.2 64.2 16.0 66.0 19.5 67.6 23.3 64.3 24.3 59.4 25.2 56.2 25.6 51.2 25.5ZM48.8 8.8 48.7 25.5 44.2 25.6 40.6 25.2 36.4 24.5 32.4 23.2 33.9 19.5 35.7 16.0 38.2 12.2 40.3 9.9 44.9 9.0 47.7 8.8Z";
|