@xyo-network/diviner-boundwitness-indexeddb 4.0.2 → 4.1.0

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.
@@ -0,0 +1,78 @@
1
+ import { IndexDescription } from '@xyo-network/archivist-model';
2
+ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
+ import { BoundWitness } from '@xyo-network/boundwitness-model';
4
+ import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
5
+ import { BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
6
+ import { Schema } from '@xyo-network/payload-model';
7
+ import { AnyConfigSchema } from '@xyo-network/module-model';
8
+
9
+ declare const IndexedDbBoundWitnessDivinerConfigSchema: "network.xyo.diviner.boundwitness.indexeddb.config";
10
+ type IndexedDbBoundWitnessDivinerConfigSchema = typeof IndexedDbBoundWitnessDivinerConfigSchema;
11
+ type IndexedDbBoundWitnessDivinerConfig = DivinerConfig<{
12
+ /**
13
+ * The database name
14
+ */
15
+ dbName?: string;
16
+ /**
17
+ * The version of the DB, defaults to 1
18
+ */
19
+ dbVersion?: number;
20
+ schema: IndexedDbBoundWitnessDivinerConfigSchema;
21
+ /**
22
+ * The storage configuration
23
+ * // TODO: Hoist to main diviner config
24
+ */
25
+ storage?: {
26
+ /**
27
+ * The indexes to create on the object store
28
+ */
29
+ indexes?: IndexDescription[];
30
+ };
31
+ /**
32
+ * The name of the object store
33
+ */
34
+ storeName?: string;
35
+ }>;
36
+
37
+ type IndexedDbBoundWitnessDivinerParams = DivinerParams<AnyConfigSchema<IndexedDbBoundWitnessDivinerConfig>>;
38
+
39
+ declare class IndexedDbBoundWitnessDiviner<TParams extends IndexedDbBoundWitnessDivinerParams = IndexedDbBoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
40
+ static readonly configSchemas: Schema[];
41
+ static readonly defaultConfigSchema: Schema;
42
+ /**
43
+ * The database name. If not supplied via config, it defaults
44
+ * to the archivist's name and if archivist's name is not supplied,
45
+ * it defaults to `archivist`. This behavior
46
+ * biases towards a single, isolated DB per archivist which seems to
47
+ * make the most sense for 99% of use cases.
48
+ */
49
+ get dbName(): string;
50
+ /**
51
+ * The database version. If not supplied via config, it defaults to the archivist default version.
52
+ */
53
+ get dbVersion(): number;
54
+ /**
55
+ * The name of the object store. If not supplied via config, it defaults
56
+ * to `payloads`.
57
+ */
58
+ get storeName(): string;
59
+ protected divineHandler(payloads?: TIn[]): Promise<TOut[]>;
60
+ protected startHandler(): Promise<void>;
61
+ /**
62
+ * Checks that the desired DB/objectStore exists and is initialized to the correct version
63
+ * @returns The initialized DB or undefined if it does not exist in the desired state
64
+ */
65
+ private tryGetInitializedDb;
66
+ /**
67
+ * Executes a callback with the initialized DB and then closes the db
68
+ * @param callback The method to execute with the initialized DB
69
+ * @returns
70
+ */
71
+ private tryUseDb;
72
+ }
73
+
74
+ declare const IndexedDbBoundWitnessDivinerSchema: "network.xyo.diviner.boundwitness.indexeddb";
75
+ type IndexedDbBoundWitnessDivinerSchema = typeof IndexedDbBoundWitnessDivinerSchema;
76
+
77
+ export { IndexedDbBoundWitnessDiviner, IndexedDbBoundWitnessDivinerConfigSchema, IndexedDbBoundWitnessDivinerSchema };
78
+ export type { IndexedDbBoundWitnessDivinerConfig, IndexedDbBoundWitnessDivinerParams };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-boundwitness-indexeddb",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -21,36 +21,36 @@
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": {
24
- "types": "./dist/types/index.d.ts",
24
+ "types": "./dist/browser/index.d.ts",
25
25
  "default": "./dist/browser/index.mjs"
26
26
  },
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "module": "dist/browser/index.mjs",
30
- "types": "dist/types/index.d.ts",
30
+ "types": "dist/browser/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/array": "^4.12.33",
33
- "@xylabs/assert": "^4.12.33",
34
- "@xylabs/exists": "^4.12.33",
35
- "@xyo-network/archivist-indexeddb": "^4.0.2",
36
- "@xyo-network/archivist-model": "^4.0.2",
37
- "@xyo-network/boundwitness-model": "^4.0.2",
38
- "@xyo-network/diviner-boundwitness-abstract": "^4.0.2",
39
- "@xyo-network/diviner-boundwitness-model": "^4.0.2",
40
- "@xyo-network/diviner-model": "^4.0.2",
41
- "@xyo-network/module-model": "^4.0.2",
42
- "@xyo-network/payload-model": "^4.0.2",
32
+ "@xylabs/array": "^4.13.15",
33
+ "@xylabs/assert": "^4.13.15",
34
+ "@xylabs/exists": "^4.13.15",
35
+ "@xyo-network/archivist-indexeddb": "^4.1.0",
36
+ "@xyo-network/archivist-model": "^4.1.0",
37
+ "@xyo-network/boundwitness-model": "^4.1.0",
38
+ "@xyo-network/diviner-boundwitness-abstract": "^4.1.0",
39
+ "@xyo-network/diviner-boundwitness-model": "^4.1.0",
40
+ "@xyo-network/diviner-model": "^4.1.0",
41
+ "@xyo-network/module-model": "^4.1.0",
42
+ "@xyo-network/payload-model": "^4.1.0",
43
43
  "idb": "^8.0.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@xylabs/delay": "^4.12.33",
47
- "@xylabs/ts-scripts-yarn3": "^6.5.12",
48
- "@xylabs/tsconfig": "^6.5.12",
49
- "@xylabs/vitest-extended": "^4.12.33",
50
- "@xyo-network/archivist-indexeddb": "^4.0.2",
51
- "@xyo-network/boundwitness-builder": "^4.0.2",
52
- "@xyo-network/node-memory": "^4.0.2",
53
- "@xyo-network/payload-builder": "^4.0.2",
46
+ "@xylabs/delay": "^4.13.15",
47
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
48
+ "@xylabs/tsconfig": "^7.0.0-rc.20",
49
+ "@xylabs/vitest-extended": "^4.13.15",
50
+ "@xyo-network/archivist-indexeddb": "^4.1.0",
51
+ "@xyo-network/boundwitness-builder": "^4.1.0",
52
+ "@xyo-network/node-memory": "^4.1.0",
53
+ "@xyo-network/payload-builder": "^4.1.0",
54
54
  "fake-indexeddb": "^6.0.1",
55
55
  "typescript": "^5.8.3",
56
56
  "vitest": "^3.2.4"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes