@bandeira-tech/b3nd-save 0.8.1 → 0.13.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.
Files changed (161) hide show
  1. package/esm/clients/save-client.d.ts +63 -29
  2. package/esm/clients/save-client.d.ts.map +1 -1
  3. package/esm/clients/save-client.js +148 -68
  4. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/mod.d.ts +1 -1
  5. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/mod.d.ts.map +1 -0
  6. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/client-console/client.d.ts.map +1 -1
  7. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/encoding/encoding.d.ts.map +1 -1
  8. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/encrypt/mod.d.ts +1 -0
  9. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/encrypt/mod.d.ts.map +1 -0
  10. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/encrypt/mod.js +1 -0
  11. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/encrypt/utils.d.ts +6 -0
  12. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/encrypt/utils.d.ts.map +1 -0
  13. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/encrypt/utils.js +12 -0
  14. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/functional-client/functional-client.d.ts.map +1 -1
  15. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/match-pattern/match-pattern.d.ts.map +1 -1
  16. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/decorators.d.ts.map +1 -1
  17. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/network.d.ts.map +1 -1
  18. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/peer.d.ts.map +1 -1
  19. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/flood.d.ts.map +1 -1
  20. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/path-vector.d.ts +3 -1
  21. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/network/policies/path-vector.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/path-vector.js +3 -1
  23. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/tell-and-read.d.ts.map +1 -1
  24. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/types.d.ts.map +1 -1
  25. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/observe-emitter/observe-emitter.d.ts.map +1 -1
  26. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/connection.d.ts +13 -5
  27. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/rig/connection.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/connection.js +1 -1
  29. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/events.d.ts.map +1 -1
  30. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/hooks.d.ts.map +1 -1
  31. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/identity.d.ts.map +1 -1
  32. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/operation-handle.d.ts.map +1 -1
  33. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/reactions.d.ts.map +1 -1
  34. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/rig.d.ts +3 -0
  35. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/rig/rig.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/rig.js +46 -4
  37. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/types.d.ts +4 -4
  38. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/rig/types.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/types/types.d.ts +119 -80
  40. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/types/types.d.ts.map +1 -0
  41. package/esm/dispatch.d.ts +116 -3
  42. package/esm/dispatch.d.ts.map +1 -1
  43. package/esm/dispatch.js +381 -5
  44. package/esm/elasticsearch/store.d.ts +124 -25
  45. package/esm/elasticsearch/store.d.ts.map +1 -1
  46. package/esm/elasticsearch/store.js +451 -92
  47. package/esm/entity-store.d.ts +1 -1
  48. package/esm/errors.d.ts +1 -1
  49. package/esm/errors.js +1 -1
  50. package/esm/fs/mod.d.ts +26 -0
  51. package/esm/fs/mod.d.ts.map +1 -1
  52. package/esm/fs/store.d.ts +100 -23
  53. package/esm/fs/store.d.ts.map +1 -1
  54. package/esm/fs/store.js +250 -66
  55. package/esm/glob.d.ts +114 -0
  56. package/esm/glob.d.ts.map +1 -0
  57. package/esm/glob.js +352 -0
  58. package/esm/identifiers.d.ts +18 -0
  59. package/esm/identifiers.d.ts.map +1 -0
  60. package/esm/identifiers.js +19 -0
  61. package/esm/indexeddb/fields.d.ts +32 -0
  62. package/esm/indexeddb/fields.d.ts.map +1 -0
  63. package/esm/indexeddb/fields.js +51 -0
  64. package/esm/indexeddb/store.d.ts +72 -17
  65. package/esm/indexeddb/store.d.ts.map +1 -1
  66. package/esm/indexeddb/store.js +362 -106
  67. package/esm/ipfs/mod.d.ts +19 -0
  68. package/esm/ipfs/mod.d.ts.map +1 -1
  69. package/esm/ipfs/mod.js +19 -0
  70. package/esm/ipfs/store.d.ts +82 -21
  71. package/esm/ipfs/store.d.ts.map +1 -1
  72. package/esm/ipfs/store.js +269 -68
  73. package/esm/json-fields.d.ts +61 -0
  74. package/esm/json-fields.d.ts.map +1 -0
  75. package/esm/json-fields.js +121 -0
  76. package/esm/localstorage/store.d.ts +89 -21
  77. package/esm/localstorage/store.d.ts.map +1 -1
  78. package/esm/localstorage/store.js +247 -54
  79. package/esm/memory/store.d.ts +35 -4
  80. package/esm/memory/store.d.ts.map +1 -1
  81. package/esm/memory/store.js +69 -47
  82. package/esm/mod.d.ts +2 -0
  83. package/esm/mod.d.ts.map +1 -1
  84. package/esm/mod.js +1 -0
  85. package/esm/mongo/fields.d.ts +53 -0
  86. package/esm/mongo/fields.d.ts.map +1 -0
  87. package/esm/mongo/fields.js +71 -0
  88. package/esm/mongo/mod.d.ts +19 -4
  89. package/esm/mongo/mod.d.ts.map +1 -1
  90. package/esm/mongo/mod.js +4 -2
  91. package/esm/mongo/store.d.ts +114 -25
  92. package/esm/mongo/store.d.ts.map +1 -1
  93. package/esm/mongo/store.js +355 -102
  94. package/esm/postgres/store.d.ts +50 -1
  95. package/esm/postgres/store.d.ts.map +1 -1
  96. package/esm/postgres/store.js +133 -13
  97. package/esm/read.d.ts +54 -7
  98. package/esm/read.d.ts.map +1 -1
  99. package/esm/read.js +141 -16
  100. package/esm/s3/store.d.ts +125 -23
  101. package/esm/s3/store.d.ts.map +1 -1
  102. package/esm/s3/store.js +313 -57
  103. package/esm/sqlite/columns.d.ts +33 -0
  104. package/esm/sqlite/columns.d.ts.map +1 -0
  105. package/esm/sqlite/columns.js +51 -0
  106. package/esm/sqlite/store.d.ts +73 -25
  107. package/esm/sqlite/store.d.ts.map +1 -1
  108. package/esm/sqlite/store.js +411 -107
  109. package/esm/types.d.ts +1 -1
  110. package/esm/url.d.ts +122 -19
  111. package/esm/url.d.ts.map +1 -1
  112. package/esm/url.js +218 -24
  113. package/esm/walk-via-ls.d.ts +122 -0
  114. package/esm/walk-via-ls.d.ts.map +1 -0
  115. package/esm/walk-via-ls.js +178 -0
  116. package/package.json +1 -1
  117. package/esm/byte-entity-shim.d.ts +0 -47
  118. package/esm/byte-entity-shim.d.ts.map +0 -1
  119. package/esm/byte-entity-shim.js +0 -138
  120. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.d.ts.map +0 -1
  121. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encrypt/mod.d.ts.map +0 -1
  122. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/path-vector.d.ts.map +0 -1
  123. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/connection.d.ts.map +0 -1
  124. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/rig.d.ts.map +0 -1
  125. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/types.d.ts.map +0 -1
  126. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.d.ts.map +0 -1
  127. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/mod.js +0 -0
  128. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/client-console/client.d.ts +0 -0
  129. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/client-console/client.js +0 -0
  130. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/encoding/encoding.d.ts +0 -0
  131. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/encoding/encoding.js +0 -0
  132. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/functional-client/functional-client.d.ts +0 -0
  133. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/functional-client/functional-client.js +0 -0
  134. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/match-pattern/match-pattern.d.ts +0 -0
  135. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/match-pattern/match-pattern.js +0 -0
  136. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/decorators.d.ts +0 -0
  137. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/decorators.js +0 -0
  138. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/network.d.ts +0 -0
  139. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/network.js +0 -0
  140. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/peer.d.ts +0 -0
  141. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/peer.js +0 -0
  142. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/flood.d.ts +0 -0
  143. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/flood.js +0 -0
  144. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/tell-and-read.d.ts +0 -0
  145. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/policies/tell-and-read.js +0 -0
  146. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/types.d.ts +0 -0
  147. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/network/types.js +0 -0
  148. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/observe-emitter/observe-emitter.d.ts +0 -0
  149. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/observe-emitter/observe-emitter.js +0 -0
  150. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/events.d.ts +0 -0
  151. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/events.js +0 -0
  152. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/hooks.d.ts +0 -0
  153. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/hooks.js +0 -0
  154. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/identity.d.ts +0 -0
  155. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/identity.js +0 -0
  156. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/operation-handle.d.ts +0 -0
  157. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/operation-handle.js +0 -0
  158. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/reactions.d.ts +0 -0
  159. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/reactions.js +0 -0
  160. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/rig/types.js +0 -0
  161. /package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/{0.22.0 → 0.25.0}/src/types/types.js +0 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * TYPE_TAGS → SQLite column type mapping for native entity tables.
