@nocentraldb/sdk 0.2.0-alpha.4 → 0.2.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connect.js CHANGED
@@ -9,6 +9,7 @@ import { accountOf } from "./accountCalls.js";
9
9
  import { createAdHoc, lookupsOf, readObjects } from "./adHoc.js";
10
10
  import { decode, encode } from "./cbor.js";
11
11
  import { flatten, randomId, } from "./connectParts.js";
12
+ import { equalToCore, fromCore, toCore } from "./dates.js";
12
13
  import { reportsOf } from "./durabilityReport.js";
13
14
  import { SetElements } from "./elements.js";
14
15
  import { erasureCallsOf, signOffOf, takeBackOf } from "./eraseCalls.js";
@@ -276,7 +277,7 @@ export const connect = async (core, options) => {
276
277
  index: state.index,
277
278
  };
278
279
  if (state.equal !== undefined) {
279
- asked.equal = state.equal.map((v) => typeof v === "string" ? v.normalize("NFC") : v);
280
+ asked.equal = state.equal.map((v) => typeof v === "string" ? v.normalize("NFC") : equalToCore(v));
280
281
  }
281
282
  if (state.take !== undefined)
282
283
  asked.take = state.take;
@@ -294,7 +295,7 @@ export const connect = async (core, options) => {
294
295
  args.space = spaceId;
295
296
  const answer = (await ask("find", args));
296
297
  return {
297
- items: answer.items.map((item) => read.remember(flatten(item), asked.collection)),
298
+ items: answer.items.map((item) => read.remember(dated(asked.collection, flatten(item)), asked.collection)),
298
299
  cursor: answer.cursor === null
299
300
  ? undefined
300
301
  : new Cursor(identity, answer.cursor),
@@ -332,10 +333,11 @@ export const connect = async (core, options) => {
332
333
  !(typeof written === "number" && Number.isSafeInteger(written))) {
333
334
  throw new NcError("invalidValue", texts.notASafeInteger(collection, field));
334
335
  }
335
- if (typeof written === "string")
336
- return written.normalize("NFC");
337
- return written;
336
+ const sent = toCore(kind, collection, field, written);
337
+ return typeof sent === "string" ? sent.normalize("NFC") : sent;
338
338
  };
339
+ /** `object`, read from `collection`, with each point in time as a Date. */
340
+ const dated = (collection, object) => fromCore(described[collection]?.fields, object);
339
341
  const values = (collection, written) => {
340
342
  const out = {};
341
343
  for (const [field, v] of Object.entries(written)) {
@@ -438,7 +440,7 @@ export const connect = async (core, options) => {
438
440
  }));
439
441
  return answer === null
440
442
  ? undefined
441
- : read.remember(flatten(answer), nameOf(collection));
443
+ : read.remember(dated(nameOf(collection), flatten(answer)), nameOf(collection));
442
444
  };
