@fireproof/core-types-base 0.22.0-dev-preview → 0.22.0-dev-preview-3
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/key-bag-if.d.ts +0 -1
- package/key-bag-if.ts +1 -1
- package/package.json +7 -7
- package/types.d.ts +54 -6
- package/types.js +6 -3
- package/types.js.map +1 -1
- package/types.ts +72 -5
package/key-bag-if.d.ts
CHANGED
|
@@ -6,6 +6,5 @@ export interface KeyBagIf {
|
|
|
6
6
|
readonly rt: KeyBagRuntime;
|
|
7
7
|
subtleKey(materialStrOrUint8: string | Uint8Array): Promise<CryptoKey>;
|
|
8
8
|
ensureKeyFromUrl(url: URI, keyFactory: () => string): Promise<Result<URI>>;
|
|
9
|
-
flush(): Promise<void>;
|
|
10
9
|
getNamedKey(name: string, failIfNotFound?: boolean, material?: string | Uint8Array): Promise<Result<KeysByFingerprint>>;
|
|
11
10
|
}
|
package/key-bag-if.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface KeyBagIf {
|
|
|
9
9
|
subtleKey(materialStrOrUint8: string | Uint8Array): Promise<CryptoKey>;
|
|
10
10
|
|
|
11
11
|
ensureKeyFromUrl(url: URI, keyFactory: () => string): Promise<Result<URI>>;
|
|
12
|
-
flush(): Promise<void>;
|
|
12
|
+
// flush(): Promise<void>;
|
|
13
13
|
|
|
14
14
|
getNamedKey(name: string, failIfNotFound?: boolean, material?: string | Uint8Array): Promise<Result<KeysByFingerprint>>;
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fireproof/core-types-base",
|
|
3
|
-
"version": "0.22.0-dev-preview",
|
|
3
|
+
"version": "0.22.0-dev-preview-3",
|
|
4
4
|
"description": "Live ledger for the web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"Meno Abels"
|
|
21
21
|
],
|
|
22
22
|
"author": "J Chris Anderson",
|
|
23
|
-
"license": "
|
|
23
|
+
"license": "AFL-2.0",
|
|
24
24
|
"homepage": "https://use-fireproof.com",
|
|
25
25
|
"gptdoc": "import { fireproof } from 'use-fireproof'; const db = fireproof('app-db-name'); const ok = await db.put({ anyField: ['any','json'] }); const doc = await db.get(ok.id); await db.del(doc._id); db.subscribe(myRedrawFn); const result = await db.query('anyField', {range : ['a', 'z']}); result.rows.map(({ key }) => key);",
|
|
26
26
|
"repository": {
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"url": "https://github.com/fireproof-storage/fireproof/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@adviser/cement": "^0.4.
|
|
35
|
-
"@fireproof/core-types-blockstore": "0.22.0-dev-preview",
|
|
34
|
+
"@adviser/cement": "^0.4.21",
|
|
35
|
+
"@fireproof/core-types-blockstore": "0.22.0-dev-preview-3",
|
|
36
|
+
"@fireproof/vendor": "0.22.0-dev-preview-3",
|
|
36
37
|
"@web3-storage/pail": "^0.6.2",
|
|
37
38
|
"multiformats": "^13.3.7",
|
|
38
|
-
"prolly-trees": "^1.0.4"
|
|
39
|
-
"@fireproof/vendor": "0.22.0-dev-preview"
|
|
39
|
+
"prolly-trees": "^1.0.4"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "tsc"
|
|
42
|
+
"build": "core-cli tsc"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EventLink } from "@web3-storage/pail/clock/api";
|
|
2
2
|
import type { Operation } from "@web3-storage/pail/crdt/api";
|
|
3
3
|
import type { Block } from "multiformats";
|
|
4
|
-
import { EnvFactoryOpts, Env, Logger, CryptoRuntime, Result, CoerceURI, AppContext, URI } from "@adviser/cement";
|
|
5
|
-
import type { DbMeta, AnyLink, StoreUrlsOpts, StoreEnDeFile, Loadable,
|
|
4
|
+
import { EnvFactoryOpts, Env, Logger, CryptoRuntime, Result, CoerceURI, AppContext, URI, CTCryptoKey } from "@adviser/cement";
|
|
5
|
+
import type { DbMeta, AnyLink, StoreUrlsOpts, StoreEnDeFile, Loadable, TransactionWrapper, BlockstoreRuntime, StoreURIRuntime, DataAndMetaAndWalStore, UrlAndInterceptor, MetaStore, WALStore, BaseStore, FileStore, CarStore, FPBlock, BlockFetcher } from "@fireproof/core-types-blockstore";
|
|
6
6
|
import type { IndexIf } from "./indexer.js";
|
|
7
7
|
import { SerdeGatewayInterceptor } from "@fireproof/core-types-blockstore";
|
|
8
8
|
export declare class NotFoundError extends Error {
|
|
9
|
-
readonly code
|
|
9
|
+
readonly code: string;
|
|
10
10
|
}
|
|
11
11
|
export type { DbMeta };
|
|
12
12
|
export type Falsy = false | null | undefined;
|
|
@@ -135,6 +135,7 @@ export interface ConfigOpts extends Partial<SuperThisOpts> {
|
|
|
135
135
|
readonly writeQueue?: Partial<WriteQueueParams>;
|
|
136
136
|
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
|
137
137
|
readonly autoCompact?: number;
|
|
138
|
+
readonly compactStrategy?: string;
|
|
138
139
|
readonly storeUrls?: StoreUrlsOpts;
|
|
139
140
|
readonly storeEnDe?: StoreEnDeFile;
|
|
140
141
|
readonly threshold?: number;
|
|
@@ -439,10 +440,26 @@ export type TraceFn = (traceEvent: TraceEvent) => void;
|
|
|
439
440
|
export interface Tracer {
|
|
440
441
|
readonly tracer: TraceFn;
|
|
441
442
|
}
|
|
443
|
+
export type TransactionMeta = unknown;
|
|
444
|
+
export interface CompactStrategyContext extends BlockFetcher {
|
|
445
|
+
readonly transactions: Set<CarTransaction>;
|
|
446
|
+
readonly clock?: CRDTClock;
|
|
447
|
+
readonly lastTxMeta: TransactionMeta;
|
|
448
|
+
readonly loader: Loadable;
|
|
449
|
+
readonly logger: Logger;
|
|
450
|
+
readonly blockstore: BlockFetcher;
|
|
451
|
+
readonly loggedBlocks: CarTransaction;
|
|
452
|
+
get(cid: AnyLink): Promise<FPBlock | Falsy>;
|
|
453
|
+
}
|
|
454
|
+
export interface CompactStrategy {
|
|
455
|
+
readonly name: string;
|
|
456
|
+
compact(block: CompactStrategyContext): Promise<TransactionMeta>;
|
|
457
|
+
}
|
|
442
458
|
export interface LedgerOpts extends Tracer {
|
|
443
459
|
readonly name: string;
|
|
444
460
|
readonly meta?: DbMeta;
|
|
445
461
|
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
|
462
|
+
readonly compactStrategy?: string;
|
|
446
463
|
readonly ctx: AppContext;
|
|
447
464
|
readonly writeQueue: WriteQueueParams;
|
|
448
465
|
readonly storeUrls: StoreURIRuntime;
|
|
@@ -474,13 +491,44 @@ export interface V2StorageKeyItem {
|
|
|
474
491
|
readonly fingerPrint: string;
|
|
475
492
|
readonly default: boolean;
|
|
476
493
|
}
|
|
477
|
-
export interface
|
|
494
|
+
export interface V2KeysItem {
|
|
478
495
|
readonly name: string;
|
|
479
496
|
readonly keys: Record<string, V2StorageKeyItem>;
|
|
480
497
|
}
|
|
498
|
+
export interface KeyMaterial {
|
|
499
|
+
readonly key: Uint8Array;
|
|
500
|
+
readonly keyStr: string;
|
|
501
|
+
}
|
|
502
|
+
export interface KeyWithFingerPrint {
|
|
503
|
+
readonly default: boolean;
|
|
504
|
+
readonly fingerPrint: string;
|
|
505
|
+
readonly key: CTCryptoKey;
|
|
506
|
+
extract(): Promise<KeyMaterial>;
|
|
507
|
+
asV2StorageKeyItem(): Promise<V2StorageKeyItem>;
|
|
508
|
+
}
|
|
509
|
+
export interface KeyUpsertResultModified {
|
|
510
|
+
readonly modified: true;
|
|
511
|
+
readonly kfp: KeyWithFingerPrint;
|
|
512
|
+
}
|
|
513
|
+
export declare function isKeyUpsertResultModified(r: KeyUpsertResult): r is KeyUpsertResultModified;
|
|
514
|
+
export interface KeyUpsertResultNotModified {
|
|
515
|
+
readonly modified: false;
|
|
516
|
+
}
|
|
517
|
+
export type KeyUpsertResult = KeyUpsertResultModified | KeyUpsertResultNotModified;
|
|
518
|
+
export interface KeysByFingerprint {
|
|
519
|
+
readonly id: string;
|
|
520
|
+
readonly name: string;
|
|
521
|
+
get(fingerPrint?: string | Uint8Array): Promise<KeyWithFingerPrint | undefined>;
|
|
522
|
+
upsert(key: string | Uint8Array, def?: boolean): Promise<Result<KeyUpsertResult>>;
|
|
523
|
+
asV2KeysItem(): Promise<V2KeysItem>;
|
|
524
|
+
}
|
|
525
|
+
export interface KeysItem {
|
|
526
|
+
readonly name: string;
|
|
527
|
+
readonly keys: Record<string, KeyWithFingerPrint>;
|
|
528
|
+
}
|
|
481
529
|
export interface KeyBagProvider {
|
|
482
|
-
get(id: string): Promise<V1StorageKeyItem |
|
|
483
|
-
set(item:
|
|
530
|
+
get(id: string): Promise<V1StorageKeyItem | V2KeysItem | undefined>;
|
|
531
|
+
set(item: V2KeysItem): Promise<void>;
|
|
484
532
|
del(id: string): Promise<void>;
|
|
485
533
|
}
|
|
486
534
|
export interface KeyBagRuntime {
|
package/types.js
CHANGED
|
@@ -7,14 +7,14 @@ export function isFalsy(value) {
|
|
|
7
7
|
}
|
|
8
8
|
export const PARAM = {
|
|
9
9
|
SUFFIX: "suffix",
|
|
10
|
-
URL_GEN: "urlGen",
|
|
10
|
+
URL_GEN: "urlGen", // "urlGen" | "default"
|
|
11
11
|
STORE_KEY: "storekey",
|
|
12
12
|
STORE: "store",
|
|
13
13
|
KEY: "key",
|
|
14
14
|
INDEX: "index",
|
|
15
15
|
NAME: "name",
|
|
16
16
|
VERSION: "version",
|
|
17
|
-
RUNTIME: "runtime",
|
|
17
|
+
RUNTIME: "runtime", // "node" | "deno" | "browser"
|
|
18
18
|
FRAG_SIZE: "fragSize",
|
|
19
19
|
IV_VERIFY: "ivVerify",
|
|
20
20
|
IV_HASH: "ivHash",
|
|
@@ -23,7 +23,7 @@ export const PARAM = {
|
|
|
23
23
|
FRAG_LEN: "len",
|
|
24
24
|
FRAG_HEAD: "headerSize",
|
|
25
25
|
EXTRACTKEY: "extractKey",
|
|
26
|
-
SELF_REFLECT: "selfReflect",
|
|
26
|
+
SELF_REFLECT: "selfReflect", // if no subscribe in Gateway see your own META updates
|
|
27
27
|
CAR_PARALLEL: "parallel",
|
|
28
28
|
CAR_CACHE_SIZE: "carCacheSize",
|
|
29
29
|
CAR_COMPACT_CACHE_SIZE: "carCompactCacheSize",
|
|
@@ -66,6 +66,9 @@ export class DataAndMetaAndWalAndBaseStore {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
export function isKeyUpsertResultModified(r) {
|
|
70
|
+
return r.modified;
|
|
71
|
+
}
|
|
69
72
|
export function defaultWriteQueueOpts(opts = {}) {
|
|
70
73
|
return {
|
|
71
74
|
...opts,
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8C,MAAM,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"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"}
|
package/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EventLink } from "@web3-storage/pail/clock/api";
|
|
2
2
|
import type { Operation } from "@web3-storage/pail/crdt/api";
|
|
3
3
|
import type { Block } from "multiformats";
|
|
4
|
-
import { EnvFactoryOpts, Env, Logger, CryptoRuntime, Result, CoerceURI, AppContext, URI } from "@adviser/cement";
|
|
4
|
+
import { EnvFactoryOpts, Env, Logger, CryptoRuntime, Result, CoerceURI, AppContext, URI, CTCryptoKey } from "@adviser/cement";
|
|
5
5
|
|
|
6
6
|
import type {
|
|
7
7
|
DbMeta,
|
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
StoreUrlsOpts,
|
|
10
10
|
StoreEnDeFile,
|
|
11
11
|
Loadable,
|
|
12
|
-
TransactionMeta,
|
|
13
12
|
TransactionWrapper,
|
|
14
13
|
BlockstoreRuntime,
|
|
15
14
|
StoreURIRuntime,
|
|
@@ -21,6 +20,7 @@ import type {
|
|
|
21
20
|
FileStore,
|
|
22
21
|
CarStore,
|
|
23
22
|
FPBlock,
|
|
23
|
+
BlockFetcher,
|
|
24
24
|
} from "@fireproof/core-types-blockstore";
|
|
25
25
|
|
|
26
26
|
import type { IndexIf } from "./indexer.js";
|
|
@@ -183,6 +183,8 @@ export interface ConfigOpts extends Partial<SuperThisOpts> {
|
|
|
183
183
|
readonly writeQueue?: Partial<WriteQueueParams>;
|
|
184
184
|
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
|
185
185
|
readonly autoCompact?: number;
|
|
186
|
+
// could be registered with registerCompactStrategy(name: string, compactStrategy: CompactStrategy)
|
|
187
|
+
readonly compactStrategy?: string; // default "FULL" other "fireproof" , "no-op"
|
|
186
188
|
readonly storeUrls?: StoreUrlsOpts;
|
|
187
189
|
readonly storeEnDe?: StoreEnDeFile;
|
|
188
190
|
readonly threshold?: number;
|
|
@@ -635,12 +637,34 @@ export interface Tracer {
|
|
|
635
637
|
readonly tracer: TraceFn;
|
|
636
638
|
}
|
|
637
639
|
|
|
640
|
+
export type TransactionMeta = unknown;
|
|
641
|
+
export interface CompactStrategyContext extends BlockFetcher {
|
|
642
|
+
readonly transactions: Set<CarTransaction>;
|
|
643
|
+
readonly clock?: CRDTClock;
|
|
644
|
+
readonly lastTxMeta: TransactionMeta;
|
|
645
|
+
readonly loader: Loadable;
|
|
646
|
+
readonly logger: Logger;
|
|
647
|
+
readonly blockstore: BlockFetcher;
|
|
648
|
+
// loader: Loader | null = null
|
|
649
|
+
readonly loggedBlocks: CarTransaction;
|
|
650
|
+
|
|
651
|
+
get(cid: AnyLink): Promise<FPBlock | Falsy>;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export interface CompactStrategy {
|
|
655
|
+
readonly name: string;
|
|
656
|
+
compact(block: CompactStrategyContext): Promise<TransactionMeta>;
|
|
657
|
+
}
|
|
658
|
+
|
|
638
659
|
export interface LedgerOpts extends Tracer {
|
|
639
660
|
readonly name: string;
|
|
640
661
|
// readonly public?: boolean;
|
|
641
662
|
readonly meta?: DbMeta;
|
|
642
663
|
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
|
643
664
|
|
|
665
|
+
// could be registered with registerCompactStrategy(name: string, compactStrategy: CompactStrategy)
|
|
666
|
+
readonly compactStrategy?: string; // default "FULL"
|
|
667
|
+
|
|
644
668
|
readonly ctx: AppContext;
|
|
645
669
|
readonly writeQueue: WriteQueueParams;
|
|
646
670
|
readonly storeUrls: StoreURIRuntime;
|
|
@@ -710,14 +734,57 @@ export interface V2StorageKeyItem {
|
|
|
710
734
|
readonly fingerPrint: string;
|
|
711
735
|
readonly default: boolean;
|
|
712
736
|
}
|
|
713
|
-
|
|
737
|
+
|
|
738
|
+
// Serialized Version
|
|
739
|
+
export interface V2KeysItem {
|
|
714
740
|
readonly name: string;
|
|
715
741
|
readonly keys: Record<string, V2StorageKeyItem>;
|
|
716
742
|
}
|
|
717
743
|
|
|
744
|
+
export interface KeyMaterial {
|
|
745
|
+
readonly key: Uint8Array;
|
|
746
|
+
readonly keyStr: string;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export interface KeyWithFingerPrint {
|
|
750
|
+
readonly default: boolean;
|
|
751
|
+
readonly fingerPrint: string;
|
|
752
|
+
readonly key: CTCryptoKey;
|
|
753
|
+
extract(): Promise<KeyMaterial>;
|
|
754
|
+
asV2StorageKeyItem(): Promise<V2StorageKeyItem>;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
export interface KeyUpsertResultModified {
|
|
758
|
+
readonly modified: true;
|
|
759
|
+
readonly kfp: KeyWithFingerPrint;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export function isKeyUpsertResultModified(r: KeyUpsertResult): r is KeyUpsertResultModified {
|
|
763
|
+
return r.modified;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export interface KeyUpsertResultNotModified {
|
|
767
|
+
readonly modified: false;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export type KeyUpsertResult = KeyUpsertResultModified | KeyUpsertResultNotModified;
|
|
771
|
+
|
|
772
|
+
export interface KeysByFingerprint {
|
|
773
|
+
readonly id: string;
|
|
774
|
+
readonly name: string;
|
|
775
|
+
get(fingerPrint?: string | Uint8Array): Promise<KeyWithFingerPrint | undefined>;
|
|
776
|
+
upsert(key: string | Uint8Array, def?: boolean): Promise<Result<KeyUpsertResult>>;
|
|
777
|
+
asV2KeysItem(): Promise<V2KeysItem>;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export interface KeysItem {
|
|
781
|
+
readonly name: string;
|
|
782
|
+
readonly keys: Record<string, KeyWithFingerPrint>;
|
|
783
|
+
}
|
|
784
|
+
|
|
718
785
|
export interface KeyBagProvider {
|
|
719
|
-
get(id: string): Promise<V1StorageKeyItem |
|
|
720
|
-
set(item:
|
|
786
|
+
get(id: string): Promise<V1StorageKeyItem | V2KeysItem | undefined>;
|
|
787
|
+
set(item: V2KeysItem): Promise<void>;
|
|
721
788
|
del(id: string): Promise<void>;
|
|
722
789
|
}
|
|
723
790
|
|