@fireproof/core 0.20.0-dev-preview-11 → 0.20.0-dev-preview-13

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/index.d.cts CHANGED
@@ -897,6 +897,13 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
897
897
  _updateIndex(): Promise<IndexTransactionMeta>;
898
898
  }
899
899
 
900
+ declare class Context {
901
+ private ctx;
902
+ set<T>(key: string, value: T): void;
903
+ get<T>(key: string): T | undefined;
904
+ delete(key: string): void;
905
+ }
906
+
900
907
  type Falsy = false | null | undefined;
901
908
  declare function isFalsy(value: unknown): value is Falsy;
902
909
  declare enum PARAM {
@@ -1248,6 +1255,7 @@ interface Ledger extends HasCRDT {
1248
1255
  readonly sthis: SuperThis;
1249
1256
  readonly id: string;
1250
1257
  readonly name: string;
1258
+ readonly context: Context;
1251
1259
  onClosed(fn: () => void): () => void;
1252
1260
  close(): Promise<void>;
1253
1261
  destroy(): Promise<void>;
@@ -1277,6 +1285,7 @@ declare class LedgerShell implements Ledger {
1277
1285
  readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
1278
1286
  readonly name: string;
1279
1287
  constructor(ref: LedgerImpl);
1288
+ get context(): Context;
1280
1289
  get id(): string;
1281
1290
  get logger(): Logger;
1282
1291
  get sthis(): SuperThis;
@@ -1295,6 +1304,7 @@ declare class LedgerImpl implements Ledger {
1295
1304
  readonly crdt: CRDT;
1296
1305
  readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
1297
1306
  readonly shells: Set<LedgerShell>;
1307
+ readonly context: Context;
1298
1308
  get name(): string;
1299
1309
  addShell(shell: LedgerShell): void;
1300
1310
  readonly _onClosedFns: Map<string, () => void>;
@@ -1522,9 +1532,24 @@ declare namespace index$2 {
1522
1532
  export { index$2_KeyBagProviderFile as KeyBagProviderFile, index$2_sysFileSystemFactory as sysFileSystemFactory };
1523
1533
  }
1524
1534
 
1535
+ declare class DefSerdeGateway implements SerdeGateway {
1536
+ readonly gw: Gateway;
1537
+ constructor(gw: Gateway);
1538
+ start(sthis: SuperThis, baseURL: URI): Promise<Result<URI>>;
1539
+ buildUrl(sthis: SuperThis, baseUrl: URI, key: string): Promise<Result<URI>>;
1540
+ close(sthis: SuperThis, uri: URI): Promise<Result<void>>;
1541
+ put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T>): Promise<Result<void>>;
1542
+ get<S>(sthis: SuperThis, url: URI): Promise<SerdeGetResult<S>>;
1543
+ delete(sthis: SuperThis, url: URI): Promise<Result<void>>;
1544
+ destroy(sthis: SuperThis, baseURL: URI): Promise<Result<void>>;
1545
+ getPlain(sthis: SuperThis, iurl: URI, key: string): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
1546
+ }
1547
+
1525
1548
  type index$1_CARDecodeEnvelope = CARDecodeEnvelope;
1526
1549
  type index$1_CAREncodeEnvelope = CAREncodeEnvelope;
1527
1550
  type index$1_Decoder = Decoder;
1551
+ type index$1_DefSerdeGateway = DefSerdeGateway;
1552
+ declare const index$1_DefSerdeGateway: typeof DefSerdeGateway;
1528
1553
  type index$1_Encoder = Encoder;
1529
1554
  type index$1_FILEDecodeEnvelope = FILEDecodeEnvelope;
1530
1555
  type index$1_FILEEncodeEnvelope = FILEEncodeEnvelope;
@@ -1537,7 +1562,7 @@ type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
1537
1562
  declare const index$1_fpDeserialize: typeof fpDeserialize;
1538
1563
  declare const index$1_fpSerialize: typeof fpSerialize;
1539
1564
  declare namespace index$1 {
1540
- export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
1565
+ export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
1541
1566
  }
1542
1567
 
1543
1568
  declare const FILESTORE_VERSION = "v0.19-file";
package/index.d.ts CHANGED
@@ -897,6 +897,13 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
897
897
  _updateIndex(): Promise<IndexTransactionMeta>;
898
898
  }
899
899
 
900
+ declare class Context {
901
+ private ctx;
902
+ set<T>(key: string, value: T): void;
903
+ get<T>(key: string): T | undefined;
904
+ delete(key: string): void;
905
+ }
906
+
900
907
  type Falsy = false | null | undefined;
901
908
  declare function isFalsy(value: unknown): value is Falsy;
902
909
  declare enum PARAM {
@@ -1248,6 +1255,7 @@ interface Ledger extends HasCRDT {
1248
1255
  readonly sthis: SuperThis;
1249
1256
  readonly id: string;
1250
1257
  readonly name: string;
1258
+ readonly context: Context;
1251
1259
  onClosed(fn: () => void): () => void;
1252
1260
  close(): Promise<void>;
1253
1261
  destroy(): Promise<void>;
@@ -1277,6 +1285,7 @@ declare class LedgerShell implements Ledger {
1277
1285
  readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
1278
1286
  readonly name: string;
1279
1287
  constructor(ref: LedgerImpl);
1288
+ get context(): Context;
1280
1289
  get id(): string;
1281
1290
  get logger(): Logger;
1282
1291
  get sthis(): SuperThis;
@@ -1295,6 +1304,7 @@ declare class LedgerImpl implements Ledger {
1295
1304
  readonly crdt: CRDT;
1296
1305
  readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
1297
1306
  readonly shells: Set<LedgerShell>;
1307
+ readonly context: Context;
1298
1308
  get name(): string;
1299
1309
  addShell(shell: LedgerShell): void;
1300
1310
  readonly _onClosedFns: Map<string, () => void>;
@@ -1522,9 +1532,24 @@ declare namespace index$2 {
1522
1532
  export { index$2_KeyBagProviderFile as KeyBagProviderFile, index$2_sysFileSystemFactory as sysFileSystemFactory };
1523
1533
  }
1524
1534
 
1535
+ declare class DefSerdeGateway implements SerdeGateway {
1536
+ readonly gw: Gateway;
1537
+ constructor(gw: Gateway);
1538
+ start(sthis: SuperThis, baseURL: URI): Promise<Result<URI>>;
1539
+ buildUrl(sthis: SuperThis, baseUrl: URI, key: string): Promise<Result<URI>>;
1540
+ close(sthis: SuperThis, uri: URI): Promise<Result<void>>;
1541
+ put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T>): Promise<Result<void>>;
1542
+ get<S>(sthis: SuperThis, url: URI): Promise<SerdeGetResult<S>>;
1543
+ delete(sthis: SuperThis, url: URI): Promise<Result<void>>;
1544
+ destroy(sthis: SuperThis, baseURL: URI): Promise<Result<void>>;
1545
+ getPlain(sthis: SuperThis, iurl: URI, key: string): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
1546
+ }
1547
+
1525
1548
  type index$1_CARDecodeEnvelope = CARDecodeEnvelope;
1526
1549
  type index$1_CAREncodeEnvelope = CAREncodeEnvelope;
1527
1550
  type index$1_Decoder = Decoder;
1551
+ type index$1_DefSerdeGateway = DefSerdeGateway;
1552
+ declare const index$1_DefSerdeGateway: typeof DefSerdeGateway;
1528
1553
  type index$1_Encoder = Encoder;
1529
1554
  type index$1_FILEDecodeEnvelope = FILEDecodeEnvelope;
1530
1555
  type index$1_FILEEncodeEnvelope = FILEEncodeEnvelope;
@@ -1537,7 +1562,7 @@ type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
1537
1562
  declare const index$1_fpDeserialize: typeof fpDeserialize;
1538
1563
  declare const index$1_fpSerialize: typeof fpSerialize;
1539
1564
  declare namespace index$1 {
1540
- export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
1565
+ export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
1541
1566
  }
1542
1567
 
1543
1568
  declare const FILESTORE_VERSION = "v0.19-file";
package/index.js CHANGED
@@ -4303,6 +4303,22 @@ var CRDTImpl = class {
4303
4303
  }
4304
4304
  };
4305
4305
 
4306
+ // src/context.ts
4307
+ var Context = class {
4308
+ constructor() {
4309
+ this.ctx = /* @__PURE__ */ new Map();
4310
+ }
4311
+ set(key, value) {
4312
+ this.ctx.set(key, value);
4313
+ }
4314
+ get(key) {
4315
+ return this.ctx.get(key);
4316
+ }
4317
+ delete(key) {
4318
+ this.ctx.delete(key);
4319
+ }
4320
+ };
4321
+
4306
4322
  // src/ledger.ts
4307
4323
  var ledgers = new KeyedResolvOnce4();
4308
4324
  function keyConfigOpts(sthis, name, opts) {
@@ -4347,6 +4363,9 @@ var LedgerShell = class {
4347
4363
  this.name = ref.name;
4348
4364
  ref.addShell(this);
4349
4365
  }
4366
+ get context() {
4367
+ return this.ref.context;
4368
+ }
4350
4369
  get id() {
4351
4370
  return this.ref.id;
4352
4371
  }
@@ -4385,6 +4404,7 @@ var LedgerImpl = class {
4385
4404
  this._noupdate_listeners = /* @__PURE__ */ new Set();
4386
4405
  // readonly blockstore: BaseBlockstore;
4387
4406
  this.shells = /* @__PURE__ */ new Set();
4407
+ this.context = new Context();
4388
4408
  this._onClosedFns = /* @__PURE__ */ new Map();
4389
4409
  this._ready = new ResolveOnce7();
4390
4410
  this.opts = opts;
@@ -4578,6 +4598,7 @@ import { runtimeFn as runtimeFn4 } from "@adviser/cement";
4578
4598
  // src/runtime/gateways/index.ts
4579
4599
  var gateways_exports = {};
4580
4600
  __export(gateways_exports, {
4601
+ DefSerdeGateway: () => DefSerdeGateway,
4581
4602
  file: () => file_exports,
4582
4603
  fpDeserialize: () => fpDeserialize,
4583
4604
  fpSerialize: () => fpSerialize
@@ -4592,7 +4613,7 @@ __export(file_exports, {
4592
4613
 
4593
4614
  // src/version.ts
4594
4615
  var PACKAGE_VERSION = Object.keys({
4595
- "0.20.0-dev-preview-11": "xxxx"
4616
+ "0.20.0-dev-preview-13": "xxxx"
4596
4617
  })[0];
4597
4618
  export {
4598
4619
  CRDTImpl,