443
445
  return {
444
446
  spaces: {
@@ -0,0 +1,13 @@
1
+ /** The core as the worker calls it: one bridge request in, its answer out. */
2
+ export type Handle = (request: Uint8Array) => Promise<Uint8Array>;
3
+ /**
4
+ * Answers each request with the core that `ready` gives, or with
5
+ * `storageFailed` once the core failed. `failed` takes an error the core
6
+ * threw outside a call, which the worker sees as an uncaught one: a trap in
7
+ * a step the core runs after the call returned leaves that call's promise
8
+ * unsettled, so the request it was answering gets its answer here.
9
+ */
10
+ export declare const guardCore: (ready: Promise<Handle>) => {
11
+ answer: (request: Uint8Array) => Promise<Uint8Array>;
12
+ failed: (error: unknown) => void;
13
+ };
@@ -0,0 +1,68 @@
1
+ // What the SDK's worker (worker.ts) answers in the core's place when the
2
+ // core fails: the module did not load, or the core trapped, as WebAssembly
3
+ // does when it runs out of memory. Every request still gets an answer, so
4
+ // the page never waits for one that does not come. A core that failed is
5
+ // not called again: a trap leaves its memory as it was mid-call, a bridge
6
+ // taken out among it, so it is broken for good (NOC-426). Every later
7
+ // request fails with `storageFailed` and a text that tells the app to open
8
+ // the database again, which starts a new worker; a `close` succeeds, so the
9
+ // app can. Internal: the package's entry does not reach it.
10
+ import { decode, encode } from "./cbor.js";
11
+ import * as texts from "./texts.js";
12
+ /** The id and the call of `request`, as far as they can be read. */
13
+ const read = (request) => {
14
+ try {
15
+ const { id, call } = decode(request);
16
+ return { id: typeof id === "number" ? id : 0, call };
17
+ }
18
+ catch {
19
+ return { id: 0 };
20
+ }
21
+ };
22
+ /** A `storageFailed` answer to `request`. */
23
+ const failure = (request, message) => encode({ id: read(request).id, error: { code: "storageFailed", message } });
24
+ /** The answer to `request` once the core failed. */
25
+ const stopped = (request) => {
26
+ const { id, call } = read(request);
27
+ return call === "close"
28
+ ? encode({ id, ok: null })
29
+ : encode({
30
+ id,
31
+ error: { code: "storageFailed", message: texts.CORE_STOPPED },
32
+ });
33
+ };
34
+ /**
35
+ * Answers each request with the core that `ready` gives, or with
36
+ * `storageFailed` once the core failed. `failed` takes an error the core
37
+ * threw outside a call, which the worker sees as an uncaught one: a trap in
38
+ * a step the core runs after the call returned leaves that call's promise
39
+ * unsettled, so the request it was answering gets its answer here.
40
+ */
41
+ export const guardCore = (ready) => {
42
+ let broken = false;
43
+ let waiting;
44
+ return {
45
+ answer: async (request) => {
46
+ if (broken)
47
+ return stopped(request);
48
+ try {
49
+ const core = await ready;
50
+ return await new Promise((resolve, reject) => {
51
+ waiting = reject;
52
+ core(request).then(resolve, reject);
53
+ });
54
+ }
55
+ catch (error) {
56
+ broken = true;
57
+ return failure(request, texts.coreFailed(String(error)));
58
+ }
59
+ finally {
60
+ waiting = undefined;
61
+ }
62
+ },
63
+ failed: (error) => {
64
+ broken = true;
65
+ waiting?.(error);
66
+ },
67
+ };
68
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The form the bridge takes for `written` in a field of `type`: a day as
3
+ * its text, a point in time as its milliseconds; `invalidValue` for
4
+ * anything else. A value of another type passes as it is.
5
+ */
6
+ export declare const toCore: (type: string | undefined, collection: string, field: string, written: unknown) => unknown;
7
+ /** A query's equality value as the bridge takes it: a Date as its milliseconds. */
8
+ export declare const equalToCore: (value: unknown) => unknown;
9
+ /**
10
+ * `object`, read from `collection`, with each point in time as a Date. The
11
+ * bridge gives a day as its text already.
12
+ */
13
+ export declare const fromCore: <T extends Record<string, unknown>>(fields: Record<string, {
14
+ type: string;
15
+ }> | undefined, object: T) => T;
package/dist/dates.js ADDED
@@ -0,0 +1,67 @@
1
+ // Days and points in time between the app and the core (RFC 0005, "Days
2
+ // and points in time"; Carsten, 2026-11-21, NOC-434). The app writes and
3
+ // reads a day as its "YYYY-MM-DD" string and a point in time as a Date; the
4
+ // bridge takes a day as that text and a point in time as its milliseconds
5
+ // since 1970-01-01T00:00:00.000Z (crates/nocentraldb/src/bridge/values.rs).
6
+ // Both range over the years 1 to 9999. Internal: the package's entry does
7
+ // not reach it.
8
+ import { NcError } from "./error.js";
9
+ import * as texts from "./texts.js";
10
+ const DATE = "ncdb/date";
11
+ const TIMESTAMP = "ncdb/timestamp";
12
+ /** The first and the last millisecond of the years 1 to 9999. */
13
+ const FIRST = -62_135_596_800_000;
14
+ const LAST = 253_402_300_799_999;
15
+ /** Whether `text` is exactly "YYYY-MM-DD" and names a day of the years 1 to 9999. */
16
+ const isDay = (text) => {
17
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text);
18
+ if (match === null)
19
+ return false;
20
+ const [year, month, day] = match.slice(1).map(Number);
21
+ if (year < 1)
22
+ return false;
23
+ // Date.UTC maps years 0 to 99 onto 1900 to 1999; setUTCFullYear does not.
24
+ const at = new Date(0);
25
+ at.setUTCFullYear(year, month - 1, day);
26
+ return (at.getUTCFullYear() === year &&
27
+ at.getUTCMonth() === month - 1 &&
28
+ at.getUTCDate() === day);
29
+ };
30
+ /** Whether `value` is a valid Date of the years 1 to 9999. */
31
+ const isPoint = (value) => value instanceof Date &&
32
+ !Number.isNaN(value.getTime()) &&
33
+ value.getTime() >= FIRST &&
34
+ value.getTime() <= LAST;
35
+ /**
36
+ * The form the bridge takes for `written` in a field of `type`: a day as
37
+ * its text, a point in time as its milliseconds; `invalidValue` for
38
+ * anything else. A value of another type passes as it is.
39
+ */
40
+ export const toCore = (type, collection, field, written) => {
41
+ if (type === DATE) {
42
+ if (typeof written === "string" && isDay(written))
43
+ return written;
44
+ throw new NcError("invalidValue", texts.notADay(collection, field));
45
+ }
46
+ if (type === TIMESTAMP) {
47
+ if (isPoint(written))
48
+ return written.getTime();
49
+ throw new NcError("invalidValue", texts.notATimestamp(collection, field));
50
+ }
51
+ return written;
52
+ };
53
+ /** A query's equality value as the bridge takes it: a Date as its milliseconds. */
54
+ export const equalToCore = (value) => value instanceof Date ? value.getTime() : value;
55
+ /**
56
+ * `object`, read from `collection`, with each point in time as a Date. The
57
+ * bridge gives a day as its text already.
58
+ */
59
+ export const fromCore = (fields, object) => {
60
+ for (const [name, field] of Object.entries(fields ?? {})) {
61
+ const value = object[name];
62
+ if (field.type === TIMESTAMP && typeof value === "number") {
63
+ object[name] = new Date(value);
64
+ }
65
+ }
66
+ return object;
67
+ };
package/dist/nc.d.ts CHANGED
@@ -68,7 +68,8 @@ export type Unknown = {
68
68
  /**
69
69
  * An object of the collection `C` as the app reads it (RFC 0005, "Types for
70
70
  * the app"): every field optional, without the deprecated ones. A choice
71
- * reads as its options or `Unknown`, an `nc.int` as a `number`, a set as
71
+ * reads as its options or `Unknown`, an `nc.int` as a `number`, an
72
+ * `nc.date` as a `"YYYY-MM-DD"` string, an `nc.timestamp` as a `Date`, a set as
72
73
  * an array, a link as an object id, a reference as `{ space, id }`
73
74
  * (RFC 0009, "Get by id").
74
75
  */
@@ -120,7 +121,11 @@ export declare const float: () => Field<number>;
120
121
  export declare const boolean: () => Field<boolean>;
121
122
  /** A choice from a fixed list of options, basic value. */
122
123
  export declare const oneOf: <const O extends readonly string[]>(options: O) => Field<O[number] | Unknown>;
123
- /** A set of basic values. */
124
+ /** A calendar day, basic value, read and written as a `"YYYY-MM-DD"` string, never converted to a time zone (RFC 0005, "Days and points in time"). */
125
+ export declare const date: () => Field<string>;
126
+ /** A point in time to the millisecond, in UTC, basic value, read and written as a `Date` (RFC 0005, "Days and points in time"). */
127
+ export declare const timestamp: () => Field<Date>;
128
+ /** A set of basic values, other than days and points in time. */
124
129
  export declare const set: <T>(element: Field<T>) => Field<T[]>;
125
130
  /** A link to one object, in one collection or in one of several. */
126
131
  export declare const link: (target: string | readonly string[]) => Field<ObjectId>;
package/dist/nc.js CHANGED
@@ -82,7 +82,11 @@ export const float = () => basic("ncdb/float");
82
82
  export const boolean = () => basic("ncdb/boolean");
83
83
  /** A choice from a fixed list of options, basic value. */
84
84
  export const oneOf = (options) => basic("ncdb/choice", options);
85
- /** A set of basic values. */
85
+ /** A calendar day, basic value, read and written as a `"YYYY-MM-DD"` string, never converted to a time zone (RFC 0005, "Days and points in time"). */
86
+ export const date = () => basic("ncdb/date");
87
+ /** A point in time to the millisecond, in UTC, basic value, read and written as a `Date` (RFC 0005, "Days and points in time"). */
88
+ export const timestamp = () => basic("ncdb/timestamp");
89
+ /** A set of basic values, other than days and points in time. */
86
90
  export const set = (element) => field({ spec: { kind: "set", of: element } });
87
91
  /** A link to one object, in one collection or in one of several. */
88
92
  export const link = (target) => field({
@@ -190,7 +194,10 @@ const describeType = (path, spec) => {
190
194
  throw new Error(texts.reservedFieldType(path, spec.name));
191
195
  case "set": {
192
196
  const element = fieldStates.get(spec.of);
193
- if (element === undefined || element.spec.kind !== "basic") {
197
+ if (element === undefined ||
198
+ element.spec.kind !== "basic" ||
199
+ element.spec.type === "ncdb/date" ||
200
+ element.spec.type === "ncdb/timestamp") {
194
201
  throw new Error(texts.setElementNotBasic(path));
195
202
  }
196
203
  if (element.person !== undefined ||
package/dist/texts.d.ts CHANGED
@@ -2,6 +2,10 @@
2
2
  export declare const AD_HOC_COPY_NOT_READ = "copy takes objects this database read, as space.get, find or subscribe gives them, not a copy of one";
3
3
  /** `anotherLock` (modelRefused): nc.open in a tab while another tab of the origin has the database open with another lock. */
4
4
  export declare const ANOTHER_LOCK = "another tab has this database open with another lock";
5
+ /** `coreFailed` (storageFailed): The call the SDK's worker was answering when its core failed, such as a write too large for the core's memory, with the browser's own message. */
6
+ export declare const coreFailed: (message: unknown) => string;
7
+ /** `coreStopped` (storageFailed): Every call after the SDK's worker's core failed in this tab, until the app closes the database and opens it again. */
8
+ export declare const CORE_STOPPED = "the database's core stopped after an earlier failure, such as a write too large for its memory: close the database and open it again";
5
9
  /** `cursorOfAnotherDatabase` (cursorOfAnotherModel): db.find or space.find, given a page's cursor from another database. */
6
10
  export declare const CURSOR_OF_ANOTHER_DATABASE = "the cursor is not of this database; start from the first page";
7
11
  /** `databaseClosed` (closed): Any call after db.close(), and the calls still waiting when it closes. */
@@ -26,6 +30,8 @@ export declare const notACollection: (collection: unknown) => string;
26
30
  export declare const notAComputedField: (collection: unknown, key: unknown) => string;
27
31
  /** `notADatabaseName` (invalidValue): nc.open, given a name that breaks RFC 0006's rule for a browser database's name. */
28
32
  export declare const NOT_ADATABASE_NAME = "a database name is 1 to 64 characters of a-z, 0-9, - and _";
33
+ /** `notADay` (invalidValue): A write of an nc.date() field given anything but such a string, a Date included. */
34
+ export declare const notADay: (collection: unknown, field: unknown) => string;
29
35
  /** `notAField`: ncdb model build, on a model whose field is not declared with a field function. */
30
36
  export declare const notAField: (path: unknown) => string;
31
37
  /** `notAPairingAnswer` (invalidValue): nc.pairingAnswer, given a text that does not start with ncdb-pair-1: or is not unpadded base64url. */
@@ -34,6 +40,8 @@ export declare const NOT_APAIRING_ANSWER = "the text is not a pairing answer, wh
34
40
  export declare const NOT_AQUERY_START_ONE = "not a query; start one from an index, such as model.tasks.indexes.byPriority";
35
41
  /** `notASafeInteger` (invalidValue): A write of an nc.int() field given a number that is not a safe integer. */
36
42
  export declare const notASafeInteger: (collection: unknown, field: unknown) => string;
43
+ /** `notATimestamp` (invalidValue): A write of an nc.timestamp() field given anything but such a Date, a string or a number included. */
44
+ export declare const notATimestamp: (collection: unknown, field: unknown) => string;
37
45
  /** `notAView`: ncdb model build, on a model whose view is not declared with nc.view. */
38
46
  export declare const notAView: (collection: unknown, key: unknown) => string;
39
47
  /** `notAnErasureRequest` (invalidValue): nc.erasureRequest, given a text that does not start with ncdb-erase-1: or is not unpadded base64url. */
package/dist/texts.js CHANGED
@@ -8,6 +8,10 @@
8
8
  export const AD_HOC_COPY_NOT_READ = "copy takes objects this database read, as space.get, find or subscribe gives them, not a copy of one";
9
9
  /** `anotherLock` (modelRefused): nc.open in a tab while another tab of the origin has the database open with another lock. */
10
10
  export const ANOTHER_LOCK = "another tab has this database open with another lock";
11
+ /** `coreFailed` (storageFailed): The call the SDK's worker was answering when its core failed, such as a write too large for the core's memory, with the browser's own message. */
12
+ export const coreFailed = (message) => `the database's core failed: ${message}`;
13
+ /** `coreStopped` (storageFailed): Every call after the SDK's worker's core failed in this tab, until the app closes the database and opens it again. */
14
+ export const CORE_STOPPED = "the database's core stopped after an earlier failure, such as a write too large for its memory: close the database and open it again";
11
15
  /** `cursorOfAnotherDatabase` (cursorOfAnotherModel): db.find or space.find, given a page's cursor from another database. */
12
16
  export const CURSOR_OF_ANOTHER_DATABASE = "the cursor is not of this database; start from the first page";
13
17
  /** `databaseClosed` (closed): Any call after db.close(), and the calls still waiting when it closes. */
@@ -32,6 +36,8 @@ export const notACollection = (collection) => `${collection}: not a collection;
32
36
  export const notAComputedField = (collection, key) => `${collection}.${key}: not a computed field; declare it with nc.reach(...).`;
33
37
  /** `notADatabaseName` (invalidValue): nc.open, given a name that breaks RFC 0006's rule for a browser database's name. */
34
38
  export const NOT_ADATABASE_NAME = "a database name is 1 to 64 characters of a-z, 0-9, - and _";
39
+ /** `notADay` (invalidValue): A write of an nc.date() field given anything but such a string, a Date included. */
40
+ export const notADay = (collection, field) => `${collection}.${field} takes a day as a "YYYY-MM-DD" string, from 0001-01-01 to 9999-12-31`;
35
41
  /** `notAField`: ncdb model build, on a model whose field is not declared with a field function. */
36
42
  export const notAField = (path) => `${path}: not a field; declare it with a field function such as nc.string().`;
37
43
  /** `notAPairingAnswer` (invalidValue): nc.pairingAnswer, given a text that does not start with ncdb-pair-1: or is not unpadded base64url. */
@@ -40,6 +46,8 @@ export const NOT_APAIRING_ANSWER = "the text is not a pairing answer, which is n
40
46
  export const NOT_AQUERY_START_ONE = "not a query; start one from an index, such as model.tasks.indexes.byPriority";
41
47
  /** `notASafeInteger` (invalidValue): A write of an nc.int() field given a number that is not a safe integer. */
42
48
  export const notASafeInteger = (collection, field) => `${collection}.${field} takes a safe integer, between -(2^53 - 1) and 2^53 - 1`;
49
+ /** `notATimestamp` (invalidValue): A write of an nc.timestamp() field given anything but such a Date, a string or a number included. */
50
+ export const notATimestamp = (collection, field) => `${collection}.${field} takes a valid Date from the year 1 to 9999`;
43
51
  /** `notAView`: ncdb model build, on a model whose view is not declared with nc.view. */
44
52
  export const notAView = (collection, key) => `${collection}.${key}: not a view; declare it with nc.view(...).`;
45
53
  /** `notAnErasureRequest` (invalidValue): nc.erasureRequest, given a text that does not start with ncdb-erase-1: or is not unpadded base64url. */
@@ -667,17 +667,17 @@ function __wbg_get_imports() {
667
667
  return ret;
668
668
  }, arguments); },
669
669
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
670
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 187, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
670
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 151, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
671
671
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_70735ce8c264698d___convert__closures_____invoke___wasm_bindgen_70735ce8c264698d___JsValue______true_);
672
672
  return ret;
673
673
  },
674
674
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
675
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 953, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
675
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 952, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
676
676
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_70735ce8c264698d___convert__closures_____invoke___wasm_bindgen_70735ce8c264698d___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_70735ce8c264698d___JsError___true_);
677
677
  return ret;
678
678
  },
679
679
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
680
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 187, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
680
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 151, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
681
681
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_70735ce8c264698d___convert__closures_____invoke___wasm_bindgen_70735ce8c264698d___JsValue______true__7);
682
682
  return ret;
683
683
  },
Binary file
package/dist/worker.js CHANGED
@@ -19,6 +19,7 @@
19
19
  // then (docs/getting-started-browser.md, "Safari"), and while it waits its
20
20
  // tab reports `waitingForTab` in `db.durability` (NOC-355).
21
21
  import { decode, encode } from "./cbor.js";
22
+ import { guardCore } from "./coreGuard.js";
22
23
  import { waitNotice } from "./waitNotice.js";
23
24
  // @ts-expect-error: generated into dist/wasm/ by the build step.
24
25
  import init, { Core } from "./wasm/nocentraldb_wasm.js";
@@ -35,23 +36,21 @@ const ready = init({
35
36
  });
36
37
  // Requests are answered one at a time, in the order they came.
37
38
  let queue = Promise.resolve();
38
- const answer = async (request) => {
39
- try {
40
- return await (await ready).handle(request);
41
- }
42
- catch (error) {
43
- // The module did not load, or the core failed: the request still gets
44
- // an answer, so the page never waits for one that does not come.
45
- const { id } = decode(request);
46
- return encode({
47
- id,
48
- error: {
49
- code: "storageFailed",
50
- message: `the core failed: ${String(error)}`,
51
- },
52
- });
53
- }
54
- };
39
+ const core = guardCore(ready.then((bridge) => (request) => bridge.handle(request)));
40
+ const answer = core.answer;
41
+ // An error nothing caught in this worker comes from the core: a trap in a
42
+ // step it runs after a call returned, as when a write is too large for its
43
+ // memory (NOC-426). The guard answers the waiting request and every later
44
+ // one with `storageFailed`; the error stops here, so the page sees the
45
+ // nc.Error and no uncaught one.
46
+ self.addEventListener("error", (event) => {
47
+ event.preventDefault();
48
+ core.failed(event.error ?? event.message);
49
+ });
50
+ self.addEventListener("unhandledrejection", (event) => {
51
+ event.preventDefault();
52
+ core.failed(event.reason);
53
+ });
55
54
  /** What the page sends, besides bridge requests, to end the worker (workerHost.ts). */
56
55
  const STOP = "stop";
57
56
  // The lock this worker holds while it may hold the database's storage:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocentraldb/sdk",
3
- "version": "0.2.0-alpha.4",
3
+ "version": "0.2.0-alpha.6",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",