@seedprotocol/sdk 0.7.7-next.988.g7046e66 → 0.7.7
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/{ClientManager-DdqRofK6.js → ClientManager-2GtDWHq6.js} +21 -21
- package/dist/{ClientManager-DdqRofK6.js.map → ClientManager-2GtDWHq6.js.map} +1 -1
- package/dist/{Item-DmK1PgK9.js → Item-D6j0IvBP.js} +53 -53
- package/dist/{Item-DmK1PgK9.js.map → Item-D6j0IvBP.js.map} +1 -1
- package/dist/{ModelProperty-DaJAII87.js → ModelProperty-B52C3CQ2.js} +26 -26
- package/dist/{ModelProperty-DaJAII87.js.map → ModelProperty-B52C3CQ2.js.map} +1 -1
- package/dist/{Schema-DhlbBQs8.js → Schema-O1QLoXv6.js} +31 -31
- package/dist/{Schema-DhlbBQs8.js.map → Schema-O1QLoXv6.js.map} +1 -1
- package/dist/{SchemaValidationService-9KHQAYQ4.js → SchemaValidationService-BxCbfDaI.js} +6 -6
- package/dist/{SchemaValidationService-9KHQAYQ4.js.map → SchemaValidationService-BxCbfDaI.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-qoVxUEEl.js → backfillMetadataPropertyIds-CzSbuucw.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-qoVxUEEl.js.map → backfillMetadataPropertyIds-CzSbuucw.js.map} +1 -1
- package/dist/{configurePlatform-CazqABrK.js → configurePlatform-Bbpw_R4y.js} +2 -2
- package/dist/{configurePlatform-CazqABrK.js.map → configurePlatform-Bbpw_R4y.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-yatbnC27.js → detachRowsBeforeDelete-D1TyEMco.js} +2 -2
- package/dist/{detachRowsBeforeDelete-yatbnC27.js.map → detachRowsBeforeDelete-D1TyEMco.js.map} +1 -1
- package/dist/{discardNewDraft-q1krLqtL.js → discardNewDraft-hiVaUVjV.js} +5 -5
- package/dist/{discardNewDraft-q1krLqtL.js.map → discardNewDraft-hiVaUVjV.js.map} +1 -1
- package/dist/dist/{ClientManager-DdqRofK6.d.ts → ClientManager-2GtDWHq6.d.ts} +1 -1
- package/dist/dist/{ClientManager-DdqRofK6.d.ts.map → ClientManager-2GtDWHq6.d.ts.map} +1 -1
- package/dist/dist/{Item-DmK1PgK9.d.ts → Item-D6j0IvBP.d.ts} +1 -1
- package/dist/dist/{Item-DmK1PgK9.d.ts.map → Item-D6j0IvBP.d.ts.map} +1 -1
- package/dist/dist/{ModelProperty-DaJAII87.d.ts → ModelProperty-B52C3CQ2.d.ts} +1 -1
- package/dist/dist/{ModelProperty-DaJAII87.d.ts.map → ModelProperty-B52C3CQ2.d.ts.map} +1 -1
- package/dist/dist/{Schema-DhlbBQs8.d.ts → Schema-O1QLoXv6.d.ts} +1 -1
- package/dist/dist/{Schema-DhlbBQs8.d.ts.map → Schema-O1QLoXv6.d.ts.map} +1 -1
- package/dist/dist/{SchemaValidationService-9KHQAYQ4.d.ts → SchemaValidationService-BxCbfDaI.d.ts} +1 -1
- package/dist/dist/{SchemaValidationService-9KHQAYQ4.d.ts.map → SchemaValidationService-BxCbfDaI.d.ts.map} +1 -1
- package/dist/dist/{backfillMetadataPropertyIds-qoVxUEEl.d.ts → backfillMetadataPropertyIds-CzSbuucw.d.ts} +1 -1
- package/dist/dist/backfillMetadataPropertyIds-CzSbuucw.d.ts.map +1 -0
- package/dist/dist/{configurePlatform-CazqABrK.d.ts → configurePlatform-Bbpw_R4y.d.ts} +1 -1
- package/dist/dist/configurePlatform-Bbpw_R4y.d.ts.map +1 -0
- package/dist/dist/{detachRowsBeforeDelete-yatbnC27.d.ts → detachRowsBeforeDelete-D1TyEMco.d.ts} +1 -1
- package/dist/dist/detachRowsBeforeDelete-D1TyEMco.d.ts.map +1 -0
- package/dist/dist/{discardNewDraft-q1krLqtL.d.ts → discardNewDraft-hiVaUVjV.d.ts} +1 -1
- package/dist/dist/discardNewDraft-hiVaUVjV.d.ts.map +1 -0
- package/dist/dist/{eas-CPYt-QVJ.d.ts → eas-DOdj-EMK.d.ts} +1 -1
- package/dist/dist/eas-DOdj-EMK.d.ts.map +1 -0
- package/dist/dist/{errors-DuFqGrjo.d.ts → errors-KM-yq2MD.d.ts} +1 -1
- package/dist/dist/{errors-DuFqGrjo.d.ts.map → errors-KM-yq2MD.d.ts.map} +1 -1
- package/dist/dist/{getItem-DPapr9uy.d.ts → getItem-Bh0zv-o1.d.ts} +1 -1
- package/dist/dist/getItem-Bh0zv-o1.d.ts.map +1 -0
- package/dist/dist/{getPublishPayload-Dnv38ZW1.d.ts → getPublishPayload-oH8wJhnH.d.ts} +1 -1
- package/dist/dist/{getPublishPayload-Dnv38ZW1.d.ts.map → getPublishPayload-oH8wJhnH.d.ts.map} +1 -1
- package/dist/dist/{getPublishUploads-Dd7dCxNi.d.ts → getPublishUploads-Cex-NBe6.d.ts} +1 -1
- package/dist/dist/{getPublishUploads-Dd7dCxNi.d.ts.map → getPublishUploads-Cex-NBe6.d.ts.map} +1 -1
- package/dist/dist/{index-CTidoFhC.d.ts → index-BAao3_Po.d.ts} +5 -5
- package/dist/dist/index-BAao3_Po.d.ts.map +1 -0
- package/dist/dist/{index-PnK3Ak9Z.d.ts → index-BbFwftAv.d.ts} +1 -1
- package/dist/dist/{index-PnK3Ak9Z.d.ts.map → index-BbFwftAv.d.ts.map} +1 -1
- package/dist/dist/{index-DeUHrBqA.d.ts → index-DpgQMIRq.d.ts} +1 -1
- package/dist/dist/{index-DeUHrBqA.d.ts.map → index-DpgQMIRq.d.ts.map} +1 -1
- package/dist/dist/{index.browser-CRvkFEhl.d.ts → index.browser-nndbVM7z.d.ts} +1 -1
- package/dist/dist/{index.browser-CRvkFEhl.d.ts.map → index.browser-nndbVM7z.d.ts.map} +1 -1
- package/dist/dist/{index.node-DQTc7kEl.d.ts → index.node-BUfx-JaP.d.ts} +1 -1
- package/dist/dist/{index.node-DQTc7kEl.d.ts.map → index.node-BUfx-JaP.d.ts.map} +1 -1
- package/dist/dist/platform.browser.d.ts +2 -2
- package/dist/dist/platform.node.d.ts +2 -2
- package/dist/dist/{property-Dk_5t4-p.d.ts → property-BDBvImLs.d.ts} +3 -3
- package/dist/dist/property-BDBvImLs.d.ts.map +1 -0
- package/dist/dist/{propertyValidationRules-BtUZdfft.d.ts → propertyValidationRules-BlfLn4rP.d.ts} +1 -1
- package/dist/dist/propertyValidationRules-BlfLn4rP.d.ts.map +1 -0
- package/dist/dist/{publishDraftGraph-CN7EsPVb.d.ts → publishDraftGraph-CLO85LLz.d.ts} +1 -1
- package/dist/dist/{publishDraftGraph-CN7EsPVb.d.ts.map → publishDraftGraph-CLO85LLz.d.ts.map} +1 -1
- package/dist/dist/{resetAmbiguousLegacyItemData-DzVlhD9u.d.ts → resetAmbiguousLegacyItemData-Cy8ik7xk.d.ts} +1 -1
- package/dist/dist/resetAmbiguousLegacyItemData-Cy8ik7xk.d.ts.map +1 -0
- package/dist/dist/{resolveModelForSyncedSeed-C_BzNN8r.d.ts → resolveModelForSyncedSeed-DFr4COc4.d.ts} +3 -3
- package/dist/dist/resolveModelForSyncedSeed-DFr4COc4.d.ts.map +1 -0
- package/dist/dist/{syncDbWithEas-BMmxPq5o.d.ts → syncDbWithEas-CAOlw3i-.d.ts} +1 -1
- package/dist/dist/syncDbWithEas-CAOlw3i-.d.ts.map +1 -0
- package/dist/dist/{tabEvents-DyGJcILs.d.ts → tabEvents-DksXwk3X.d.ts} +1 -1
- package/dist/dist/{tabEvents-DyGJcILs.d.ts.map → tabEvents-DksXwk3X.d.ts.map} +1 -1
- package/dist/dist/{tolerantWebAccess-Zxy2EUzu.d.ts → tolerantWebAccess-CEIjFGf0.d.ts} +1 -1
- package/dist/dist/{tolerantWebAccess-Zxy2EUzu.d.ts.map → tolerantWebAccess-CEIjFGf0.d.ts.map} +1 -1
- package/dist/dist/{updateSeedRevokedAt-DxhC4ABM.d.ts → updateSeedRevokedAt-Cjr35YjE.d.ts} +1 -1
- package/dist/dist/updateSeedRevokedAt-Cjr35YjE.d.ts.map +1 -0
- package/dist/{eas-CPYt-QVJ.js → eas-DOdj-EMK.js} +3 -3
- package/dist/{eas-CPYt-QVJ.js.map → eas-DOdj-EMK.js.map} +1 -1
- package/dist/{errors-DuFqGrjo.js → errors-KM-yq2MD.js} +27 -27
- package/dist/{errors-DuFqGrjo.js.map → errors-KM-yq2MD.js.map} +1 -1
- package/dist/{getItem-DPapr9uy.js → getItem-Bh0zv-o1.js} +4 -4
- package/dist/{getItem-DPapr9uy.js.map → getItem-Bh0zv-o1.js.map} +1 -1
- package/dist/{getPublishPayload-Dnv38ZW1.js → getPublishPayload-oH8wJhnH.js} +13 -13
- package/dist/{getPublishPayload-Dnv38ZW1.js.map → getPublishPayload-oH8wJhnH.js.map} +1 -1
- package/dist/{getPublishUploads-Dd7dCxNi.js → getPublishUploads-Cex-NBe6.js} +6 -6
- package/dist/{getPublishUploads-Dd7dCxNi.js.map → getPublishUploads-Cex-NBe6.js.map} +1 -1
- package/dist/{index-CTidoFhC.js → index-BAao3_Po.js} +8 -8
- package/dist/index-BAao3_Po.js.map +1 -0
- package/dist/{index-PnK3Ak9Z.js → index-BbFwftAv.js} +2 -2
- package/dist/index-BbFwftAv.js.map +1 -0
- package/dist/{index-DeUHrBqA.js → index-DpgQMIRq.js} +2 -2
- package/dist/{index-DeUHrBqA.js.map → index-DpgQMIRq.js.map} +1 -1
- package/dist/{index.browser-CRvkFEhl.js → index.browser-nndbVM7z.js} +10 -12
- package/dist/index.browser-nndbVM7z.js.map +1 -0
- package/dist/{index.node-DQTc7kEl.js → index.node-BUfx-JaP.js} +6 -6
- package/dist/{index.node-DQTc7kEl.js.map → index.node-BUfx-JaP.js.map} +1 -1
- package/dist/main.js +22 -22
- package/dist/node.js +12 -12
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +4 -4
- package/dist/{property-Dk_5t4-p.js → property-BDBvImLs.js} +6 -6
- package/dist/{property-Dk_5t4-p.js.map → property-BDBvImLs.js.map} +1 -1
- package/dist/{propertyValidationRules-BtUZdfft.js → propertyValidationRules-BlfLn4rP.js} +6 -6
- package/dist/{propertyValidationRules-BtUZdfft.js.map → propertyValidationRules-BlfLn4rP.js.map} +1 -1
- package/dist/{publishDraftGraph-CN7EsPVb.js → publishDraftGraph-CLO85LLz.js} +6 -6
- package/dist/{publishDraftGraph-CN7EsPVb.js.map → publishDraftGraph-CLO85LLz.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-DzVlhD9u.js → resetAmbiguousLegacyItemData-Cy8ik7xk.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-DzVlhD9u.js.map → resetAmbiguousLegacyItemData-Cy8ik7xk.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-C_BzNN8r.js → resolveModelForSyncedSeed-DFr4COc4.js} +4 -4
- package/dist/resolveModelForSyncedSeed-DFr4COc4.js.map +1 -0
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/db/read/resolveModelForSyncedSeed.d.ts +2 -2
- package/dist/src/node/helpers/scripts.d.ts +1 -1
- package/dist/{syncDbWithEas-BMmxPq5o.js → syncDbWithEas-CAOlw3i-.js} +13 -13
- package/dist/{syncDbWithEas-BMmxPq5o.js.map → syncDbWithEas-CAOlw3i-.js.map} +1 -1
- package/dist/{tabEvents-DyGJcILs.js → tabEvents-DksXwk3X.js} +4 -4
- package/dist/{tabEvents-DyGJcILs.js.map → tabEvents-DksXwk3X.js.map} +1 -1
- package/dist/{tolerantWebAccess-Zxy2EUzu.js → tolerantWebAccess-CEIjFGf0.js} +6 -6
- package/dist/{tolerantWebAccess-Zxy2EUzu.js.map → tolerantWebAccess-CEIjFGf0.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-DxhC4ABM.js → updateSeedRevokedAt-Cjr35YjE.js} +3 -3
- package/dist/{updateSeedRevokedAt-DxhC4ABM.js.map → updateSeedRevokedAt-Cjr35YjE.js.map} +1 -1
- package/package.json +6 -6
- package/dist/dist/backfillMetadataPropertyIds-qoVxUEEl.d.ts.map +0 -1
- package/dist/dist/configurePlatform-CazqABrK.d.ts.map +0 -1
- package/dist/dist/detachRowsBeforeDelete-yatbnC27.d.ts.map +0 -1
- package/dist/dist/discardNewDraft-q1krLqtL.d.ts.map +0 -1
- package/dist/dist/eas-CPYt-QVJ.d.ts.map +0 -1
- package/dist/dist/getItem-DPapr9uy.d.ts.map +0 -1
- package/dist/dist/index-CTidoFhC.d.ts.map +0 -1
- package/dist/dist/property-Dk_5t4-p.d.ts.map +0 -1
- package/dist/dist/propertyValidationRules-BtUZdfft.d.ts.map +0 -1
- package/dist/dist/resetAmbiguousLegacyItemData-DzVlhD9u.d.ts.map +0 -1
- package/dist/dist/resolveModelForSyncedSeed-C_BzNN8r.d.ts.map +0 -1
- package/dist/dist/syncDbWithEas-BMmxPq5o.d.ts.map +0 -1
- package/dist/dist/updateSeedRevokedAt-DxhC4ABM.d.ts.map +0 -1
- package/dist/index-CTidoFhC.js.map +0 -1
- package/dist/index-PnK3Ak9Z.js.map +0 -1
- package/dist/index.browser-CRvkFEhl.js.map +0 -1
- package/dist/resolveModelForSyncedSeed-C_BzNN8r.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import fs__default from 'fs';
|
|
4
|
-
import { h as BaseFileManager, B as BaseDb, j as appState, am as SEED_CONFIG_FILE, an as SEED_CONFIG_FALLBACKS } from './index-
|
|
5
|
-
import { B as BasePathResolver } from './configurePlatform-
|
|
4
|
+
import { h as BaseFileManager, B as BaseDb, j as appState, am as SEED_CONFIG_FILE, an as SEED_CONFIG_FALLBACKS } from './index-DpgQMIRq.js';
|
|
5
|
+
import { B as BasePathResolver } from './configurePlatform-Bbpw_R4y.js';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import * as fsAsync from 'fs/promises';
|
|
8
8
|
import { pathToFileURL } from 'url';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import { s as schema } from './index-
|
|
10
|
+
import { s as schema } from './index-BbFwftAv.js';
|
|
11
11
|
import { createClient } from '@libsql/client';
|
|
12
12
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
13
13
|
import { migrate } from 'drizzle-orm/libsql/migrator';
|
|
@@ -289,10 +289,10 @@ class NodeDb {
|
|
|
289
289
|
logger$1('[Db.prepareDb] running migrations from %s', outDir);
|
|
290
290
|
await migrate(db, { migrationsFolder: outDir });
|
|
291
291
|
this.db = db;
|
|
292
|
-
const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-
|
|
292
|
+
const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CzSbuucw.js');
|
|
293
293
|
await backfillMetadataPropertyIds();
|
|
294
294
|
// One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)
|
|
295
|
-
const { resetAmbiguousLegacyItemData } = await import('./resetAmbiguousLegacyItemData-
|
|
295
|
+
const { resetAmbiguousLegacyItemData } = await import('./resetAmbiguousLegacyItemData-Cy8ik7xk.js');
|
|
296
296
|
await resetAmbiguousLegacyItemData();
|
|
297
297
|
return this.db;
|
|
298
298
|
}
|
|
@@ -577,4 +577,4 @@ function createPlatformServices() {
|
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
export { Db as D, FileManager as F, PathResolver as P, resolveFilesDir as a, createPlatformServices as c, resolveSdkDrizzleMigrationsDir as r };
|
|
580
|
-
//# sourceMappingURL=index.node-
|
|
580
|
+
//# sourceMappingURL=index.node-BUfx-JaP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node-DQTc7kEl.js","sources":["../../src/helpers/dotSeedPath.ts","../../src/node/helpers/FileManager.ts","../../src/node/db/Db.ts","../../src/node/helpers/PathResolver.ts","../../src/node/helpers/resolveFilesDir.ts","../../src/platform/index.node.ts"],"sourcesContent":["/**\n * Whether a relative filesDir already names the .seed directory or a path inside\n * it ('.seed', '.seed/files', './.seed/files'). '.seed-alt/x' is not: it is\n * resolved under .seed like any other relative path.\n */\nexport function isUnderDotSeed(relativePath: string): boolean {\n const firstSegment = relativePath.split(/[\\\\/]+/).find((segment) => segment !== '' && segment !== '.')\n return firstSegment === '.seed'\n}\n","import * as fsAsync from 'fs/promises'\nimport * as fs from 'fs'\nimport { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'\nimport type { IFileManager } from '@/helpers/FileManager/IFileManager'\nimport path from 'path'\nimport { pathToFileURL } from 'url'\n\nexport class NodeFileManager implements IFileManager {\n async getFs() {\n return fs\n }\n\n getFsSync() {\n return fs\n }\n\n /** Node has no blob URLs; a file:// URL keeps refResolvedDisplayValue meaningful for server callers. */\n async getContentUrlFromPath(filePath: string): Promise<string | undefined> {\n return pathToFileURL(path.resolve(filePath)).href\n }\n\n async initializeFileSystem(_workingDir?: string): Promise<void> {\n return // No need to initialize file system in node\n }\n\n async downloadAllFiles(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeImage(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeAllImages(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async pathExists(filePath: string): Promise<boolean> {\n return await fsAsync.access(filePath).then(() => true).catch(() => false)\n }\n\n /** Node reads the real file system; nothing is cached. */\n async invalidateCachedPaths(): Promise<void> {}\n\n async getFileSize(filePath: string): Promise<number | null> {\n try {\n const stat = await fsAsync.stat(filePath)\n return stat.size\n } catch {\n return null\n }\n }\n\n async listImageFiles(): Promise<string[]> {\n return this.listFiles('images')\n }\n\n async listFiles(dir: string): Promise<string[]> {\n const targetDir = BaseFileManager.getFilesPath(dir)\n const exists = await this.pathExists(targetDir)\n if (!exists) {\n return []\n }\n const entries = await fsAsync.readdir(targetDir, { withFileTypes: true })\n return entries.filter((entry) => entry.isFile()).map((entry) => entry.name)\n }\n\n async createDirIfNotExists(filePath: string): Promise<void> {\n await fsAsync.mkdir(filePath, { recursive: true })\n }\n\n async waitForFile(filePath: string, interval: number = 1000, timeout: number = 60000): Promise<boolean> {\n const pathExists = await this.pathExists(filePath)\n if (pathExists) {\n return true\n }\n\n return new Promise((resolve, reject) => {\n const startTime = Date.now()\n let isBusy = false\n\n const checkInterval = setInterval(async () => {\n if (isBusy) {\n return\n }\n isBusy = true\n\n try {\n const exists = await this.pathExists(filePath)\n if (exists) {\n clearInterval(checkInterval)\n resolve(true)\n return\n }\n\n if (Date.now() - startTime >= timeout) {\n clearInterval(checkInterval)\n reject(new Error('Timeout exceeded while waiting for file'))\n return\n }\n } catch (error) {\n clearInterval(checkInterval)\n reject(error)\n return\n } finally {\n isBusy = false\n }\n }, interval)\n })\n }\n\n async waitForFileWithContent(filePath: string, interval: number = 100, timeout: number = 5000): Promise<boolean> {\n return this.waitForFile(filePath, interval, timeout)\n }\n\n async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n const dir = path.dirname(filePath)\n await fsAsync.mkdir(dir, { recursive: true })\n\n if (typeof content === 'string') {\n await fsAsync.writeFile(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n const arrayBuffer = await content.arrayBuffer()\n await fsAsync.writeFile(filePath, new Uint8Array(arrayBuffer))\n } else if (content instanceof ArrayBuffer) {\n await fsAsync.writeFile(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n saveFileSync(filePath: string, content: string | Blob | ArrayBuffer): void {\n const dir = path.dirname(filePath)\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true })\n }\n\n if (typeof content === 'string') {\n fs.writeFileSync(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n throw new Error('Blob content not supported in saveFileSync. Use saveFile() instead or convert to ArrayBuffer first.')\n } else if (content instanceof ArrayBuffer) {\n fs.writeFileSync(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return await fsAsync.readFile(filePath)\n }\n\n async readFileAsString(filePath: string): Promise<string> {\n return await fsAsync.readFile(filePath, 'utf-8')\n }\n\n async readFile(filePath: string): Promise<File> {\n return new File([await fsAsync.readFile(filePath)], filePath)\n }\n\n readFileSync(filePath: string): File {\n return new File([fs.readFileSync(filePath)], filePath)\n }\n\n getParentDirPath(filePath: string): string {\n return path.dirname(filePath)\n }\n\n getFilenameFromPath(filePath: string): string {\n return path.basename(filePath)\n }\n\n getPathModule(): any {\n return path\n }\n}\n\n/** @deprecated Prefer NodeFileManager */\nexport const FileManager = NodeFileManager\n\nBaseFileManager.configure(new NodeFileManager())\n\nconst _check: IFileManager = new NodeFileManager()\nvoid _check\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport type { IDb } from '@/interfaces/IDb'\nimport path from 'path'\nimport { fileURLToPath } from 'node:url'\nimport debug from 'debug'\nimport { appState } from '@/seedSchema'\nimport fs from 'fs'\nimport { createClient } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { migrate } from 'drizzle-orm/libsql/migrator'\nimport * as schema from '@/seedSchema'\nimport { Observable, interval, switchMap, distinctUntilChanged, startWith } from 'rxjs'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\n\nconst logger = debug('seedSdk:node:db:Db')\n\nexport interface DbConfig {\n dbUrl?: string\n /** @deprecated Unused — schema is the static SDK seedSchema + prebuilt SQL migrations */\n schemaDir?: string\n outDir?: string\n}\n\nfunction resolveDbPaths(filesDir: string, config?: DbConfig) {\n const outDir = config?.outDir || path.join(filesDir, 'db')\n const dbPath = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl.replace(/^file:/, '') : config.dbUrl)\n : path.join(outDir, 'seed.db')\n return { outDir, dbPath }\n}\n\n/**\n * Locate prebuilt drizzle migration SQL shipped with the SDK\n * (same files the browser embeds via drizzleFiles.ts).\n */\nexport function resolveSdkDrizzleMigrationsDir(sdkRootDir?: string): string {\n const root =\n sdkRootDir ||\n (() => {\n try {\n return BasePathResolver.getSdkRootDir()\n } catch {\n return process.cwd()\n }\n })()\n\n // Look next to this module first, so the SDK always runs its own migrations\n // whatever the working directory (monorepos, packaged Electron apps, scripts\n // run from elsewhere). Rollup bundles this file into a chunk directly under\n // dist/, next to the copied dist/db/drizzle.\n const moduleDir = path.dirname(fileURLToPath(import.meta.url))\n\n const candidates = [\n path.join(moduleDir, 'db', 'drizzle'), // bundled: dist/<chunk>.js -> dist/db/drizzle\n path.join(moduleDir, '..', '..', 'db', 'drizzle'), // source: src/node/db -> src/db/drizzle\n path.join(moduleDir, '..', 'db', 'drizzle'), // dist layout variants\n path.join(moduleDir, '..', '..', '..', 'src', 'db', 'drizzle'), // dist/node -> src\n path.join(root, 'db', 'drizzle'), // production: sdkRoot is dist/\n path.join(root, 'dist', 'db', 'drizzle'), // sdk package root with built dist\n path.join(root, 'src', 'db', 'drizzle'), // monorepo / sdk-dev\n path.join(root, 'packages', 'sdk', 'src', 'db', 'drizzle'), // monorepo root as cwd\n path.join(root, 'packages', 'sdk', 'dist', 'db', 'drizzle'),\n ]\n\n for (const candidate of candidates) {\n if (fs.existsSync(path.join(candidate, 'meta', '_journal.json'))) {\n return candidate\n }\n }\n\n throw new Error(\n `Could not find SDK drizzle migrations (meta/_journal.json). Searched under: ${candidates.join(', ')}`,\n )\n}\n\nfunction copyDirRecursive(sourceDir: string, targetDir: string) {\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true })\n }\n for (const entry of fs.readdirSync(sourceDir)) {\n const sourcePath = path.join(sourceDir, entry)\n const targetPath = path.join(targetDir, entry)\n const stats = fs.statSync(sourcePath)\n if (stats.isDirectory()) {\n copyDirRecursive(sourcePath, targetPath)\n } else {\n fs.copyFileSync(sourcePath, targetPath)\n }\n }\n}\n\n\n/** The file a local libsql `file:` URL opens; undefined for `:memory:` and remote URLs. */\nconst localDbFilePath = (dbUrl: string): string | undefined => {\n if (!dbUrl.startsWith('file:')) return undefined\n const filePath = dbUrl.slice('file:'.length).split('?')[0]\n if (!filePath || filePath === ':memory:') return undefined\n return filePath.startsWith('//') ? filePath.replace(/^\\/\\/(localhost)?/, '') : filePath\n}\n\nexport class NodeDb implements IDb {\n db: any\n\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return !!this.db\n }\n\n /**\n * Copy prebuilt SQL migrations into the app db directory (overwrite to stay current).\n */\n copyDrizzleFiles(filesDir: string, migrationsSourceDir?: string, config?: DbConfig): string {\n const { outDir } = resolveDbPaths(filesDir, config)\n const source = migrationsSourceDir || resolveSdkDrizzleMigrationsDir()\n logger('[Db.copyDrizzleFiles] copying from %s to %s', source, outDir)\n copyDirRecursive(source, outDir)\n return outDir\n }\n\n async prepareDb(filesDir: string, config?: DbConfig) {\n const resolvedFilesDir = path.resolve(filesDir)\n\n if (!fs.existsSync(resolvedFilesDir)) {\n fs.mkdirSync(resolvedFilesDir, { recursive: true })\n }\n\n const { outDir, dbPath } = resolveDbPaths(resolvedFilesDir, config)\n\n if (!fs.existsSync(outDir)) {\n fs.mkdirSync(outDir, { recursive: true })\n }\n\n // Install SDK migration SQL next to the DB (same source of truth as browser)\n this.copyDrizzleFiles(resolvedFilesDir, undefined, config)\n\n const dbUrl = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl : `file:${path.resolve(config.dbUrl)}`)\n : `file:${path.resolve(dbPath)}`\n\n // libsql won't create the database's folder (\"Unable to open connection … 14\").\n const dbFilePath = localDbFilePath(dbUrl)\n if (dbFilePath) {\n fs.mkdirSync(path.dirname(dbFilePath), { recursive: true })\n }\n\n const client = createClient({ url: dbUrl })\n const db = drizzle(client, { schema })\n\n logger('[Db.prepareDb] running migrations from %s', outDir)\n await migrate(db, { migrationsFolder: outDir })\n\n this.db = db\n\n const { backfillMetadataPropertyIds } = await import('@/db/backfillMetadataPropertyIds')\n await backfillMetadataPropertyIds()\n\n // One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)\n const { resetAmbiguousLegacyItemData } = await import('@/db/resetAmbiguousLegacyItemData')\n await resetAmbiguousLegacyItemData()\n\n return this.db\n }\n\n async connectToDb(_pathToDir: string) {\n return {\n id: this.db ? this.db.constructor.name : '',\n }\n }\n\n async migrate(pathToDbDir: string, _dbName: string, _dbId: string) {\n try {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n await migrate(this.db, { migrationsFolder: pathToDbDir })\n const queryResult = await this.db.select().from(appState)\n logger('queryResult', queryResult)\n } catch (error: any) {\n const errorMessage = error.message || String(error) || ''\n const errorString = String(error)\n const isMigrationError =\n errorMessage.includes(\"Can't find meta/_journal.json\") ||\n errorMessage.includes('_journal.json') ||\n errorMessage.includes(\"Cannot read properties of undefined\") ||\n errorMessage.includes(\"reading 'dialect'\") ||\n errorMessage.includes('undefined is not an object') ||\n errorString.includes('dialect') ||\n errorString.includes('undefined is not an object')\n\n if (isMigrationError) {\n if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {\n logger(\n 'Warning: Migration failed, but continuing in test environment:',\n errorMessage || errorString,\n )\n return this.db\n }\n }\n throw error\n }\n\n return this.db\n }\n\n /**\n * Polling-based liveQuery stub for Node. Prefer browser reactive queries in UI apps.\n */\n liveQuery<T>(query: ((sql: any) => any) | any): Observable<T[]> {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n const pollInterval = 1000\n\n if (typeof query === 'function') {\n throw new Error(\n 'SQL tag functions are not supported in node liveQuery stub implementation. Use Drizzle query builders instead.',\n )\n }\n\n const queryBuilder = query\n\n return interval(pollInterval).pipe(\n startWith(0),\n switchMap(async () => {\n try {\n const result = await Promise.resolve(queryBuilder)\n return result as T[]\n } catch (error) {\n logger('[Db.liveQuery] Error executing query:', error)\n throw error\n }\n }),\n distinctUntilChanged((prev, curr) => {\n return JSON.stringify(prev) === JSON.stringify(curr)\n }),\n )\n }\n}\n\n/** @deprecated Prefer NodeDb */\nexport const Db = NodeDb\n\nBaseDb.configure(new NodeDb())\n\nconst _check: IDb = new NodeDb()\nvoid _check\n","import path from 'path'\nimport fs from 'fs'\nimport { SEED_CONFIG_FILE, SEED_CONFIG_FALLBACKS } from '@/helpers/constants'\nimport type { IPathResolver } from '@/helpers/PathResolver/IPathResolver'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:node:helpers:PathResolver')\n\nexport class NodePathResolver implements IPathResolver {\n /** @deprecated Prefer BasePathResolver static methods or configure(). */\n static getInstance(): IPathResolver {\n return BasePathResolver.getInstance()\n }\n\n /**\n * Detects the current environment based on filesystem structure and package.json\n */\n private detectEnvironment(): 'sdk-dev' | 'linked-sdk' | 'production' | 'test' {\n // Check if we're in the SDK repo itself\n if (process.env.NODE_ENV !== 'test' && this.isInSdkRepo()) {\n return 'sdk-dev'\n }\n\n // Check if we're running tests\n if (process.env.NODE_ENV === 'test') {\n return 'test'\n }\n\n // Check if we're using a linked version of the SDK\n if (this.isUsingLinkedSdk()) {\n return 'linked-sdk'\n }\n\n // Default to production environment\n return 'production'\n }\n\n private isInSdkRepo(): boolean {\n try {\n const currentDir = process.cwd()\n // Check when running from packages/sdk (SDK package root)\n if (fs.existsSync(path.join(currentDir, 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n // Check when running from monorepo root\n if (fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'packages', 'sdk', 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n return false\n } catch {\n return false\n }\n }\n\n private isUsingLinkedSdk(): boolean {\n try {\n const pkgPath = path.join(process.cwd(), 'package.json')\n if (!fs.existsSync(pkgPath)) return false\n \n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n const sdkDep = pkg.dependencies?.['@seedprotocol/sdk']\n \n return sdkDep && (sdkDep.startsWith('link:') || sdkDep.startsWith('portal:'))\n } catch {\n return false\n }\n }\n\n /**\n * Gets the root directory containing node_modules\n */\n getRootWithNodeModules(): string {\n const processCwd = process.cwd()\n\n const calledFromMocks = processCwd.includes('__mocks__')\n\n if (calledFromMocks) {\n return path.join(processCwd, '..', '..', '..', '..',)\n }\n\n return processCwd\n }\n\n /**\n * Gets the SDK root directory\n */\n getSdkRootDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n const processCwd = process.cwd()\n\n // For test environment, always return the SDK root directory\n if (env === 'test') {\n return rootWithNodeModules\n }\n\n if (env === 'linked-sdk') {\n // For linked packages, find the package directory\n const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'))\n const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk']\n if (sdkPath === 'link:@seedprotocol/sdk') {\n return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk',)\n }\n return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''))\n }\n\n // After early returns, env can only be 'sdk-dev' or 'production'\n if (env === 'sdk-dev') {\n // When running from monorepo root, SDK root is packages/sdk\n if (fs.existsSync(path.join(rootWithNodeModules, 'packages', 'sdk', 'package.json'))) {\n return path.join(rootWithNodeModules, 'packages', 'sdk')\n }\n // When running from packages/sdk directly\n return rootWithNodeModules\n }\n \n // Production: {sdk package}/dist. Resolve the installed package rather than\n // assuming it sits under the working directory: hoisted monorepos, packaged\n // Electron apps and scripts run from another directory all differ.\n try {\n const { createRequire } = process.getBuiltinModule('node:module')\n const pkgJson = createRequire(import.meta.url).resolve('@seedprotocol/sdk/package.json')\n return path.join(path.dirname(pkgJson), 'dist')\n } catch {\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk', 'dist')\n }\n }\n\n getNodeModulesDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n\n let nodeModulesDir = path.join(rootWithNodeModules, 'node_modules')\n\n if (env !== 'linked-sdk' && env !== 'sdk-dev' && nodeModulesDir.includes('__tests__')) {\n nodeModulesDir = path.join(process.cwd(), '..', '..', '..', '..', 'node_modules',)\n }\n\n return nodeModulesDir\n }\n\n /**\n * Gets the .seed directory path\n */\n getDotSeedDir(schemaFileDir?: string): string {\n if (!schemaFileDir && process.env.SEED_SDK_TEST_PROJECT_TYPE && !process.cwd().includes('__mocks__')) {\n return path.join(process.cwd(), '__tests__', '__mocks__', process.env.SEED_SDK_TEST_PROJECT_TYPE, 'project', '.seed')\n }\n return path.join(schemaFileDir || process.cwd(), '.seed')\n }\n\n /**\n * Finds the Seed Protocol config file in the given directory\n * @param searchDir - Directory to search for the config file\n * @returns The path to the found config file, or null if not found\n */\n findConfigFile(searchDir: string = process.cwd()): string | null {\n // First try the primary config file name\n const primaryPath = path.join(searchDir, SEED_CONFIG_FILE)\n if (fs.existsSync(primaryPath)) {\n return primaryPath\n }\n\n // Then try fallback names in order\n for (const fallbackName of SEED_CONFIG_FALLBACKS) {\n const fallbackPath = path.join(searchDir, fallbackName)\n if (fs.existsSync(fallbackPath)) {\n return fallbackPath\n }\n }\n\n return null\n }\n\n /**\n * Gets paths for app-specific directories\n */\n getAppPaths(schemaFileDir?: string | undefined) {\n const env = this.detectEnvironment()\n const dotSeedDir = this.getDotSeedDir(schemaFileDir)\n const nodeModulesDir = this.getNodeModulesDir()\n\n logger('env', env)\n\n logger('getAppPaths', {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n })\n\n return {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n }\n }\n}\n\n/** @deprecated Prefer NodePathResolver; kept for CLI / node entry exports. */\nexport const PathResolver = NodePathResolver\n\nBasePathResolver.configure(new NodePathResolver())\n\nconst _check: IPathResolver = new NodePathResolver()\nvoid _check\n","import fs from 'fs'\nimport path from 'path'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport { isUnderDotSeed } from '@/helpers/dotSeedPath'\n\n/**\n * The filesDir to use on Node, resolved relative to the .seed directory at the project root.\n * A browser OPFS-style path such as '/app-files' that doesn't exist on disk becomes\n * '.seed/app-files'; a relative path not already under .seed is joined to .seed; other absolute\n * paths are used as-is.\n */\nexport function resolveFilesDir(filesDir: string): string {\n // Not created here: prepareDb creates filesDir (under .seed when it's relative), so an absolute\n // filesDir works from a read-only working directory (e.g. a packaged Electron app's cwd `/`).\n const dotSeedDir = BasePathResolver.getDotSeedDir()\n\n // Browser OPFS paths are single-level, like '/app-files' or '/files'.\n const pathWithoutLeadingSlash = filesDir.slice(1)\n const isBrowserOpfsPath =\n path.isAbsolute(filesDir) &&\n filesDir.startsWith('/') &&\n pathWithoutLeadingSlash.length > 0 &&\n !pathWithoutLeadingSlash.includes('/') &&\n !fs.existsSync(filesDir)\n\n if (isBrowserOpfsPath) {\n return path.join(dotSeedDir, filesDir.slice(1) || 'app-files')\n }\n if (!path.isAbsolute(filesDir)) {\n return isUnderDotSeed(filesDir) ? path.resolve(filesDir) : path.join(dotSeedDir, filesDir)\n }\n return filesDir\n}\n","import { NodePathResolver } from '@/node/helpers/PathResolver'\nimport { NodeFileManager } from '@/node/helpers/FileManager'\nimport { NodeDb } from '@/node/db/Db'\nimport { NodeArweaveClient } from '@/node/helpers/ArweaveClient'\nimport { NodeEasClient } from '@/node/helpers/EasClient'\nimport { NodeQueryClient } from '@/node/helpers/QueryClient'\nimport type { PlatformServices } from './types'\n\nexport function createPlatformServices(): PlatformServices {\n return {\n pathResolver: new NodePathResolver(),\n fileManager: new NodeFileManager(),\n db: new NodeDb(),\n arweaveClient: new NodeArweaveClient(),\n easClient: new NodeEasClient(),\n queryClient: new NodeQueryClient(),\n }\n}\n\nexport { configurePlatform } from './configurePlatform'\nexport { resolveFilesDir } from '@/node/helpers/resolveFilesDir'\nexport type { PlatformServices } from './types'\n"],"names":["logger","fs"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AAIG;AACG,SAAU,cAAc,CAAC,YAAoB,EAAA;IACjD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,CAAC;IACtG,OAAO,YAAY,KAAK,OAAO;AACjC;;MCDa,eAAe,CAAA;AAC1B,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,EAAE;IACX;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,EAAE;IACX;;IAGA,MAAM,qBAAqB,CAAC,QAAgB,EAAA;QAC1C,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;IACnD;IAEA,MAAM,oBAAoB,CAAC,WAAoB,EAAA;AAC7C,QAAA,OAAM;IACR;AAEA,IAAA,MAAM,gBAAgB,GAAA;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;AAEA,IAAA,MAAM,WAAW,GAAA;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;AAEA,IAAA,MAAM,eAAe,GAAA;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;IAEA,MAAM,UAAU,CAAC,QAAgB,EAAA;QAC/B,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;IAC3E;;IAGA,MAAM,q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node-BUfx-JaP.js","sources":["../../src/helpers/dotSeedPath.ts","../../src/node/helpers/FileManager.ts","../../src/node/db/Db.ts","../../src/node/helpers/PathResolver.ts","../../src/node/helpers/resolveFilesDir.ts","../../src/platform/index.node.ts"],"sourcesContent":["/**\n * Whether a relative filesDir already names the .seed directory or a path inside\n * it ('.seed', '.seed/files', './.seed/files'). '.seed-alt/x' is not: it is\n * resolved under .seed like any other relative path.\n */\nexport function isUnderDotSeed(relativePath: string): boolean {\n const firstSegment = relativePath.split(/[\\\\/]+/).find((segment) => segment !== '' && segment !== '.')\n return firstSegment === '.seed'\n}\n","import * as fsAsync from 'fs/promises'\nimport * as fs from 'fs'\nimport { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'\nimport type { IFileManager } from '@/helpers/FileManager/IFileManager'\nimport path from 'path'\nimport { pathToFileURL } from 'url'\n\nexport class NodeFileManager implements IFileManager {\n async getFs() {\n return fs\n }\n\n getFsSync() {\n return fs\n }\n\n /** Node has no blob URLs; a file:// URL keeps refResolvedDisplayValue meaningful for server callers. */\n async getContentUrlFromPath(filePath: string): Promise<string | undefined> {\n return pathToFileURL(path.resolve(filePath)).href\n }\n\n async initializeFileSystem(_workingDir?: string): Promise<void> {\n return // No need to initialize file system in node\n }\n\n async downloadAllFiles(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeImage(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeAllImages(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async pathExists(filePath: string): Promise<boolean> {\n return await fsAsync.access(filePath).then(() => true).catch(() => false)\n }\n\n /** Node reads the real file system; nothing is cached. */\n async invalidateCachedPaths(): Promise<void> {}\n\n async getFileSize(filePath: string): Promise<number | null> {\n try {\n const stat = await fsAsync.stat(filePath)\n return stat.size\n } catch {\n return null\n }\n }\n\n async listImageFiles(): Promise<string[]> {\n return this.listFiles('images')\n }\n\n async listFiles(dir: string): Promise<string[]> {\n const targetDir = BaseFileManager.getFilesPath(dir)\n const exists = await this.pathExists(targetDir)\n if (!exists) {\n return []\n }\n const entries = await fsAsync.readdir(targetDir, { withFileTypes: true })\n return entries.filter((entry) => entry.isFile()).map((entry) => entry.name)\n }\n\n async createDirIfNotExists(filePath: string): Promise<void> {\n await fsAsync.mkdir(filePath, { recursive: true })\n }\n\n async waitForFile(filePath: string, interval: number = 1000, timeout: number = 60000): Promise<boolean> {\n const pathExists = await this.pathExists(filePath)\n if (pathExists) {\n return true\n }\n\n return new Promise((resolve, reject) => {\n const startTime = Date.now()\n let isBusy = false\n\n const checkInterval = setInterval(async () => {\n if (isBusy) {\n return\n }\n isBusy = true\n\n try {\n const exists = await this.pathExists(filePath)\n if (exists) {\n clearInterval(checkInterval)\n resolve(true)\n return\n }\n\n if (Date.now() - startTime >= timeout) {\n clearInterval(checkInterval)\n reject(new Error('Timeout exceeded while waiting for file'))\n return\n }\n } catch (error) {\n clearInterval(checkInterval)\n reject(error)\n return\n } finally {\n isBusy = false\n }\n }, interval)\n })\n }\n\n async waitForFileWithContent(filePath: string, interval: number = 100, timeout: number = 5000): Promise<boolean> {\n return this.waitForFile(filePath, interval, timeout)\n }\n\n async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n const dir = path.dirname(filePath)\n await fsAsync.mkdir(dir, { recursive: true })\n\n if (typeof content === 'string') {\n await fsAsync.writeFile(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n const arrayBuffer = await content.arrayBuffer()\n await fsAsync.writeFile(filePath, new Uint8Array(arrayBuffer))\n } else if (content instanceof ArrayBuffer) {\n await fsAsync.writeFile(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n saveFileSync(filePath: string, content: string | Blob | ArrayBuffer): void {\n const dir = path.dirname(filePath)\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true })\n }\n\n if (typeof content === 'string') {\n fs.writeFileSync(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n throw new Error('Blob content not supported in saveFileSync. Use saveFile() instead or convert to ArrayBuffer first.')\n } else if (content instanceof ArrayBuffer) {\n fs.writeFileSync(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return await fsAsync.readFile(filePath)\n }\n\n async readFileAsString(filePath: string): Promise<string> {\n return await fsAsync.readFile(filePath, 'utf-8')\n }\n\n async readFile(filePath: string): Promise<File> {\n return new File([await fsAsync.readFile(filePath)], filePath)\n }\n\n readFileSync(filePath: string): File {\n return new File([fs.readFileSync(filePath)], filePath)\n }\n\n getParentDirPath(filePath: string): string {\n return path.dirname(filePath)\n }\n\n getFilenameFromPath(filePath: string): string {\n return path.basename(filePath)\n }\n\n getPathModule(): any {\n return path\n }\n}\n\n/** @deprecated Prefer NodeFileManager */\nexport const FileManager = NodeFileManager\n\nBaseFileManager.configure(new NodeFileManager())\n\nconst _check: IFileManager = new NodeFileManager()\nvoid _check\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport type { IDb } from '@/interfaces/IDb'\nimport path from 'path'\nimport { fileURLToPath } from 'node:url'\nimport debug from 'debug'\nimport { appState } from '@/seedSchema'\nimport fs from 'fs'\nimport { createClient } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { migrate } from 'drizzle-orm/libsql/migrator'\nimport * as schema from '@/seedSchema'\nimport { Observable, interval, switchMap, distinctUntilChanged, startWith } from 'rxjs'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\n\nconst logger = debug('seedSdk:node:db:Db')\n\nexport interface DbConfig {\n dbUrl?: string\n /** @deprecated Unused — schema is the static SDK seedSchema + prebuilt SQL migrations */\n schemaDir?: string\n outDir?: string\n}\n\nfunction resolveDbPaths(filesDir: string, config?: DbConfig) {\n const outDir = config?.outDir || path.join(filesDir, 'db')\n const dbPath = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl.replace(/^file:/, '') : config.dbUrl)\n : path.join(outDir, 'seed.db')\n return { outDir, dbPath }\n}\n\n/**\n * Locate prebuilt drizzle migration SQL shipped with the SDK\n * (same files the browser embeds via drizzleFiles.ts).\n */\nexport function resolveSdkDrizzleMigrationsDir(sdkRootDir?: string): string {\n const root =\n sdkRootDir ||\n (() => {\n try {\n return BasePathResolver.getSdkRootDir()\n } catch {\n return process.cwd()\n }\n })()\n\n // Look next to this module first, so the SDK always runs its own migrations\n // whatever the working directory (monorepos, packaged Electron apps, scripts\n // run from elsewhere). Rollup bundles this file into a chunk directly under\n // dist/, next to the copied dist/db/drizzle.\n const moduleDir = path.dirname(fileURLToPath(import.meta.url))\n\n const candidates = [\n path.join(moduleDir, 'db', 'drizzle'), // bundled: dist/<chunk>.js -> dist/db/drizzle\n path.join(moduleDir, '..', '..', 'db', 'drizzle'), // source: src/node/db -> src/db/drizzle\n path.join(moduleDir, '..', 'db', 'drizzle'), // dist layout variants\n path.join(moduleDir, '..', '..', '..', 'src', 'db', 'drizzle'), // dist/node -> src\n path.join(root, 'db', 'drizzle'), // production: sdkRoot is dist/\n path.join(root, 'dist', 'db', 'drizzle'), // sdk package root with built dist\n path.join(root, 'src', 'db', 'drizzle'), // monorepo / sdk-dev\n path.join(root, 'packages', 'sdk', 'src', 'db', 'drizzle'), // monorepo root as cwd\n path.join(root, 'packages', 'sdk', 'dist', 'db', 'drizzle'),\n ]\n\n for (const candidate of candidates) {\n if (fs.existsSync(path.join(candidate, 'meta', '_journal.json'))) {\n return candidate\n }\n }\n\n throw new Error(\n `Could not find SDK drizzle migrations (meta/_journal.json). Searched under: ${candidates.join(', ')}`,\n )\n}\n\nfunction copyDirRecursive(sourceDir: string, targetDir: string) {\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true })\n }\n for (const entry of fs.readdirSync(sourceDir)) {\n const sourcePath = path.join(sourceDir, entry)\n const targetPath = path.join(targetDir, entry)\n const stats = fs.statSync(sourcePath)\n if (stats.isDirectory()) {\n copyDirRecursive(sourcePath, targetPath)\n } else {\n fs.copyFileSync(sourcePath, targetPath)\n }\n }\n}\n\n\n/** The file a local libsql `file:` URL opens; undefined for `:memory:` and remote URLs. */\nconst localDbFilePath = (dbUrl: string): string | undefined => {\n if (!dbUrl.startsWith('file:')) return undefined\n const filePath = dbUrl.slice('file:'.length).split('?')[0]\n if (!filePath || filePath === ':memory:') return undefined\n return filePath.startsWith('//') ? filePath.replace(/^\\/\\/(localhost)?/, '') : filePath\n}\n\nexport class NodeDb implements IDb {\n db: any\n\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return !!this.db\n }\n\n /**\n * Copy prebuilt SQL migrations into the app db directory (overwrite to stay current).\n */\n copyDrizzleFiles(filesDir: string, migrationsSourceDir?: string, config?: DbConfig): string {\n const { outDir } = resolveDbPaths(filesDir, config)\n const source = migrationsSourceDir || resolveSdkDrizzleMigrationsDir()\n logger('[Db.copyDrizzleFiles] copying from %s to %s', source, outDir)\n copyDirRecursive(source, outDir)\n return outDir\n }\n\n async prepareDb(filesDir: string, config?: DbConfig) {\n const resolvedFilesDir = path.resolve(filesDir)\n\n if (!fs.existsSync(resolvedFilesDir)) {\n fs.mkdirSync(resolvedFilesDir, { recursive: true })\n }\n\n const { outDir, dbPath } = resolveDbPaths(resolvedFilesDir, config)\n\n if (!fs.existsSync(outDir)) {\n fs.mkdirSync(outDir, { recursive: true })\n }\n\n // Install SDK migration SQL next to the DB (same source of truth as browser)\n this.copyDrizzleFiles(resolvedFilesDir, undefined, config)\n\n const dbUrl = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl : `file:${path.resolve(config.dbUrl)}`)\n : `file:${path.resolve(dbPath)}`\n\n // libsql won't create the database's folder (\"Unable to open connection … 14\").\n const dbFilePath = localDbFilePath(dbUrl)\n if (dbFilePath) {\n fs.mkdirSync(path.dirname(dbFilePath), { recursive: true })\n }\n\n const client = createClient({ url: dbUrl })\n const db = drizzle(client, { schema })\n\n logger('[Db.prepareDb] running migrations from %s', outDir)\n await migrate(db, { migrationsFolder: outDir })\n\n this.db = db\n\n const { backfillMetadataPropertyIds } = await import('@/db/backfillMetadataPropertyIds')\n await backfillMetadataPropertyIds()\n\n // One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)\n const { resetAmbiguousLegacyItemData } = await import('@/db/resetAmbiguousLegacyItemData')\n await resetAmbiguousLegacyItemData()\n\n return this.db\n }\n\n async connectToDb(_pathToDir: string) {\n return {\n id: this.db ? this.db.constructor.name : '',\n }\n }\n\n async migrate(pathToDbDir: string, _dbName: string, _dbId: string) {\n try {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n await migrate(this.db, { migrationsFolder: pathToDbDir })\n const queryResult = await this.db.select().from(appState)\n logger('queryResult', queryResult)\n } catch (error: any) {\n const errorMessage = error.message || String(error) || ''\n const errorString = String(error)\n const isMigrationError =\n errorMessage.includes(\"Can't find meta/_journal.json\") ||\n errorMessage.includes('_journal.json') ||\n errorMessage.includes(\"Cannot read properties of undefined\") ||\n errorMessage.includes(\"reading 'dialect'\") ||\n errorMessage.includes('undefined is not an object') ||\n errorString.includes('dialect') ||\n errorString.includes('undefined is not an object')\n\n if (isMigrationError) {\n if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {\n logger(\n 'Warning: Migration failed, but continuing in test environment:',\n errorMessage || errorString,\n )\n return this.db\n }\n }\n throw error\n }\n\n return this.db\n }\n\n /**\n * Polling-based liveQuery stub for Node. Prefer browser reactive queries in UI apps.\n */\n liveQuery<T>(query: ((sql: any) => any) | any): Observable<T[]> {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n const pollInterval = 1000\n\n if (typeof query === 'function') {\n throw new Error(\n 'SQL tag functions are not supported in node liveQuery stub implementation. Use Drizzle query builders instead.',\n )\n }\n\n const queryBuilder = query\n\n return interval(pollInterval).pipe(\n startWith(0),\n switchMap(async () => {\n try {\n const result = await Promise.resolve(queryBuilder)\n return result as T[]\n } catch (error) {\n logger('[Db.liveQuery] Error executing query:', error)\n throw error\n }\n }),\n distinctUntilChanged((prev, curr) => {\n return JSON.stringify(prev) === JSON.stringify(curr)\n }),\n )\n }\n}\n\n/** @deprecated Prefer NodeDb */\nexport const Db = NodeDb\n\nBaseDb.configure(new NodeDb())\n\nconst _check: IDb = new NodeDb()\nvoid _check\n","import path from 'path'\nimport fs from 'fs'\nimport { SEED_CONFIG_FILE, SEED_CONFIG_FALLBACKS } from '@/helpers/constants'\nimport type { IPathResolver } from '@/helpers/PathResolver/IPathResolver'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:node:helpers:PathResolver')\n\nexport class NodePathResolver implements IPathResolver {\n /** @deprecated Prefer BasePathResolver static methods or configure(). */\n static getInstance(): IPathResolver {\n return BasePathResolver.getInstance()\n }\n\n /**\n * Detects the current environment based on filesystem structure and package.json\n */\n private detectEnvironment(): 'sdk-dev' | 'linked-sdk' | 'production' | 'test' {\n // Check if we're in the SDK repo itself\n if (process.env.NODE_ENV !== 'test' && this.isInSdkRepo()) {\n return 'sdk-dev'\n }\n\n // Check if we're running tests\n if (process.env.NODE_ENV === 'test') {\n return 'test'\n }\n\n // Check if we're using a linked version of the SDK\n if (this.isUsingLinkedSdk()) {\n return 'linked-sdk'\n }\n\n // Default to production environment\n return 'production'\n }\n\n private isInSdkRepo(): boolean {\n try {\n const currentDir = process.cwd()\n // Check when running from packages/sdk (SDK package root)\n if (fs.existsSync(path.join(currentDir, 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n // Check when running from monorepo root\n if (fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'packages', 'sdk', 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n return false\n } catch {\n return false\n }\n }\n\n private isUsingLinkedSdk(): boolean {\n try {\n const pkgPath = path.join(process.cwd(), 'package.json')\n if (!fs.existsSync(pkgPath)) return false\n \n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n const sdkDep = pkg.dependencies?.['@seedprotocol/sdk']\n \n return sdkDep && (sdkDep.startsWith('link:') || sdkDep.startsWith('portal:'))\n } catch {\n return false\n }\n }\n\n /**\n * Gets the root directory containing node_modules\n */\n getRootWithNodeModules(): string {\n const processCwd = process.cwd()\n\n const calledFromMocks = processCwd.includes('__mocks__')\n\n if (calledFromMocks) {\n return path.join(processCwd, '..', '..', '..', '..',)\n }\n\n return processCwd\n }\n\n /**\n * Gets the SDK root directory\n */\n getSdkRootDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n const processCwd = process.cwd()\n\n // For test environment, always return the SDK root directory\n if (env === 'test') {\n return rootWithNodeModules\n }\n\n if (env === 'linked-sdk') {\n // For linked packages, find the package directory\n const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'))\n const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk']\n if (sdkPath === 'link:@seedprotocol/sdk') {\n return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk',)\n }\n return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''))\n }\n\n // After early returns, env can only be 'sdk-dev' or 'production'\n if (env === 'sdk-dev') {\n // When running from monorepo root, SDK root is packages/sdk\n if (fs.existsSync(path.join(rootWithNodeModules, 'packages', 'sdk', 'package.json'))) {\n return path.join(rootWithNodeModules, 'packages', 'sdk')\n }\n // When running from packages/sdk directly\n return rootWithNodeModules\n }\n \n // Production: {sdk package}/dist. Resolve the installed package rather than\n // assuming it sits under the working directory: hoisted monorepos, packaged\n // Electron apps and scripts run from another directory all differ.\n try {\n const { createRequire } = process.getBuiltinModule('node:module')\n const pkgJson = createRequire(import.meta.url).resolve('@seedprotocol/sdk/package.json')\n return path.join(path.dirname(pkgJson), 'dist')\n } catch {\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk', 'dist')\n }\n }\n\n getNodeModulesDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n\n let nodeModulesDir = path.join(rootWithNodeModules, 'node_modules')\n\n if (env !== 'linked-sdk' && env !== 'sdk-dev' && nodeModulesDir.includes('__tests__')) {\n nodeModulesDir = path.join(process.cwd(), '..', '..', '..', '..', 'node_modules',)\n }\n\n return nodeModulesDir\n }\n\n /**\n * Gets the .seed directory path\n */\n getDotSeedDir(schemaFileDir?: string): string {\n if (!schemaFileDir && process.env.SEED_SDK_TEST_PROJECT_TYPE && !process.cwd().includes('__mocks__')) {\n return path.join(process.cwd(), '__tests__', '__mocks__', process.env.SEED_SDK_TEST_PROJECT_TYPE, 'project', '.seed')\n }\n return path.join(schemaFileDir || process.cwd(), '.seed')\n }\n\n /**\n * Finds the Seed Protocol config file in the given directory\n * @param searchDir - Directory to search for the config file\n * @returns The path to the found config file, or null if not found\n */\n findConfigFile(searchDir: string = process.cwd()): string | null {\n // First try the primary config file name\n const primaryPath = path.join(searchDir, SEED_CONFIG_FILE)\n if (fs.existsSync(primaryPath)) {\n return primaryPath\n }\n\n // Then try fallback names in order\n for (const fallbackName of SEED_CONFIG_FALLBACKS) {\n const fallbackPath = path.join(searchDir, fallbackName)\n if (fs.existsSync(fallbackPath)) {\n return fallbackPath\n }\n }\n\n return null\n }\n\n /**\n * Gets paths for app-specific directories\n */\n getAppPaths(schemaFileDir?: string | undefined) {\n const env = this.detectEnvironment()\n const dotSeedDir = this.getDotSeedDir(schemaFileDir)\n const nodeModulesDir = this.getNodeModulesDir()\n\n logger('env', env)\n\n logger('getAppPaths', {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n })\n\n return {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n }\n }\n}\n\n/** @deprecated Prefer NodePathResolver; kept for CLI / node entry exports. */\nexport const PathResolver = NodePathResolver\n\nBasePathResolver.configure(new NodePathResolver())\n\nconst _check: IPathResolver = new NodePathResolver()\nvoid _check\n","import fs from 'fs'\nimport path from 'path'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport { isUnderDotSeed } from '@/helpers/dotSeedPath'\n\n/**\n * The filesDir to use on Node, resolved relative to the .seed directory at the project root.\n * A browser OPFS-style path such as '/app-files' that doesn't exist on disk becomes\n * '.seed/app-files'; a relative path not already under .seed is joined to .seed; other absolute\n * paths are used as-is.\n */\nexport function resolveFilesDir(filesDir: string): string {\n // Not created here: prepareDb creates filesDir (under .seed when it's relative), so an absolute\n // filesDir works from a read-only working directory (e.g. a packaged Electron app's cwd `/`).\n const dotSeedDir = BasePathResolver.getDotSeedDir()\n\n // Browser OPFS paths are single-level, like '/app-files' or '/files'.\n const pathWithoutLeadingSlash = filesDir.slice(1)\n const isBrowserOpfsPath =\n path.isAbsolute(filesDir) &&\n filesDir.startsWith('/') &&\n pathWithoutLeadingSlash.length > 0 &&\n !pathWithoutLeadingSlash.includes('/') &&\n !fs.existsSync(filesDir)\n\n if (isBrowserOpfsPath) {\n return path.join(dotSeedDir, filesDir.slice(1) || 'app-files')\n }\n if (!path.isAbsolute(filesDir)) {\n return isUnderDotSeed(filesDir) ? path.resolve(filesDir) : path.join(dotSeedDir, filesDir)\n }\n return filesDir\n}\n","import { NodePathResolver } from '@/node/helpers/PathResolver'\nimport { NodeFileManager } from '@/node/helpers/FileManager'\nimport { NodeDb } from '@/node/db/Db'\nimport { NodeArweaveClient } from '@/node/helpers/ArweaveClient'\nimport { NodeEasClient } from '@/node/helpers/EasClient'\nimport { NodeQueryClient } from '@/node/helpers/QueryClient'\nimport type { PlatformServices } from './types'\n\nexport function createPlatformServices(): PlatformServices {\n return {\n pathResolver: new NodePathResolver(),\n fileManager: new NodeFileManager(),\n db: new NodeDb(),\n arweaveClient: new NodeArweaveClient(),\n easClient: new NodeEasClient(),\n queryClient: new NodeQueryClient(),\n }\n}\n\nexport { configurePlatform } from './configurePlatform'\nexport { resolveFilesDir } from '@/node/helpers/resolveFilesDir'\nexport type { PlatformServices } from './types'\n"],"names":["logger","fs"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AAIG;AACG,SAAU,cAAc,CAAC,YAAoB,EAAA;IACjD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,CAAC;IACtG,OAAO,YAAY,KAAK,OAAO;AACjC;;MCDa,eAAe,CAAA;AAC1B,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,EAAE;IACX;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,EAAE;IACX;;IAGA,MAAM,qBAAqB,CAAC,QAAgB,EAAA;QAC1C,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;IACnD;IAEA,MAAM,oBAAoB,CAAC,WAAoB,EAAA;AAC7C,QAAA,OAAM;IACR;AAEA,IAAA,MAAM,gBAAgB,GAAA;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;AAEA,IAAA,MAAM,WAAW,GAAA;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;AAEA,IAAA,MAAM,eAAe,GAAA;AACnB,QAA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B,EAAE;QACpC,WAAW,EAAE,IAAI,eAAe,EAAE;QAClC,EAAE,EAAE,IAAI,MAAM,EAAE;QAChB,aAAa,EAAE,IAAI,iBAAiB,EAAE;QACtC,SAAS,EAAE,IAAI,aAAa,EAAE;QAC9B,WAAW,EAAE,IAAI,eAAe,EAAE;KACnC;AACH;;"}
|
package/dist/main.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export { C as ConflictError, d as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-
|
|
2
|
-
import { B as BaseDb, F as versions, ae as normalizePublisher, C as seeds, ai as generateId, m as metadata, t as models, v as properties, n as normalizeDataType, aa as listRelationEasPropertyName, k as arweaveL1FinalizeJobs, U as normalizeRelationPropertyValue, V as resolveSeedIdsFromRefString, i as isDataType, M as ModelPropertyDataTypes, a6 as INTERNAL_PROPERTY_NAMES, p as htmlEmbeddedImageCoPublish, a2 as ZERO_BYTES32, h as BaseFileManager, Y as getStorageDirForDataType } from './index-
|
|
3
|
-
export { H as AmbiguousModelError, ar as CONTENT_SHA256_TAG, as as CONTENT_TYPE_TAG, ad as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, a9 as INTERNAL_DATA_TYPES, at as ImageSize, au as SEED_PROTOCOL_SCHEMA_NAME, av as SeedModels, aw as VERSION_SCHEMA_DEF, a5 as VERSION_SCHEMA_UID, ax as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, j as appState, _ as buildArweaveContentTags, ay as classifyMediaRef, az as closestImageSize, aA as contentSha256TagMatches, ab as easPropertyNameForPublish, o as easSyncProcesses, aB as ensureImageLocal, I as eventEmitter, aC as getAddressesForItemsFilter, W as getArweaveUrlForTransaction, Z as getContentSha256, Q as getCorrectId, aD as getFeedItemStringField, R as isPublishedSeedRef, r as modelSchemas, s as modelUids, aE as normalizeAddressConfig, aF as normalizeAddressList, aG as normalizeArweaveTxIdForEnsure, aH as normalizeFeedItemFields, aj as normalizeHexAddress, y as propertyUids, z as publishProcesses, aI as resolveMediaRef, A as schemas, E as uploadProcesses } from './index-
|
|
4
|
-
export { getPropertySchema } from './property-
|
|
5
|
-
export { A as ADDRESSES_PERSISTED_EVENT, F as FILES_CHANGED_EVENT, L as LOCAL_COPIES_REMOVED_EVENT, T as TabLockTimeoutError, i as isLeaderTab, p as parseAddressesPersistedPayload, w as whenLeaderTab } from './tabEvents-
|
|
6
|
-
export { E as EAS_CHAIN_ID_APP_STATE_KEY, I as INIT_CONFIG_CONFLICT_MESSAGE, d as assertLocalDbChain, e as claimUnpublishedDrafts, C as client, f as createLocalQueryDataSource, j as createSchema, k as easSyncActor, m as getClient, n as getPublishedSeedRecord, o as getSchemaNameFromId, i as importJsonSchema, p as isSeedQueryLocalSourceRegistered, q as listSchemas, u as loadAllSchemasFromDb, v as mergeEasSyncRequestIntents, r as readJsonImportFile, x as readSchema, y as registerSeedQueryLocalSource, z as requestEasSyncFromAddressChange, A as requestEasSyncFromEventBus, B as requestEasSyncFromModelsInit, D as sendEasSyncClientRequest, F as setRetriesWhenOnlineEnabled, G as startEasSyncActor, s as syncSchemaFromSource, t as transformImportToSchemaFile, H as unregisterSeedQueryLocalSource } from './ClientManager-
|
|
7
|
-
import { l as isVersionRevoked, e as compareMetadataRowsLatestFirst, p as parseListPropertyValueFromStorage, t as isPublishedMetadataRow, h as getLatestPublishedVersionRow } from './Item-
|
|
8
|
-
export { C as ClientManagerState, I as Item, a as ItemProperty, b as ItemPropertySaveValidationError, M as METADATA_LATEST_FIRST_ORDER_SQL, u as MachineIds, O as OwnershipError, P as PUBLISH_NOT_CONFIGURED_MESSAGE, c as assertItemOwned, v as createNewItem, x as getEasSchemaForItemProperty, k as getGetAdditionalSyncAddresses, y as getGetPublisherForNewSeeds, z as getMetadataLatest, A as getPublishExecutor, B as getRevokeExecutor, E as getUploadExecutor, F as getVersionData, i as isItemOwned, G as isLocalUnsealedDraft, H as isSeedRowOwned, J as localUnsealedDraftSql, K as ownedPublisherSql, L as ownedSeedsSql, N as pickLatestMetadataRowPerProperty, Q as placeholderUidSql, R as propertyMachine, S as publisherInAddressListSql, T as publisherIsInOwnedSet, U as setAdditionalSyncAddresses, V as setGetPublisherForNewSeeds, W as setPublishExecutor, X as setRevokeExecutor, Y as setUploadExecutor, d as waitForEntityIdle } from './Item-
|
|
1
|
+
export { C as ConflictError, d as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-KM-yq2MD.js';
|
|
2
|
+
import { B as BaseDb, F as versions, ae as normalizePublisher, C as seeds, ai as generateId, m as metadata, t as models, v as properties, n as normalizeDataType, aa as listRelationEasPropertyName, k as arweaveL1FinalizeJobs, U as normalizeRelationPropertyValue, V as resolveSeedIdsFromRefString, i as isDataType, M as ModelPropertyDataTypes, a6 as INTERNAL_PROPERTY_NAMES, p as htmlEmbeddedImageCoPublish, a2 as ZERO_BYTES32, h as BaseFileManager, Y as getStorageDirForDataType } from './index-DpgQMIRq.js';
|
|
3
|
+
export { H as AmbiguousModelError, ar as CONTENT_SHA256_TAG, as as CONTENT_TYPE_TAG, ad as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, a9 as INTERNAL_DATA_TYPES, at as ImageSize, au as SEED_PROTOCOL_SCHEMA_NAME, av as SeedModels, aw as VERSION_SCHEMA_DEF, a5 as VERSION_SCHEMA_UID, ax as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, j as appState, _ as buildArweaveContentTags, ay as classifyMediaRef, az as closestImageSize, aA as contentSha256TagMatches, ab as easPropertyNameForPublish, o as easSyncProcesses, aB as ensureImageLocal, I as eventEmitter, aC as getAddressesForItemsFilter, W as getArweaveUrlForTransaction, Z as getContentSha256, Q as getCorrectId, aD as getFeedItemStringField, R as isPublishedSeedRef, r as modelSchemas, s as modelUids, aE as normalizeAddressConfig, aF as normalizeAddressList, aG as normalizeArweaveTxIdForEnsure, aH as normalizeFeedItemFields, aj as normalizeHexAddress, y as propertyUids, z as publishProcesses, aI as resolveMediaRef, A as schemas, E as uploadProcesses } from './index-DpgQMIRq.js';
|
|
4
|
+
export { getPropertySchema } from './property-BDBvImLs.js';
|
|
5
|
+
export { A as ADDRESSES_PERSISTED_EVENT, F as FILES_CHANGED_EVENT, L as LOCAL_COPIES_REMOVED_EVENT, T as TabLockTimeoutError, i as isLeaderTab, p as parseAddressesPersistedPayload, w as whenLeaderTab } from './tabEvents-DksXwk3X.js';
|
|
6
|
+
export { E as EAS_CHAIN_ID_APP_STATE_KEY, I as INIT_CONFIG_CONFLICT_MESSAGE, d as assertLocalDbChain, e as claimUnpublishedDrafts, C as client, f as createLocalQueryDataSource, j as createSchema, k as easSyncActor, m as getClient, n as getPublishedSeedRecord, o as getSchemaNameFromId, i as importJsonSchema, p as isSeedQueryLocalSourceRegistered, q as listSchemas, u as loadAllSchemasFromDb, v as mergeEasSyncRequestIntents, r as readJsonImportFile, x as readSchema, y as registerSeedQueryLocalSource, z as requestEasSyncFromAddressChange, A as requestEasSyncFromEventBus, B as requestEasSyncFromModelsInit, D as sendEasSyncClientRequest, F as setRetriesWhenOnlineEnabled, G as startEasSyncActor, s as syncSchemaFromSource, t as transformImportToSchemaFile, H as unregisterSeedQueryLocalSource } from './ClientManager-2GtDWHq6.js';
|
|
7
|
+
import { l as isVersionRevoked, e as compareMetadataRowsLatestFirst, p as parseListPropertyValueFromStorage, t as isPublishedMetadataRow, h as getLatestPublishedVersionRow } from './Item-D6j0IvBP.js';
|
|
8
|
+
export { C as ClientManagerState, I as Item, a as ItemProperty, b as ItemPropertySaveValidationError, M as METADATA_LATEST_FIRST_ORDER_SQL, u as MachineIds, O as OwnershipError, P as PUBLISH_NOT_CONFIGURED_MESSAGE, c as assertItemOwned, v as createNewItem, x as getEasSchemaForItemProperty, k as getGetAdditionalSyncAddresses, y as getGetPublisherForNewSeeds, z as getMetadataLatest, A as getPublishExecutor, B as getRevokeExecutor, E as getUploadExecutor, F as getVersionData, i as isItemOwned, G as isLocalUnsealedDraft, H as isSeedRowOwned, J as localUnsealedDraftSql, K as ownedPublisherSql, L as ownedSeedsSql, N as pickLatestMetadataRowPerProperty, Q as placeholderUidSql, R as propertyMachine, S as publisherInAddressListSql, T as publisherIsInOwnedSet, U as setAdditionalSyncAddresses, V as setGetPublisherForNewSeeds, W as setPublishExecutor, X as setRevokeExecutor, Y as setUploadExecutor, d as waitForEntityIdle } from './Item-D6j0IvBP.js';
|
|
9
9
|
import { eq, desc, and, inArray, or, isNotNull, ne, isNull } from 'drizzle-orm';
|
|
10
10
|
import { isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex } from '@seedprotocol/eas';
|
|
11
11
|
export { EAS_CHAIN_DEPLOYMENTS, BaseEasClient as EasClient, easName, getCanonicalItemPropertiesFromEas, getEasChainDeployment, getEasEndpoint, getEasReadChainId, getEasSchemaUidBySchemaName, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, matchEasName, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
|
|
12
|
-
export { S as Schema, d as deleteModelFromSchema, a as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-
|
|
12
|
+
export { S as Schema, d as deleteModelFromSchema, a as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-O1QLoXv6.js';
|
|
13
13
|
export { D as DatabaseNotPersistentError, F as FileSystemLockedError } from './errors-Do7v6RKu.js';
|
|
14
|
-
export { M as MODEL_AMBIGUOUS_EVENT } from './resolveModelForSyncedSeed-
|
|
15
|
-
export { ModelProperty } from './ModelProperty-
|
|
16
|
-
export { getModelSchemasFromEas } from './eas-
|
|
14
|
+
export { M as MODEL_AMBIGUOUS_EVENT } from './resolveModelForSyncedSeed-DFr4COc4.js';
|
|
15
|
+
export { ModelProperty } from './ModelProperty-B52C3CQ2.js';
|
|
16
|
+
export { getModelSchemasFromEas } from './eas-DOdj-EMK.js';
|
|
17
17
|
export { BaseArweaveClient, DEFAULT_ARWEAVE_GATEWAYS, DEFAULT_ARWEAVE_GRAPHQL_URL, DEFAULT_ARWEAVE_HOST, DEFAULT_GATEWAY_SIDECAR_HOST, DEFAULT_GATEWAY_SIDECAR_PORT, DEFAULT_SEED_FEED_HYPER_KEY, DEFAULT_SEED_GATEWAY_HYPER_KEY, SEED_RSS_IMAGE_RELATION_FIELD_KEYS, ensureReadGatewaySelected, fetchArweaveRawFromBaseUrl, fetchArweaveRawTextAcrossGateways, getArweaveReadBaseUrls, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getLastHealthyReadGatewayHost, getPreferredArweaveReadBaseUrls, getReadGatewayHostsForConfig, getResolvedArweaveReadBaseUrls, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, hasArweaveContentReadTransform, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isEasAttestationExplorerUrl, isGatewayHostCircuitOpen, isKnownArweaveGatewayHostname, isReadGatewayKnownHealthy, mergePrimaryHostWithDefaults, normalizeGatewayHostKey, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, readArweaveContentResponse, recordGatewayHostFailure, recordGatewayHostSuccess, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, resolveSeedRssImageRelationFromItem, resolveSeedRssImageRelationRef, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setArweaveContentReadTransform, setPreferredArweaveReadBaseUrls, setResolvedSeedGatewayEndpoints, transformArweaveContent } from '@seedprotocol/arweave';
|
|
18
|
-
export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-
|
|
19
|
-
import { a as getSegmentedItemProperties, g as getPublishDraftGraph, i as isSeedRevoked, f as findRelatedSeedRow, b as isUnpublishedSeed, h as htmlPropertyNameForHtmlSeed, r as relatedModelNameFromDef } from './publishDraftGraph-
|
|
20
|
-
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-
|
|
18
|
+
export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-Cjr35YjE.js';
|
|
19
|
+
import { a as getSegmentedItemProperties, g as getPublishDraftGraph, i as isSeedRevoked, f as findRelatedSeedRow, b as isUnpublishedSeed, h as htmlPropertyNameForHtmlSeed, r as relatedModelNameFromDef } from './publishDraftGraph-CLO85LLz.js';
|
|
20
|
+
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-oH8wJhnH.js';
|
|
21
21
|
import 'pluralize';
|
|
22
|
-
import { g as getRelatedDraftsCoPublishedWith, f as findEmbeddedImageFilePath } from './getPublishUploads-
|
|
23
|
-
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, h as extractDataUriImagesFromHtml, i as findSeedPropertyRefsInHtml, j as getPublishUploadData, k as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, l as replaceSeedPropertyRefsInHtml, m as resolveEffectiveHtmlEmbeddedDataUriPolicy, n as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-
|
|
22
|
+
import { g as getRelatedDraftsCoPublishedWith, f as findEmbeddedImageFilePath } from './getPublishUploads-Cex-NBe6.js';
|
|
23
|
+
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, h as extractDataUriImagesFromHtml, i as findSeedPropertyRefsInHtml, j as getPublishUploadData, k as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, l as replaceSeedPropertyRefsInHtml, m as resolveEffectiveHtmlEmbeddedDataUriPolicy, n as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-Cex-NBe6.js';
|
|
24
24
|
import 'js-yaml';
|
|
25
25
|
import 'xstate';
|
|
26
26
|
import 'debug';
|
|
@@ -35,7 +35,7 @@ import '@noble/hashes/sha3';
|
|
|
35
35
|
import '@noble/hashes/utils';
|
|
36
36
|
import 'lodash-es';
|
|
37
37
|
import 'rxjs';
|
|
38
|
-
import './SchemaValidationService-
|
|
38
|
+
import './SchemaValidationService-BxCbfDaI.js';
|
|
39
39
|
import '@sinclair/typebox/value';
|
|
40
40
|
import 'parse5';
|
|
41
41
|
import './mimeTypes-C9r76DCH.js';
|
|
@@ -708,7 +708,7 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
|
|
|
708
708
|
visited.add(seedLocalId);
|
|
709
709
|
const result = [];
|
|
710
710
|
const { itemRelationProperties, itemImageProperties, itemListProperties } = await getSegmentedItemProperties(item);
|
|
711
|
-
const getItemMod = await import('./getItem-
|
|
711
|
+
const getItemMod = await import('./getItem-Bh0zv-o1.js');
|
|
712
712
|
const { getItem } = getItemMod;
|
|
713
713
|
const processRelationOrImage = async (prop) => {
|
|
714
714
|
const snapshot = prop.getService().getSnapshot();
|
|
@@ -727,7 +727,7 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
|
|
|
727
727
|
if (!value && prop.propertyName && isStorageSeed) {
|
|
728
728
|
const ctx = context;
|
|
729
729
|
if (ctx.seedLocalId || ctx.seedUid) {
|
|
730
|
-
const _mod_0 = await import('./Item-
|
|
730
|
+
const _mod_0 = await import('./Item-D6j0IvBP.js');
|
|
731
731
|
const _ns_0 = _mod_0.a5;
|
|
732
732
|
const { getPropertyData } = _ns_0;
|
|
733
733
|
const meta = await getPropertyData({
|
|
@@ -920,7 +920,7 @@ async function loadRelatedItem(value) {
|
|
|
920
920
|
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalized);
|
|
921
921
|
if (!seedLocalId && !seedUid)
|
|
922
922
|
return undefined;
|
|
923
|
-
const { getItem } = await import('./getItem-
|
|
923
|
+
const { getItem } = await import('./getItem-Bh0zv-o1.js');
|
|
924
924
|
try {
|
|
925
925
|
return await getItem({ seedLocalId, seedUid });
|
|
926
926
|
}
|
|
@@ -1016,7 +1016,7 @@ async function appendCoPublishImages(item, acc, seen, visited, forceFullSnapshot
|
|
|
1016
1016
|
.from(htmlEmbeddedImageCoPublish)
|
|
1017
1017
|
.where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId));
|
|
1018
1018
|
for (const row of rows) {
|
|
1019
|
-
const _mod_1 = await import('./Item-
|
|
1019
|
+
const _mod_1 = await import('./Item-D6j0IvBP.js');
|
|
1020
1020
|
const _ns_1 = _mod_1.a6;
|
|
1021
1021
|
const { Item } = _ns_1;
|
|
1022
1022
|
const imageItem = await Item.find({
|
package/dist/node.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { enableMapSet } from 'immer';
|
|
2
|
-
export { C as ConflictError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-
|
|
3
|
-
import { M as ModelPropertyDataTypes, P as Property, N as addModelsToDb, B as BaseDb } from './index-
|
|
4
|
-
export { H as AmbiguousModelError, O as INIT_SCRIPT_SUCCESS_MESSAGE, S as SCHEMA_TS, j as appState, l as config, I as eventEmitter, Q as getCorrectId, R as isPublishedSeedRef, m as metadata, s as modelUids, t as models, U as normalizeRelationPropertyValue, V as resolveSeedIdsFromRefString, C as seeds, F as versions } from './index-
|
|
2
|
+
export { C as ConflictError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-KM-yq2MD.js';
|
|
3
|
+
import { M as ModelPropertyDataTypes, P as Property, N as addModelsToDb, B as BaseDb } from './index-DpgQMIRq.js';
|
|
4
|
+
export { H as AmbiguousModelError, O as INIT_SCRIPT_SUCCESS_MESSAGE, S as SCHEMA_TS, j as appState, l as config, I as eventEmitter, Q as getCorrectId, R as isPublishedSeedRef, m as metadata, s as modelUids, t as models, U as normalizeRelationPropertyValue, V as resolveSeedIdsFromRefString, C as seeds, F as versions } from './index-DpgQMIRq.js';
|
|
5
5
|
import 'pluralize';
|
|
6
6
|
import '@seedprotocol/eas';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
|
-
export { I as Item, a as ItemProperty, b as ItemPropertySaveValidationError, O as OwnershipError, c as assertItemOwned, i as isItemOwned } from './Item-
|
|
9
|
-
import { c as createPlatformServices } from './index.node-
|
|
10
|
-
export { D as Db, F as FileManager, P as PathResolver, r as resolveSdkDrizzleMigrationsDir } from './index.node-
|
|
8
|
+
export { I as Item, a as ItemProperty, b as ItemPropertySaveValidationError, O as OwnershipError, c as assertItemOwned, i as isItemOwned } from './Item-D6j0IvBP.js';
|
|
9
|
+
import { c as createPlatformServices } from './index.node-BUfx-JaP.js';
|
|
10
|
+
export { D as Db, F as FileManager, P as PathResolver, r as resolveSdkDrizzleMigrationsDir } from './index.node-BUfx-JaP.js';
|
|
11
11
|
import yaml from 'js-yaml';
|
|
12
12
|
import fs__default, { readFileSync } from 'fs';
|
|
13
|
-
export { C as client, g as getRefValueType, i as importJsonSchema, l as loadSchemaFromFile, r as readJsonImportFile, s as syncSchemaFromSource, t as transformImportToSchemaFile } from './ClientManager-
|
|
14
|
-
import { c as configurePlatform } from './configurePlatform-
|
|
15
|
-
export { B as BasePathResolver } from './configurePlatform-
|
|
13
|
+
export { C as client, g as getRefValueType, i as importJsonSchema, l as loadSchemaFromFile, r as readJsonImportFile, s as syncSchemaFromSource, t as transformImportToSchemaFile } from './ClientManager-2GtDWHq6.js';
|
|
14
|
+
import { c as configurePlatform } from './configurePlatform-Bbpw_R4y.js';
|
|
15
|
+
export { B as BasePathResolver } from './configurePlatform-Bbpw_R4y.js';
|
|
16
16
|
import { execSync } from 'child_process';
|
|
17
17
|
import path from 'path';
|
|
18
18
|
import 'xstate';
|
|
@@ -29,11 +29,11 @@ import '@noble/hashes/sha3';
|
|
|
29
29
|
import '@noble/hashes/utils';
|
|
30
30
|
import 'lodash-es';
|
|
31
31
|
import 'rxjs';
|
|
32
|
-
import './tabEvents-
|
|
32
|
+
import './tabEvents-DksXwk3X.js';
|
|
33
33
|
import 'fs/promises';
|
|
34
34
|
import 'url';
|
|
35
35
|
import 'node:url';
|
|
36
|
-
import './index-
|
|
36
|
+
import './index-BbFwftAv.js';
|
|
37
37
|
import '@libsql/client';
|
|
38
38
|
import 'drizzle-orm/libsql';
|
|
39
39
|
import 'drizzle-orm/libsql/migrator';
|
|
@@ -232,7 +232,7 @@ const findSeedBinary = () => {
|
|
|
232
232
|
};
|
|
233
233
|
/**
|
|
234
234
|
* Ensures the Node app DB exists and SDK migrations are applied.
|
|
235
|
-
* (Formerly `runSeedInit`; CLI spawn / npx fallbacks
|
|
235
|
+
* (Formerly `runSeedInit`; its CLI spawn / npx fallbacks were removed in 0.5.0, see docs/adr/0018-fixed-sdk-tables-no-runtime-codegen.md.)
|
|
236
236
|
*/
|
|
237
237
|
const ensureNodeDbSchema = async (_schemaFileDir, appFilesDirPath) => {
|
|
238
238
|
if (!appFilesDirPath) {
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../src/imports/markdown.ts","../../src/node/webpack/index.ts","../../src/node/helpers/scripts.ts","../../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n /** For List: element type when primitive (e.g. 'Text', 'Number'). Use target for list of relations. */\n itemsType?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target, itemsType } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (itemsType) {\n // List of primitives: itemsType = 'Text', 'Number', etc.\n if (itemsType === ModelPropertyDataTypes.Relation && target) {\n schema[propertyName] = Property.List('Relation', target)\n } else if (itemsType !== ModelPropertyDataTypes.Relation) {\n schema[propertyName] = Property.List(itemsType as any)\n } else {\n throw new Error(\n `List of relations requires target model for property ${propertyName}`,\n )\n }\n } else if (target) {\n // Backward compat: target = model name for list of relations\n schema[propertyName] = Property.List('Relation', target)\n } else {\n throw new Error(\n `List property ${propertyName} requires either itemsType (e.g. 'Text') or target (model name for list of relations)`,\n )\n }\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n // addModelsToDb reads property definitions from the model's snapshot context, not from `schema`;\n // without this it saves the model with no properties (and no Relation/List ref models).\n _getSnapshotContext: () => ({ properties: schema }),\n create: async () => {\n throw new Error('Model.create() should not be called directly')\n },\n originalConstructor: class {},\n }\n \n return {\n [modelName]: modelClass as any as Model,\n }\n}\n\n/**\n * Reads a markdown file, parses frontmatter, and saves models/properties to database\n * @param filePath Path to the markdown file\n * @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)\n * @returns The created ModelDefinitions\n */\nexport const saveModelsFromMarkdown = async (\n filePath: string,\n _db: BetterSQLite3Database<any> | SqliteRemoteDatabase<any>,\n): Promise<ModelDefinitions> => {\n // Parse frontmatter\n const frontmatter = parseMarkdownFrontmatter(filePath)\n \n if (!frontmatter) {\n throw new Error(`No frontmatter found in ${filePath}`)\n }\n \n // Validate and process seed config\n const seedConfig = frontmatter as SeedConfig\n const modelDefinitions = processSeedConfig(seedConfig)\n \n // Save to database\n await addModelsToDb(modelDefinitions, undefined, undefined, undefined)\n \n return modelDefinitions\n}\n","/**\n * Webpack / Next.js config helper for Seed Protocol apps.\n * @deprecated Use `withSeed` from `@seedprotocol/next`, which covers Turbopack and webpack and\n * sets the cross-origin isolation headers.\n */\nexport const withSeed = (config: any, webpack: any, isServer: boolean) => {\n config.plugins.push(\n new webpack.NormalModuleReplacementPlugin(/node:/, (resource: { request: string }) => {\n resource.request = resource.request.replace(/^node:/, '')\n }),\n )\n\n if (!isServer) {\n config.resolve.alias['fs'] = '@zenfs/core'\n config.resolve.alias['node:fs'] = '@zenfs/core'\n config.resolve.alias['node:path'] = 'path-browserify'\n config.resolve.alias['path'] = 'path-browserify'\n }\n\n if (isServer) {\n config.externals.push('@sqlite.org/sqlite-wasm')\n config.externals.push('chokidar')\n config.externals.push('arweave')\n }\n\n return config\n}\n","import { execSync } from 'child_process'\nimport path from 'path'\nimport fs from 'fs'\nimport { BaseDb } from '@/db/Db/BaseDb'\n\nexport const commandExists = (command: string): boolean => {\n try {\n execSync(`which ${command}`, { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Finds the seed binary path, trying multiple locations\n * @returns The path to the seed binary, or null if not found\n */\nexport const findSeedBinary = (): string | null => {\n const cwd = process.cwd()\n\n const possiblePaths = [\n path.join(cwd, 'node_modules', '.bin', 'seed'),\n path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n ]\n\n for (const binPath of possiblePaths) {\n if (fs.existsSync(binPath)) {\n return binPath\n }\n }\n\n return null\n}\n\n/**\n * Ensures the Node app DB exists and SDK migrations are applied.\n * (Formerly `runSeedInit`; CLI spawn / npx fallbacks archived under docs/archive/commented/.)\n */\nexport const ensureNodeDbSchema = async (\n _schemaFileDir?: string,\n appFilesDirPath?: string\n): Promise<void> => {\n if (!appFilesDirPath) {\n throw new Error('ensureNodeDbSchema requires appFilesDirPath')\n }\n\n await BaseDb.prepareDb(appFilesDirPath)\n}\n\n/** @deprecated Use ensureNodeDbSchema */\nexport const runSeedInit = ensureNodeDbSchema\n","import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport { Model, Property } from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty, ItemPropertySaveValidationError } from '../ItemProperty/ItemProperty'\nexport type { IItem, IItemProperty } from '../interfaces'\n\n// Errors\nexport { AmbiguousModelError } from '../Model/errors'\nexport { ItemCreateValidationError, UnknownModelError, type ItemCreateProblem } from '../Item/errors'\nexport { ConflictError, type ConflictResult } from '../Schema/errors'\nexport { OwnershipError, assertItemOwned, isItemOwned } from '../helpers/ownership'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db, resolveSdkDrizzleMigrationsDir } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\nexport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '../helpers/relationSeedRef'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Webpack helper\nexport { withSeed } from './webpack'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\nexport type { MultiTabMode } from '../helpers/tabCoordinator'\nexport type { SyncFromEasOptions } from '../events/item/syncDbWithEas'\nexport type { HtmlEmbeddedDataUriPolicy } from '../helpers/property'\n\n// CLI exports\nexport { PathResolver } from './helpers/PathResolver'\nexport { BasePathResolver } from '../helpers/PathResolver/BasePathResolver'\nexport {\n commandExists,\n ensureNodeDbSchema,\n runSeedInit,\n findSeedBinary,\n} from './helpers/scripts'\nexport { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from '../helpers/constants'\n\n// Side effect imports for CLI — register platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,QAAgB,KACc;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;;;IAI/C,MAAM,gBAAgB,GAAG,mCAAmC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC;AAEhC,IAAA,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe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Ae,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AACxE,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC;AACpD,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC9E,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC;AAC1D,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;KACrF;AAED,IAAA,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE;AACnC,QAAA,IAAIA,WAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AAC1B,YAAA,OAAO,OAAO;QAChB;IACF;AAEA,IAAA,OAAO,IAAI;AACb;AAEA;;;AAGG;AACI,MAAM,kBAAkB,GAAG,OAChC,cAAuB,EACvB,eAAwB,KACP;IACjB,IAAI,CAAC,eAAe,EAAE;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC;IAChE;AAEA,IAAA,MAAM,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;AACzC;AAEA;AACO,MAAM,WAAW,GAAG;;ACgB3B,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE;;"}
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../src/imports/markdown.ts","../../src/node/webpack/index.ts","../../src/node/helpers/scripts.ts","../../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n /** For List: element type when primitive (e.g. 'Text', 'Number'). Use target for list of relations. */\n itemsType?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target, itemsType } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (itemsType) {\n // List of primitives: itemsType = 'Text', 'Number', etc.\n if (itemsType === ModelPropertyDataTypes.Relation && target) {\n schema[propertyName] = Property.List('Relation', target)\n } else if (itemsType !== ModelPropertyDataTypes.Relation) {\n schema[propertyName] = Property.List(itemsType as any)\n } else {\n throw new Error(\n `List of relations requires target model for property ${propertyName}`,\n )\n }\n } else if (target) {\n // Backward compat: target = model name for list of relations\n schema[propertyName] = Property.List('Relation', target)\n } else {\n throw new Error(\n `List property ${propertyName} requires either itemsType (e.g. 'Text') or target (model name for list of relations)`,\n )\n }\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n // addModelsToDb reads property definitions from the model's snapshot context, not from `schema`;\n // without this it saves the model with no properties (and no Relation/List ref models).\n _getSnapshotContext: () => ({ properties: schema }),\n create: async () => {\n throw new Error('Model.create() should not be called directly')\n },\n originalConstructor: class {},\n }\n \n return {\n [modelName]: modelClass as any as Model,\n }\n}\n\n/**\n * Reads a markdown file, parses frontmatter, and saves models/properties to database\n * @param filePath Path to the markdown file\n * @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)\n * @returns The created ModelDefinitions\n */\nexport const saveModelsFromMarkdown = async (\n filePath: string,\n _db: BetterSQLite3Database<any> | SqliteRemoteDatabase<any>,\n): Promise<ModelDefinitions> => {\n // Parse frontmatter\n const frontmatter = parseMarkdownFrontmatter(filePath)\n \n if (!frontmatter) {\n throw new Error(`No frontmatter found in ${filePath}`)\n }\n \n // Validate and process seed config\n const seedConfig = frontmatter as SeedConfig\n const modelDefinitions = processSeedConfig(seedConfig)\n \n // Save to database\n await addModelsToDb(modelDefinitions, undefined, undefined, undefined)\n \n return modelDefinitions\n}\n","/**\n * Webpack / Next.js config helper for Seed Protocol apps.\n * @deprecated Use `withSeed` from `@seedprotocol/next`, which covers Turbopack and webpack and\n * sets the cross-origin isolation headers.\n */\nexport const withSeed = (config: any, webpack: any, isServer: boolean) => {\n config.plugins.push(\n new webpack.NormalModuleReplacementPlugin(/node:/, (resource: { request: string }) => {\n resource.request = resource.request.replace(/^node:/, '')\n }),\n )\n\n if (!isServer) {\n config.resolve.alias['fs'] = '@zenfs/core'\n config.resolve.alias['node:fs'] = '@zenfs/core'\n config.resolve.alias['node:path'] = 'path-browserify'\n config.resolve.alias['path'] = 'path-browserify'\n }\n\n if (isServer) {\n config.externals.push('@sqlite.org/sqlite-wasm')\n config.externals.push('chokidar')\n config.externals.push('arweave')\n }\n\n return config\n}\n","import { execSync } from 'child_process'\nimport path from 'path'\nimport fs from 'fs'\nimport { BaseDb } from '@/db/Db/BaseDb'\n\nexport const commandExists = (command: string): boolean => {\n try {\n execSync(`which ${command}`, { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Finds the seed binary path, trying multiple locations\n * @returns The path to the seed binary, or null if not found\n */\nexport const findSeedBinary = (): string | null => {\n const cwd = process.cwd()\n\n const possiblePaths = [\n path.join(cwd, 'node_modules', '.bin', 'seed'),\n path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n ]\n\n for (const binPath of possiblePaths) {\n if (fs.existsSync(binPath)) {\n return binPath\n }\n }\n\n return null\n}\n\n/**\n * Ensures the Node app DB exists and SDK migrations are applied.\n * (Formerly `runSeedInit`; its CLI spawn / npx fallbacks were removed in 0.5.0, see docs/adr/0018-fixed-sdk-tables-no-runtime-codegen.md.)\n */\nexport const ensureNodeDbSchema = async (\n _schemaFileDir?: string,\n appFilesDirPath?: string\n): Promise<void> => {\n if (!appFilesDirPath) {\n throw new Error('ensureNodeDbSchema requires appFilesDirPath')\n }\n\n await BaseDb.prepareDb(appFilesDirPath)\n}\n\n/** @deprecated Use ensureNodeDbSchema */\nexport const runSeedInit = ensureNodeDbSchema\n","import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport { Model, Property } from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty, ItemPropertySaveValidationError } from '../ItemProperty/ItemProperty'\nexport type { IItem, IItemProperty } from '../interfaces'\n\n// Errors\nexport { AmbiguousModelError } from '../Model/errors'\nexport { ItemCreateValidationError, UnknownModelError, type ItemCreateProblem } from '../Item/errors'\nexport { ConflictError, type ConflictResult } from '../Schema/errors'\nexport { OwnershipError, assertItemOwned, isItemOwned } from '../helpers/ownership'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db, resolveSdkDrizzleMigrationsDir } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\nexport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '../helpers/relationSeedRef'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Webpack helper\nexport { withSeed } from './webpack'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\nexport type { MultiTabMode } from '../helpers/tabCoordinator'\nexport type { SyncFromEasOptions } from '../events/item/syncDbWithEas'\nexport type { HtmlEmbeddedDataUriPolicy } from '../helpers/property'\n\n// CLI exports\nexport { PathResolver } from './helpers/PathResolver'\nexport { BasePathResolver } from '../helpers/PathResolver/BasePathResolver'\nexport {\n commandExists,\n ensureNodeDbSchema,\n runSeedInit,\n findSeedBinary,\n} from './helpers/scripts'\nexport { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from '../helpers/constants'\n\n// Side effect imports for CLI — register platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,QAAgB,KACc;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;;;IAI/C,MAAM,gBAAgB,GAAG,mCAAmC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC;AAEhC,IAAA,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,C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,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AACxE,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC;AACpD,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC9E,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC;AAC1D,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;KACrF;AAED,IAAA,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE;AACnC,QAAA,IAAIA,WAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AAC1B,YAAA,OAAO,OAAO;QAChB;IACF;AAEA,IAAA,OAAO,IAAI;AACb;AAEA;;;AAGG;AACI,MAAM,kBAAkB,GAAG,OAChC,cAAuB,EACvB,eAAwB,KACP;IACjB,IAAI,CAAC,eAAe,EAAE;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC;IAChE;AAEA,IAAA,MAAM,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;AACzC;AAEA;AACO,MAAM,WAAW,GAAG;;ACgB3B,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE;;"}
|
package/dist/platform.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-
|
|
2
|
-
export { c as configurePlatform } from './configurePlatform-
|
|
3
|
-
import './index-
|
|
1
|
+
export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-nndbVM7z.js';
|
|
2
|
+
export { c as configurePlatform } from './configurePlatform-Bbpw_R4y.js';
|
|
3
|
+
import './index-DpgQMIRq.js';
|
|
4
4
|
import 'debug';
|
|
5
5
|
import '@seedprotocol/arweave';
|
|
6
6
|
import '@seedprotocol/eas';
|
|
@@ -16,11 +16,11 @@ import '@noble/hashes/sha256';
|
|
|
16
16
|
import '@noble/hashes/sha3';
|
|
17
17
|
import '@noble/hashes/utils';
|
|
18
18
|
import 'lodash-es';
|
|
19
|
-
import './tabEvents-
|
|
19
|
+
import './tabEvents-DksXwk3X.js';
|
|
20
20
|
import './mimeTypes-C9r76DCH.js';
|
|
21
21
|
import './errors-Do7v6RKu.js';
|
|
22
22
|
import 'drizzle-orm/sqlite-proxy';
|
|
23
|
-
import './index-
|
|
23
|
+
import './index-BbFwftAv.js';
|
|
24
24
|
import 'sqlocal/drizzle';
|
|
25
25
|
import 'rxjs';
|
|
26
26
|
import 'graphql-request';
|
package/dist/platform.node.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { c as createPlatformServices, a as resolveFilesDir } from './index.node-
|
|
1
|
+
export { c as createPlatformServices, a as resolveFilesDir } from './index.node-BUfx-JaP.js';
|
|
2
2
|
import '@seedprotocol/arweave/node';
|
|
3
3
|
import '@seedprotocol/eas/node';
|
|
4
|
-
export { c as configurePlatform } from './configurePlatform-
|
|
4
|
+
export { c as configurePlatform } from './configurePlatform-Bbpw_R4y.js';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'fs';
|
|
7
|
-
import './index-
|
|
7
|
+
import './index-DpgQMIRq.js';
|
|
8
8
|
import 'debug';
|
|
9
9
|
import '@seedprotocol/arweave';
|
|
10
10
|
import '@seedprotocol/eas';
|
|
@@ -23,7 +23,7 @@ import 'lodash-es';
|
|
|
23
23
|
import 'fs/promises';
|
|
24
24
|
import 'url';
|
|
25
25
|
import 'node:url';
|
|
26
|
-
import './index-
|
|
26
|
+
import './index-BbFwftAv.js';
|
|
27
27
|
import '@libsql/client';
|
|
28
28
|
import 'drizzle-orm/libsql';
|
|
29
29
|
import 'drizzle-orm/libsql/migrator';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pluralize from 'pluralize';
|
|
2
|
-
import { B as BaseDb, v as properties, t as models, G as resolveStorageNameToSchemaName, g as normalizePropertyRecordSchema } from './index-
|
|
3
|
-
export { M as ModelPropertyDataTypes, P as Property, T as THtmlEmbeddedDataUriPolicy, a as TProperty, b as TPropertyConstructor, c as TPropertyDataType, d as TPropertyDefs, e as TStorageType, i as isDataType, n as normalizeDataType } from './index-
|
|
2
|
+
import { B as BaseDb, v as properties, t as models, G as resolveStorageNameToSchemaName, g as normalizePropertyRecordSchema } from './index-DpgQMIRq.js';
|
|
3
|
+
export { M as ModelPropertyDataTypes, P as Property, T as THtmlEmbeddedDataUriPolicy, a as TProperty, b as TPropertyConstructor, c as TPropertyDataType, d as TPropertyDefs, e as TStorageType, i as isDataType, n as normalizeDataType } from './index-DpgQMIRq.js';
|
|
4
4
|
import { and, eq } from 'drizzle-orm';
|
|
5
5
|
import { modelPropertiesToObject } from './model-oHA3YhOd.js';
|
|
6
6
|
import 'debug';
|
|
@@ -55,15 +55,15 @@ const getPropertySchema = async (modelName, propertyName,
|
|
|
55
55
|
/** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */
|
|
56
56
|
scope = {}) => {
|
|
57
57
|
// Dynamic import to break circular dependency
|
|
58
|
-
const _mod_0 = await import('./errors-
|
|
58
|
+
const _mod_0 = await import('./errors-KM-yq2MD.js');
|
|
59
59
|
const _ns_0 = _mod_0.j;
|
|
60
60
|
const modelMod = _ns_0;
|
|
61
61
|
const { Model } = modelMod;
|
|
62
|
-
const _mod_1 = await import('./Schema-
|
|
62
|
+
const _mod_1 = await import('./Schema-O1QLoXv6.js');
|
|
63
63
|
const _ns_1 = _mod_1.b;
|
|
64
64
|
const schemaMod = _ns_1;
|
|
65
65
|
const { Schema } = schemaMod;
|
|
66
|
-
const _mod_2 = await import('./index-
|
|
66
|
+
const _mod_2 = await import('./index-DpgQMIRq.js');
|
|
67
67
|
const _ns_2 = _mod_2.bh;
|
|
68
68
|
const { resolveModelRecord } = _ns_2;
|
|
69
69
|
const model = await Model.resolveAsync(modelName, scope);
|
|
@@ -289,4 +289,4 @@ scope = {}) => {
|
|
|
289
289
|
};
|
|
290
290
|
|
|
291
291
|
export { getPropertySchema, normalizePropertyRecordSchema };
|
|
292
|
-
//# sourceMappingURL=property-
|
|
292
|
+
//# sourceMappingURL=property-BDBvImLs.js.map
|