@rotorsoft/act-sqlite 2.1.0 → 2.1.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.
@@ -59,43 +59,6 @@ export interface SqliteConfig {
59
59
  */
60
60
  pii_encryption?: Encryption;
61
61
  }
62
- /** Translate a stream filter (regex-shaped or plain substring) into a
63
- * SQLite `GLOB` pattern.
64
- *
65
- * `GLOB` — not `LIKE` — because `GLOB` is **case-sensitive**,
66
- * matching PG's `~` and InMemory's `RegExp`. SQLite's `LIKE` is ASCII
67
- * case-insensitive, and its per-connection `PRAGMA case_sensitive_like`
68
- * override is unreliable under libsql's pooled connections (a
69
- * transaction and a follow-up read can land on different connections).
70
- * `GLOB` carries its case-sensitivity in the operator itself, so it is
71
- * correct regardless of which pooled connection runs the statement.
72
- *
73
- * Honors `^` / `$` anchors and converts `.*` → `*`, `.` → `?`.
74
- * Unanchored input gets `*` wildcards on both sides. `GLOB` has no
75
- * ESCAPE clause and `%` / `_` are ordinary literals under it — so no
76
- * escaping is needed. The portable grammar rejects `*`, `?`, and `[`
77
- * as literals (they are metacharacters), so a literal can never collide
78
- * with a `GLOB` wildcard.
79
- *
80
- * Only the portable filter grammar documented on
81
- * {@link QueryStreams.stream} is convertible: `^` / `$` anchors, `.`,
82
- * `.*`, and literal characters. Any richer regex syntax throws
83
- * {@link ValidationError} — a lossy approximation would silently
84
- * return wrong rows, the worst available failure mode when the filter
85
- * drives `reset` / `unblock`.
86
- *
87
- * Examples:
88
- * - `^abc$` → `abc` (exact)
89
- * - `^abc.*` → `abc*` (starts-with)
90
- * - `.*abc$` → `*abc` (ends-with)
91
- * - `abc` → `*abc*` (contains)
92
- * - `a.c` → `*a?c*` (single-char wildcard, contains)
93
- * - `^a_c$` → `a_c` (literal underscore — ordinary under GLOB)
94
- * - `(a|b)` → throws {@link ValidationError}
95
- *
96
- * @internal exported for testing
97
- */
98
- export declare function streamPatternToGlob(input: string): string;
99
62
  /**
100
63
  * SQLite event store adapter for [@rotorsoft/act](https://www.npmjs.com/package/@rotorsoft/act).
101
64
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-store.d.ts","sourceRoot":"","sources":["../../src/sqlite-store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,SAAS,EACT,SAAS,EACT,KAAK,EACL,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAWxB,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B;AA6GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmCzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,WAAY,YAAW,KAAK;IACvC,OAAO,CAAC,MAAM,CAAS;IAMvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;IAEvE,YAAY,MAAM,EAAE,YAAY,EAQ/B;YAMa,wBAAwB;YAexB,oBAAoB;IAgB5B,IAAI,kBAgLT;IAEK,IAAI,kBAIT;IASD,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,GAAG;IAiBL,OAAO,kBAEZ;IAGK,MAAM,C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,CAAC,CAAC,CAAC,CAAC,CA2EtC;YAIa,uBAAuB;YAuEvB,sBAAsB;IA8FpC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlE;IAMK,QAAQ,CACZ,OAAO,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;iBAKW,MAAM;mBACJ,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;iBACnC,IAAI;QA6ElB;IAED;;;;;;;;;;OAUG;IAGG,OAAO,CACX,MAAM,EAAE,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,KACpE,OAAO,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,IAAI,CAAC,CAqCf;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhD;CACF"}
@@ -0,0 +1,37 @@
1
+ /** Translate a stream filter (regex-shaped or plain substring) into a
2
+ * SQLite `GLOB` pattern.
3
+ *
4
+ * `GLOB` — not `LIKE` — because `GLOB` is **case-sensitive**,
5
+ * matching PG's `~` and InMemory's `RegExp`. SQLite's `LIKE` is ASCII
6
+ * case-insensitive, and its per-connection `PRAGMA case_sensitive_like`
7
+ * override is unreliable under libsql's pooled connections (a
8
+ * transaction and a follow-up read can land on different connections).
9
+ * `GLOB` carries its case-sensitivity in the operator itself, so it is
10
+ * correct regardless of which pooled connection runs the statement.
11
+ *
12
+ * Honors `^` / `$` anchors and converts `.*` → `*`, `.` → `?`.
13
+ * Unanchored input gets `*` wildcards on both sides. `GLOB` has no
14
+ * ESCAPE clause and `%` / `_` are ordinary literals under it — so no
15
+ * escaping is needed. The portable grammar rejects `*`, `?`, and `[`
16
+ * as literals (they are metacharacters), so a literal can never collide
17
+ * with a `GLOB` wildcard.
18
+ *
19
+ * Only the portable filter grammar documented on
20
+ * {@link QueryStreams.stream} is convertible: `^` / `$` anchors, `.`,
21
+ * `.*`, and literal characters. Any richer regex syntax throws
22
+ * {@link ValidationError} — a lossy approximation would silently
23
+ * return wrong rows, the worst available failure mode when the filter
24
+ * drives `reset` / `unblock`.
25
+ *
26
+ * Examples:
27
+ * - `^abc$` → `abc` (exact)
28
+ * - `^abc.*` → `abc*` (starts-with)
29
+ * - `.*abc$` → `*abc` (ends-with)
30
+ * - `abc` → `*abc*` (contains)
31
+ * - `a.c` → `*a?c*` (single-char wildcard, contains)
32
+ * - `^a_c$` → `a_c` (literal underscore — ordinary under GLOB)
33
+ * - `(a|b)` → throws {@link ValidationError}
34
+ *
35
+ */
36
+ export declare function stream_glob(input: string): string;
37
+ //# sourceMappingURL=stream-glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-glob.d.ts","sourceRoot":"","sources":["../../src/stream-glob.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmCjD"}
package/dist/index.cjs CHANGED
@@ -20,51 +20,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- SqliteStore: () => SqliteStore,
24
- streamPatternToGlob: () => streamPatternToGlob
23
+ SqliteStore: () => SqliteStore
25
24
  });
