one 2.18.0 → 2.18.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.
@@ -32,11 +32,12 @@ function createOrezTransport(options) {
32
32
  url.searchParams.set("appID", options.appID);
33
33
  url.searchParams.set("schema", `${options.appID}_${options.shardNum ?? 0}`);
34
34
  }
35
+ const extraHeaders = await options.headers?.();
35
36
  const response = await request(url.toString(), {
36
37
  method: "POST",
37
38
  headers: {
38
39
  "Content-Type": "application/json",
39
- ...await options.headers?.()
40
+ ...extraHeaders
40
41
  },
41
42
  body: JSON.stringify(body),
42
43
  signal
@@ -37,11 +37,12 @@ function createOrezTransport(options) {
37
37
  url.searchParams.set("appID", options.appID);
38
38
  url.searchParams.set("schema", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);
39
39
  }
40
+ var extraHeaders = await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options));
40
41
  var response = await request(url.toString(), {
41
42
  method: "POST",
42
43
  headers: {
43
44
  "Content-Type": "application/json",
44
- ...await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options))
45
+ ...extraHeaders
45
46
  },
46
47
  body: JSON.stringify(body),
47
48
  signal
@@ -37,11 +37,12 @@ function createOrezTransport(options) {
37
37
  url.searchParams.set("appID", options.appID);
38
38
  url.searchParams.set("schema", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);
39
39
  }
40
+ var extraHeaders = await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options));
40
41
  var response = await request(url.toString(), {
41
42
  method: "POST",
42
43
  headers: {
43
44
  "Content-Type": "application/json",
44
- ...await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options))
45
+ ...extraHeaders
45
46
  },
46
47
  body: JSON.stringify(body),
47
48
  signal
