@seedprotocol/sdk 0.2.25 → 0.2.27
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-CKu619ns.js → Db-BXj7xeIK.js} +2 -2
- package/dist/{Db-CKu619ns.js.map → Db-BXj7xeIK.js.map} +1 -1
- package/dist/{Db-ClRDgyEs.js → Db-Dk-X1anD.js} +2 -2
- package/dist/{Db-ClRDgyEs.js.map → Db-Dk-X1anD.js.map} +1 -1
- package/dist/{FileManager-BGej9rn4.js → FileManager-D-yaDuSt.js} +12 -2
- package/dist/FileManager-D-yaDuSt.js.map +1 -0
- package/dist/{Item-C2YmSK8u.js → Item-DXgQOWw4.js} +2 -2
- package/dist/{Item-C2YmSK8u.js.map → Item-DXgQOWw4.js.map} +1 -1
- package/dist/{ItemProperty-paRxkEyi.js → ItemProperty-Dmpm-jKr.js} +2 -2
- package/dist/{ItemProperty-paRxkEyi.js.map → ItemProperty-Dmpm-jKr.js.map} +1 -1
- package/dist/{index-CvbP69-W.js → index-CreT8SAL.js} +16 -16
- package/dist/index-CreT8SAL.js.map +1 -0
- package/dist/{index-nUutMqms.js → index-hIQeW9Wa.js} +2 -2
- package/dist/index-hIQeW9Wa.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-DKZ-EtdB.js → seed.schema.config-CVCqLN-b.js} +2 -2
- package/dist/{seed.schema.config-DKZ-EtdB.js.map → seed.schema.config-CVCqLN-b.js.map} +1 -1
- package/dist/src/configureFs.ts +2 -2
- package/dist/src/getPublishPayload.ts +3 -3
- package/dist/src/helpers.ts +4 -4
- package/dist/src/saveImageSrc.ts +0 -15
- package/dist/types/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts +1 -0
- package/dist/types/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/FileManager-BGej9rn4.js.map +0 -1
- package/dist/index-CvbP69-W.js.map +0 -1
- package/dist/index-nUutMqms.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import { b as BaseDb } from './index-
|
|
2
|
+
import { b as BaseDb } from './index-CreT8SAL.js';
|
|
3
3
|
import { defineConfig } from 'drizzle-kit';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
import process from 'node:process';
|
|
@@ -111,4 +111,4 @@ class Db extends BaseDb {
|
|
|
111
111
|
BaseDb.setPlatformClass(Db);
|
|
112
112
|
|
|
113
113
|
export { Db };
|
|
114
|
-
//# sourceMappingURL=Db-
|
|
114
|
+
//# sourceMappingURL=Db-BXj7xeIK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db-
|
|
1
|
+
{"version":3,"file":"Db-BXj7xeIK.js","sources":["../../src/node/db/node.app.db.config.ts","../../src/node/db/Db.ts"],"sourcesContent":["import { defineConfig } from 'drizzle-kit'\nimport dotenv from 'dotenv'\nimport process from 'node:process'\nimport path from 'path'\nimport { DrizzleConfig } from 'drizzle-orm'\n\ndotenv.config()\n\nlet sdkRoot = './node_modules/@seedprotocol/sdk'\n\nif (process.env.IS_SEED_DEV) {\n sdkRoot = './src'\n}\n\nlet dotSeedDir = path.join(process.cwd(), '.seed')\n\nif (process.env.IS_SEED_DEV) {\n dotSeedDir = path.join(\n process.cwd(),\n '__tests__',\n '__mocks__',\n 'browser',\n 'project',\n '.seed',\n )\n}\n\nlet schemaDir = `${sdkRoot}/dist/seedSchema/*.ts`\n\nif (process.env.IS_SEED_DEV) {\n schemaDir = `${sdkRoot}/seedSchema/*.ts`\n}\n\nexport default defineConfig({\n schema: schemaDir,\n dialect: 'sqlite',\n out: `${dotSeedDir}/db`,\n dbCredentials: {\n url: `${dotSeedDir}/db/app_db.sqlite3`,\n },\n}) as DrizzleConfig\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces\";\nimport nodeAppDbConfig from \"./node.app.db.config\";\nimport { drizzle } from \"drizzle-orm/better-sqlite3\";\nimport { defineConfig, } from \"drizzle-kit\";\nimport path from \"path\";\nimport { DrizzleConfig, } from \"drizzle-orm\";\nimport Database from \"better-sqlite3\";\n\nconst getConfig = (filesDir: string) => {\n\n const dotSeedDir = path.join(filesDir, '.seed')\n let schemaDir = `${dotSeedDir}/schema/*Schema.ts`\n\n const nodeDbConfig = defineConfig({\n schema: schemaDir,\n dialect: 'sqlite',\n out: `${dotSeedDir}/db`,\n dbCredentials: {\n url: `${dotSeedDir}/db/app_db.sqlite3`,\n }\n }) as DrizzleConfig & { dbCredentials: { url: string } }\n\n return nodeDbConfig\n}\n\nclass Db extends BaseDb implements IDb {\n constructor() {\n super()\n }\n\n static getAppDb() {\n return drizzle(nodeAppDbConfig)\n }\n\n static isAppDbReady() {\n return true\n }\n\n static async prepareDb(filesDir: string) {\n const nodeDbConfig = getConfig(filesDir)\n\n let db\n\n try {\n db = drizzle(nodeDbConfig)\n } catch (error) {\n console.error(error)\n }\n\n try {\n const client = new Database(nodeDbConfig.dbCredentials.url)\n db = drizzle({ client })\n } catch (error) {\n console.error(error)\n }\n\n return db\n }\n\n static async connectToDb(pathToDir: string, dbName: string) {\n\n const nodeDbConfig = getConfig(pathToDir)\n\n return {\n id: drizzle(nodeDbConfig).$client.name\n }\n }\n}\n\nBaseDb.setPlatformClass(Db)\n\nexport { Db }"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,CAAC,MAAM,EAAE;AAEf,IAAI,OAAO,GAAG,kCAAkC;AAEhD,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;IAC3B,OAAO,GAAG,OAAO;AACnB;AAEA,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC;AAElD,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;IAC3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;IAGb,OAAa,SAAS,CAAC,QAAgB,EAAA;;AACrC,YAAA,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC;AAExC,YAAA,IAAI,EAAE;AAEN,YAAA,IAAI;AACF,gBAAA,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;;YAC1B,OAAO,KAAK,EAAE;AACd,gBAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;;AAGtB,YAAA,IAAI;gBACF,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC;AAC3D,gBAAA,EAAE,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;;YACxB,OAAO,KAAK,EAAE;AACd,gBAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;;AAGtB,YAAA,OAAO,EAAE;SACV,CAAA;AAAA;AAED,IAAA,OAAa,WAAW,CAAC,SAAiB,EAAE,MAAc,EAAA;;AAExD,YAAA,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC;YAEzC,OAAO;gBACL,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;aACnC;SACF,CAAA;AAAA;AACF;AAED,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as BaseDb, g as getAppDb, i as isAppDbReady, c as getSqliteWasmClient } from './index-
|
|
1
|
+
import { b as BaseDb, g as getAppDb, i as isAppDbReady, c as getSqliteWasmClient } from './index-CreT8SAL.js';
|
|
2
2
|
import { __awaiter } from 'tslib';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import 'immer';
|
|
@@ -135,4 +135,4 @@ class Db extends BaseDb {
|
|
|
135
135
|
BaseDb.setPlatformClass(Db);
|
|
136
136
|
|
|
137
137
|
export { Db };
|
|
138
|
-
//# sourceMappingURL=Db-
|
|
138
|
+
//# sourceMappingURL=Db-Dk-X1anD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db-
|
|
1
|
+
{"version":3,"file":"Db-Dk-X1anD.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(filesDir: string) {\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,IA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AAM,KAAI;AACrC,YAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAK;;;AAIhC,gBAAA,mBAAmB,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAI;;oBAG9C,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;wBACnD,MAAM,CAAC,QAAQ,CAAC;wBAChB,MAAM,CAAC,yBAAyB,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,18 +1,28 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { b as BaseFileManager } from './constants-CuI_qYXt.js';
|
|
3
|
+
import { fs } from '@zenfs/core';
|
|
3
4
|
import '@ethereum-attestation-service/eas-sdk';
|
|
4
5
|
|
|
5
6
|
class FileManager extends BaseFileManager {
|
|
6
7
|
static readFileAsBuffer(filePath) {
|
|
7
8
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8
|
-
// Implement browser-specific logic
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
reject(new Error('Not implemented'));
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
+
static getContentUrlFromPath(path) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const fileExists = yield fs.promises.exists(path);
|
|
17
|
+
if (fileExists) {
|
|
18
|
+
const fileContents = yield fs.promises.readFile(path);
|
|
19
|
+
const fileHandler = new File([fileContents], path);
|
|
20
|
+
return URL.createObjectURL(fileHandler);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
14
24
|
}
|
|
15
25
|
BaseFileManager.setPlatformClass(FileManager);
|
|
16
26
|
|
|
17
27
|
export { FileManager };
|
|
18
|
-
//# sourceMappingURL=FileManager-
|
|
28
|
+
//# sourceMappingURL=FileManager-D-yaDuSt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileManager-D-yaDuSt.js","sources":["../../src/browser/helpers/FileManager.ts"],"sourcesContent":["import { BaseFileManager } from \"@/helpers/FileManager/BaseFileManager\";\nimport { fs } from \"@zenfs/core\";\nclass FileManager extends BaseFileManager {\n static async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return new Promise((resolve, reject) => {\n reject(new Error('Not implemented'));\n });\n }\n\n static async getContentUrlFromPath(path: string): Promise<string | undefined> {\n const fileExists = await fs.promises.exists(\n path,\n )\n if (fileExists) {\n const fileContents = await fs.promises.readFile(\n path,\n )\n const fileHandler = new File([fileContents], path)\n return URL.createObjectURL(fileHandler)\n }\n }\n}\n\nBaseFileManager.setPlatformClass(FileManager);\n\nexport { FileManager };\n"],"names":[],"mappings":";;;;;AAEA,MAAM,WAAY,SAAQ,eAAe,CAAA;IACvC,OAAa,gBAAgB,CAAC,QAAgB,EAAA;;YAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,gBAAA,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACtC,aAAC,CAAC;SACH,CAAA;AAAA;IAED,OAAa,qBAAqB,CAAC,IAAY,EAAA;;YAC7C,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CACzC,IAAI,CACL;YACD,IAAI,UAAU,EAAE;gBACd,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAC7C,IAAI,CACL;gBACD,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;AAClD,gBAAA,OAAO,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;;SAE1C,CAAA;AAAA;AACF;AAED,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseItem } from './index-
|
|
1
|
+
import { B as BaseItem } from './index-CreT8SAL.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-DXgQOWw4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item-
|
|
1
|
+
{"version":3,"file":"Item-DXgQOWw4.js","sources":["../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues, NewItemProps } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: NewItemProps<T>) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAA8B,EAAA;QACxC,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BaseItemProperty } from './index-
|
|
1
|
+
import { a as BaseItemProperty } from './index-CreT8SAL.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import 'tslib';
|
|
@@ -36,4 +36,4 @@ class ItemProperty extends BaseItemProperty {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { ItemProperty };
|
|
39
|
-
//# sourceMappingURL=ItemProperty-
|
|
39
|
+
//# sourceMappingURL=ItemProperty-Dmpm-jKr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemProperty-
|
|
1
|
+
{"version":3,"file":"ItemProperty-Dmpm-jKr.js","sources":["../../src/node/ItemProperty/ItemProperty.ts"],"sourcesContent":["import { IItemProperty } from '@/interfaces'\nimport { BaseItemProperty } from '@/ItemProperty/BaseItemProperty'\nimport { CreatePropertyInstanceProps, ModelSchema, ModelValues, } from '@/types'\n\nexport class ItemProperty<PropertyType> extends BaseItemProperty<PropertyType> implements IItemProperty<PropertyType> {\n constructor(initialValues: Partial<CreatePropertyInstanceProps>) {\n super(initialValues)\n }\n}"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,YAA2B,SAAQ,gBAA8B,CAAA;AAC5E,IAAA,WAAA,CAAY,aAAmD,EAAA;QAC7D,KAAK,CAAC,aAAa,CAAC;;AAEvB;;;;"}
|
|
@@ -134,7 +134,7 @@ const initItem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
134
134
|
Item$2 = (yield Promise.resolve().then(function () { return Item$1; })).Item;
|
|
135
135
|
}
|
|
136
136
|
if (!isBrowser()) {
|
|
137
|
-
Item$2 = (yield import('./Item-
|
|
137
|
+
Item$2 = (yield import('./Item-DXgQOWw4.js')).Item;
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -184,17 +184,17 @@ const initItemProperty = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
184
184
|
ItemProperty$2 = (yield Promise.resolve().then(function () { return ItemProperty$1; })).ItemProperty;
|
|
185
185
|
}
|
|
186
186
|
if (!isBrowser()) {
|
|
187
|
-
ItemProperty$2 = (yield import('./ItemProperty-
|
|
187
|
+
ItemProperty$2 = (yield import('./ItemProperty-Dmpm-jKr.js')).ItemProperty;
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
let Db;
|
|
192
192
|
const initDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
193
|
if (isBrowser()) {
|
|
194
|
-
Db = (yield import('./Db-
|
|
194
|
+
Db = (yield import('./Db-Dk-X1anD.js')).Db;
|
|
195
195
|
}
|
|
196
196
|
if (!isBrowser()) {
|
|
197
|
-
Db = (yield import('./Db-
|
|
197
|
+
Db = (yield import('./Db-BXj7xeIK.js')).Db;
|
|
198
198
|
}
|
|
199
199
|
// TODO: Add config for React Native
|
|
200
200
|
});
|
|
@@ -1696,7 +1696,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1696
1696
|
if (!models$1) {
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
1699
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CVCqLN-b.js');
|
|
1700
1700
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
1701
1701
|
let hasModelsInDb = false;
|
|
1702
1702
|
const schemaDefsByModelName = new Map();
|
|
@@ -2441,17 +2441,17 @@ const fetchDirectory = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
2441
2441
|
return response.json();
|
|
2442
2442
|
});
|
|
2443
2443
|
const fetchFilesRecursively = (url, localPath, fileList) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2444
|
-
|
|
2445
|
-
|
|
2444
|
+
for (const file of fileList) {
|
|
2445
|
+
try {
|
|
2446
2446
|
const fileUrl = `${url}/${file}`;
|
|
2447
2447
|
const fileLocalPath = path.join(localPath, file);
|
|
2448
2448
|
// logger(`[fetchFilesRecursively] fileUrl: ${fileUrl}`)
|
|
2449
2449
|
// logger(`[fetchFilesRecursively] fileLocalPath: ${fileLocalPath}`)
|
|
2450
2450
|
yield downloadFile(fileUrl, fileLocalPath);
|
|
2451
2451
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2452
|
+
catch (error) {
|
|
2453
|
+
console.error(`Failed to fetch files from ${url}:`, error);
|
|
2454
|
+
}
|
|
2455
2455
|
}
|
|
2456
2456
|
});
|
|
2457
2457
|
const confirmFilesExist = (filePaths) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -2911,7 +2911,7 @@ const isFsInitialized = () => {
|
|
|
2911
2911
|
|
|
2912
2912
|
const logger$f = debug('app:internal:actors:configureFs');
|
|
2913
2913
|
const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
2914
|
-
const { endpoints, appDbService } = context;
|
|
2914
|
+
const { endpoints, appDbService, filesDir, } = context;
|
|
2915
2915
|
logger$f('[internal/actors] [configureFs] Configuring FS');
|
|
2916
2916
|
const _configureFs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2917
2917
|
logger$f('[internal/actors] [configureFs] calling _configureFs');
|
|
@@ -2926,7 +2926,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2926
2926
|
eventLabel: 'fs.downloadAll.success',
|
|
2927
2927
|
},
|
|
2928
2928
|
});
|
|
2929
|
-
const journalPath = `${BROWSER_FS_TOP_DIR}/db/meta/_journal.json`;
|
|
2929
|
+
const journalPath = `${filesDir || BROWSER_FS_TOP_DIR}/db/meta/_journal.json`;
|
|
2930
2930
|
const journalExists = yield fs.promises.exists(journalPath);
|
|
2931
2931
|
if (journalExists) {
|
|
2932
2932
|
appDbService.send({ type: DB_WAITING_FOR_FILES_RECEIVED });
|
|
@@ -5517,7 +5517,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5517
5517
|
if (propertyRecordSchema &&
|
|
5518
5518
|
propertyRecordSchema.storageType &&
|
|
5519
5519
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
5520
|
-
const { Item } = yield import('./index-
|
|
5520
|
+
const { Item } = yield import('./index-hIQeW9Wa.js');
|
|
5521
5521
|
const item = yield Item.find({
|
|
5522
5522
|
seedLocalId,
|
|
5523
5523
|
modelName,
|
|
@@ -8105,7 +8105,7 @@ const initQueryClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
8105
8105
|
|
|
8106
8106
|
const initFileManager = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8107
8107
|
if (isBrowser()) {
|
|
8108
|
-
(yield import('./FileManager-
|
|
8108
|
+
(yield import('./FileManager-D-yaDuSt.js')).FileManager;
|
|
8109
8109
|
}
|
|
8110
8110
|
if (!isBrowser()) {
|
|
8111
8111
|
(yield import('./FileManager-CYXquukS.js')).FileManager;
|
|
@@ -8146,7 +8146,7 @@ const client = {
|
|
|
8146
8146
|
arweaveDomain,
|
|
8147
8147
|
filesDir,
|
|
8148
8148
|
});
|
|
8149
|
-
const { models: internalModels } = yield import('./seed.schema.config-
|
|
8149
|
+
const { models: internalModels } = yield import('./seed.schema.config-CVCqLN-b.js');
|
|
8150
8150
|
for (const [key, value] of Object.entries(internalModels)) {
|
|
8151
8151
|
setModel(key, value);
|
|
8152
8152
|
}
|
|
@@ -8194,4 +8194,4 @@ const client = {
|
|
|
8194
8194
|
enableMapSet();
|
|
8195
8195
|
|
|
8196
8196
|
export { BaseItem as B, Db as D, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, BaseItemProperty as a, BaseDb as b, getSqliteWasmClient as c, ImageSrc as d, Item$2 as e, ItemProperty$2 as f, getAppDb as g, useItem as h, isAppDbReady as i, useItemProperties as j, useCreateItem as k, useItemProperty as l, useDeleteItem as m, useGlobalServiceStatus as n, usePublishItem as o, usePersistedSnapshots as p, useServices as q, useService as r, getCorrectId as s, getGlobalService as t, useItems as u, eventEmitter as v, withSeed as w, client as x };
|
|
8197
|
-
//# sourceMappingURL=index-
|
|
8197
|
+
//# sourceMappingURL=index-CreT8SAL.js.map
|