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

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>;
@@ -1313,11 +1323,7 @@ declare class LedgerImpl implements Ledger {
1313
1323
  private _no_update_notify;
1314
1324
  }
1315
1325
  declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1316
- declare class Fireproof {
1317
- Ledger(name: string, opts?: ConfigOpts): Ledger;
1318
- DB(name: string, opts?: ConfigOpts): Database;
1319
- }
1320
- declare const fireproof: Fireproof;
1326
+ declare function fireproof(name: string, opts?: ConfigOpts): Database;
1321
1327
 
1322
1328
  declare function isDatabase(db: unknown): db is Database;
1323
1329
  declare class DatabaseImpl implements Database {
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>;
@@ -1313,11 +1323,7 @@ declare class LedgerImpl implements Ledger {
1313
1323
  private _no_update_notify;
1314
1324
  }
1315
1325
  declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1316
- declare class Fireproof {
1317
- Ledger(name: string, opts?: ConfigOpts): Ledger;
1318
- DB(name: string, opts?: ConfigOpts): Database;
1319
- }
1320
- declare const fireproof: Fireproof;
1326
+ declare function fireproof(name: string, opts?: ConfigOpts): Database;
1321
1327
 
1322
1328
  declare function isDatabase(db: unknown): db is Database;
1323
1329
  declare class DatabaseImpl implements Database {
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;
@@ -4538,15 +4558,9 @@ function toStoreURIRuntime(sthis, name, sopts) {
4538
4558
  }
4539
4559
  };
4540
4560
  }
4541
- var Fireproof = class {
4542
- Ledger(name, opts) {
4543
- return LedgerFactory(name, opts);
4544
- }
4545
- DB(name, opts) {
4546
- return new DatabaseImpl(this.Ledger(name, opts));
4547
- }
4548
- };
4549
- var fireproof = new Fireproof();
4561
+ function fireproof(name, opts) {
4562
+ return new DatabaseImpl(LedgerFactory(name, opts));
4563
+ }
4550
4564
 
4551
4565
  // src/runtime/index.ts
4552
4566
  var runtime_exports = {};
@@ -4598,7 +4612,7 @@ __export(file_exports, {
4598
4612
 
4599
4613
  // src/version.ts
4600
4614
  var PACKAGE_VERSION = Object.keys({
4601
- "0.20.0-dev-preview-10": "xxxx"
4615
+ "0.20.0-dev-preview-12": "xxxx"
4602
4616
  })[0];
4603
4617
  export {
4604
4618
  CRDTImpl,