@@ -1 +1 @@
1
- {"version":3,"file":"orez.native.js","names":[],"sources":["cjs/zero/native/orez.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar orez_exports = {};\n__export(orez_exports, {\n createOrezTransport: () => createOrezTransport\n});\nmodule.exports = __toCommonJS(orez_exports);\nvar import_orez_wake = require(\"./orez-wake\");\nfunction createOrezTransport(options) {\n var _options_fetch;\n var server = options.server.replace(/\\/$/, \"\");\n var request = (_options_fetch = options.fetch) !== null && _options_fetch !== void 0 ? _options_fetch : globalThis.fetch.bind(globalThis);\n var post = async function post2(path, body, signal) {\n var _options_headers;\n var url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n var _options_shardNum;\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);\n }\n var response = await request(url.toString(), {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options))\n },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n var result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? (0, import_orez_wake.subscribeOrezWake)(server, identity, options.wake, request2) : function() {\n };\n },\n async pull(state, queries, signal) {\n var received = await post(\"pull\", {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n {\n op: \"clear\"\n },\n ...queries.map(function(query) {\n return {\n op: \"put\",\n ...query\n };\n })\n ]\n }\n }, signal);\n var response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n var got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch)) throw new Error(\"Orez pull returned invalid gotQueries\");\n return {\n ...response,\n gotQueriesPatch: got.patch\n };\n }\n return response;\n },\n async push(state, mutations, signal) {\n var body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map(function(mutation2) {\n return {\n ...mutation2,\n name: mutation2.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation2.args === void 0 ? [] : [\n mutation2.args\n ]\n };\n })\n };\n var received = await post(\"push\", options.payloadCodec ? await options.payloadCodec.encodePush(body) : body, signal);\n if (!received || typeof received !== \"object\") throw new Error(\"Orez push returned an invalid response\");\n var response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations)) throw new Error(\"Orez push returned an invalid mutation response\");\n var expected = new Set(mutations.map(function(mutation2) {\n return mutation2.id;\n }));\n var outcomes = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = response.mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var mutation = _step.value;\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id)) throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result)) throw new Error(\"Orez push returned an invalid mutation result\");\n var result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\") throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\") throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : {\n type: \"success\"\n }\n });\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,Y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M,oDAAoD;KAC5W,IAAI,CAAC,SAAS,UAAU,OAAO,SAAS,WAAW,YAAY,MAAM,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,+CAA+C;KAC9J,IAAI,SAAS,SAAS;KACtB,IAAI,WAAW,UAAU,OAAO,OAAO,UAAU,UAAU,MAAM,IAAI,MAAM,8CAA8C;KACzH,IAAI,OAAO,UAAU,SAAS,OAAO,OAAO,YAAY,UAAU,MAAM,IAAI,MAAM,iDAAiD;KACnI,IAAI,OAAO,UAAU,oBAAoB;KACzC,SAAS,KAAK;MACZ,IAAI,SAAS,GAAG;MAChB,QAAQ,OAAO,QAAQ;OACrB,MAAM;OACN,OAAO;QACL,MAAM,OAAO,UAAU,QAAQ,QAAQ;QACvC,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAK,UAAU,MAAM;QACpF,SAAS,OAAO;OAClB;MACF,IAAI,EACF,MAAM,UACR;KACF,CAAC;IACH;GACF,SAAS,KAAK;IACZ,oBAAoB;IACpB,iBAAiB;GACnB,UAAU;IACR,IAAI;KACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;MAC1D,UAAU,OAAO;KACnB;IACF,UAAU;KACR,IAAI,mBAAmB;MACrB,MAAM;KACR;IACF;GACF;GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"orez.native.js","names":[],"sources":["cjs/zero/native/orez.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar orez_exports = {};\n__export(orez_exports, {\n createOrezTransport: () => createOrezTransport\n});\nmodule.exports = __toCommonJS(orez_exports);\nvar import_orez_wake = require(\"./orez-wake\");\nfunction createOrezTransport(options) {\n var _options_fetch;\n var server = options.server.replace(/\\/$/, \"\");\n var request = (_options_fetch = options.fetch) !== null && _options_fetch !== void 0 ? _options_fetch : globalThis.fetch.bind(globalThis);\n var post = async function post2(path, body, signal) {\n var _options_headers;\n var url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n var _options_shardNum;\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);\n }\n var extraHeaders = await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options));\n var response = await request(url.toString(), {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...extraHeaders\n },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n var result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? (0, import_orez_wake.subscribeOrezWake)(server, identity, options.wake, request2) : function() {\n };\n },\n async pull(state, queries, signal) {\n var received = await post(\"pull\", {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n {\n op: \"clear\"\n },\n ...queries.map(function(query) {\n return {\n op: \"put\",\n ...query\n };\n })\n ]\n }\n }, signal);\n var response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n var got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch)) throw new Error(\"Orez pull returned invalid gotQueries\");\n return {\n ...response,\n gotQueriesPatch: got.patch\n };\n }\n return response;\n },\n async push(state, mutations, signal) {\n var body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map(function(mutation2) {\n return {\n ...mutation2,\n name: mutation2.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation2.args === void 0 ? [] : [\n mutation2.args\n ]\n };\n })\n };\n var received = await post(\"push\", options.payloadCodec ? await options.payloadCodec.encodePush(body) : body, signal);\n if (!received || typeof received !== \"object\") throw new Error(\"Orez push returned an invalid response\");\n var response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations)) throw new Error(\"Orez push returned an invalid mutation response\");\n var expected = new Set(mutations.map(function(mutation2) {\n return mutation2.id;\n }));\n var outcomes = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = response.mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var mutation = _step.value;\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id)) throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result)) throw new Error(\"Orez push returned an invalid mutation result\");\n var result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\") throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\") throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : {\n type: \"success\"\n }\n });\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,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BAAoB;KACzC,SAAS,KAAK;MACZ,IAAI,SAAS,GAAG;MAChB,QAAQ,OAAO,QAAQ;OACrB,MAAM;OACN,OAAO;QACL,MAAM,OAAO,UAAU,QAAQ,QAAQ;QACvC,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAK,UAAU,MAAM;QACpF,SAAS,OAAO;OAClB;MACF,IAAI,EACF,MAAM,UACR;KACF,CAAC;IACH;GACF,SAAS,KAAK;IACZ,oBAAoB;IACpB,iBAAiB;GACnB,UAAU;IACR,IAAI;KACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;MAC1D,UAAU,OAAO;KACnB;IACF,UAAU;KACR,IAAI,mBAAmB;MACrB,MAAM;KACR;IACF;GACF;GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
@@ -10,11 +10,12 @@ function createOrezTransport(options) {
10
10
  url.searchParams.set("appID", options.appID);
11
11
  url.searchParams.set("schema", `${options.appID}_${options.shardNum ?? 0}`);
12
12
  }
13
+ const extraHeaders = await options.headers?.();
13
14
  const response = await request(url.toString(), {
14
15
  method: "POST",
15
16
  headers: {
16
17
  "Content-Type": "application/json",
17
- ...await options.headers?.()
18
+ ...extraHeaders
18
19
  },
19
20
  body: JSON.stringify(body),
20
21
  signal
@@ -1 +1 @@
1
- {"version":3,"file":"orez.js","names":[],"sources":["esm/zero/native/orez.js"],"sourcesContent":["import { subscribeOrezWake } from \"./orez-wake\";\nfunction createOrezTransport(options) {\n const server = options.server.replace(/\\/$/, \"\");\n const request = options.fetch ?? globalThis.fetch.bind(globalThis);\n const post = async (path, body, signal) => {\n const url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${options.shardNum ?? 0}`);\n }\n const response = await request(url.toString(), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...await options.headers?.() },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n const result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? subscribeOrezWake(server, identity, options.wake, request2) : () => {\n };\n },\n async pull(state, queries, signal) {\n const received = await post(\n \"pull\",\n {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n { op: \"clear\" },\n ...queries.map((query) => ({ op: \"put\", ...query }))\n ]\n }\n },\n signal\n );\n const response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n const got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch))\n throw new Error(\"Orez pull returned invalid gotQueries\");\n return { ...response, gotQueriesPatch: got.patch };\n }\n return response;\n },\n async push(state, mutations, signal) {\n const body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map((mutation) => ({\n ...mutation,\n name: mutation.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation.args === void 0 ? [] : [mutation.args]\n }))\n };\n const received = await post(\n \"push\",\n options.payloadCodec ? await options.payloadCodec.encodePush(body) : body,\n signal\n );\n if (!received || typeof received !== \"object\")\n throw new Error(\"Orez push returned an invalid response\");\n const response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations))\n throw new Error(\"Orez push returned an invalid mutation response\");\n const expected = new Set(mutations.map((mutation) => mutation.id));\n const outcomes = [];\n for (const mutation of response.mutations) {\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id))\n throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result))\n throw new Error(\"Orez push returned an invalid mutation result\");\n const result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\")\n throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\")\n throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : { type: \"success\" }\n });\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\nexport {\n createOrezTransport\n};\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,SAAS,oBAAoB,SAAS;CACpC,MAAM,SAAS,QAAQ,OAAO,QAAQ,OAAO,EAAE;CAC/C,MAAM,UAAU,QAAQ,SAAS,WAAW,MAAM,KAAK,UAAU;CACjE,MAAM,OAAO,OAAO,MAAM,MAAM,WAAW;EACzC,MAAM,MAAM,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM;EACvC,IAAI,SAAS,QAAQ;GACnB,IAAI,aAAa,IAAI,SAAS,QAAQ,KAAK;GAC3C,IAAI,aAAa,IAAI,UAAU,GAAG,QAAQ,MAAM,GAAG,QAAQ,YAAY,GAAG;EAC5E;EACA,MAAM,WAAW,MAAM,QAAQ,IAAI,SAAS,GAAG;GAC7C,QAAQ;GACR,SAAS;IAAE,gBAAgB;IAAoB,GAAG,MAAM,QAAQ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,8CAA8C;IAChE,IAAI,OAAO,UAAU,SAAS,OAAO,OAAO,YAAY,UACtD,MAAM,IAAI,MAAM,iDAAiD;IACnE,IAAI,OAAO,UAAU,oBAAoB;IACzC,SAAS,KAAK;KACZ,IAAI,SAAS,GAAG;KAChB,QAAQ,OAAO,QAAQ;MACrB,MAAM;MACN,OAAO;OACL,MAAM,OAAO,UAAU,QAAQ,QAAQ;OACvC,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAK,UAAU,MAAM;OACpF,SAAS,OAAO;MAClB;KACF,IAAI,EAAE,MAAM,UAAU;IACxB,CAAC;GACH;GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"orez.js","names":[],"sources":["esm/zero/native/orez.js"],"sourcesContent":["import { subscribeOrezWake } from \"./orez-wake\";\nfunction createOrezTransport(options) {\n const server = options.server.replace(/\\/$/, \"\");\n const request = options.fetch ?? globalThis.fetch.bind(globalThis);\n const post = async (path, body, signal) => {\n const url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${options.shardNum ?? 0}`);\n }\n const extraHeaders = await options.headers?.();\n const response = await request(url.toString(), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...extraHeaders },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n const result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? subscribeOrezWake(server, identity, options.wake, request2) : () => {\n };\n },\n async pull(state, queries, signal) {\n const received = await post(\n \"pull\",\n {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n { op: \"clear\" },\n ...queries.map((query) => ({ op: \"put\", ...query }))\n ]\n }\n },\n signal\n );\n const response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n const got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch))\n throw new Error(\"Orez pull returned invalid gotQueries\");\n return { ...response, gotQueriesPatch: got.patch };\n }\n return response;\n },\n async push(state, mutations, signal) {\n const body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map((mutation) => ({\n ...mutation,\n name: mutation.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation.args === void 0 ? [] : [mutation.args]\n }))\n };\n const received = await post(\n \"push\",\n options.payloadCodec ? await options.payloadCodec.encodePush(body) : body,\n signal\n );\n if (!received || typeof received !== \"object\")\n throw new Error(\"Orez push returned an invalid response\");\n const response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations))\n throw new Error(\"Orez push returned an invalid mutation response\");\n const expected = new Set(mutations.map((mutation) => mutation.id));\n const outcomes = [];\n for (const mutation of response.mutations) {\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id))\n throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result))\n throw new Error(\"Orez push returned an invalid mutation result\");\n const result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\")\n throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\")\n throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : { type: \"success\" }\n });\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\nexport {\n createOrezTransport\n};\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,SAAS,oBAAoB,SAAS;CACpC,MAAM,SAAS,QAAQ,OAAO,QAAQ,OAAO,EAAE;CAC/C,MAAM,UAAU,QAAQ,SAAS,WAAW,MAAM,KAAK,UAAU;CACjE,MAAM,OAAO,OAAO,MAAM,MAAM,WAAW;EACzC,MAAM,MAAM,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM;EACvC,IAAI,SAAS,QAAQ;GACnB,IAAI,aAAa,IAAI,SAAS,QAAQ,KAAK;GAC3C,IAAI,aAAa,IAAI,UAAU,GAAG,QAAQ,MAAM,GAAG,QAAQ,YAAY,GAAG;EAC5E;EACA,MAAM,eAAe,MAAM,QAAQ,UAAU;EAC7C,MAAM,WAAW,MAAM,QAAQ,IAAI,SAAS,GAAG;GAC7C,QAAQ;GACR,SAAS;IAAE,gBAAgB;IAAoB,GAAG;GAAa;GAC/D,MAAM,KAAK,UAAU,IAAI;GACzB;EACF,CAAC;EACD,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM,QAAQ,KAAK,WAAW,SAAS,QAAQ;EAC3E,MAAM,SAAS,MAAM,SAAS,KAAK;EACnC,IAAI,UAAU,OAAO,WAAW,YAAY,WAAW,QAAQ;GAC7D,MAAM,IAAI,MAAM,QAAQ,KAAK,WAAW,KAAK,UAAU,MAAM,GAAG;EAClE;EACA,OAAO;CACT;CACA,OAAO;EACL,cAA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ClB;KACF,IAAI,EAAE,MAAM,UAAU;IACxB,CAAC;GACH;GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
@@ -13,11 +13,12 @@ function createOrezTransport(options) {
13
13
  url.searchParams.set("appID", options.appID);
14
14
  url.searchParams.set("schema", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);
15
15
  }
16
+ var extraHeaders = await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options));
16
17
  var response = await request(url.toString(), {
17
18
  method: "POST",
18
19
  headers: {
19
20
  "Content-Type": "application/json",
20
- ...await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options))
21
+ ...extraHeaders
21
22
  },
22
23
  body: JSON.stringify(body),
23
24
  signal
@@ -1 +1 @@
1
- {"version":3,"file":"orez.native.js","names":[],"sources":["esm/zero/native/orez.native.js"],"sourcesContent":["import { subscribeOrezWake } from \"./orez-wake\";\nfunction createOrezTransport(options) {\n var _options_fetch;\n var server = options.server.replace(/\\/$/, \"\");\n var request = (_options_fetch = options.fetch) !== null && _options_fetch !== void 0 ? _options_fetch : globalThis.fetch.bind(globalThis);\n var post = async function post2(path, body, signal) {\n var _options_headers;\n var url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n var _options_shardNum;\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);\n }\n var response = await request(url.toString(), {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options))\n },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n var result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? subscribeOrezWake(server, identity, options.wake, request2) : function() {\n };\n },\n async pull(state, queries, signal) {\n var received = await post(\"pull\", {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n {\n op: \"clear\"\n },\n ...queries.map(function(query) {\n return {\n op: \"put\",\n ...query\n };\n })\n ]\n }\n }, signal);\n var response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n var got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch)) throw new Error(\"Orez pull returned invalid gotQueries\");\n return {\n ...response,\n gotQueriesPatch: got.patch\n };\n }\n return response;\n },\n async push(state, mutations, signal) {\n var body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map(function(mutation2) {\n return {\n ...mutation2,\n name: mutation2.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation2.args === void 0 ? [] : [\n mutation2.args\n ]\n };\n })\n };\n var received = await post(\"push\", options.payloadCodec ? await options.payloadCodec.encodePush(body) : body, signal);\n if (!received || typeof received !== \"object\") throw new Error(\"Orez push returned an invalid response\");\n var response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations)) throw new Error(\"Orez push returned an invalid mutation response\");\n var expected = new Set(mutations.map(function(mutation2) {\n return mutation2.id;\n }));\n var outcomes = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = response.mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var mutation = _step.value;\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id)) throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result)) throw new Error(\"Orez push returned an invalid mutation result\");\n var result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\") throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\") throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : {\n type: \"success\"\n }\n });\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\nexport {\n createOrezTransport\n};\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,SAAS,oBAAoB,SAAS;CACpC,IAAI;CACJ,IAAI,SAAS,QAAQ,OAAO,QAAQ,OAAO,EAAE;CAC7C,IAAI,WAAW,iBAAiB,QAAQ,WAAW,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,WAAW,MAAM,KAAK,UAAU;CACxI,IAAI,OAAO,eAAe,MAAM,MAAM,MAAM,QAAQ;EAClD,IAAI;EACJ,IAAI,MAAM,IAAI,IAAI,GAAG,OAAO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GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"orez.native.js","names":[],"sources":["esm/zero/native/orez.native.js"],"sourcesContent":["import { subscribeOrezWake } from \"./orez-wake\";\nfunction createOrezTransport(options) {\n var _options_fetch;\n var server = options.server.replace(/\\/$/, \"\");\n var request = (_options_fetch = options.fetch) !== null && _options_fetch !== void 0 ? _options_fetch : globalThis.fetch.bind(globalThis);\n var post = async function post2(path, body, signal) {\n var _options_headers;\n var url = new URL(`${server}/${path}`);\n if (path === \"push\") {\n var _options_shardNum;\n url.searchParams.set(\"appID\", options.appID);\n url.searchParams.set(\"schema\", `${options.appID}_${(_options_shardNum = options.shardNum) !== null && _options_shardNum !== void 0 ? _options_shardNum : 0}`);\n }\n var extraHeaders = await ((_options_headers = options.headers) === null || _options_headers === void 0 ? void 0 : _options_headers.call(options));\n var response = await request(url.toString(), {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...extraHeaders\n },\n body: JSON.stringify(body),\n signal\n });\n if (!response.ok) throw new Error(`Orez ${path} failed: ${response.status}`);\n var result = await response.json();\n if (result && typeof result === \"object\" && \"error\" in result) {\n throw new Error(`Orez ${path} failed: ${JSON.stringify(result)}`);\n }\n return result;\n };\n return {\n subscribeWake(identity, request2) {\n return options.wake ? subscribeOrezWake(server, identity, options.wake, request2) : function() {\n };\n },\n async pull(state, queries, signal) {\n var received = await post(\"pull\", {\n clientID: state.clientID,\n clientGroupID: state.clientGroupID,\n cookie: state.cookie,\n queries: {\n version: state.queryVersion,\n patch: [\n {\n op: \"clear\"\n },\n ...queries.map(function(query) {\n return {\n op: \"put\",\n ...query\n };\n })\n ]\n }\n }, signal);\n var response = options.payloadCodec ? await options.payloadCodec.decodePull(received) : received;\n if (!response || typeof response !== \"object\" || !(\"cookie\" in response)) {\n throw new Error(\"Orez pull returned an invalid response\");\n }\n if (\"gotQueries\" in response && response.gotQueries !== void 0) {\n var got = response.gotQueries;\n if (!got || typeof got !== \"object\" || !(\"version\" in got) || !Number.isSafeInteger(got.version) || !(\"patch\" in got) || !Array.isArray(got.patch)) throw new Error(\"Orez pull returned invalid gotQueries\");\n return {\n ...response,\n gotQueriesPatch: got.patch\n };\n }\n return response;\n },\n async push(state, mutations, signal) {\n var body = {\n clientGroupID: state.clientGroupID,\n pushVersion: 1,\n schemaVersion: options.schemaVersion,\n timestamp: Date.now(),\n mutations: mutations.map(function(mutation2) {\n return {\n ...mutation2,\n name: mutation2.name.replaceAll(\".\", \"|\"),\n type: \"custom\",\n args: mutation2.args === void 0 ? [] : [\n mutation2.args\n ]\n };\n })\n };\n var received = await post(\"push\", options.payloadCodec ? await options.payloadCodec.encodePush(body) : body, signal);\n if (!received || typeof received !== \"object\") throw new Error(\"Orez push returned an invalid response\");\n var response = \"pushResponse\" in received ? received.pushResponse : received;\n if (!response || typeof response !== \"object\" || !(\"mutations\" in response) || !Array.isArray(response.mutations)) throw new Error(\"Orez push returned an invalid mutation response\");\n var expected = new Set(mutations.map(function(mutation2) {\n return mutation2.id;\n }));\n var outcomes = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = response.mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var mutation = _step.value;\n if (!mutation || typeof mutation !== \"object\" || !(\"id\" in mutation) || !mutation.id || typeof mutation.id !== \"object\" || !(\"clientID\" in mutation.id) || mutation.id.clientID !== state.clientID || !(\"id\" in mutation.id) || typeof mutation.id.id !== \"number\" || !expected.delete(mutation.id.id)) throw new Error(\"Orez push returned an unexpected mutation identity\");\n if (!mutation.result || typeof mutation.result !== \"object\" || Array.isArray(mutation.result)) throw new Error(\"Orez push returned an invalid mutation result\");\n var result = mutation.result;\n if (\"error\" in result && typeof result.error !== \"string\") throw new Error(\"Orez push returned an invalid mutation error\");\n if (result.error === \"app\" && typeof result.message !== \"string\") throw new Error(\"Orez push returned an invalid application error\");\n if (result.error === \"alreadyProcessed\") continue;\n outcomes.push({\n id: mutation.id.id,\n result: result.error ? {\n type: \"error\",\n error: {\n type: result.error === \"app\" ? \"app\" : \"zero\",\n message: typeof result.message === \"string\" ? result.message : JSON.stringify(result),\n details: result.details\n }\n } : {\n type: \"success\"\n }\n });\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (expected.size) throw new Error(\"Orez push omitted mutation results\");\n return outcomes;\n }\n };\n}\nexport {\n createOrezTransport\n};\n//# sourceMappingURL=orez.js.map\n"],"mappings":";;;AACA,SAAS,oBAAoB,SAAS;CACpC,IAAI;CACJ,IAAI,SAAS,QAAQ,OAAO,QAAQ,OAAO,EAAE;CAC7C,IAAI,WAAW,iBAAiB,QAAQ,WAAW,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,WAAW,MAAM,KAAK,UAAU;CACxI,IAAI,OAAO,eAAe,MAAM,MAAM,MAAM,QAAQ;EAClD,IAAI;EACJ,IAAI,MAAM,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM;EACrC,IAAI,SAAS,QAAQ;GACnB,IAAI;GACJ,IAAI,aAAa,IAAI,SAAS,QAAQ,KAAK;GAC3C,IAAI,aAAa,IAAI,UAAU,GAAG,QAAQ,MAAM,IAAI,oBAAoB,QAAQ,cAAc,QAAQ,sBAAsB,KAAK,IAAI,oBAAoB,GAAG;EAC9J;EACA,IAAI,eAAe,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ,qBAAqB,KAAK,IAAI,KAAK,IAAI,iBAAiB,KAAK,OAAO;EAC/I,IAAI,WAAW,MAAM,QAAQ,IAAI,SAAS,GAAG;GAC3C,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,GAAG;GACL;GACA,MAAM,KAAK,UAAU,IAA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,oDAAoD;KAC5W,IAAI,CAAC,SAAS,UAAU,OAAO,SAAS,WAAW,YAAY,MAAM,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,+CAA+C;KAC9J,IAAI,SAAS,SAAS;KACtB,IAAI,WAAW,UAAU,OAAO,OAAO,UAAU,UAAU,MAAM,IAAI,MAAM,8CAA8C;KACzH,IAAI,OAAO,UAAU,SAAS,OAAO,OAAO,YAAY,UAAU,MAAM,IAAI,MAAM,iDAAiD;KACnI,IAAI,OAAO,UAAU,oBAAoB;KACzC,SAAS,KAAK;MACZ,IAAI,SAAS,GAAG;MAChB,QAAQ,OAAO,QAAQ;OACrB,MAAM;OACN,OAAO;QACL,MAAM,OAAO,UAAU,QAAQ,QAAQ;QACvC,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAK,UAAU,MAAM;QACpF,SAAS,OAAO;OAClB;MACF,IAAI,EACF,MAAM,UACR;KACF,CAAC;IACH;GACF,SAAS,KAAK;IACZ,oBAAoB;IACpB,iBAAiB;GACnB,UAAU;IACR,IAAI;KACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;MAC1D,UAAU,OAAO;KACnB;IACF,UAAU;KACR,IAAI,mBAAmB;MACrB,MAAM;KACR;IACF;GACF;GACA,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,oCAAoC;GACvE,OAAO;EACT;CACF;AACF"}
@@ -67,8 +67,13 @@ struct OneNativeSlot: UIViewRepresentable {
67
67
  func updateUIView(_ view: Container, context: Context) {
68
68
  if view.content !== content {
69
69
  // a recycled react view can already sit in another slot, so only release
70
- // the previous content while this slot still holds it.
71
- if view.content.superview === view { view.content.removeFromSuperview() }
70
+ // the previous content while this slot still holds it. a live slot still
71
+ // referencing it takes it over, so the release cannot strand its row blank.
72
+ if view.content.superview === view {
73
+ let previous = view.content
74
+ previous.removeFromSuperview()
75
+ Container.rehomeContent(previous, excluding: view)
76
+ }
72
77
  view.content = content
73
78
  }
74
79
  view.mode = mode
@@ -89,12 +94,69 @@ struct OneNativeSlot: UIViewRepresentable {
89
94
  }
90
95
  static func dismantleUIView(_ view: Container, coordinator: ()) {
91
96
  view.onLayout = nil
92
- if view.content.superview === view { view.content.removeFromSuperview() }
97
+ // swiftui can update this slot after its replacement mounted, handing the
98
+ // content back here; hand it to a live slot on the way out instead of
99
+ // orphaning the replacement's row.
100
+ if view.content.superview === view {
101
+ view.content.removeFromSuperview()
102
+ Container.rehomeContent(view.content, excluding: view)
103
+ }
93
104
  }
94
105
 
95
106
  final class Container: UIView {
107
+ // containers still referencing each content view, so a release can hand
108
+ // content to a live container instead of orphaning it. entries hold weak
109
+ // references and compact on access.
110
+ private final class WeakContainer {
111
+ weak var container: Container?
112
+ init(_ container: Container) { self.container = container }
113
+ }
114
+ private static var containersByContent = [ObjectIdentifier: [WeakContainer]]()
115
+
116
+ private static func track(_ container: Container, content: UIView) {
117
+ let key = ObjectIdentifier(content)
118
+ var boxes = (containersByContent[key] ?? []).filter { $0.container != nil }
119
+ if !boxes.contains(where: { $0.container === container }) {
120
+ boxes.append(WeakContainer(container))
121
+ }
122
+ containersByContent[key] = boxes
123
+ }
124
+
125
+ private static func untrack(_ container: Container, content: UIView) {
126
+ let key = ObjectIdentifier(content)
127
+ guard let boxes = containersByContent[key] else { return }
128
+ let kept = boxes.filter { $0.container != nil && $0.container !== container }
129
+ if kept.isEmpty { containersByContent.removeValue(forKey: key) }
130
+ else { containersByContent[key] = kept }
131
+ }
132
+
133
+ // mount parentless content in another live on-window container referencing
134
+ // it, so a teardown releasing content cannot strand the replacement blank.
135
+ // only swiftui-side releases rehome: fabric recycles unmounted views in the
136
+ // same transaction and asserts they have no superview, so composition
137
+ // teardown leaves content parentless.
138
+ static func rehomeContent(_ content: UIView, excluding: Container) {
139
+ guard content.superview == nil else { return }
140
+ let key = ObjectIdentifier(content)
141
+ guard let boxes = containersByContent[key] else { return }
142
+ containersByContent[key] = boxes.filter { $0.container != nil }
143
+ for box in boxes {
144
+ guard let other = box.container, other !== excluding else { continue }
145
+ guard other.content === content, other.window != nil else { continue }
146
+ other.claimContent()
147
+ other.setNeedsLayout()
148
+ return
149
+ }
150
+ }
151
+
96
152
  var content: UIView {
97
- didSet { reportedFrame = nil }
153
+ didSet {
154
+ reportedFrame = nil
155
+ if oldValue !== content {
156
+ Self.untrack(self, content: oldValue)
157
+ Self.track(self, content: content)
158
+ }
159
+ }
98
160
  }
99
161
  var mode = Mode.passive
100
162
  weak var layoutHost: UIView?
@@ -106,8 +168,10 @@ struct OneNativeSlot: UIViewRepresentable {
106
168
  init(content: UIView) {
107
169
  self.content = content
108
170
  super.init(frame: .zero)
171
+ Self.track(self, content: content)
109
172
  claimContent()
110
173
  }
174
+ deinit { Self.untrack(self, content: content) }
111
175
  required init?(coder: NSCoder) { fatalError("init(coder:) is unavailable") }
112
176
 
113
177
  // swiftUI can update a slot it is about to tear down after its replacement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one",
3
- "version": "2.18.0",
3
+ "version": "2.18.1",
4
4
  "description": "One is a React framework for web, iOS, and Android apps.",
5
5
  "license": "BSD-3-Clause",
6
6
  "sideEffects": [
@@ -291,15 +291,15 @@
291
291
  "@react-navigation/routers": "8.0.0-alpha.21",
292
292
  "@rozenite/middleware": "^2.5.0",
293
293
  "@ungap/structured-clone": "^1.2.0",
294
- "@vxrn/color-scheme": "2.18.0",
295
- "@vxrn/compiler": "2.18.0",
296
- "@vxrn/resolve": "2.18.0",
297
- "@vxrn/tslib-lite": "2.18.0",
298
- "@vxrn/use-isomorphic-layout-effect": "2.18.0",
299
- "@vxrn/utils": "2.18.0",
294
+ "@vxrn/color-scheme": "2.18.1",
295
+ "@vxrn/compiler": "2.18.1",
296
+ "@vxrn/resolve": "2.18.1",
297
+ "@vxrn/tslib-lite": "2.18.1",
298
+ "@vxrn/use-isomorphic-layout-effect": "2.18.1",
299
+ "@vxrn/utils": "2.18.1",
300
300
  "citty": "^0.1.6",
301
301
  "core-js": "^3.38.1",
302
- "create-vxrn": "2.18.0",
302
+ "create-vxrn": "2.18.1",
303
303
  "escape-string-regexp": "^5.0.0",
304
304
  "fast-deep-equal": "^3.1.3",
305
305
  "fast-glob": "^3.3.3",
@@ -320,7 +320,7 @@
320
320
  "tsconfig-paths": "^4",
321
321
  "use-latest-callback": "^0.3.5",
322
322
  "vite": "^8.2.2",
323
- "vxrn": "2.18.0",
323
+ "vxrn": "2.18.1",
324
324
  "web-streams-polyfill": "^4.3.0",
325
325
  "ws": "^8.21.0",
326
326
  "xxhashjs": "^0.2.2"
@@ -350,7 +350,7 @@
350
350
  "@babel/types": "^7.28.5",
351
351
  "babel-dead-code-elimination": "1.0.10",
352
352
  "babel-plugin-module-resolver": "^5.0.2",
353
- "@vxrn/vite-plugin-metro": "2.18.0",
353
+ "@vxrn/vite-plugin-metro": "2.18.1",
354
354
  "react-native-css-interop": "^0.2.6"
355
355
  },
356
356
  "peerDependenciesMeta": {
@@ -428,7 +428,7 @@
428
428
  "@types/react-dom": "^19.3.0",
429
429
  "@types/react-test-renderer": "^19.1.0",
430
430
  "@types/xxhashjs": "^0.2.4",
431
- "@vxrn/emitter": "2.18.0",
431
+ "@vxrn/emitter": "2.18.1",
432
432
  "abort-controller": "3.0.0",
433
433
  "depcheck": "^1.4.7",
434
434
  "esbuild": "^0.28.1",
@@ -457,7 +457,7 @@
457
457
  "@babel/types": "^7.28.5",
458
458
  "babel-dead-code-elimination": "1.0.10",
459
459
  "babel-plugin-module-resolver": "^5.0.2",
460
- "@vxrn/vite-plugin-metro": "2.18.0",
460
+ "@vxrn/vite-plugin-metro": "2.18.1",
461
461
  "react-native-css-interop": "^0.2.6",
462
462
  "zod": "4.6.6"
463
463
  },
@@ -628,7 +628,7 @@
628
628
  }
629
629
  }
630
630
  },
631
- "releaseSourceCommit": "f925d952bf59cce9ab994bbcf4cf751694adbd01",
631
+ "releaseSourceCommit": "e396bf155a7146feef14b61804cdf181c5786dd7",
632
632
  "repository": {
633
633
  "type": "git",
634
634
  "url": "git+https://github.com/onejs/one.git",
@@ -44,9 +44,10 @@ export function createOrezTransport(options: OrezTransportOptions): OrezTranspor
44
44
  url.searchParams.set('appID', options.appID)
45
45
  url.searchParams.set('schema', `${options.appID}_${options.shardNum ?? 0}`)
46
46
  }
47
+ const extraHeaders = await options.headers?.()
47
48
  const response = await request(url.toString(), {
48
49
  method: 'POST',
49
- headers: { 'Content-Type': 'application/json', ...(await options.headers?.()) },
50
+ headers: { 'Content-Type': 'application/json', ...extraHeaders },
50
51
  body: JSON.stringify(body),
51
52
  signal,
52
53
  })
@@ -1 +1 @@
1
- {"version":3,"file":"orez.d.ts","sourceRoot":"","sources":["../../../src/zero/native/orez.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EACV,WAAW,EAMX,SAAS,EACV,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACxE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,YAAY,CAAC,EAAE;QACb,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;QACrD,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KACtD,CAAA;CACF,CAAA;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,aAAa,CACX,QAAQ,EAAE,IAAI,CAA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