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

Sign up to get free protection for your applications and to get access to all the features.
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>;
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>;
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;
@@ -4592,7 +4612,7 @@ __export(file_exports, {
4592
4612
 
4593
4613
  // src/version.ts
4594
4614
  var PACKAGE_VERSION = Object.keys({
4595
- "0.20.0-dev-preview-11": "xxxx"
4615
+ "0.20.0-dev-preview-12": "xxxx"
4596
4616
  })[0];
4597
4617
  export {
4598
4618
  CRDTImpl,