3
+ *
4
+ * SQLite uses type affinity rather than strict types — a single field
5
+ * picks the first recognized canonical tag in declaration order and
6
+ * resolves to an affinity that matches Postgres's storage semantics
7
+ * as closely as the medium allows.
8
+ */
9
+ import { type EntityField } from "../entity.js";
10
+ export interface ColumnPlan {
11
+ /** Field/column name. */
12
+ name: string;
13
+ /** SQLite SQL type (affinity). */
14
+ sqlType: string;
15
+ /** The recognized canonical tag — drives adapt-for-write/read. */
16
+ tag: string;
17
+ }
18
+ export interface ColumnPlanResult {
19
+ columns: ColumnPlan[];
20
+ unsupported: {
21
+ name: string;
22
+ reason: string;
23
+ }[];
24
+ }
25
+ /**
26
+ * Resolve a schema's fields into SQLite column plans.
27
+ *
28
+ * Skips fields whose tags are all outside `TYPE_TAGS`; reports them
29
+ * via `unsupported`. Rejects invalid field names up front so we never
30
+ * emit unsafe SQL identifiers.
31
+ */
32
+ export declare function planColumns(fields: EntityField[]): ColumnPlanResult;
33
+ //# sourceMappingURL=columns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../src/sqlite/columns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAa,MAAM,cAAc,CAAC;AAc3D,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAgB,CA0BnE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * TYPE_TAGS → SQLite column type mapping for native entity tables.
3
+ *
4
+ * SQLite uses type affinity rather than strict types — a single field
5
+ * picks the first recognized canonical tag in declaration order and
6
+ * resolves to an affinity that matches Postgres's storage semantics
7
+ * as closely as the medium allows.
8
+ */
9
+ import { TYPE_TAGS } from "../entity.js";
10
+ const SQL_TYPE = {
11
+ [TYPE_TAGS.STRING]: "TEXT",
12
+ [TYPE_TAGS.NUMBER]: "REAL",
13
+ [TYPE_TAGS.BIGINT]: "INTEGER",
14
+ [TYPE_TAGS.BOOLEAN]: "INTEGER",
15
+ [TYPE_TAGS.BYTES]: "BLOB",
16
+ [TYPE_TAGS.TIMESTAMP]: "TEXT",
17
+ [TYPE_TAGS.JSON]: "TEXT",
18
+ };
19
+ const FIELD_NAME = /^[a-zA-Z][a-zA-Z0-9_]*$/;
20
+ /**
21
+ * Resolve a schema's fields into SQLite column plans.
22
+ *
23
+ * Skips fields whose tags are all outside `TYPE_TAGS`; reports them
24
+ * via `unsupported`. Rejects invalid field names up front so we never
25
+ * emit unsafe SQL identifiers.
26
+ */
27
+ export function planColumns(fields) {
28
+ const columns = [];
29
+ const unsupported = [];
30
+ for (const field of fields) {
31
+ if (!FIELD_NAME.test(field.name)) {
32
+ unsupported.push({
33
+ name: field.name,
34
+ reason: `field name must match ${FIELD_NAME.source}; got '${field.name}'`,
35
+ });
36
+ continue;
37
+ }
38
+ const tag = field.type.find((t) => SQL_TYPE[t] !== undefined);
39
+ if (!tag) {
40
+ unsupported.push({
41
+ name: field.name,
42
+ reason: field.type.length === 0
43
+ ? "field declares no type tags"
44
+ : `no recognised tag in [${field.type.join(", ")}]`,
45
+ });
46
+ continue;
47
+ }
48
+ columns.push({ name: field.name, sqlType: SQL_TYPE[tag], tag });
49
+ }
50
+ return { columns, unsupported };
51
+ }
@@ -1,42 +1,90 @@
1
1
  /**
2
- * SqliteStore — SQLite implementation of Store.
2
+ * SqliteStore — SQLite implementation of `EntityStore`.
3
3
  *
4
- * Pure mechanical byte storage with no protocol awareness. Pushes
5
- * fn=ls/fn=count down to SQL using the shallow-direct-leaves
6
- * predicate: `uri LIKE ? || '%' AND uri NOT LIKE ? || '%/%'`.
4
+ * One layout for every schema: `{prefix}_{entity}_data` with `uri TEXT
5
+ * PRIMARY KEY` and one column per supported field, typed by the
6
+ * canonical `TYPE_TAGS` it carries (see `./columns.ts`). `BYTES_ENTITY`
7
+ * is just an entity with one `payload BLOB` column — no legacy
8
+ * special case.
7
9
  *
8
- * Uses an injected synchronous SqliteExecutor; results are wrapped in
9
- * Promise.resolve() to satisfy the async Store interface. `payload`
10
- * is a BLOB; the store does not inspect or transform its contents.
10
+ * ## Lifecycle
11
+ *
12
+ * `entitySupport(schema)` is pure it runs `planColumns` and returns
13
+ * a `SqliteEntityMeta` with the target table name, column plans,
14
+ * bytes-column set, and the support report. No IO.
15
+ *
16
+ * `provisionEntity(meta)` runs `CREATE TABLE IF NOT EXISTS` and then
17
+ * verifies the live shape matches the meta (catches same-name-
18
+ * different-shape collisions). `entityStatus(meta)` performs the same
19
+ * check in isolation via `PRAGMA table_info`.
20
+ *
21
+ * Writes/reads/deletes consume the meta directly: no per-call cache
22
+ * gate. Operations against a not-yet-provisioned meta surface
23
+ * SQLite's natural failure per entry.
24
+ *
25
+ * `fn=ls` / `fn=count` push down to SQL — the shallow-direct-leaves
26
+ * predicate (`uri LIKE prefix || '%' AND uri NOT LIKE prefix || '%/%'`)
27
+ * is enforced in the WHERE clause against the entity's table.
28
+ *
29
+ * `fn=find` (v2 spec §3.5; foundation PR #82) reuses the same `_ls`
30
+ * SQL composition with a single branch: under `fn=find` the shallow
31
+ * safety predicate (`AND uri NOT LIKE prefix || '%/%'`) is DROPPED so
32
+ * the LIKE prefix walk crosses `/` and matches the whole subtree.
33
+ * The prefix bind is still a two-arg `[prefix, globToSqlLike(pattern)]`
34
+ * pair — never concatenated into the pattern body, so room/segment
35
+ * names containing literal `%`/`_` cannot break out of the parameter
36
+ * (LIKE-injection safety via `ESCAPE '\'`). `pushDownFind: true` is
37
+ * advertised so dispatch trusts the backend's deep walk.
38
+ *
39
+ * Writes are wrapped in a transaction (`capabilities.atomicBatch =
40
+ * true`). Stream-shaped values on `BLOB` columns are collected to
41
+ * `Uint8Array` *before* the transaction opens.
11
42
  */