26
25
  module.exports = __toCommonJS(index_exports);
27
26
 
28
27
  // src/sqlite-store.ts
29
28
  var import_client = require("@libsql/client");
30
- var import_act = require("@rotorsoft/act");
29
+ var import_act2 = require("@rotorsoft/act");
31
30
  var import_adapter = require("@rotorsoft/act/adapter");
32
31
  var import_types = require("@rotorsoft/act/types");
33
32
  var import_act_crypto = require("@rotorsoft/act-crypto");
34
- var SHARED_MEMORY_URL = "file::memory:?cache=shared";
35
- var is_in_memory_url = (url) => url === ":memory:" || url === "file::memory:" || url.startsWith("file::memory:?");
36
- var resolve_url = (url) => {
37
- if (typeof url !== "string" || url.trim().length === 0)
38
- throw new import_act.ValidationError(
39
- 'SqliteStore config \u2014 "url" is required and has no default. Use a file database ("file:myapp.db"), a remote libSQL server ("libsql://\u2026" plus authToken), or ":memory:" for a process-wide shared in-memory database. For isolated throwaway state, prefer InMemoryStore from @rotorsoft/act',
40
- { url },
41
- "missing url"
42
- );
43
- if (url.startsWith("file::memory:?") && url.includes("cache=private"))
44
- throw new import_act.ValidationError(
45
- 'SqliteStore config \u2014 a private in-memory database ("cache=private") cannot back a store: libSQL gives each connection its own database, so writes are accepted and then lost on the next statement. Use ":memory:" for the shared-cache database, a "file:" path, or InMemoryStore from @rotorsoft/act',
46
- { url },
47
- "private in-memory url"
48
- );
49
- return is_in_memory_url(url) ? SHARED_MEMORY_URL : url;
50
- };
51
- var parse_json = (raw) => JSON.parse(raw);
52
- var to_committed = (row, prefix = "") => ({
53
- id: Number(row[`${prefix}id`]),
54
- stream: row[`${prefix}stream`],
55
- version: Number(row[`${prefix}version`]),
56
- created: new Date(row[`${prefix}created`]),
57
- name: row[`${prefix}name`],
58
- data: parse_json(row[`${prefix}data`]),
59
- meta: parse_json(row[`${prefix}meta`])
60
- });
61
- var SQLITE_CONSTRAINT_UNIQUE = 2067;
62
- var is_unique_violation = (e) => {
63
- const err = e;
64
- return err?.rawCode === SQLITE_CONSTRAINT_UNIQUE || typeof err?.message === "string" && err.message.includes("UNIQUE constraint failed");
65
- };
33
+
34
+ // src/stream-glob.ts
35
+ var import_act = require("@rotorsoft/act");
66
36
  var PORTABLE_BODY = /^(?:\.\*|\.|[^\\^$.()[\]{}|+?*])*$/;
