@fireproof/core 0.20.0-dev-preview-10 → 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.cjs +24 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +11 -5
- package/index.d.ts +11 -5
- package/index.js +24 -10
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
- package/react/index.cjs +1 -1
- package/react/index.cjs.map +1 -1
- package/react/index.js +1 -1
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/interceptor-gateway.test.ts +1 -1
- package/tests/fireproof/all-gateway.test.ts +2 -2
- package/tests/fireproof/database.test.ts +9 -9
- package/tests/fireproof/fireproof.test.ts +19 -19
- package/tests/fireproof/hello.test.ts +5 -5
- package/tests/fireproof/indexer.test.ts +7 -7
- package/tests/fireproof/multiple-ledger.test.ts +1 -1
- package/tests/gateway/file/loader-config.test.ts +4 -4
- package/tests/gateway/indexdb/loader-config.test.ts +1 -1
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
|
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
|
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
|
-
|
4542
|
-
|
4543
|
-
|
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-
|
4615
|
+
"0.20.0-dev-preview-12": "xxxx"
|
4602
4616
|
})[0];
|
4603
4617
|
export {
|
4604
4618
|
CRDTImpl,
|