@mdbase-dev/sdk 0.2.56 → 0.2.58

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.
@@ -26371,6 +26371,56 @@ ${end.comment}` : end.comment;
26371
26371
  }
26372
26372
  });
26373
26373
 
26374
+ // src/transport/inprocess.ts
26375
+ function inProcessConnector(runtime2, options = {}) {
26376
+ return {
26377
+ description: "in-process",
26378
+ open(hello, signal) {
26379
+ return new Promise((resolve2, reject) => {
26380
+ let port;
26381
+ try {
26382
+ port = runtime2.connect(options);
26383
+ } catch (e) {
26384
+ reject(mdbaseError("unavailable", `runtime refused to connect: ${String(e)}`));
26385
+ return;
26386
+ }
26387
+ const onAbort = () => {
26388
+ port.close();
26389
+ reject(mdbaseError("cancelled", "connect aborted"));
26390
+ };
26391
+ signal?.addEventListener("abort", onAbort, { once: true });
26392
+ port.onframe = (f) => {
26393
+ signal?.removeEventListener("abort", onAbort);
26394
+ port.onframe = null;
26395
+ port.onclose = null;
26396
+ resolve2({ port, helloResponse: f });
26397
+ };
26398
+ port.onclose = (e) => {
26399
+ signal?.removeEventListener("abort", onAbort);
26400
+ reject(e ?? mdbaseError("unavailable", "runtime closed the session"));
26401
+ };
26402
+ port.send(hello);
26403
+ });
26404
+ }
26405
+ };
26406
+ }
26407
+ var init_inprocess = __esm({
26408
+ "src/transport/inprocess.ts"() {
26409
+ "use strict";
26410
+ init_errors();
26411
+ }
26412
+ });
26413
+
26414
+ // src/app-host/collection-timezone.ts
26415
+ function isCollectionTimezoneName(value2) {
26416
+ return typeof value2 === "string" && value2.length <= 100 && /^(?:UTC|[A-Z][A-Za-z0-9_+-]*(?:\/[A-Z][A-Za-z0-9_+-]*)+)$/.test(value2);
26417
+ }
26418
+ var init_collection_timezone = __esm({
26419
+ "src/app-host/collection-timezone.ts"() {
26420
+ "use strict";
26421
+ }
26422
+ });
26423
+
26374
26424
  // src/app-grant/native-completion.ts
26375
26425
  function object4(value2) {
26376
26426
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2) ? value2 : null;
@@ -29587,6 +29637,8 @@ ${end.comment}` : end.comment;
29587
29637
  return Object.freeze([value2[0], value2[1], value2[2], action, Object.freeze([payload[0], payload[1]])]);
29588
29638
  } else if (action === "authorize") {
29589
29639
  if (payload !== null && (typeof payload !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(payload) || payload === "00000000-0000-0000-0000-000000000000")) fail20();
29640
+ } else if (action === "openUnsynced") {
29641
+ if (payload !== null && !isCollectionTimezoneName(payload)) fail20();
29590
29642
  } else if (action === "foreground") {
29591
29643
  if (typeof payload !== "boolean") fail20();
29592
29644
  } else if (action === "approvalClosed") {
@@ -29598,6 +29650,7 @@ ${end.comment}` : end.comment;
29598
29650
  var init_worker_protocol = __esm({
29599
29651
  "src/application/worker-protocol.ts"() {
29600
29652
  "use strict";
29653
+ init_collection_timezone();
29601
29654
  APPLICATION_WORKER_PROTOCOL = "mdbn-application-worker/1";
29602
29655
  APPLICATION_WORKER_MAX_ID = 4294967295;
29603
29656
  APPLICATION_WORKER_MAX_SECRET_BYTES = 4096;
@@ -31819,46 +31872,6 @@ ${end.comment}` : end.comment;
31819
31872
  }
31820
31873
  });
31821
31874
 
31822
- // src/transport/inprocess.ts
31823
- function inProcessConnector(runtime2, options = {}) {
31824
- return {
31825
- description: "in-process",
31826
- open(hello, signal) {
31827
- return new Promise((resolve2, reject) => {
31828
- let port;
31829
- try {
31830
- port = runtime2.connect(options);
31831
- } catch (e) {
31832
- reject(mdbaseError("unavailable", `runtime refused to connect: ${String(e)}`));
31833
- return;
31834
- }
31835
- const onAbort = () => {
31836
- port.close();
31837
- reject(mdbaseError("cancelled", "connect aborted"));
31838
- };
31839
- signal?.addEventListener("abort", onAbort, { once: true });
31840
- port.onframe = (f) => {
31841
- signal?.removeEventListener("abort", onAbort);
31842
- port.onframe = null;
31843
- port.onclose = null;
31844
- resolve2({ port, helloResponse: f });
31845
- };
31846
- port.onclose = (e) => {
31847
- signal?.removeEventListener("abort", onAbort);
31848
- reject(e ?? mdbaseError("unavailable", "runtime closed the session"));
31849
- };
31850
- port.send(hello);
31851
- });
31852
- }
31853
- };
31854
- }
31855
- var init_inprocess = __esm({
31856
- "src/transport/inprocess.ts"() {
31857
- "use strict";
31858
- init_errors();
31859
- }
31860
- });
31861
-
31862
31875
  // src/app-host/local-facade.ts
31863
31876
  function pin2(source) {
31864
31877
  const ids = [source.account, source.installation, source.collection];
@@ -50122,7 +50135,7 @@ ${end.comment}` : end.comment;
50122
50135
  this.publish();
50123
50136
  await retired;
50124
50137
  if (this.closed || caller.aborted) throw new ApplicationRuntimeError("application_fenced");
50125
- return this.complete(await this.worker.request("openUnsynced", null, caller), caller);
50138
+ return this.complete(await this.worker.request("openUnsynced", options.timezone ?? null, caller), caller);
50126
50139
  }, caller);
50127
50140
  }
50128
50141
  /** After a complete transfer into this tab's open collection: keep the
@@ -51707,6 +51720,7 @@ ${end.comment}` : end.comment;
51707
51720
  init_errors();
51708
51721
 
51709
51722
  // src/app-host/unsynced-collection.ts
51723
+ init_collection_timezone();
51710
51724
  var STORE2 = "unsynced";
51711
51725
  var KEY2 = "current";
51712
51726
  var MOVED = "moved.";
@@ -51721,10 +51735,11 @@ ${end.comment}` : end.comment;
51721
51735
  };
51722
51736
  var fail9 = (reason = "unavailable") => new AppUnsyncedCollectionError(reason);
51723
51737
  function identity2(value2) {
51724
- if (!value2 || typeof value2 !== "object" || Array.isArray(value2) || Object.keys(value2).sort().join() !== "account,collection,device,installation,replica,version") throw fail9();
51738
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2) || Object.keys(value2).some((key3) => !["version", "account", "installation", "collection", "replica", "device", "timezone"].includes(key3))) throw fail9();
51725
51739
  const row3 = value2;
51726
51740
  const ids = [row3.account, row3.installation, row3.collection, row3.replica, row3.device];
51727
51741
  if (row3.version !== 1 || ids.some((id6) => typeof id6 !== "string" || !UUID8.test(id6)) || new Set(ids).size !== ids.length) throw fail9();
51742
+ if ("timezone" in row3 && row3.timezone !== null && !isCollectionTimezoneName(row3.timezone)) throw fail9();
51728
51743
  return Object.freeze({ ...row3 });
51729
51744
  }
51730
51745
  function database(name3, signal) {