67
- function streamPatternToGlob(input) {
37
+ function stream_glob(input) {
68
38
  let s = input;
69
39
  const start = s.startsWith("^");
70
40
  const end = s.endsWith("$");
@@ -97,6 +67,40 @@ function streamPatternToGlob(input) {
97
67
  }
98
68
  return out;
99
69
  }
70
+
71
+ // src/sqlite-store.ts
72
+ var SHARED_MEMORY_URL = "file::memory:?cache=shared";
73
+ var is_in_memory_url = (url) => url === ":memory:" || url === "file::memory:" || url.startsWith("file::memory:?");
74
+ var resolve_url = (url) => {
75
+ if (typeof url !== "string" || url.trim().length === 0)
76
+ throw new import_act2.ValidationError(
77
+ 'SqliteStore config \u2014 "url" is required and has no default. Use a file database ("file:myapp.db"), a remote libSQL server ("libsql://\u2026" plus authToken), or ":memory:" for a process-wide shared in-memory database. For isolated throwaway state, prefer InMemoryStore from @rotorsoft/act',
78
+ { url },
79
+ "missing url"
80
+ );
81
+ if (url.startsWith("file::memory:?") && url.includes("cache=private"))
82
+ throw new import_act2.ValidationError(
83
+ 'SqliteStore config \u2014 a private in-memory database ("cache=private") cannot back a store: libSQL gives each connection its own database, so writes are accepted and then lost on the next statement. Use ":memory:" for the shared-cache database, a "file:" path, or InMemoryStore from @rotorsoft/act',
84
+ { url },
85
+ "private in-memory url"
86
+ );
87
+ return is_in_memory_url(url) ? SHARED_MEMORY_URL : url;
88
+ };
89
+ var parse_json = (raw) => JSON.parse(raw);
90
+ var to_committed = (row, prefix = "") => ({
91
+ id: Number(row[`${prefix}id`]),
92
+ stream: row[`${prefix}stream`],
93
+ version: Number(row[`${prefix}version`]),
94
+ created: new Date(row[`${prefix}created`]),
95
+ name: row[`${prefix}name`],
96
+ data: parse_json(row[`${prefix}data`]),
97
+ meta: parse_json(row[`${prefix}meta`])
98
+ });
99
+ var SQLITE_CONSTRAINT_UNIQUE = 2067;
100
+ var is_unique_violation = (e) => {
101
+ const err = e;
102
+ return err?.rawCode === SQLITE_CONSTRAINT_UNIQUE || typeof err?.message === "string" && err.message.includes("UNIQUE constraint failed");
103
+ };
100
104
  var SqliteStore = class {
101
105
  client;
102
106
  // Memoized key resolver for the optional `pii_encryption` envelope.
@@ -275,7 +279,7 @@ var SqliteStore = class {
275
279
  // Opens a write transaction: a BEGIN that fails is a {@link StoreError} too.
276
280
  _begin(operation) {
277
281
  return this.client.transaction("write").catch((e) => {
278
- throw new import_act.StoreError(operation, { cause: e });
282
+ throw new import_act2.StoreError(operation, { cause: e });
279
283
  });
280
284
  }
281
285
  // One write transaction, in its turn: any failure rolls back and throws a {@link StoreError} naming the operation.
@@ -288,7 +292,7 @@ var SqliteStore = class {
288
292
  return result;
289
293
  } catch (e) {
290
294
  await tx.rollback();
291
- throw new import_act.StoreError(operation, { cause: e });
295
+ throw new import_act2.StoreError(operation, { cause: e });
292
296
  }
293
297
  });
294
298
  }