12
- import type { DeleteResult, Output, StatusResult } from "../deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.js";
13
- import { type BytesOnlyEntityMeta } from "../byte-entity-shim.js";
43
+ import type { DeleteResult, Output, StatusResult } from "../deps/jsr.io/@bandeira-tech/b3nd-core/0.25.0/src/types/types.js";
14
44
  import type { EntityStore } from "../entity-store.js";
15
- import type { EntityRecord, EntitySchema } from "../entity.js";
45
+ import { type EntityMeta, type EntityRecord, type EntitySchema } from "../entity.js";
16
46
  import type { StoreCapabilities, StoreWriteResult } from "../types.js";
47
+ import { type ColumnPlan } from "./columns.js";
17
48
  import type { SqliteExecutor } from "./mod.js";
18
- export declare class SqliteStore implements EntityStore<BytesOnlyEntityMeta> {
19
- private readonly tableName;
49
+ /**
50
+ * SqliteStore-specific entity handle.
51
+ *
52
+ * `tableName` is the prefixed-and-suffixed target table; `columns`
53
+ * are the planned user columns (without the always-present `uri`,
54
+ * `created_at`, `updated_at`); `declared` is the set of user column
55
+ * names for the per-write extras check; `bytesColumns` drives stream
56
+ * normalisation; `jsonColumns`/`tsColumns`/`booleanColumns` drive
57
+ * the per-tag adapt-for-write/read coercions.
58
+ */
59
+ export interface SqliteEntityMeta extends EntityMeta {
60
+ readonly tableName: string;
61
+ readonly columns: readonly ColumnPlan[];
62
+ readonly declared: ReadonlySet<string>;
63
+ readonly bytesColumns: ReadonlySet<string>;
64
+ }
65
+ export declare class SqliteStore implements EntityStore<SqliteEntityMeta> {
66
+ private readonly tablePrefix;
20
67
  private readonly executor;
21
- private readonly provisioned;
22
68
  constructor(tablePrefix: string, executor: SqliteExecutor);
23
- entitySupport(schema: EntitySchema): BytesOnlyEntityMeta;
24
- entityStatus(meta: BytesOnlyEntityMeta): Promise<"live" | "unprovisioned">;
25
- provisionEntity(meta: BytesOnlyEntityMeta): Promise<void>;
26
- write(meta: BytesOnlyEntityMeta, entries: {
69
+ entitySupport(schema: EntitySchema): SqliteEntityMeta;
70
+ entityStatus(meta: SqliteEntityMeta): Promise<"live" | "unprovisioned">;
71
+ provisionEntity(meta: SqliteEntityMeta): Promise<void>;
72
+ write(meta: SqliteEntityMeta, entries: {
27
73
  uri: string;
28
74
  record: EntityRecord;
29
75
  }[]): Promise<StoreWriteResult[]>;
30
- read<T = EntityRecord | undefined>(meta: BytesOnlyEntityMeta, urls: string[]): Promise<Output<T>[]>;
31
- delete(meta: BytesOnlyEntityMeta, uris: string[]): Promise<DeleteResult[]>;
32
- private _writeBytes;
33
- private _readBytes;
76
+ read<T = EntityRecord | undefined>(meta: SqliteEntityMeta, urls: string[]): Promise<Output<T>[]>;
77
+ delete(meta: SqliteEntityMeta, uris: string[]): Promise<DeleteResult[]>;
78
+ status(): Promise<StatusResult>;
79
+ capabilities(): StoreCapabilities;
34
80
  private _readOne;
35
81
  private _ls;
36
82
  private _count;
37
- private _deleteBytes;
38
- status(): Promise<StatusResult>;
39
- private schemaUris;
40
- capabilities(): StoreCapabilities;
83
+ /**
84
+ * Enumerate every `{tablePrefix}_*_data` table currently in the
85
+ * database. Used by `status()` to advertise the entities a peer can
86
+ * talk to without per-entity bookkeeping.
87
+ */
88
+ private _listProvisionedEntities;
41
89
  }
42
90
  //# sourceMappingURL=store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sqlite/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,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