@bandeira-tech/b3nd-save 0.8.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 (177) hide show
  1. package/LICENSE +21 -0
  2. package/esm/_dnt.shims.d.ts +2 -0
  3. package/esm/_dnt.shims.d.ts.map +1 -0
  4. package/esm/_dnt.shims.js +57 -0
  5. package/esm/byte-entity-shim.d.ts +47 -0
  6. package/esm/byte-entity-shim.d.ts.map +1 -0
  7. package/esm/byte-entity-shim.js +138 -0
  8. package/esm/clients/mod.d.ts +15 -0
  9. package/esm/clients/mod.d.ts.map +1 -0
  10. package/esm/clients/mod.js +14 -0
  11. package/esm/clients/save-client.d.ts +87 -0
  12. package/esm/clients/save-client.d.ts.map +1 -0
  13. package/esm/clients/save-client.js +174 -0
  14. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.d.ts +40 -0
  15. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.js +31 -0
  17. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/client-console/client.d.ts +30 -0
  18. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/client-console/client.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/client-console/client.js +70 -0
  20. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encoding/encoding.d.ts +16 -0
  21. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encoding/encoding.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encoding/encoding.js +50 -0
  23. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encrypt/mod.d.ts +235 -0
  24. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encrypt/mod.d.ts.map +1 -0
  25. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/encrypt/mod.js +619 -0
  26. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/functional-client/functional-client.d.ts +43 -0
  27. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/functional-client/functional-client.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/functional-client/functional-client.js +54 -0
  29. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/match-pattern/match-pattern.d.ts +47 -0
  30. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/match-pattern/match-pattern.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/match-pattern/match-pattern.js +134 -0
  32. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/decorators.d.ts +20 -0
  33. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/decorators.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/decorators.js +34 -0
  35. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/network.d.ts +46 -0
  36. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/network.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/network.js +131 -0
  38. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/peer.d.ts +27 -0
  39. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/peer.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/peer.js +25 -0
  41. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/flood.d.ts +59 -0
  42. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/flood.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/flood.js +188 -0
  44. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/path-vector.d.ts +35 -0
  45. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/path-vector.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/path-vector.js +57 -0
  47. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/tell-and-read.d.ts +117 -0
  48. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/tell-and-read.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/policies/tell-and-read.js +125 -0
  50. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/types.d.ts +112 -0
  51. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/types.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/network/types.js +21 -0
  53. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/observe-emitter/observe-emitter.d.ts +35 -0
  54. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/observe-emitter/observe-emitter.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/observe-emitter/observe-emitter.js +106 -0
  56. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/connection.d.ts +88 -0
  57. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/connection.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/connection.js +86 -0
  59. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/events.d.ts +83 -0
  60. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/events.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/events.js +115 -0
  62. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/hooks.d.ts +164 -0
  63. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/hooks.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/hooks.js +67 -0
  65. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/identity.d.ts +99 -0
  66. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/identity.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/identity.js +190 -0
  68. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/operation-handle.d.ts +185 -0
  69. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/operation-handle.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/operation-handle.js +103 -0
  71. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/reactions.d.ts +58 -0
  72. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/reactions.d.ts.map +1 -0
  73. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/reactions.js +64 -0
  74. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/rig.d.ts +295 -0
  75. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/rig.d.ts.map +1 -0
  76. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/rig.js +898 -0
  77. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/types.d.ts +167 -0
  78. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/types.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/rig/types.js +5 -0
  80. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.d.ts +278 -0
  81. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.d.ts.map +1 -0
  82. package/esm/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.js +89 -0
  83. package/esm/dispatch.d.ts +35 -0
  84. package/esm/dispatch.d.ts.map +1 -0
  85. package/esm/dispatch.js +40 -0
  86. package/esm/elasticsearch/mod.d.ts +31 -0
  87. package/esm/elasticsearch/mod.d.ts.map +1 -0
  88. package/esm/elasticsearch/mod.js +8 -0
  89. package/esm/elasticsearch/store.d.ts +44 -0
  90. package/esm/elasticsearch/store.d.ts.map +1 -0
  91. package/esm/elasticsearch/store.js +213 -0
  92. package/esm/entity-store.d.ts +106 -0
  93. package/esm/entity-store.d.ts.map +1 -0
  94. package/esm/entity-store.js +46 -0
  95. package/esm/entity.d.ts +125 -0
  96. package/esm/entity.d.ts.map +1 -0
  97. package/esm/entity.js +66 -0
  98. package/esm/errors.d.ts +23 -0
  99. package/esm/errors.d.ts.map +1 -0
  100. package/esm/errors.js +25 -0
  101. package/esm/fs/mod.d.ts +28 -0
  102. package/esm/fs/mod.d.ts.map +1 -0
  103. package/esm/fs/mod.js +13 -0
  104. package/esm/fs/store.d.ts +45 -0
  105. package/esm/fs/store.d.ts.map +1 -0
  106. package/esm/fs/store.js +194 -0
  107. package/esm/indexeddb/mod.d.ts +9 -0
  108. package/esm/indexeddb/mod.d.ts.map +1 -0
  109. package/esm/indexeddb/mod.js +8 -0
  110. package/esm/indexeddb/store.d.ts +47 -0
  111. package/esm/indexeddb/store.d.ts.map +1 -0
  112. package/esm/indexeddb/store.js +299 -0
  113. package/esm/ipfs/mod.d.ts +24 -0
  114. package/esm/ipfs/mod.d.ts.map +1 -0
  115. package/esm/ipfs/mod.js +13 -0
  116. package/esm/ipfs/store.d.ts +42 -0
  117. package/esm/ipfs/store.d.ts.map +1 -0
  118. package/esm/ipfs/store.js +197 -0
  119. package/esm/localstorage/mod.d.ts +9 -0
  120. package/esm/localstorage/mod.d.ts.map +1 -0
  121. package/esm/localstorage/mod.js +8 -0
  122. package/esm/localstorage/store.d.ts +45 -0
  123. package/esm/localstorage/store.d.ts.map +1 -0
  124. package/esm/localstorage/store.js +147 -0
  125. package/esm/memory/mod.d.ts +12 -0
  126. package/esm/memory/mod.d.ts.map +1 -0
  127. package/esm/memory/mod.js +11 -0
  128. package/esm/memory/store.d.ts +73 -0
  129. package/esm/memory/store.d.ts.map +1 -0
  130. package/esm/memory/store.js +300 -0
  131. package/esm/mod.d.ts +36 -0
  132. package/esm/mod.d.ts.map +1 -0
  133. package/esm/mod.js +31 -0
  134. package/esm/mongo/mod.d.ts +35 -0
  135. package/esm/mongo/mod.d.ts.map +1 -0
  136. package/esm/mongo/mod.js +8 -0
  137. package/esm/mongo/store.d.ts +42 -0
  138. package/esm/mongo/store.d.ts.map +1 -0
  139. package/esm/mongo/store.js +185 -0
  140. package/esm/package.json +3 -0
  141. package/esm/payload.d.ts +24 -0
  142. package/esm/payload.d.ts.map +1 -0
  143. package/esm/payload.js +30 -0
  144. package/esm/postgres/columns.d.ts +33 -0
  145. package/esm/postgres/columns.d.ts.map +1 -0
  146. package/esm/postgres/columns.js +51 -0
  147. package/esm/postgres/mod.d.ts +19 -0
  148. package/esm/postgres/mod.d.ts.map +1 -0
  149. package/esm/postgres/mod.js +9 -0
  150. package/esm/postgres/store.d.ts +75 -0
  151. package/esm/postgres/store.d.ts.map +1 -0
  152. package/esm/postgres/store.js +364 -0
  153. package/esm/read.d.ts +40 -0
  154. package/esm/read.d.ts.map +1 -0
  155. package/esm/read.js +67 -0
  156. package/esm/s3/mod.d.ts +23 -0
  157. package/esm/s3/mod.d.ts.map +1 -0
  158. package/esm/s3/mod.js +13 -0
  159. package/esm/s3/store.d.ts +46 -0
  160. package/esm/s3/store.d.ts.map +1 -0
  161. package/esm/s3/store.js +183 -0
  162. package/esm/sqlite/mod.d.ts +18 -0
  163. package/esm/sqlite/mod.d.ts.map +1 -0
  164. package/esm/sqlite/mod.js +8 -0
  165. package/esm/sqlite/schema.d.ts +10 -0
  166. package/esm/sqlite/schema.d.ts.map +1 -0
  167. package/esm/sqlite/schema.js +26 -0
  168. package/esm/sqlite/store.d.ts +42 -0
  169. package/esm/sqlite/store.d.ts.map +1 -0
  170. package/esm/sqlite/store.js +184 -0
  171. package/esm/types.d.ts +101 -0
  172. package/esm/types.d.ts.map +1 -0
  173. package/esm/types.js +21 -0
  174. package/esm/url.d.ts +108 -0
  175. package/esm/url.d.ts.map +1 -0
  176. package/esm/url.js +151 -0
  177. package/package.json +93 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 B3nd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export declare const dntGlobalThis: Omit<typeof globalThis, never>;