@@ -351,9 +355,9 @@ var SqliteStore = class {
351
355
  return committed;
352
356
  } catch (e) {
353
357
  await tx.rollback();
354
- if (e instanceof import_act.ConcurrencyError) throw e;
358
+ if (e instanceof import_act2.ConcurrencyError) throw e;
355
359
  if (is_unique_violation(e)) throw (0, import_adapter.concurrencyError)(appending, head);
356
- throw new import_act.StoreError("commit", { cause: e });
360
+ throw new import_act2.StoreError("commit", { cause: e });
357
361
  }
358
362
  });
359
363
  }
@@ -367,7 +371,7 @@ var SqliteStore = class {
367
371
  args.push(query.stream);
368
372
  } else {
369
373
  sql += " AND stream GLOB ?";
370
- args.push(streamPatternToGlob(query.stream));
374
+ args.push(stream_glob(query.stream));
371
375
  }
372
376
  }
373
377
  if (query?.names !== void 0) {
@@ -426,7 +430,7 @@ var SqliteStore = class {
426
430
  async subscribe(streams, correlated_at, correlator) {
427
431
  for (const { stream, source } of streams) {
428
432
  if (source !== void 0 && !(0, import_adapter.isStreamName)(source, stream))
429
- streamPatternToGlob(source);
433
+ stream_glob(source);
430
434
  }
431
435
  return this._tx("subscribe", async (tx) => {
432
436
  let subscribed = 0;
@@ -717,7 +721,7 @@ var SqliteStore = class {
717
721
  args.push(filter.stream);
718
722
  } else {
719
723
  conditions.push("stream GLOB ?");
720
- args.push(streamPatternToGlob(filter.stream));
724
+ args.push(stream_glob(filter.stream));
721
725
  }
722
726
  }
723
727
  if (filter.source !== void 0) {
@@ -727,7 +731,7 @@ var SqliteStore = class {
727
731
  args.push(filter.source);
728
732
  } else {
729
733
  conditions.push("source GLOB ?");
730
- args.push(streamPatternToGlob(filter.source));
734
+ args.push(stream_glob(filter.source));
731
735
  }
732
736
  }
733
737
  if (filter.blocked !== void 0) {
@@ -850,7 +854,7 @@ var SqliteStore = class {
850
854
  args.push(input.stream);
851
855
  } else {
852
856
  where.push(`e.stream GLOB ?`);
853
- args.push(streamPatternToGlob(input.stream));
857
+ args.push(stream_glob(input.stream));
854
858
  }
855
859
  }
856
860
  if (exclude.length) {
@@ -1138,7 +1142,6 @@ var SqliteStore = class {
1138
1142
  };
1139
1143
  // Annotate the CommonJS export names for ESM import in node:
1140
1144
  0 && (module.exports = {
1141
- SqliteStore,
1142
- streamPatternToGlob
1145
+ SqliteStore
1143
1146
  });
1144
1147
  //# sourceMappingURL=index.cjs.map