@seedprotocol/sdk 0.2.8 → 0.2.10
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/dist/Db-DgE-Lola.js +39 -0
- package/dist/Db-DgE-Lola.js.map +1 -0
- package/dist/Db-DoBRA_OH.js +138 -0
- package/dist/Db-DoBRA_OH.js.map +1 -0
- package/dist/{Item-Da3oF6rX.js → Item-DxpfLjF9.js} +2 -2
- package/dist/{Item-Da3oF6rX.js.map → Item-DxpfLjF9.js.map} +1 -1
- package/dist/{index-vIPO_QrC.js → index-9iAccUrw.js} +19 -6
- package/dist/index-9iAccUrw.js.map +1 -0
- package/dist/{index-BAqEY103.js → index-gd_7iXhC.js} +2 -2
- package/dist/index-gd_7iXhC.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-DrHfhLwp.js → seed.schema.config-DaIalFhy.js} +2 -2
- package/dist/{seed.schema.config-DrHfhLwp.js.map → seed.schema.config-DaIalFhy.js.map} +1 -1
- package/dist/src/Db.ts +1 -1
- package/dist/src/addModelsToDb.ts +1 -1
- package/dist/src/client.ts +2 -0
- package/dist/src/connectToDb.ts +1 -1
- package/dist/src/createMetadata.ts +1 -1
- package/dist/src/createSeed.ts +1 -1
- package/dist/src/createSeeds.ts +1 -1
- package/dist/src/createVersion.ts +1 -1
- package/dist/src/deleteItem.ts +1 -1
- package/dist/src/download.ts +1 -1
- package/dist/src/fetchRelatedItems.ts +1 -1
- package/dist/src/getExistingItem.ts +1 -1
- package/dist/src/getItemData.ts +1 -1
- package/dist/src/getItemProperties.ts +1 -1
- package/dist/src/getItemProperty.ts +1 -1
- package/dist/src/getItems.ts +1 -1
- package/dist/src/getMetadata.ts +1 -1
- package/dist/src/getModelSchemas.ts +1 -1
- package/dist/src/getPropertyData.ts +1 -1
- package/dist/src/getRelationValueData.ts +1 -1
- package/dist/src/getSeedData.ts +1 -1
- package/dist/src/getStorageTransactionIdForSeedUid.ts +1 -1
- package/dist/src/getVersionData.ts +1 -1
- package/dist/src/hydrateFromDb.ts +1 -1
- package/dist/src/initialize.ts +1 -1
- package/dist/src/prepareDb.ts +1 -1
- package/dist/src/preparePublishRequestData.ts +1 -1
- package/dist/src/recoverDeletedItem.ts +1 -1
- package/dist/src/saveAppState.ts +1 -1
- package/dist/src/saveConfig.ts +1 -1
- package/dist/src/saveDataToDb.ts +1 -1
- package/dist/src/saveItemStorage.ts +1 -1
- package/dist/src/saveMetadata.ts +1 -1
- package/dist/src/services.ts +1 -1
- package/dist/src/syncDbWithEas.ts +1 -1
- package/dist/src/updateMetadata.ts +1 -1
- package/dist/src/versionData.ts +1 -1
- package/dist/src/waitForDb.ts +19 -18
- package/dist/types/src/browser/db/Db.d.ts +1 -1
- package/dist/types/src/browser/db/Db.d.ts.map +1 -1
- package/dist/types/src/client.d.ts.map +1 -1
- package/dist/types/src/db/Db/BaseDb.d.ts.map +1 -0
- package/dist/types/src/db/Db/index.d.ts +5 -0
- package/dist/types/src/db/Db/index.d.ts.map +1 -0
- package/dist/types/src/node/db/Db.d.ts +1 -1
- package/dist/types/src/node/db/Db.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BAqEY103.js.map +0 -1
- package/dist/index-vIPO_QrC.js.map +0 -1
- package/dist/types/src/db/BaseDb.d.ts.map +0 -1
- /package/dist/types/src/db/{BaseDb.d.ts → Db/BaseDb.d.ts} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { a as BaseDb } from './index-9iAccUrw.js';
|
|
2
|
+
import 'immer';
|
|
3
|
+
import 'reflect-metadata';
|
|
4
|
+
import 'tslib';
|
|
5
|
+
import '@sinclair/typebox';
|
|
6
|
+
import 'xstate';
|
|
7
|
+
import 'rxjs';
|
|
8
|
+
import '@zenfs/core';
|
|
9
|
+
import 'dayjs';
|
|
10
|
+
import 'nanoid';
|
|
11
|
+
import 'nanoid-dictionary';
|
|
12
|
+
import 'debug';
|
|
13
|
+
import './constants-C0HNnrob.js';
|
|
14
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
15
|
+
import 'drizzle-orm/sqlite-core';
|
|
16
|
+
import 'drizzle-orm';
|
|
17
|
+
import 'path';
|
|
18
|
+
import 'react';
|
|
19
|
+
import 'pluralize';
|
|
20
|
+
import 'eventemitter3';
|
|
21
|
+
import 'lodash-es';
|
|
22
|
+
import '@statelyai/inspect';
|
|
23
|
+
import 'drizzle-orm/sqlite-proxy';
|
|
24
|
+
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
25
|
+
import 'drizzle-orm/migrator';
|
|
26
|
+
import 'node:fs';
|
|
27
|
+
import '@zenfs/dom';
|
|
28
|
+
import 'arweave';
|
|
29
|
+
import 'use-immer';
|
|
30
|
+
import '@xstate/react';
|
|
31
|
+
|
|
32
|
+
class Db extends BaseDb {
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Db };
|
|
39
|
+
//# sourceMappingURL=Db-DgE-Lola.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Db-DgE-Lola.js","sources":["../../src/node/db/Db.ts"],"sourcesContent":["import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces\";\n\nexport class Db extends BaseDb implements IDb {\n constructor() {\n super()\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGM,MAAO,EAAG,SAAQ,MAAM,CAAA;AAC5B,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAEV;;;;"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { a as BaseDb, g as getAppDb, i as isAppDbReady, b as getSqliteWasmClient } from './index-9iAccUrw.js';
|
|
2
|
+
import { __awaiter } from 'tslib';
|
|
3
|
+
import debug from 'debug';
|
|
4
|
+
import 'immer';
|
|
5
|
+
import 'reflect-metadata';
|
|
6
|
+
import '@sinclair/typebox';
|
|
7
|
+
import 'xstate';
|
|
8
|
+
import 'rxjs';
|
|
9
|
+
import '@zenfs/core';
|
|
10
|
+
import 'dayjs';
|
|
11
|
+
import 'nanoid';
|
|
12
|
+
import 'nanoid-dictionary';
|
|
13
|
+
import './constants-C0HNnrob.js';
|
|
14
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
15
|
+
import 'drizzle-orm/sqlite-core';
|
|
16
|
+
import 'drizzle-orm';
|
|
17
|
+
import 'path';
|
|
18
|
+
import 'react';
|
|
19
|
+
import 'pluralize';
|
|
20
|
+
import 'eventemitter3';
|
|
21
|
+
import 'lodash-es';
|
|
22
|
+
import '@statelyai/inspect';
|
|
23
|
+
import 'drizzle-orm/sqlite-proxy';
|
|
24
|
+
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
25
|
+
import 'drizzle-orm/migrator';
|
|
26
|
+
import 'node:fs';
|
|
27
|
+
import '@zenfs/dom';
|
|
28
|
+
import 'arweave';
|
|
29
|
+
import 'use-immer';
|
|
30
|
+
import '@xstate/react';
|
|
31
|
+
|
|
32
|
+
class SqliteConnectionManager {
|
|
33
|
+
constructor(sqliteModule, idleTimeout = 300000) {
|
|
34
|
+
// Default idle timeout: 5 minutes
|
|
35
|
+
this.sqliteModule = sqliteModule;
|
|
36
|
+
this.idleTimeout = idleTimeout;
|
|
37
|
+
this.databases = {};
|
|
38
|
+
this.idleTimers = {};
|
|
39
|
+
}
|
|
40
|
+
resetIdleTimer(dbName) {
|
|
41
|
+
if (this.idleTimers[dbName]) {
|
|
42
|
+
clearTimeout(this.idleTimers[dbName]);
|
|
43
|
+
}
|
|
44
|
+
this.idleTimers[dbName] = setTimeout(() => {
|
|
45
|
+
this.closeConnection(dbName);
|
|
46
|
+
}, this.idleTimeout);
|
|
47
|
+
}
|
|
48
|
+
getConnection(dbName) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (this.databases[dbName]) {
|
|
51
|
+
this.resetIdleTimer(dbName);
|
|
52
|
+
return this.databases[dbName];
|
|
53
|
+
}
|
|
54
|
+
const db = new this.sqliteModule();
|
|
55
|
+
yield db.open(dbName);
|
|
56
|
+
this.databases[dbName] = db;
|
|
57
|
+
this.resetIdleTimer(dbName);
|
|
58
|
+
return db;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
execute(dbName_1, sql_1) {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* (dbName, sql, params = []) {
|
|
63
|
+
const db = yield this.getConnection(dbName);
|
|
64
|
+
const result = db.exec(sql, params);
|
|
65
|
+
this.resetIdleTimer(dbName);
|
|
66
|
+
return result;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
closeConnection(dbName) {
|
|
70
|
+
if (this.databases[dbName]) {
|
|
71
|
+
this.databases[dbName].close();
|
|
72
|
+
delete this.databases[dbName];
|
|
73
|
+
if (this.idleTimers[dbName]) {
|
|
74
|
+
clearTimeout(this.idleTimers[dbName]);
|
|
75
|
+
delete this.idleTimers[dbName];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const logger = debug('app:browser:db:Db');
|
|
82
|
+
class Db extends BaseDb {
|
|
83
|
+
constructor() {
|
|
84
|
+
super();
|
|
85
|
+
}
|
|
86
|
+
static getAppDb() {
|
|
87
|
+
return getAppDb();
|
|
88
|
+
}
|
|
89
|
+
static isAppDbReady() {
|
|
90
|
+
return isAppDbReady();
|
|
91
|
+
}
|
|
92
|
+
static prepareDb() {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const interval = setInterval(() => {
|
|
95
|
+
// TODO: Add a timeout
|
|
96
|
+
// TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome
|
|
97
|
+
getSqliteWasmClient().then((sqliteWasmClient) => {
|
|
98
|
+
if (sqliteWasmClient) {
|
|
99
|
+
clearInterval(interval);
|
|
100
|
+
const manager = new SqliteConnectionManager(sqliteWasmClient);
|
|
101
|
+
resolve(manager);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}, 200);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
static connectToDb(pathToDir, dbName) {
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
const interval = setInterval(() => {
|
|
110
|
+
// TODO: Add a timeout
|
|
111
|
+
// TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome
|
|
112
|
+
getSqliteWasmClient().then((sqliteWasmClient) => {
|
|
113
|
+
//@ts-ignore
|
|
114
|
+
sqliteWasmClient('config-get', {}).then((response) => {
|
|
115
|
+
logger(response);
|
|
116
|
+
logger('Running SQLite3 version', response.result.version.libVersion);
|
|
117
|
+
//@ts-ignore
|
|
118
|
+
sqliteWasmClient('open', {
|
|
119
|
+
filename: `file:${pathToDir}/db/${dbName}.sqlite3?vfs=opfs`,
|
|
120
|
+
}).then((response) => {
|
|
121
|
+
logger(response);
|
|
122
|
+
const dbId = response.dbId;
|
|
123
|
+
logger('OPFS is available, created persisted database at', response.result.filename.replace(/^file:(.*?)\?vfs=opfs$/, '$1'));
|
|
124
|
+
if (dbId) {
|
|
125
|
+
clearInterval(interval);
|
|
126
|
+
resolve(dbId);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}, 500);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
BaseDb.setPlatformClass(Db);
|
|
136
|
+
|
|
137
|
+
export { Db };
|
|
138
|
+
//# sourceMappingURL=Db-DoBRA_OH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Db-DoBRA_OH.js","sources":["../../src/services/db/connectionManager.ts","../../src/browser/db/Db.ts"],"sourcesContent":["type SqliteDatabase = {\n open: (filename: string) => Promise<void>\n exec: (sql: string, params?: any[]) => any\n close: () => void\n}\n\nclass SqliteConnectionManager {\n private sqliteModule: SqliteDatabase\n private idleTimeout: number\n private databases: { [key: string]: SqliteDatabase }\n private idleTimers: { [key: string]: NodeJS.Timeout }\n\n constructor(sqliteModule: SqliteDatabase, idleTimeout: number = 300000) {\n // Default idle timeout: 5 minutes\n this.sqliteModule = sqliteModule\n this.idleTimeout = idleTimeout\n this.databases = {}\n this.idleTimers = {}\n }\n\n private resetIdleTimer(dbName: string): void {\n if (this.idleTimers[dbName]) {\n clearTimeout(this.idleTimers[dbName])\n }\n\n this.idleTimers[dbName] = setTimeout(() => {\n this.closeConnection(dbName)\n }, this.idleTimeout)\n }\n\n private async getConnection(dbName: string): Promise<SqliteDatabase> {\n if (this.databases[dbName]) {\n this.resetIdleTimer(dbName)\n return this.databases[dbName]\n }\n\n const db = new this.sqliteModule()\n await db.open(dbName)\n this.databases[dbName] = db\n this.resetIdleTimer(dbName)\n return db\n }\n\n public async execute(\n dbName: string,\n sql: string,\n params: any[] = [],\n ): Promise<any> {\n const db = await this.getConnection(dbName)\n const result = db.exec(sql, params)\n this.resetIdleTimer(dbName)\n return result\n }\n\n public closeConnection(dbName: string): void {\n if (this.databases[dbName]) {\n this.databases[dbName].close()\n delete this.databases[dbName]\n if (this.idleTimers[dbName]) {\n clearTimeout(this.idleTimers[dbName])\n delete this.idleTimers[dbName]\n }\n }\n }\n}\n\nexport { SqliteConnectionManager }\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces/IDb\";\nimport { getAppDb, getSqliteWasmClient, isAppDbReady } from \"./sqlWasmClient\";\nimport { SqliteConnectionManager } from \"@/services/db\";\nimport debug from \"debug\";\n\nconst logger = debug('app:browser:db:Db')\n\nclass Db extends BaseDb implements IDb {\n constructor() {\n super()\n }\n\n static getAppDb() {\n return getAppDb()\n }\n\n static isAppDbReady() {\n return isAppDbReady()\n }\n\n static prepareDb() {\n\n return new Promise((resolve, reject) => {\n let sqliteWasmClient\n const interval = setInterval(() => {\n // TODO: Add a timeout\n // TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome\n getSqliteWasmClient().then((sqliteWasmClient) => {\n\n if (sqliteWasmClient) {\n clearInterval(interval)\n const manager = new SqliteConnectionManager(sqliteWasmClient)\n resolve(manager)\n }\n })\n\n }, 200)\n })\n }\n\n static connectToDb(pathToDir: string, dbName: string) {\n\n return new Promise((resolve, reject) => {\n const interval = setInterval(() => {\n\n // TODO: Add a timeout\n // TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome\n getSqliteWasmClient().then((sqliteWasmClient) => {\n\n //@ts-ignore\n sqliteWasmClient('config-get', {}).then((response) => {\n logger(response)\n logger('Running SQLite3 version', response.result.version.libVersion)\n\n //@ts-ignore\n sqliteWasmClient('open', {\n filename: `file:${pathToDir}/db/${dbName}.sqlite3?vfs=opfs`,\n }).then((response: { dbId: string, result: { filename: string } }) => {\n\n logger(response)\n const dbId = response.dbId\n logger(\n 'OPFS is available, created persisted database at',\n response.result.filename.replace(/^file:(.*?)\\?vfs=opfs$/, '$1'),\n )\n\n if (dbId) {\n clearInterval(interval)\n resolve(dbId)\n }\n })\n })\n })\n }, 500)\n })\n }\n}\n\nBaseDb.setPlatformClass(Db)\n\nexport { Db }"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,CAAA;IAM3B,WAAY,CAAA,YAA4B,EAAE,WAAA,GAAsB,MAAM,EAAA;;AAEpE,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY;AAChC,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;AAC9B,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE;AACnB,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE;;AAGd,IAAA,cAAc,CAAC,MAAc,EAAA;AACnC,QAAA,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC3B,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;;QAGvC,IAAI,CAAC,UAAU,CAAC,MAA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B,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;;wBAGrE,gBAAgB,CAAC,MAAM,EAAE;AACvB,4BAAA,QAAQ,EAAE,CAAA,KAAA,EAAQ,SAAS,CAAA,IAAA,EAAO,MAAM,CAAmB,iBAAA,CAAA;AAC5D,yBAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAwD,KAAI;4BAEnE,MAAM,CAAC,QAAQ,CAAC;AAChB,4BAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI;AAC1B,4BAAA,MAAM,CACJ,kDAAkD,EAClD,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CACjE;4BAED,IAAI,IAAI,EAAE;gCACR,aAAa,CAAC,QAAQ,CAAC;gCACvB,OAAO,CAAC,IAAI,CAAC;;AAEjB,yBAAC,CAAC;AACJ,qBAAC,CAAC;AACJ,iBAAC,CAAC;aACH,EAAE,GAAG,CAAC;AACT,SAAC,CAAC;;AAEL;AAED,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseItem } from './index-
|
|
1
|
+
import { B as BaseItem } from './index-9iAccUrw.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import 'tslib';
|
|
@@ -37,4 +37,4 @@ class Item extends BaseItem {
|
|
|
37
37
|
BaseItem.setPlatformClass(Item);
|
|
38
38
|
|
|
39
39
|
export { Item };
|
|
40
|
-
//# sourceMappingURL=Item-
|
|
40
|
+
//# sourceMappingURL=Item-DxpfLjF9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item-
|
|
1
|
+
{"version":3,"file":"Item-DxpfLjF9.js","sources":["../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: any) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAAkB,EAAA;QAC5B,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
|
|
@@ -1262,7 +1262,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1262
1262
|
if (propertyRecordSchema &&
|
|
1263
1263
|
propertyRecordSchema.storageType &&
|
|
1264
1264
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
1265
|
-
const { Item } = yield import('./index-
|
|
1265
|
+
const { Item } = yield import('./index-gd_7iXhC.js');
|
|
1266
1266
|
const item = yield Item.find({
|
|
1267
1267
|
seedLocalId,
|
|
1268
1268
|
modelName,
|
|
@@ -1364,6 +1364,9 @@ const getAppDb = () => {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
return appDb;
|
|
1366
1366
|
};
|
|
1367
|
+
const isAppDbReady = () => {
|
|
1368
|
+
return !!appDb;
|
|
1369
|
+
};
|
|
1367
1370
|
const runQueryForStatement = (statement) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1368
1371
|
const appDb = getAppDb();
|
|
1369
1372
|
return appDb.run(sql.raw(statement));
|
|
@@ -2213,7 +2216,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2213
2216
|
if (!models$1) {
|
|
2214
2217
|
return;
|
|
2215
2218
|
}
|
|
2216
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2219
|
+
const { models: SeedModels } = yield import('./seed.schema.config-DaIalFhy.js');
|
|
2217
2220
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2218
2221
|
let hasModelsInDb = false;
|
|
2219
2222
|
const schemaDefsByModelName = new Map();
|
|
@@ -7980,7 +7983,7 @@ const initItem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
7980
7983
|
(yield Promise.resolve().then(function () { return Item$1; })).Item;
|
|
7981
7984
|
}
|
|
7982
7985
|
else {
|
|
7983
|
-
(yield import('./Item-
|
|
7986
|
+
(yield import('./Item-DxpfLjF9.js')).Item;
|
|
7984
7987
|
}
|
|
7985
7988
|
});
|
|
7986
7989
|
|
|
@@ -8020,6 +8023,15 @@ const initFileManager = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
8020
8023
|
}
|
|
8021
8024
|
});
|
|
8022
8025
|
|
|
8026
|
+
const initDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8027
|
+
if (typeof window !== 'undefined') {
|
|
8028
|
+
(yield import('./Db-DoBRA_OH.js')).Db;
|
|
8029
|
+
}
|
|
8030
|
+
else {
|
|
8031
|
+
(yield import('./Db-DgE-Lola.js')).Db;
|
|
8032
|
+
}
|
|
8033
|
+
});
|
|
8034
|
+
|
|
8023
8035
|
const client = {
|
|
8024
8036
|
init: (_a) => __awaiter(void 0, [_a], void 0, function* ({ config, addresses }) {
|
|
8025
8037
|
yield initItem();
|
|
@@ -8027,6 +8039,7 @@ const client = {
|
|
|
8027
8039
|
yield initEasClient();
|
|
8028
8040
|
yield initQueryClient();
|
|
8029
8041
|
yield initFileManager();
|
|
8042
|
+
yield initDb();
|
|
8030
8043
|
const { endpoints, models, arweaveDomain } = config;
|
|
8031
8044
|
if (arweaveDomain) {
|
|
8032
8045
|
setArweaveDomain(arweaveDomain);
|
|
@@ -8051,7 +8064,7 @@ const client = {
|
|
|
8051
8064
|
addresses,
|
|
8052
8065
|
arweaveDomain,
|
|
8053
8066
|
});
|
|
8054
|
-
const { models: internalModels } = yield import('./seed.schema.config-
|
|
8067
|
+
const { models: internalModels } = yield import('./seed.schema.config-DaIalFhy.js');
|
|
8055
8068
|
for (const [key, value] of Object.entries(internalModels)) {
|
|
8056
8069
|
setModel(key, value);
|
|
8057
8070
|
}
|
|
@@ -8101,5 +8114,5 @@ const client = {
|
|
|
8101
8114
|
|
|
8102
8115
|
enableMapSet();
|
|
8103
8116
|
|
|
8104
|
-
export { BaseItem as B, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T,
|
|
8105
|
-
//# sourceMappingURL=index-
|
|
8117
|
+
export { BaseItem as B, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, BaseDb as a, getSqliteWasmClient as b, ImageSrc as c, ItemProperty as d, useItem as e, useItemProperties as f, getAppDb as g, useCreateItem as h, isAppDbReady as i, useItemProperty as j, useDeleteItem as k, useGlobalServiceStatus as l, useServices as m, getGlobalService as n, getCorrectId as o, eventEmitter as p, client as q, useItems as u, withSeed as w };
|
|
8118
|
+
//# sourceMappingURL=index-9iAccUrw.js.map
|