2
+ //# sourceMappingURL=_dnt.shims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
@@ -0,0 +1,57 @@
1
+ const dntGlobals = {};
2
+ export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
3
+ function createMergeProxy(baseObj, extObj) {
4
+ return new Proxy(baseObj, {
5
+ get(_target, prop, _receiver) {
6
+ if (prop in extObj) {
7
+ return extObj[prop];
8
+ }
9
+ else {
10
+ return baseObj[prop];
11
+ }
12
+ },
13
+ set(_target, prop, value) {
14
+ if (prop in extObj) {
15
+ delete extObj[prop];
16
+ }
17
+ baseObj[prop] = value;
18
+ return true;
19
+ },
20
+ deleteProperty(_target, prop) {
21
+ let success = false;
22
+ if (prop in extObj) {
23
+ delete extObj[prop];
24
+ success = true;
25
+ }
26
+ if (prop in baseObj) {
27
+ delete baseObj[prop];
28
+ success = true;
29
+ }
30
+ return success;
31
+ },
32
+ ownKeys(_target) {
33
+ const baseKeys = Reflect.ownKeys(baseObj);
34
+ const extKeys = Reflect.ownKeys(extObj);
35
+ const extKeysSet = new Set(extKeys);
36
+ return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
37
+ },
38
+ defineProperty(_target, prop, desc) {
39
+ if (prop in extObj) {
40
+ delete extObj[prop];
41
+ }
42
+ Reflect.defineProperty(baseObj, prop, desc);
43
+ return true;
44
+ },
45
+ getOwnPropertyDescriptor(_target, prop) {
46
+ if (prop in extObj) {
47
+ return Reflect.getOwnPropertyDescriptor(extObj, prop);
48
+ }
49
+ else {
50
+ return Reflect.getOwnPropertyDescriptor(baseObj, prop);
51
+ }
52
+ },
53
+ has(_target, prop) {
54
+ return prop in extObj || prop in baseObj;
55
+ },
56
+ });
57
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Byte-only EntityStore shim — shared transition helper.
3
+ *
4
+ * Wraps a backend's byte-shaped private operations (`_writeBytes`,
5
+ * `_readBytes`, `_deleteBytes`) behind the `EntityStore` interface
6
+ * while only `BYTES_ENTITY` is supported. The meta returned by
7
+ * {@link bytesOnlyEntitySupport} carries the source schema so the
8
+ * shim can detect any non-BYTES schema at op time and surface a
9
+ * per-entry failure (or reject on `read`, which has no per-entry
10
+ * error channel).
11
+ *
12
+ * Future per-backend PRs add native layouts for custom schemas; this
13
+ * file goes away (or shrinks) once every backend can route any
14
+ * schema natively.
15
+ */
16
+ import type { DeleteResult, Output } from "./deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.js";
17
+ import { type EntityMeta, type EntityRecord, type EntitySchema } from "./entity.js";
18
+ import type { StoreEntry, StoreWriteResult } from "./types.js";
19
+ export declare function isBytesEntity(schema: EntitySchema): boolean;
20
+ /** EntityMeta produced by bytes-only backends. */
21
+ export interface BytesOnlyEntityMeta extends EntityMeta {
22
+ readonly schema: EntitySchema;
23
+ readonly isBytes: boolean;
24
+ }
25
+ /** Compile a schema into the bytes-only meta. Pure. */
26
+ export declare function bytesOnlyEntitySupport(schema: EntitySchema): BytesOnlyEntityMeta;
27
+ /**
28
+ * Route a schema-aware write through the backend's byte path when
29
+ * `meta` is for BYTES_ENTITY; otherwise return per-entry failures.
30
+ */
31
+ export declare function bytesOnlyWrite(meta: BytesOnlyEntityMeta, storeName: string, entries: {
32
+ uri: string;
33
+ record: EntityRecord;
34
+ }[], writeBytes: (entries: StoreEntry[]) => Promise<StoreWriteResult[]>): Promise<StoreWriteResult[]>;
35
+ /**
36
+ * Route a schema-aware read through the backend's byte path when
37
+ * `meta` is for BYTES_ENTITY; otherwise reject. Read results are
38
+ * re-wrapped as `{ payload: bytes }` records to match the `EntityStore`
39
+ * read contract.
40
+ */
41
+ export declare function bytesOnlyRead<T = EntityRecord | undefined>(meta: BytesOnlyEntityMeta, storeName: string, urls: string[], readBytes: (urls: string[]) => Promise<Output<unknown>[]>): Promise<Output<T>[]>;
42
+ /**
43
+ * Route a schema-aware delete through the backend's byte path when
44
+ * `meta` is for BYTES_ENTITY; otherwise return per-entry failures.
45
+ */
46
+ export declare function bytesOnlyDelete(meta: BytesOnlyEntityMeta, storeName: string, uris: string[], deleteBytes: (uris: string[]) => Promise<DeleteResult[]>): Promise<DeleteResult[]>;
47
+ //# sourceMappingURL=byte-entity-shim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"byte-entity-shim.d.ts","sourceRoot":"","sources":["../src/byte-entity-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAE7G,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE7E,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE3D;AAED,kDAAkD;AAClD,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAiBD,uDAAuD;AACvD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,GACnB,mBAAmB,CAMrB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,EAAE,EAChD,UAAU,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,GACjE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAiD7B;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,CAAC,GAAG,YAAY,GAAG,SAAS,EAC9D,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,GACxD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAQtB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC,GACvD,OAAO,CAAC,YAAY,EAAE,CAAC,CAczB"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Byte-only EntityStore shim — shared transition helper.
3
+ *
4
+ * Wraps a backend's byte-shaped private operations (`_writeBytes`,
5
+ * `_readBytes`, `_deleteBytes`) behind the `EntityStore` interface
6
+ * while only `BYTES_ENTITY` is supported. The meta returned by
7
+ * {@link bytesOnlyEntitySupport} carries the source schema so the
8
+ * shim can detect any non-BYTES schema at op time and surface a
9
+ * per-entry failure (or reject on `read`, which has no per-entry
10
+ * error channel).
11
+ *
12
+ * Future per-backend PRs add native layouts for custom schemas; this
13
+ * file goes away (or shrinks) once every backend can route any
14
+ * schema natively.
15
+ */
16
+ import { storageFailure } from "./errors.js";
17
+ import { BYTES_ENTITY, } from "./entity.js";
18
+ export function isBytesEntity(schema) {
19
+ return schema.name === BYTES_ENTITY.name;
20
+ }
21
+ /** EntitySupport for a backend that currently only honors BYTES_ENTITY. */
22
+ function bytesOnlySupport(schema) {
23
+ if (isBytesEntity(schema)) {
24
+ return { entity: schema.name, supported: ["payload"], unsupported: [] };
25
+ }
26
+ return {
27
+ entity: schema.name,
28
+ supported: [],
29
+ unsupported: schema.fields.map((f) => ({
30
+ name: f.name,
31
+ reason: "backend currently routes BYTES_ENTITY only",
32
+ })),
33
+ };
34
+ }
35
+ /** Compile a schema into the bytes-only meta. Pure. */
36
+ export function bytesOnlyEntitySupport(schema) {
37
+ return {
38
+ support: bytesOnlySupport(schema),
39
+ schema,
40
+ isBytes: isBytesEntity(schema),
41
+ };
42
+ }
43
+ /**
44
+ * Route a schema-aware write through the backend's byte path when
45
+ * `meta` is for BYTES_ENTITY; otherwise return per-entry failures.
46
+ */
47
+ export async function bytesOnlyWrite(meta, storeName, entries, writeBytes) {
48
+ if (!meta.isBytes) {
49
+ return entries.map((e) => ({
50
+ success: false,
51
+ ...storageFailure(new Error(`${storeName}: schema '${meta.schema.name}' not supported (BYTES_ENTITY only)`), "Unsupported schema", e.uri),
52
+ }));
53
+ }
54
+ const byteEntries = [];
55
+ const failures = [];
56
+ for (let i = 0; i < entries.length; i++) {
57
+ const { uri, record } = entries[i];
58
+ const payload = record.payload;
59
+ if (!(payload instanceof Uint8Array) && !(payload instanceof ReadableStream)) {
60
+ failures.push({
61
+ index: i,
62
+ result: {
63
+ success: false,
64
+ ...storageFailure(new Error(`${storeName}: BYTES_ENTITY record.payload must be Uint8Array or ReadableStream`), "Invalid record", uri),
65
+ },
66
+ });
67
+ continue;
68
+ }
69
+ byteEntries.push({ uri, payload: payload });
70
+ }
71
+ if (failures.length === entries.length)
72
+ return failures.map((f) => f.result);
73
+ const okResults = await writeBytes(byteEntries);
74
+ // Re-interleave failures with the successful write results in input order.
75
+ const out = new Array(entries.length);
76
+ let ok = 0;
77
+ let fail = 0;
78
+ for (let i = 0; i < entries.length; i++) {
79
+ if (failures[fail]?.index === i)
80
+ out[i] = failures[fail++].result;
81
+ else
82
+ out[i] = okResults[ok++];
83
+ }
84
+ return out;
85
+ }
86
+ /**
87
+ * Route a schema-aware read through the backend's byte path when
88
+ * `meta` is for BYTES_ENTITY; otherwise reject. Read results are
89
+ * re-wrapped as `{ payload: bytes }` records to match the `EntityStore`
90
+ * read contract.
91
+ */
92
+ export async function bytesOnlyRead(meta, storeName, urls, readBytes) {
93
+ if (!meta.isBytes) {
94
+ throw new Error(`${storeName}: schema '${meta.schema.name}' not supported (BYTES_ENTITY only)`);
95
+ }
96
+ const rows = await readBytes(urls);
97
+ return rows.map(([uri, value]) => [uri, wrapAsRecord(value)]);
98
+ }
99
+ /**
100
+ * Route a schema-aware delete through the backend's byte path when
101
+ * `meta` is for BYTES_ENTITY; otherwise return per-entry failures.
102
+ */
103
+ export function bytesOnlyDelete(meta, storeName, uris, deleteBytes) {
104
+ if (!meta.isBytes) {
105
+ return Promise.resolve(uris.map((uri) => ({
106
+ success: false,
107
+ ...storageFailure(new Error(`${storeName}: schema '${meta.schema.name}' not supported (BYTES_ENTITY only)`), "Unsupported schema", uri),
108
+ })));
109
+ }
110
+ return deleteBytes(uris);
111
+ }
112
+ /**
113
+ * Wrap a byte read result back into a record-shaped payload.
114
+ *
115
+ * - Point read miss (`undefined`) → `undefined`.
116
+ * - Point read bytes → `{ payload: bytes }`.
117
+ * - `fn=ls&format=full` children (`Output<bytes>[]`) → each child's
118
+ * bytes payload wrapped the same way.
119
+ * - `fn=ls&format=uris` (`string[]`) and `fn=count` (`number`) pass
120
+ * through unchanged.
121
+ */
122
+ function wrapAsRecord(value) {
123
+ if (value === undefined || value === null)
124
+ return value;
125
+ if (value instanceof Uint8Array || value instanceof ReadableStream) {
126
+ return { payload: value };
127
+ }
128
+ if (Array.isArray(value)) {
129
+ return value.map((row) => {
130
+ if (Array.isArray(row) && row.length === 2) {
131
+ const [u, v] = row;
132
+ return [u, wrapAsRecord(v)];
133
+ }
134
+ return row;
135
+ });
136
+ }
137
+ return value;
138
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Store → `ProtocolInterfaceNode` adapter.
3
+ *
4
+ * `SaveClient` is the single client this package exposes. It takes a
5
+ * `SaveMapper` (wire payload → `EntityRecord`), the target
6
+ * `EntitySchema`, and the backing store — read as "receive payloads
7
+ * X, map as Y, store on S". All three are explicit; the client does
8
+ * not invent defaults.
9
+ *
10
+ * Built-in mappers `mapToBytes` and `passThroughRecord` cover the
11
+ * common cases (opaque bytes via `BYTES_ENTITY`, already-shaped
12
+ * records via a custom schema).
13
+ */
14
+ export { mapToBytes, passThroughRecord, SaveClient, type SaveMapper, } from "./save-client.js";
15
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/clients/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Store → `ProtocolInterfaceNode` adapter.
3
+ *
4
+ * `SaveClient` is the single client this package exposes. It takes a
5
+ * `SaveMapper` (wire payload → `EntityRecord`), the target
6
+ * `EntitySchema`, and the backing store — read as "receive payloads
7
+ * X, map as Y, store on S". All three are explicit; the client does
8
+ * not invent defaults.
9
+ *
10
+ * Built-in mappers `mapToBytes` and `passThroughRecord` cover the
11
+ * common cases (opaque bytes via `BYTES_ENTITY`, already-shaped
12
+ * records via a custom schema).
13
+ */
14
+ export { mapToBytes, passThroughRecord, SaveClient, } from "./save-client.js";
@@ -0,0 +1,87 @@
1
+ /**
2
+ * SaveClient — unified ProtocolInterfaceNode adapter over an EntityStore.
3
+ *
4
+ * Construction shape:
5
+ *
6
+ * new SaveClient(mapper, entity, store)
7
+ *
8
+ * Reads on the rig: "receive payloads X, map as Y into entity E,
9
+ * store on S". All three are explicit; the client does not invent
10
+ * defaults.
11
+ *
12
+ * - **mapper** — a {@link SaveMapper}: freeform projection from the
13
+ * wire payload `TIn` to an `EntityRecord` matching `entity`. Runs
14
+ * per write entry; throwing produces a per-entry `ReceiveResult`
15
+ * failure. {@link mapToBytes} and {@link passThroughRecord} cover
16
+ * the common cases.
17
+ * - **entity** — the {@link EntitySchema} this client routes. Use
18
+ * {@link BYTES_ENTITY} for opaque-bytes wires.
19
+ * - **store** — any {@link EntityStore}. Every backend in this
20
+ * package implements it.
21
+ *
22
+ * ## Lifecycle
23
+ *
24
+ * SaveClient is pure: it computes its `EntityMeta` once at
25
+ * construction (via `store.entitySupport(target)`, which is a pure
26
+ * function) and reuses it on every `receive`/`read`/`delete`. There
27
+ * is no lifecycle method on the client — provisioning the underlying
28
+ * store is the **caller's** job, handled out of band (app boot for
29
+ * production, test setup for tests):
30
+ *
31
+ * await store.provisionEntity(store.entitySupport(target));
32
+ * const client = new SaveClient(mapper, target, store);
33
+ *
34
+ * If the caller skips provisioning, the backend surfaces its natural
35
+ * failure on first IO (storage error for write/delete, throw or miss
36
+ * for read) — same as calling any other `EntityStore` method against
37
+ * an unprovisioned entity.
38
+ *
39
+ * Wire shape: a `receive` message is `Output<TIn | null>` —
40
+ * `[uri, payload]` where `payload === null` is the delete-by-convention.
41
+ * Reads come back as the stored records (or raw bytes when `entity`
42
+ * is `BYTES_ENTITY`); the mapper is receive-only.
43
+ *
44
+ * A `SaveClient` is a one-shot, isolated thing: each one routes one
45
+ * entity, and routing a different entity means constructing a
46
+ * different client.
47
+ */
48
+ import type { Output, ProtocolInterfaceNode, ReceiveResult, StatusResult } from "../deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/src/types/types.js";
49
+ import { ObserveEmitter } from "../deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.js";
50
+ import type { EntityStore } from "../entity-store.js";
51
+ import { type EntityMeta, type EntityRecord, type EntitySchema } from "../entity.js";
52
+ import type { StorePayload } from "../types.js";
53
+ /**
54
+ * Freeform projection from wire payload → `EntityRecord` for the
55
+ * target schema. Runs per write entry inside `SaveClient.receive`.
56
+ * Throwing produces a `ReceiveResult` failure for that entry; the
57
+ * rest of the batch is unaffected.
58
+ */
59
+ export type SaveMapper<TIn = unknown> = (uri: string, payload: TIn) => EntityRecord | Promise<EntityRecord>;
60
+ /**
61
+ * Built-in mapper that wraps a byte payload as a `BYTES_ENTITY`
62
+ * record (`{ payload: bytes }`). Use with `target: BYTES_ENTITY` when
63
+ * the wire is already opaque bytes.
64
+ */
65
+ export declare const mapToBytes: SaveMapper<StorePayload>;
66
+ /**
67
+ * Built-in mapper that passes the wire payload through as-is,
68
+ * assuming it already matches the target schema. Use when the
69
+ * protocol upstream has already produced a valid `EntityRecord`.
70
+ */
71
+ export declare const passThroughRecord: SaveMapper<EntityRecord>;
72
+ export declare class SaveClient<TIn = unknown> extends ObserveEmitter implements ProtocolInterfaceNode {
73
+ readonly mapper: SaveMapper<TIn>;
74
+ readonly target: EntitySchema;
75
+ readonly store: EntityStore;
76
+ /**
77
+ * The store-compiled meta for `target`. Derived once at construction
78
+ * via `store.entitySupport(target)` (pure). Exposed so callers can
79
+ * inspect `meta.support` to see which fields the medium accepted.
80
+ */
81
+ readonly meta: EntityMeta;
82
+ constructor(mapper: SaveMapper<TIn>, target: EntitySchema, store: EntityStore);
83
+ receive(msgs: Output<TIn | null>[]): Promise<ReceiveResult[]>;
84
+ read<T = EntityRecord | StorePayload | undefined>(urls: string[]): Promise<Output<T>[]>;
85
+ status(): Promise<StatusResult>;
86
+ }
87
+ //# sourceMappingURL=save-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-client.d.ts","sourceRoot":"","sources":["../../src/clients/save-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,qBAAqB,EACrB,aAAa,EACb,YAAY,EACb,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,GAAG,GAAG,OAAO,IAAI,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,GAAG,KACT,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC,YAAY,CAE9C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,YAAY,CAC9C,CAAC;AAiCV,qBAAa,UAAU,CAAC,GAAG,GAAG,OAAO,CAAE,SAAQ,cAC7C,YAAW,qBAAqB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;gBAGxB,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EACvB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,WAAW;IASd,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GACzB,OAAO,CAAC,aAAa,EAAE,CAAC;IA8DrB,IAAI,CAAC,CAAC,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,EACpD,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAUvB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;CAGhC"}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * SaveClient — unified ProtocolInterfaceNode adapter over an EntityStore.
3
+ *
4
+ * Construction shape:
5
+ *
6
+ * new SaveClient(mapper, entity, store)
7
+ *
8
+ * Reads on the rig: "receive payloads X, map as Y into entity E,
9
+ * store on S". All three are explicit; the client does not invent
10
+ * defaults.
11
+ *
12
+ * - **mapper** — a {@link SaveMapper}: freeform projection from the
13
+ * wire payload `TIn` to an `EntityRecord` matching `entity`. Runs
14
+ * per write entry; throwing produces a per-entry `ReceiveResult`
15
+ * failure. {@link mapToBytes} and {@link passThroughRecord} cover
16
+ * the common cases.
17
+ * - **entity** — the {@link EntitySchema} this client routes. Use
18
+ * {@link BYTES_ENTITY} for opaque-bytes wires.
19
+ * - **store** — any {@link EntityStore}. Every backend in this
20
+ * package implements it.
21
+ *
22
+ * ## Lifecycle
23
+ *
24
+ * SaveClient is pure: it computes its `EntityMeta` once at
25
+ * construction (via `store.entitySupport(target)`, which is a pure
26
+ * function) and reuses it on every `receive`/`read`/`delete`. There
27
+ * is no lifecycle method on the client — provisioning the underlying
28
+ * store is the **caller's** job, handled out of band (app boot for
29
+ * production, test setup for tests):
30
+ *
31
+ * await store.provisionEntity(store.entitySupport(target));
32
+ * const client = new SaveClient(mapper, target, store);
33
+ *
34
+ * If the caller skips provisioning, the backend surfaces its natural
35
+ * failure on first IO (storage error for write/delete, throw or miss
36
+ * for read) — same as calling any other `EntityStore` method against
37
+ * an unprovisioned entity.
38
+ *
39
+ * Wire shape: a `receive` message is `Output<TIn | null>` —
40
+ * `[uri, payload]` where `payload === null` is the delete-by-convention.
41
+ * Reads come back as the stored records (or raw bytes when `entity`
42
+ * is `BYTES_ENTITY`); the mapper is receive-only.
43
+ *
44
+ * A `SaveClient` is a one-shot, isolated thing: each one routes one
45
+ * entity, and routing a different entity means constructing a
46
+ * different client.
47
+ */
48
+ import { ObserveEmitter } from "../deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.js";
49
+ import { BYTES_ENTITY, } from "../entity.js";
50
+ /**
51
+ * Built-in mapper that wraps a byte payload as a `BYTES_ENTITY`
52
+ * record (`{ payload: bytes }`). Use with `target: BYTES_ENTITY` when
53
+ * the wire is already opaque bytes.
54
+ */
55
+ export const mapToBytes = (_uri, payload) => ({
56
+ payload,
57
+ });
58
+ /**
59
+ * Built-in mapper that passes the wire payload through as-is,
60
+ * assuming it already matches the target schema. Use when the
61
+ * protocol upstream has already produced a valid `EntityRecord`.
62
+ */
63
+ export const passThroughRecord = (_uri, payload) => payload;
64
+ /**
65
+ * Unwrap `BYTES_ENTITY` read results back to bytes-on-the-wire.
66
+ *
67
+ * The store returns:
68
+ * - `fn=read`: a single `EntityRecord` (or `undefined` for a miss).
69
+ * - `fn=ls&format=full`: `Output<EntityRecord | undefined>[]`.
70
+ * - `fn=ls&format=uris`: `string[]`.
71
+ * - `fn=count`: `number`.
72
+ *
73
+ * Record-shaped payloads carry `{ payload: bytes }`; we surface the
74
+ * inner bytes. Other shapes pass through unchanged.
75
+ */
76
+ function unwrapBytes(value) {
77
+ if (value === undefined || value === null)
78
+ return value;
79
+ if (value instanceof Uint8Array)
80
+ return value;
81
+ if (Array.isArray(value)) {
82
+ return value.map((row) => {
83
+ if (Array.isArray(row) && row.length === 2) {
84
+ const [childUri, childPayload] = row;
85
+ return [childUri, unwrapBytes(childPayload)];
86
+ }
87
+ return row;
88
+ });
89
+ }
90
+ if (typeof value === "object") {
91
+ const rec = value;
92
+ if ("payload" in rec)
93
+ return rec.payload;
94
+ }
95
+ return value;
96
+ }
97
+ export class SaveClient extends ObserveEmitter {
98
+ mapper;
99
+ target;
100
+ store;
101
+ /**
102
+ * The store-compiled meta for `target`. Derived once at construction
103
+ * via `store.entitySupport(target)` (pure). Exposed so callers can
104
+ * inspect `meta.support` to see which fields the medium accepted.
105
+ */
106
+ meta;
107
+ constructor(mapper, target, store) {
108
+ super();
109
+ this.mapper = mapper;
110
+ this.target = target;
111
+ this.store = store;
112
+ this.meta = store.entitySupport(target);
113
+ }
114
+ async receive(msgs) {
115
+ const results = new Array(msgs.length);
116
+ const writes = [];
117
+ const deletes = [];
118
+ for (let i = 0; i < msgs.length; i++) {
119
+ const [uri, payload] = msgs[i];
120
+ if (!uri || typeof uri !== "string") {
121
+ results[i] = { accepted: false, error: "URI is required" };
122
+ continue;
123
+ }
124
+ if (payload === null) {
125
+ deletes.push({ uri, index: i });
126
+ continue;
127
+ }
128
+ try {
129
+ const record = await this.mapper(uri, payload);
130
+ writes.push({ uri, record, wire: payload, index: i });
131
+ }
132
+ catch (e) {
133
+ results[i] = {
134
+ accepted: false,
135
+ error: e instanceof Error ? e.message : String(e),
136
+ };
137
+ }
138
+ }
139
+ if (writes.length > 0) {
140
+ const writeResults = await this.store.write(this.meta, writes.map(({ uri, record }) => ({ uri, record })));
141
+ for (let j = 0; j < writeResults.length; j++) {
142
+ const w = writes[j];
143
+ const r = writeResults[j];
144
+ results[w.index] = { accepted: r.success, error: r.error };
145
+ if (r.success)
146
+ this._emit(w.uri, w.wire);
147
+ }
148
+ }
149
+ if (deletes.length > 0) {
150
+ const delResults = await this.store.delete(this.meta, deletes.map((d) => d.uri));
151
+ const deletedUris = [];
152
+ for (let j = 0; j < delResults.length; j++) {
153
+ const d = deletes[j];
154
+ const r = delResults[j];
155
+ results[d.index] = { accepted: r.success, error: r.error };
156
+ if (r.success)
157
+ deletedUris.push(d.uri);
158
+ }
159
+ if (deletedUris.length > 0)
160
+ this._emitDeletes(deletedUris);
161
+ }
162
+ return results;
163
+ }
164
+ async read(urls) {
165
+ const isBytes = this.target.name === BYTES_ENTITY.name;
166
+ const rows = await this.store.read(this.meta, urls);
167
+ if (!isBytes)
168
+ return rows;
169
+ return rows.map(([uri, payload]) => [uri, unwrapBytes(payload)]);
170
+ }
171
+ status() {
172
+ return this.store.status();
173
+ }
174
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module
3
+ * B3nd Core — framework foundation.
4
+ *
5
+ * Everything the framework needs to run a decentralized/distributed
6
+ * network: types, encoding, clients, Rig, Identity, connection,
7
+ * hooks, events, reactions, and network primitives.
8
+ */
9
+ export type { B3ndError, ClientError, CodeHandler, DeleteResult, HealthStatus, Output, Program, ProgramResult, ProtocolInterfaceNode, ReadFn, ReceiveResult, StatusResult, WriteResult, } from "./src/types/types.js";
10
+ export { ErrorCode, Errors } from "./src/types/types.js";
11
+ export { decodeBase64, decodeHex, encodeBase64, encodeHex, } from "./src/encoding/encoding.js";
12
+ export { FunctionalClient } from "./src/functional-client/functional-client.js";
13
+ export type { FunctionalClientConfig } from "./src/functional-client/functional-client.js";
14
+ export { ObserveEmitter } from "./src/observe-emitter/observe-emitter.js";
15
+ export type { ObserveListener } from "./src/observe-emitter/observe-emitter.js";
16
+ export { ConsoleClient } from "./src/client-console/client.js";
17
+ export { Identity } from "./src/rig/identity.js";
18
+ export type { ExportedIdentity } from "./src/rig/identity.js";
19
+ export { Rig } from "./src/rig/rig.js";
20
+ export type { RigConfig, RigInfo, RigRoutes } from "./src/rig/types.js";
21
+ export type { HandleEmitEvent, HandleErrorEvent, OperationEventHandler, OperationEventMap, OperationEventName, OperationHandle, ProcessDoneEvent, ProcessErrorEvent, ReactionErrorEvent, RouteErrorEvent, RouteSuccessEvent, SettledEvent, } from "./src/rig/operation-handle.js";
22
+ export type { AfterHook, BeforeHook, ErrorHookCtx, ErrorPhase, HooksConfig, OnErrorHook, ReadCtx, ReceiveCtx, RigHooks, SendCtx, } from "./src/rig/hooks.js";
23
+ export { resolveHooks, runAfter, runBefore, runOnError, } from "./src/rig/hooks.js";
24
+ export type { EventHandler, RigEvent, RigEventName } from "./src/rig/events.js";
25
+ export { RigEventEmitter } from "./src/rig/events.js";
26
+ export type { Reaction, ReactionHandler } from "./src/rig/reactions.js";
27
+ export { ReactionRegistry } from "./src/rig/reactions.js";
28
+ export { compilePattern, matches } from "./src/match-pattern/match-pattern.js";
29
+ export type { Matcher } from "./src/match-pattern/match-pattern.js";
30
+ export { connection } from "./src/rig/connection.js";
31
+ export type { Connection, ConnectionOptions } from "./src/rig/connection.js";
32
+ export { network } from "./src/network/network.js";
33
+ export { peer } from "./src/network/peer.js";
34
+ export { flood } from "./src/network/policies/flood.js";
35
+ export { pathVector } from "./src/network/policies/path-vector.js";
36
+ export { tellAndRead } from "./src/network/policies/tell-and-read.js";
37
+ export { bestEffort } from "./src/network/decorators.js";
38
+ export type { InboundCtx, NetworkOptions, Peer, PeerDecorator, Policy, StrategyFactory, } from "./src/network/types.js";
39
+ export type { TellAndReadBundle, TellAndReadOptions, } from "./src/network/policies/tell-and-read.js";
40
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@bandeira-tech/b3nd-core/0.22.0/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,YAAY,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,SAAS,GACV,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,YAAY,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAI3F,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAIhF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,YAAY,GACb,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/E,YAAY,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI7E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,YAAY,EACV,UAAU,EACV,cAAc,EACd,IAAI,EACJ,aAAa,EACb,MAAM,EACN,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module
3
+ * B3nd Core — framework foundation.
4
+ *
5
+ * Everything the framework needs to run a decentralized/distributed
6
+ * network: types, encoding, clients, Rig, Identity, connection,
7
+ * hooks, events, reactions, and network primitives.
8
+ */
9
+ export { ErrorCode, Errors } from "./src/types/types.js";
10
+ export { decodeBase64, decodeHex, encodeBase64, encodeHex, } from "./src/encoding/encoding.js";
11
+ // ── Protocol clients ──
12
+ export { FunctionalClient } from "./src/functional-client/functional-client.js";
13
+ // ── ObserveEmitter ──
14
+ export { ObserveEmitter } from "./src/observe-emitter/observe-emitter.js";
15
+ // ── Built-in transport clients ──
16
+ export { ConsoleClient } from "./src/client-console/client.js";
17
+ // ── Rig ──
18
+ export { Identity } from "./src/rig/identity.js";
19
+ export { Rig } from "./src/rig/rig.js";
20
+ export { resolveHooks, runAfter, runBefore, runOnError, } from "./src/rig/hooks.js";
21
+ export { RigEventEmitter } from "./src/rig/events.js";
22
+ export { ReactionRegistry } from "./src/rig/reactions.js";
23
+ export { compilePattern, matches } from "./src/match-pattern/match-pattern.js";
24
+ export { connection } from "./src/rig/connection.js";
25
+ // ── Network primitives ──
26
+ export { network } from "./src/network/network.js";
27
+ export { peer } from "./src/network/peer.js";
28
+ export { flood } from "./src/network/policies/flood.js";
29
+ export { pathVector } from "./src/network/policies/path-vector.js";
30
+ export { tellAndRead } from "./src/network/policies/tell-and-read.js";
31
+ export { bestEffort } from "./src/network/decorators.js";