@seedprotocol/sdk 0.7.11-next.1384.g8b47246 → 0.7.11

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.
Files changed (122) hide show
  1. package/dist/{BaseFileManager-DLou1TZS.js → BaseFileManager-D-pLXQAp.js} +2 -14
  2. package/dist/BaseFileManager-D-pLXQAp.js.map +1 -0
  3. package/dist/{Item-Ld1iPicQ.js → Item-BU9wIT7l.js} +61 -59
  4. package/dist/Item-BU9wIT7l.js.map +1 -0
  5. package/dist/{ModelProperty-C8gTx4pO.js → ModelProperty-Bv7KzP97.js} +40 -37
  6. package/dist/ModelProperty-Bv7KzP97.js.map +1 -0
  7. package/dist/{Schema-BzeBUZxi.js → Schema-C_4wv0RP.js} +22 -22
  8. package/dist/{Schema-BzeBUZxi.js.map → Schema-C_4wv0RP.js.map} +1 -1
  9. package/dist/{SchemaValidationService-CW0s7V7R.js → SchemaValidationService-Dc-lpFQX.js} +9 -6
  10. package/dist/{SchemaValidationService-CW0s7V7R.js.map → SchemaValidationService-Dc-lpFQX.js.map} +1 -1
  11. package/dist/{tabEvents-BnBzIdEi.js → arweaveContentTags-iW_HcWJA.js} +53 -5
  12. package/dist/arweaveContentTags-iW_HcWJA.js.map +1 -0
  13. package/dist/{configurePlatform-WkmvqeTO.js → configurePlatform-BH1YOZpg.js} +2 -2
  14. package/dist/{configurePlatform-WkmvqeTO.js.map → configurePlatform-BH1YOZpg.js.map} +1 -1
  15. package/dist/db/drizzle/0030_drop_property_uids.sql +1 -0
  16. package/dist/db/drizzle/meta/0030_snapshot.json +1638 -0
  17. package/dist/db/drizzle/meta/_journal.json +8 -1
  18. package/dist/{detachRowsBeforeDelete-BZr_0iZU.js → detachRowsBeforeDelete-Cie55SoG.js} +4 -6
  19. package/dist/detachRowsBeforeDelete-Cie55SoG.js.map +1 -0
  20. package/dist/dist/{BaseFileManager-DLou1TZS.d.ts → BaseFileManager-D-pLXQAp.d.ts} +432 -495
  21. package/dist/dist/BaseFileManager-D-pLXQAp.d.ts.map +1 -0
  22. package/dist/dist/{configurePlatform-WkmvqeTO.d.ts → configurePlatform-BH1YOZpg.d.ts} +1 -1
  23. package/dist/dist/configurePlatform-BH1YOZpg.d.ts.map +1 -0
  24. package/dist/dist/{index-BjWk0x4-.d.ts → index-2PaIhvOU.d.ts} +1 -64
  25. package/dist/dist/{index-BjWk0x4-.d.ts.map → index-2PaIhvOU.d.ts.map} +1 -1
  26. package/dist/dist/{index.node-DV1OXCp0.d.ts → index.node-C3rI1upv.d.ts} +1 -253
  27. package/dist/dist/{index.node-DV1OXCp0.d.ts.map → index.node-C3rI1upv.d.ts.map} +1 -1
  28. package/dist/dist/minimumUpgradeVersion-Dg2MguFf.d.ts +20 -0
  29. package/dist/dist/minimumUpgradeVersion-Dg2MguFf.d.ts.map +1 -0
  30. package/dist/dist/platform.node.d.ts +2 -2
  31. package/dist/{download-Cvac_VGu.js → download-DHWUPLlK.js} +4 -5
  32. package/dist/{download-Cvac_VGu.js.map → download-DHWUPLlK.js.map} +1 -1
  33. package/dist/{eas-CdhfODXL.js → eas-MXEdKKVc.js} +10 -7
  34. package/dist/{eas-CdhfODXL.js.map → eas-MXEdKKVc.js.map} +1 -1
  35. package/dist/{ensureImageLocal-DNM6c2yD.js → ensureImageLocal-B6suz6FC.js} +8 -9
  36. package/dist/{ensureImageLocal-DNM6c2yD.js.map → ensureImageLocal-B6suz6FC.js.map} +1 -1
  37. package/dist/{getPublishPayload-CLrAcZwr.js → getPublishPayload-Dd3HCYeI.js} +8 -49
  38. package/dist/getPublishPayload-Dd3HCYeI.js.map +1 -0
  39. package/dist/{getPublishPendingDiff-DiPff8pS.js → getPublishPendingDiff-kcTP52Kj.js} +11 -9
  40. package/dist/{getPublishPendingDiff-DiPff8pS.js.map → getPublishPendingDiff-kcTP52Kj.js.map} +1 -1
  41. package/dist/{index-BjWk0x4-.js → index-2PaIhvOU.js} +2 -4
  42. package/dist/index-2PaIhvOU.js.map +1 -0
  43. package/dist/{index-9udoYObJ.js → index-BXTyvnKb.js} +11 -8
  44. package/dist/index-BXTyvnKb.js.map +1 -0
  45. package/dist/{index-CghAYA-z.js → index-CmNqUKQN.js} +11 -8
  46. package/dist/index-CmNqUKQN.js.map +1 -0
  47. package/dist/{index-Cdm7Q7el.js → index-Xs_EDi-_.js} +18 -403
  48. package/dist/index-Xs_EDi-_.js.map +1 -0
  49. package/dist/{index.browser-D9oC-KKx.js → index.browser-BkcOQGhw.js} +25 -69
  50. package/dist/index.browser-BkcOQGhw.js.map +1 -0
  51. package/dist/{index.node-DV1OXCp0.js → index.node-C3rI1upv.js} +8 -6
  52. package/dist/index.node-C3rI1upv.js.map +1 -0
  53. package/dist/main.js +19 -22
  54. package/dist/main.js.map +1 -1
  55. package/dist/{minimumUpgradeVersion-BDhHvHtr.js → minimumUpgradeVersion-Dg2MguFf.js} +38 -9
  56. package/dist/minimumUpgradeVersion-Dg2MguFf.js.map +1 -0
  57. package/dist/{modelPropertyRecordSchemas-se4QMXSi.js → modelPropertyRecordSchemas-CEac3FB8.js} +8 -5
  58. package/dist/{modelPropertyRecordSchemas-se4QMXSi.js.map → modelPropertyRecordSchemas-CEac3FB8.js.map} +1 -1
  59. package/dist/node.js +14 -11
  60. package/dist/node.js.map +1 -1
  61. package/dist/platform.browser.js +6 -7
  62. package/dist/platform.browser.js.map +1 -1
  63. package/dist/platform.node.js +5 -5
  64. package/dist/{property-Broz_CWj.js → property-4jSqHieb.js} +11 -8
  65. package/dist/property-4jSqHieb.js.map +1 -0
  66. package/dist/{errors-DKxFSvb3.js → publishErrors-DZXDX3B6.js} +1688 -195
  67. package/dist/publishErrors-DZXDX3B6.js.map +1 -0
  68. package/dist/{readHtmlBodyForStorageSeed-FvwYPn4m.js → readHtmlBodyForStorageSeed-Cva1DPzE.js} +9 -9
  69. package/dist/{readHtmlBodyForStorageSeed-FvwYPn4m.js.map → readHtmlBodyForStorageSeed-Cva1DPzE.js.map} +1 -1
  70. package/dist/seedSchema/index.ts +0 -1
  71. package/dist/src/ItemProperty/ItemProperty.d.ts +1 -0
  72. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  73. package/dist/src/browser/db/Db.d.ts.map +1 -1
  74. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  75. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  76. package/dist/src/db/minimumUpgradeVersion.d.ts +20 -5
  77. package/dist/src/db/minimumUpgradeVersion.d.ts.map +1 -1
  78. package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts +2 -3
  79. package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts.map +1 -1
  80. package/dist/src/index.d.ts +4 -1
  81. package/dist/src/index.d.ts.map +1 -1
  82. package/dist/src/node/db/Db.d.ts.map +1 -1
  83. package/dist/src/node/index.d.ts +9 -1
  84. package/dist/src/node/index.d.ts.map +1 -1
  85. package/dist/src/seedSchema/index.d.ts +0 -1
  86. package/dist/src/seedSchema/index.d.ts.map +1 -1
  87. package/dist/{syncDbWithEas-Dj_8VqM7.js → syncDbWithEas-V_9gIyHp.js} +21 -20
  88. package/dist/syncDbWithEas-V_9gIyHp.js.map +1 -0
  89. package/dist/{tolerantWebAccess-CNfvmR3m.js → tolerantWebAccess-D6hFxREe.js} +7 -8
  90. package/dist/{tolerantWebAccess-CNfvmR3m.js.map → tolerantWebAccess-D6hFxREe.js.map} +1 -1
  91. package/dist/{updateSeedRevokedAt-D-3SLW-D.js → updateSeedRevokedAt-CsAoUEEt.js} +4 -4
  92. package/dist/{updateSeedRevokedAt-D-3SLW-D.js.map → updateSeedRevokedAt-CsAoUEEt.js.map} +1 -1
  93. package/package.json +7 -7
  94. package/dist/BaseFileManager-DLou1TZS.js.map +0 -1
  95. package/dist/Item-Ld1iPicQ.js.map +0 -1
  96. package/dist/ModelProperty-C8gTx4pO.js.map +0 -1
  97. package/dist/arweaveContentTags-Bh4wCTal.js +0 -51
  98. package/dist/arweaveContentTags-Bh4wCTal.js.map +0 -1
  99. package/dist/detachRowsBeforeDelete-BZr_0iZU.js.map +0 -1
  100. package/dist/dist/BaseFileManager-DLou1TZS.d.ts.map +0 -1
  101. package/dist/dist/configurePlatform-WkmvqeTO.d.ts.map +0 -1
  102. package/dist/dist/minimumUpgradeVersion-BDhHvHtr.d.ts +0 -9
  103. package/dist/dist/minimumUpgradeVersion-BDhHvHtr.d.ts.map +0 -1
  104. package/dist/errors-DKxFSvb3.js.map +0 -1
  105. package/dist/getPublishPayload-CLrAcZwr.js.map +0 -1
  106. package/dist/getPublishUploads-DFcgc27c.js +0 -784
  107. package/dist/getPublishUploads-DFcgc27c.js.map +0 -1
  108. package/dist/index-9udoYObJ.js.map +0 -1
  109. package/dist/index-BjWk0x4-.js.map +0 -1
  110. package/dist/index-Cdm7Q7el.js.map +0 -1
  111. package/dist/index-CghAYA-z.js.map +0 -1
  112. package/dist/index.browser-D9oC-KKx.js.map +0 -1
  113. package/dist/index.node-DV1OXCp0.js.map +0 -1
  114. package/dist/minimumUpgradeVersion-BDhHvHtr.js.map +0 -1
  115. package/dist/property-Broz_CWj.js.map +0 -1
  116. package/dist/publishGraph-DnWoWZRP.js +0 -311
  117. package/dist/publishGraph-DnWoWZRP.js.map +0 -1
  118. package/dist/seedSchema/PropertyUidSchema.ts +0 -16
  119. package/dist/src/seedSchema/PropertyUidSchema.d.ts +0 -64
  120. package/dist/src/seedSchema/PropertyUidSchema.d.ts.map +0 -1
  121. package/dist/syncDbWithEas-Dj_8VqM7.js.map +0 -1
  122. package/dist/tabEvents-BnBzIdEi.js.map +0 -1
@@ -1,21 +1,21 @@
1
1
  import * as fsAsync from 'fs/promises';
2
2
  import * as fs from 'fs';
3
3
  import fs__default from 'fs';
4
- import { w as BaseFileManager, x as isSqliteBusyError, S as SQLITE_BUSY_RETRY_DELAYS_MS, B as BaseDb, a as appState } from './BaseFileManager-DLou1TZS.js';
4
+ import { r as BaseFileManager, t as isSqliteBusyError, S as SQLITE_BUSY_RETRY_DELAYS_MS, B as BaseDb, a as appState } from './BaseFileManager-D-pLXQAp.js';
5
5
  import path from 'path';
6
6
  import { pathToFileURL } from 'url';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import debug from 'debug';
9
- import { s as schema } from './index-BjWk0x4-.js';
9
+ import { s as schema } from './index-2PaIhvOU.js';
10
10
  import { createClient } from '@libsql/client';
11
11
  import { drizzle } from 'drizzle-orm/libsql';
12
12
  import { migrate } from 'drizzle-orm/libsql/migrator';
13
13
  import { interval, startWith, switchMap, distinctUntilChanged } from 'rxjs';
14
- import { r as recreateIfOlderThanMinimumUpgradeVersion } from './minimumUpgradeVersion-BDhHvHtr.js';
14
+ import { r as recreateIfOlderThanMinimumUpgradeVersion, a as recreateBackupPath } from './minimumUpgradeVersion-Dg2MguFf.js';
15
15
  import { DefaultArweaveClient } from '@seedprotocol/arweave';
16
16
  import { DefaultQueryClient } from '@seedprotocol/eas';
17
17
  import { NodeEasClient } from '@seedprotocol/eas/node';
18
- import './configurePlatform-WkmvqeTO.js';
18
+ import './configurePlatform-BH1YOZpg.js';
19
19
 
20
20
  class NodeFileManager {
21
21
  async getFs() {
@@ -412,7 +412,9 @@ class NodeDb {
412
412
  if (localDbFilePath(dbUrl))
413
413
  await client.execute('PRAGMA journal_mode = WAL');
414
414
  const db = drizzle(client, { schema });
415
- await recreateIfOlderThanMinimumUpgradeVersion(db);
415
+ await recreateIfOlderThanMinimumUpgradeVersion(db, {
416
+ backupPath: dbFilePath ? recreateBackupPath(dbFilePath) : undefined,
417
+ });
416
418
  logger('[Db.prepareDb] running migrations from %s', outDir);
417
419
  await migrate(db, { migrationsFolder: outDir });
418
420
  if (generation !== this.openGeneration) {
@@ -537,4 +539,4 @@ function createPlatformServices() {
537
539
  }
538
540
 
539
541
  export { NodeDb as N, NodeFileManager as a, resolveFilesDir as b, createPlatformServices as c, resolveSdkDrizzleMigrationsDir as r };
540
- //# sourceMappingURL=index.node-DV1OXCp0.js.map
542
+ //# sourceMappingURL=index.node-C3rI1upv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node-C3rI1upv.js","sources":["../../src/node/helpers/FileManager.ts","../../src/node/db/singleConnectionTransactions.ts","../../src/node/db/Db.ts","../../src/node/helpers/dotSeedDir.ts","../../src/helpers/dotSeedPath.ts","../../src/node/helpers/resolveFilesDir.ts","../../src/platform/index.node.ts"],"sourcesContent":["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\nBaseFileManager.configure(new NodeFileManager())\n\nconst _check: IFileManager = new NodeFileManager()\nvoid _check\n","import type { Client } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { isSqliteBusyError, SQLITE_BUSY_RETRY_DELAYS_MS } from '@/browser/db/sqliteBusyRetry'\n\n/**\n * Transactions on libsql's one connection, with the browser's semantics (ADR 0019).\n *\n * libsql's own `transaction()` hands the transaction the client's connection and opens a new one\n * for everything after, so a process ends up with several connections that lock each other out\n * (SQLITE_BUSY) and, in tests, lost an outbox op's committed insert. Here every statement uses the\n * client's single connection instead:\n *\n * - `transaction(fn)` runs one transaction at a time: BEGIN IMMEDIATE, `fn` on a Drizzle database\n * whose statements go straight to the connection, then COMMIT, or ROLLBACK when `fn` throws.\n * - Statements on the app database (the patched client) wait while a transaction is open, as\n * SQLocal makes them wait in the browser. So `fn` must not use the app database: it would wait\n * for its own transaction.\n * - Statements outside a transaction keep the busy retry: another process may hold the file.\n *\n * libsql 0.5 doesn't reset a statement that failed with SQLITE_BUSY, and that leaves its\n * connection in an implicit transaction that never commits: every later write on it is lost when it\n * closes and never reaches the file (`inTransaction` still reads false). So after a busy error the\n * connection is replaced (`reconnect()`) before anything else runs on it, and a transaction waits\n * for statements that are between attempts.\n */\nexport function createSingleConnectionTransactions(client: Client, schema: Record<string, unknown>) {\n const execute = client.execute.bind(client)\n const batch = client.batch.bind(client)\n\n /** Resolves when the open transaction ends; undefined when none is open. */\n let open: Promise<void> | undefined\n /** The transactions waiting their turn, chained. */\n let queue: Promise<void> = Promise.resolve()\n\n const outsideTransactions = async () => {\n while (open) await open\n }\n\n /** Statements outside transactions that are running or replacing a busy connection. */\n let statementsRunning = 0\n const whenStatementsDone: (() => void)[] = []\n const statementsDone = () =>\n statementsRunning === 0 ? Promise.resolve() : new Promise<void>((resolve) => whenStatementsDone.push(resolve))\n\n const statement = async <T>(run: () => Promise<T>): Promise<T> => {\n for (let attempt = 0; ; attempt++) {\n await outsideTransactions()\n statementsRunning++\n try {\n return await run()\n } catch (error) {\n if (!isSqliteBusyError(error) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length) throw error\n await client.reconnect()\n } finally {\n if (--statementsRunning === 0) for (const resolve of whenStatementsDone.splice(0)) resolve()\n }\n await new Promise((resolve) => setTimeout(resolve, SQLITE_BUSY_RETRY_DELAYS_MS[attempt]))\n }\n }\n\n client.execute = ((...args: Parameters<Client['execute']>) => statement(() => execute(...args))) as Client['execute']\n client.batch = ((...args: Parameters<Client['batch']>) => statement(() => batch(...args))) as Client['batch']\n\n // What Drizzle uses of the client, straight to the connection: the transaction's own statements\n const transactionClient = {\n execute,\n batch,\n protocol: client.protocol,\n get closed() {\n return client.closed\n },\n } as unknown as Client\n const transactionDb = drizzle(transactionClient, { schema })\n\n async function transaction<T>(fn: (tx: typeof transactionDb) => Promise<T>): Promise<T> {\n const previous = queue\n let finished!: () => void\n queue = new Promise<void>((resolve) => (finished = resolve))\n await previous\n let end!: () => void\n open = new Promise<void>((resolve) => (end = resolve))\n try {\n await statementsDone()\n try {\n await execute('BEGIN IMMEDIATE')\n } catch (error) {\n // Busy: BaseDb.transaction retries the whole transaction, on a fresh connection\n if (isSqliteBusyError(error)) await client.reconnect()\n throw error\n }\n try {\n const result = await fn(transactionDb)\n await execute('COMMIT')\n return result\n } catch (error) {\n try {\n await execute('ROLLBACK')\n } catch {\n // Already rolled back (SQLite does on some errors)\n }\n if (isSqliteBusyError(error)) await client.reconnect()\n throw error\n }\n } finally {\n open = undefined\n end()\n finished()\n }\n }\n\n return { transaction }\n}\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 { createSingleConnectionTransactions } from './singleConnectionTransactions'\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 { recreateBackupPath, recreateIfOlderThanMinimumUpgradeVersion } from '@/db/minimumUpgradeVersion'\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 * The installed @seedprotocol/sdk's dist directory, resolved from this module rather than the\n * working directory (hoisted monorepos, packaged Electron apps and scripts run from elsewhere all\n * differ). The working directory when the package can't be resolved.\n */\nfunction installedSdkDistDir(): string {\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 process.cwd()\n }\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 = sdkRootDir || installedSdkDistDir()\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/** 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 private client: ReturnType<typeof createClient> | undefined\n /** Bumped by close(), so a prepareDb that was running closes what it opened instead of keeping it. */\n private openGeneration = 0\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return !!this.db\n }\n\n transactions: ReturnType<typeof createSingleConnectionTransactions> | undefined\n\n async transaction<T>(fn: (tx: any) => Promise<T>): Promise<T> {\n if (!this.db || !this.transactions) throw new Error('Database not prepared')\n return this.transactions.transaction(fn)\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 generation = this.openGeneration\n this.closeOpenDb()\n const client = createClient({ url: dbUrl })\n this.client = client\n // One connection for everything, transactions included (see singleConnectionTransactions)\n this.transactions = createSingleConnectionTransactions(client, schema)\n // Readers in other processes (a CLI on the same file) don't block a commit in WAL\n if (localDbFilePath(dbUrl)) await client.execute('PRAGMA journal_mode = WAL')\n const db = drizzle(client, { schema })\n\n await recreateIfOlderThanMinimumUpgradeVersion(db, {\n backupPath: dbFilePath ? recreateBackupPath(dbFilePath) : undefined,\n })\n logger('[Db.prepareDb] running migrations from %s', outDir)\n await migrate(db, { migrationsFolder: outDir })\n if (generation !== this.openGeneration) {\n if (this.client === client) this.closeOpenDb()\n else client.close()\n throw new Error('The database was closed while it was being opened')\n }\n\n this.db = db\n\n return this.db\n }\n\n async close(): Promise<void> {\n this.openGeneration++\n this.closeOpenDb()\n }\n\n /** Closes the libsql client and forgets the database. */\n private closeOpenDb(): void {\n const client = this.client\n this.db = undefined\n this.transactions = undefined\n this.client = undefined\n if (client && !client.closed) client.close()\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 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\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\nBaseDb.configure(new NodeDb())\n\nconst _check: IDb = new NodeDb()\nvoid _check\n","import path from 'path'\n\n/**\n * The project's `.seed` directory on Node: `<process.cwd()>/.seed`. Apps whose working directory\n * isn't writable (a packaged Electron app's is often `/`) chdir before init or pass an absolute\n * filesDir.\n */\nexport function getDotSeedDir(): string {\n return path.join(process.cwd(), '.seed')\n}\n","/**\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 fs from 'fs'\nimport path from 'path'\nimport { getDotSeedDir } from './dotSeedDir'\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 = 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 { NodeFileManager } from '@/node/helpers/FileManager'\nimport { NodeDb } from '@/node/db/Db'\nimport { DefaultArweaveClient } from '@seedprotocol/arweave'\nimport { DefaultQueryClient } from '@seedprotocol/eas'\nimport { NodeEasClient } from '@seedprotocol/eas/node'\nimport type { PlatformServices } from './types'\n\nexport function createPlatformServices(): PlatformServices {\n return {\n fileManager: new NodeFileManager(),\n db: new NodeDb(),\n arweaveClient: new DefaultArweaveClient(),\n // Own undici Agent for EAS requests: shorter TLS handshake on Node 24.21+, 30 s keep-alive.\n easClient: new NodeEasClient(),\n queryClient: new DefaultQueryClient(),\n }\n}\n\nexport { configurePlatform } from './configurePlatform'\nexport { resolveFilesDir } from '@/node/helpers/resolveFilesDir'\nexport type { PlatformServices } from './types'\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;MAOa,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;IAC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AAE;;IAGlC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,IAAA,MAAM,iBAAiB,GACrB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;AACzB,QAAA,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;QACxB,uBAAuB,CAAC,MAAM,GAAG,CAAC;AAClC,QAAA,CAAC,uBAAuB,CAAC,QAAQ,CAAC,GAAG,CAAC;AACtC,QAAA,CAACA,WAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;IAE1B,IAAI,iBAAiB,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC;IAChE;IACA,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC9B,OAAO,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5F;AACA,IAAA,OAAO,QAAQ;AACjB;;SCzBgB,sBAAsB,GAAA;IACpC,OAAO;QACL,WAAW,EAAE,IAAI,eAAe,EAAE;QAClC,EAAE,EAAE,IAAI,MAAM,EAAE;QAChB,aAAa,EAAE,IAAI,oBAAoB,EAAE;;QAEzC,SAAS,EAAE,IAAI,aAAa,EAAE;QAC9B,WAAW,EAAE,IAAI,kBAAkB,EAAE;KACtC;AACH;;"}
package/dist/main.js CHANGED
@@ -1,39 +1,36 @@
1
- export { C as ConflictError, E as EAS_CHAIN_ID_APP_STATE_KEY, A as INIT_CONFIG_CONFLICT_MESSAGE, B as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError, v as assertLocalDbChain, D as claimUnpublishedDrafts, a as client, F as createLocalQueryDataSource, G as easSyncActor, H as getClient, J as getPublishedSeedRecord, K as getSchemaNameFromId, i as importJsonSchema, L as isSeedQueryLocalSourceRegistered, N as listSchemas, k as loadAllSchemasFromDb, O as mergeEasSyncRequestIntents, r as readJsonImportFile, P as registerSeedQueryLocalSource, Q as requestEasSyncFromAddressChange, R as requestEasSyncFromModelsInit, V as sendEasSyncClientRequest, W as setRetriesWhenOnlineEnabled, X as startEasSyncActor, b as syncSchemaFromSource, c as transformImportToSchemaFile, Y as unregisterSeedQueryLocalSource } from './errors-DKxFSvb3.js';
2
- export { A as ADDRESSES_PERSISTED_EVENT, E as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, F as FILES_CHANGED_EVENT, m as INTERNAL_DATA_TYPES, I as ImageSize, L as LOCAL_COPIES_REMOVED_EVENT, M as ModelPropertyDataTypes, S as SEED_PROTOCOL_SCHEMA_NAME, y as SeedModels, z as TabLockTimeoutError, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, h as eventEmitter, k as generateId, B as isChangeFeedRunning, i as isDataType, C as isLeaderTab, n as normalizeDataType, G as parseAddressesPersistedPayload, H as watchEntityChanges, J as watchEntityRows, K as whenLeaderTab } from './tabEvents-BnBzIdEi.js';
3
- export { getPropertySchema } from './property-Broz_CWj.js';
4
- export { A as AmbiguousModelError, C as ClearNotSupportedError, aU as ClientManagerState, a7 as EntityUnloadedError, I as Item, l as ItemProperty, n as ItemPropertySaveValidationError, aB as METADATA_LATEST_FIRST_ORDER_SQL, aV as MachineIds, q as OwnershipError, aW as PUBLISH_NOT_CONFIGURED_MESSAGE, s as assertItemOwned, D as compareMetadataRowsLatestFirst, aX as createNewItem, ar as easPropertyNameForPublish, aY as getAddressesForItemsFilter, aZ as getArweaveUrlForTransaction, t as getCorrectId, ak as getGetAdditionalSyncAddresses, a_ as getGetPublisherForNewSeeds, a$ as getMetadataLatest, b0 as getPublishExecutor, b1 as getRevokeExecutor, b2 as getUploadExecutor, b3 as getVersionData, ac as isClientReady, b4 as isClientReadySnapshot, u as isItemOwned, b5 as isLocalUnsealedDraft, v as isPublishedSeedRef, b6 as isSeedRowOwned, aq as listRelationEasPropertyName, b7 as localUnsealedDraftSql, b8 as normalizeAddressConfig, b9 as normalizeAddressList, am as normalizeHexAddress, ag as normalizePublisher, ba as ownedPublisherSql, bb as ownedSeedsSql, bc as pickLatestMetadataRowPerProperty, bd as placeholderUidSql, be as propertyMachine, bf as publisherInAddressListSql, bg as publisherIsInOwnedSet, bh as setAdditionalSyncAddresses, bi as setGetPublisherForNewSeeds, bj as setPublishExecutor, bk as setRevokeExecutor, bl as setUploadExecutor, W as whenDbReady } from './Item-Ld1iPicQ.js';
5
- export { B as BaseDb, w as BaseFileManager, w as FileManager, a as appState, e as arweaveL1FinalizeJobs, f as easSyncProcesses, h as htmlEmbeddedImageCoPublish, m as metadata, j as modelSchemas, b as modelUids, d as models, l as properties, q as propertyUids, r as publishProcesses, t as schemas, s as seeds, u as uploadProcesses, v as versions } from './BaseFileManager-DLou1TZS.js';
6
- export { A as ArchiveExportError, a as applyPropertyAttestationUidsFromPublish, e as estimateDataUriByteLength, b as exportArchive, g as getAttesterForSeed, c as getMetadataAttestationUidsForSeedUid, d as getSeedPublishState, f as getUnpublishedRelatedItems, h as getVersionsForSeedUid, m as markPropertyAttestationsRetracted, r as renameModelProperty, i as resolveMediaRef, s as summarizePublishWork, u as updateModelProperties, j as updateVersionUid } from './index-Cdm7Q7el.js';
7
- export { S as Schema, s as schemaMachine } from './Schema-BzeBUZxi.js';
1
+ export { A as ArchiveExportError, C as ConflictError, L as EAS_CHAIN_ID_APP_STATE_KEY, N as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, O as HTML_EMBEDDED_MAX_IMAGE_BYTES, Q as HTML_EMBEDDED_MAX_TOTAL_BYTES, H as HtmlEmbeddedDataUriLimitError, a as HtmlSeedPropertyRefError, V as INIT_CONFIG_CONFLICT_MESSAGE, I as ItemCreateError, b as ItemCreateValidationError, M as Model, P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, c as RelatedItemUnpublishedError, e as RelationTargetError, W as SEED_PROPERTY_REF_PREFIX, U as UnknownModelError, D as assertLocalDbChain, X as claimUnpublishedDrafts, Y as clearHtmlEmbeddedImageCoPublishRows, f as client, Z as createLocalQueryDataSource, _ as easSyncActor, g as exportArchive, $ as extractDataUriImagesFromHtml, a0 as findSeedPropertyRefsInHtml, a1 as getClient, F as getPublishGraph, a2 as getPublishUploadData, a3 as getPublishedSeedRecord, a4 as getSchemaNameFromId, i as importJsonSchema, a5 as isSeedQueryLocalSourceRegistered, a6 as itemHasPublishUploadCandidates, a7 as listSchemas, q as loadAllSchemasFromDb, a8 as mergeEasSyncRequestIntents, a9 as prepareHtmlEmbeddedImagesForPublish, r as readJsonImportFile, aa as registerSeedQueryLocalSource, ab as replaceDataUrisInParsedHtml, ac as replaceSeedPropertyRefsInHtml, ad as requestEasSyncFromAddressChange, ae as requestEasSyncFromModelsInit, af as resolveEffectiveHtmlEmbeddedDataUriPolicy, ag as rewriteHtmlEmbeddedImagesOnDisk, ah as sendEasSyncClientRequest, ai as setRetriesWhenOnlineEnabled, aj as startEasSyncActor, h as syncSchemaFromSource, j as transformImportToSchemaFile, ak as unregisterSeedQueryLocalSource } from './publishErrors-DZXDX3B6.js';
2
+ export { A as ADDRESSES_PERSISTED_EVENT, C as CONTENT_SHA256_TAG, v as CONTENT_TYPE_TAG, E as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, F as FILES_CHANGED_EVENT, m as INTERNAL_DATA_TYPES, I as ImageSize, L as LOCAL_COPIES_REMOVED_EVENT, M as ModelPropertyDataTypes, S as SEED_PROTOCOL_SCHEMA_NAME, w as SeedModels, x as TabLockTimeoutError, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, y as buildArweaveContentTags, z as contentSha256TagMatches, h as eventEmitter, k as generateId, B as getContentSha256, G as isChangeFeedRunning, i as isDataType, H as isLeaderTab, n as normalizeDataType, J as parseAddressesPersistedPayload, K as watchEntityChanges, N as watchEntityRows, O as whenLeaderTab } from './arweaveContentTags-iW_HcWJA.js';
3
+ export { getPropertySchema } from './property-4jSqHieb.js';
4
+ export { A as AmbiguousModelError, C as ClearNotSupportedError, aL as ClientManagerState, E as EntityUnloadedError, I as Item, l as ItemProperty, n as ItemPropertySaveValidationError, ap as METADATA_LATEST_FIRST_ORDER_SQL, aM as MachineIds, e as OutboxOpFailedError, q as OwnershipError, aN as PUBLISH_NOT_CONFIGURED_MESSAGE, S as StagedValueMissingError, s as assertItemOwned, D as compareMetadataRowsLatestFirst, aO as createNewItem, ai as easPropertyNameForPublish, aP as getAddressesForItemsFilter, aQ as getArweaveUrlForTransaction, t as getCorrectId, ab as getGetAdditionalSyncAddresses, aR as getGetPublisherForNewSeeds, aS as getMetadataLatest, aT as getPublishExecutor, aU as getRevokeExecutor, aV as getUploadExecutor, aW as getVersionData, a3 as isClientReady, aX as isClientReadySnapshot, u as isItemOwned, aY as isLocalUnsealedDraft, v as isPublishedSeedRef, aZ as isSeedRowOwned, ah as listRelationEasPropertyName, a_ as localUnsealedDraftSql, a$ as normalizeAddressConfig, b0 as normalizeAddressList, ad as normalizeHexAddress, a7 as normalizePublisher, b1 as ownedPublisherSql, b2 as ownedSeedsSql, b3 as pickLatestMetadataRowPerProperty, b4 as placeholderUidSql, b5 as propertyMachine, b6 as publisherInAddressListSql, b7 as publisherIsInOwnedSet, b8 as setAdditionalSyncAddresses, b9 as setGetPublisherForNewSeeds, ba as setPublishExecutor, bb as setRevokeExecutor, bc as setUploadExecutor, M as whenDbReady } from './Item-BU9wIT7l.js';
5
+ export { B as BaseDb, r as BaseFileManager, r as FileManager, a as appState, e as arweaveL1FinalizeJobs, f as easSyncProcesses, h as htmlEmbeddedImageCoPublish, m as metadata, j as modelSchemas, b as modelUids, d as models, l as properties, o as publishProcesses, q as schemas, s as seeds, u as uploadProcesses, v as versions } from './BaseFileManager-D-pLXQAp.js';
6
+ export { a as applyPropertyAttestationUidsFromPublish, e as estimateDataUriByteLength, g as getAttesterForSeed, b as getMetadataAttestationUidsForSeedUid, c as getSeedPublishState, d as getUnpublishedRelatedItems, f as getVersionsForSeedUid, m as markPropertyAttestationsRetracted, r as renameModelProperty, h as resolveMediaRef, s as summarizePublishWork, u as updateModelProperties, i as updateVersionUid } from './index-Xs_EDi-_.js';
7
+ export { S as Schema, s as schemaMachine } from './Schema-C_4wv0RP.js';
8
8
  export { D as DatabaseNotPersistentError, F as FileSystemLockedError, U as UnsupportedBrowserError, c as checkBrowserSupport } from './browserSupport-C64rX-2I.js';
9
- export { M as MODEL_AMBIGUOUS_EVENT, u as updateSeedRevokedAt } from './updateSeedRevokedAt-D-3SLW-D.js';
10
- export { ModelProperty } from './ModelProperty-C8gTx4pO.js';
9
+ export { M as MODEL_AMBIGUOUS_EVENT, u as updateSeedRevokedAt } from './updateSeedRevokedAt-CsAoUEEt.js';
10
+ export { ModelProperty } from './ModelProperty-Bv7KzP97.js';
11
11
  export { EAS_CHAIN_DEPLOYMENTS, BaseEasClient as EasClient, VERSION_SCHEMA_DEF, VERSION_SCHEMA_UID, easName, getCanonicalItemPropertiesFromEas, getEasChainDeployment, getEasEndpoint, getEasReadChainId, getEasSchemaUidForExactDefinition, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, matchEasName, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
12
- export { getModelSchemasFromEas } from './eas-CdhfODXL.js';
12
+ export { getModelSchemasFromEas } from './eas-MXEdKKVc.js';
13
13
  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, classifyMediaRef, ensureReadGatewaySelected, fetchArweaveRawFromBaseUrl, fetchArweaveRawTextAcrossGateways, getArweaveReadBaseUrls, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getFeedItemStringField, getLastHealthyReadGatewayHost, getPreferredArweaveReadBaseUrls, getReadGatewayHostsForConfig, getResolvedArweaveReadBaseUrls, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, hasArweaveContentReadTransform, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isEasAttestationExplorerUrl, isGatewayHostCircuitOpen, isKnownArweaveGatewayHostname, isReadGatewayKnownHealthy, mergePrimaryHostWithDefaults, normalizeFeedItemFields, normalizeGatewayHostKey, normalizeRelationPropertyValue, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, readArweaveContentResponse, recordGatewayHostFailure, recordGatewayHostSuccess, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, resolveSeedIdsFromRefString, resolveSeedRssImageRelationFromItem, resolveSeedRssImageRelationRef, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setArweaveContentReadTransform, setPreferredArweaveReadBaseUrls, setResolvedSeedGatewayEndpoints, transformArweaveContent } from '@seedprotocol/arweave';
14
- export { closestImageSize, ensureImageLocal, normalizeArweaveTxIdForEnsure } from './ensureImageLocal-DNM6c2yD.js';
15
- export { getPublishPendingDiff } from './getPublishPendingDiff-DiPff8pS.js';
16
- export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, b as getPendingRetractions, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-CLrAcZwr.js';
17
- export { g as getPublishGraph } from './publishGraph-DnWoWZRP.js';
18
- 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, l as replaceDataUrisInParsedHtml, m as replaceSeedPropertyRefsInHtml, n as resolveEffectiveHtmlEmbeddedDataUriPolicy, o as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-DFcgc27c.js';
19
- export { C as CONTENT_SHA256_TAG, a as CONTENT_TYPE_TAG, b as buildArweaveContentTags, c as contentSha256TagMatches, g as getContentSha256 } from './arweaveContentTags-Bh4wCTal.js';
14
+ export { closestImageSize, ensureImageLocal, normalizeArweaveTxIdForEnsure } from './ensureImageLocal-B6suz6FC.js';
15
+ export { getPublishPendingDiff } from './getPublishPendingDiff-kcTP52Kj.js';
16
+ export { a as getPendingRetractions, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-Dd3HCYeI.js';
20
17
  import 'xstate';
21
18
  import 'debug';
22
19
  import 'pluralize';
23
20
  import 'drizzle-orm';
24
21
  import '@sinclair/typebox';
25
22
  import 'lodash-es';
23
+ import '@seedprotocol/query';
24
+ import '@seedprotocol/archive';
25
+ import 'parse5';
26
26
  import '@noble/hashes/sha3';
27
27
  import '@noble/hashes/utils';
28
- import '@seedprotocol/query';
29
28
  import 'nanoid';
30
29
  import 'nanoid-dictionary';
30
+ import '@noble/hashes/sha256';
31
31
  import 'rxjs';
32
32
  import 'drizzle-orm/sqlite-core';
33
- import '@seedprotocol/archive';
34
- import './SchemaValidationService-CW0s7V7R.js';
33
+ import './SchemaValidationService-Dc-lpFQX.js';
35
34
  import '@sinclair/typebox/value';
36
- import './download-Cvac_VGu.js';
37
- import '@noble/hashes/sha256';
38
- import 'parse5';
35
+ import './download-DHWUPLlK.js';
39
36
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -11,8 +11,10 @@ const MIN_UPGRADE_SDK_VERSION = '0.7.7';
11
11
  */
12
12
  const FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS = 1792354539632;
13
13
  /**
14
- * appState key that 0.7.7's first init wrote (its stored-display-URL fix) and no older SDK did. It
15
- * tells a 0.7.7 database from an older one with the same migrations.
14
+ * appState key that 0.7.7 wrote after its first init (its stored-display-URL fix) and no older SDK
15
+ * did. It tells a 0.7.7 database from an older one with the same migrations, but 0.7.7 wrote it from
16
+ * a background task, so a 0.7.7 database can lack it (closed right after init, the task failed).
17
+ * Such a database is treated as older and is backed up before it is recreated.
16
18
  */
17
19
  const MIN_VERSION_APP_STATE_KEY = 'storedDisplayUrlsCleared';
18
20
  /** First column of the first row. libsql's rows index like arrays but aren't iterable. */
@@ -61,21 +63,48 @@ async function dropAllObjects(db) {
61
63
  await db.run(sql `PRAGMA foreign_keys = ON`);
62
64
  }
63
65
  }
66
+ /**
67
+ * Path for the copy of a database about to be recreated: `seed.db` →
68
+ * `seed.before-recreate-<ms>.db` in the same folder.
69
+ */
70
+ function recreateBackupPath(dbFilePath, now = Date.now()) {
71
+ return dbFilePath.replace(/(\.db)?$/, `.before-recreate-${now}.db`);
72
+ }
64
73
  /**
65
74
  * Recreates a database an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote (decision D1 of the
66
75
  * 2026-10 SDK audit): its tables are dropped before migrations run, so everything not yet published
67
- * is gone and published data comes back through EAS sync. Files under filesDir stay where they are.
68
- * Call it before migrations, holding the migrate lock. Returns true if it recreated the database.
76
+ * is gone from it and published data comes back through EAS sync. Files under filesDir stay where
77
+ * they are.
78
+ *
79
+ * The database is first copied to `backupPath` with `VACUUM INTO`, since a 0.7.7 database whose
80
+ * marker task never ran looks the same as an older one (see {@link MIN_VERSION_APP_STATE_KEY}).
81
+ * Without a `backupPath` (a remote libsql URL), or if the copy fails, the database is kept as it is:
82
+ * losing drafts is worse than opening an old one. Call it before migrations, holding the migrate
83
+ * lock. Returns true if it recreated the database.
69
84
  */
70
- async function recreateIfOlderThanMinimumUpgradeVersion(db) {
85
+ async function recreateIfOlderThanMinimumUpgradeVersion(db, { backupPath } = {}) {
71
86
  if (!(await isOlderThanMinimumUpgradeVersion(db)))
72
87
  return false;
88
+ if (!backupPath) {
89
+ console.warn(`[seed-protocol] This local database looks older than ${MIN_UPGRADE_SDK_VERSION}, but it can't be ` +
90
+ 'backed up here, so it is opened as it is.');
91
+ return false;
92
+ }
93
+ try {
94
+ await db.run(sql `VACUUM INTO ${backupPath}`);
95
+ }
96
+ catch (error) {
97
+ console.warn(`[seed-protocol] This local database looks older than ${MIN_UPGRADE_SDK_VERSION}, but backing it up ` +
98
+ `to ${backupPath} failed, so it is opened as it is.`, error);
99
+ return false;
100
+ }
73
101
  console.warn(`[seed-protocol] This local database was written by an SDK older than ${MIN_UPGRADE_SDK_VERSION}. ` +
74
- 'It is being recreated: unpublished items are dropped, and published items come back through EAS sync.');
102
+ 'It is being recreated: unpublished items are dropped, and published items come back through EAS sync. ' +
103
+ `A copy of the old database is at ${backupPath}.`);
75
104
  await dropAllObjects(db);
76
- logger('dropped the tables of a database older than %s', MIN_UPGRADE_SDK_VERSION);
105
+ logger('dropped the tables of a database older than %s; copy at %s', MIN_UPGRADE_SDK_VERSION, backupPath);
77
106
  return true;
78
107
  }
79
108
 
80
- export { recreateIfOlderThanMinimumUpgradeVersion as r };
81
- //# sourceMappingURL=minimumUpgradeVersion-BDhHvHtr.js.map
109
+ export { recreateBackupPath as a, recreateIfOlderThanMinimumUpgradeVersion as r };
110
+ //# sourceMappingURL=minimumUpgradeVersion-Dg2MguFf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimumUpgradeVersion-Dg2MguFf.js","sources":["../../src/db/minimumUpgradeVersion.ts"],"sourcesContent":["import { sql, type SQL } from 'drizzle-orm'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:db:minimumUpgradeVersion')\n\n/** The oldest SDK whose local database a newer SDK opens as it is. Older ones are recreated. */\nexport const MIN_UPGRADE_SDK_VERSION = '0.7.7'\n\n/**\n * `when` of migration 0020, the first one 0.7.7 doesn't ship: a database that applied it was opened\n * by 0.7.8 or later. SDKs 0.7.2 to 0.7.7 all ship migrations 0000-0019, so the count alone can't\n * tell 0.7.7 from older.\n */\nexport const FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS = 1792354539632\n\n/**\n * appState key that 0.7.7 wrote after its first init (its stored-display-URL fix) and no older SDK\n * did. It tells a 0.7.7 database from an older one with the same migrations, but 0.7.7 wrote it from\n * a background task, so a 0.7.7 database can lack it (closed right after init, the task failed).\n * Such a database is treated as older and is backed up before it is recreated.\n */\nexport const MIN_VERSION_APP_STATE_KEY = 'storedDisplayUrlsCleared'\n\n/** The part of a Drizzle SQLite database (sqlite-proxy or libsql) the check needs. */\ntype SqlRunner = {\n values: (query: SQL) => Promise<unknown[][]>\n run: (query: SQL) => Promise<unknown>\n}\n\n/** First column of the first row. libsql's rows index like arrays but aren't iterable. */\nconst firstValue = async (db: SqlRunner, query: SQL): Promise<unknown> => (await db.values(query))[0]?.[0]\n\nconst hasTable = async (db: SqlRunner, name: string): Promise<boolean> =>\n (await db.values(sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${name}`)).length > 0\n\n/**\n * True if an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote this database and no newer SDK\n * has opened it since. False for a new (empty) database.\n */\nexport async function isOlderThanMinimumUpgradeVersion(db: SqlRunner): Promise<boolean> {\n if (!(await hasTable(db, '__drizzle_migrations'))) return false\n const lastMigration = await firstValue(db, sql`SELECT MAX(created_at) FROM __drizzle_migrations`)\n if (lastMigration == null) return false\n if (Number(lastMigration) >= FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS) return false\n if (!(await hasTable(db, 'appState'))) return true\n const marker = await db.values(sql`SELECT 1 FROM appState WHERE key = ${MIN_VERSION_APP_STATE_KEY}`)\n return marker.length === 0\n}\n\n/**\n * Drops every table, view and trigger, so the migrations that follow build the database as on a\n * fresh install. `__drizzle_migrations` goes last: if this stops halfway, the next start still sees\n * an old database and drops the rest.\n */\nasync function dropAllObjects(db: SqlRunner): Promise<void> {\n const rows = await db.values(\n sql`SELECT type, name FROM sqlite_master\n WHERE type IN ('view', 'trigger', 'table') AND name NOT LIKE 'sqlite_%'`,\n )\n const order = { trigger: 0, view: 1, table: 2 } as Record<string, number>\n const objects = rows\n .map((row) => [String(row[0]), String(row[1])] as const)\n .sort(([typeA, nameA], [typeB, nameB]) =>\n order[typeA]! - order[typeB]! ||\n Number(nameA === '__drizzle_migrations') - Number(nameB === '__drizzle_migrations'))\n const foreignKeys = await firstValue(db, sql`PRAGMA foreign_keys`)\n // Dropping a parent table would otherwise run foreign key checks against tables not dropped yet.\n await db.run(sql`PRAGMA foreign_keys = OFF`)\n try {\n for (const [type, name] of objects) {\n await db.run(sql.raw(`DROP ${type.toUpperCase()} IF EXISTS \"${name.replace(/\"/g, '\"\"')}\"`))\n }\n } finally {\n if (Number(foreignKeys) === 1) await db.run(sql`PRAGMA foreign_keys = ON`)\n }\n}\n\n/**\n * Path for the copy of a database about to be recreated: `seed.db` →\n * `seed.before-recreate-<ms>.db` in the same folder.\n */\nexport function recreateBackupPath(dbFilePath: string, now = Date.now()): string {\n return dbFilePath.replace(/(\\.db)?$/, `.before-recreate-${now}.db`)\n}\n\n/**\n * Recreates a database an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote (decision D1 of the\n * 2026-10 SDK audit): its tables are dropped before migrations run, so everything not yet published\n * is gone from it and published data comes back through EAS sync. Files under filesDir stay where\n * they are.\n *\n * The database is first copied to `backupPath` with `VACUUM INTO`, since a 0.7.7 database whose\n * marker task never ran looks the same as an older one (see {@link MIN_VERSION_APP_STATE_KEY}).\n * Without a `backupPath` (a remote libsql URL), or if the copy fails, the database is kept as it is:\n * losing drafts is worse than opening an old one. Call it before migrations, holding the migrate\n * lock. Returns true if it recreated the database.\n */\nexport async function recreateIfOlderThanMinimumUpgradeVersion(\n db: SqlRunner,\n { backupPath }: { backupPath?: string } = {},\n): Promise<boolean> {\n if (!(await isOlderThanMinimumUpgradeVersion(db))) return false\n if (!backupPath) {\n console.warn(\n `[seed-protocol] This local database looks older than ${MIN_UPGRADE_SDK_VERSION}, but it can't be ` +\n 'backed up here, so it is opened as it is.',\n )\n return false\n }\n try {\n await db.run(sql`VACUUM INTO ${backupPath}`)\n } catch (error) {\n console.warn(\n `[seed-protocol] This local database looks older than ${MIN_UPGRADE_SDK_VERSION}, but backing it up ` +\n `to ${backupPath} failed, so it is opened as it is.`,\n error,\n )\n return false\n }\n console.warn(\n `[seed-protocol] This local database was written by an SDK older than ${MIN_UPGRADE_SDK_VERSION}. ` +\n 'It is being recreated: unpublished items are dropped, and published items come back through EAS sync. ' +\n `A copy of the old database is at ${backupPath}.`,\n )\n await dropAllObjects(db)\n logger('dropped the tables of a database older than %s; copy at %s', MIN_UPGRADE_SDK_VERSION, backupPath)\n return true\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,MAAM,GAAG,KAAK,CAAC,kCAAkC,CAAC;AAExD;AACO,MAAM,uBAAuB,GAAG,OAAO;AAE9C;;;;AAIG;AACI,MAAM,wCAAwC,GAAG,aAAa;AAErE;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,0BAA0B;AAQnE;AACA,MAAM,UAAU,GAAG,OAAO,EAAa,EAAE,KAAU,KAAuB,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AAE1G,MAAM,QAAQ,GAA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,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,OAAO,CAAC,IAAI,CACV,CAAA,qDAAA,EAAwD,uBAAuB,CAAA,kBAAA,CAAoB;AACjG,YAAA,2CAA2C,CAC9C;AACD,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI;QACF,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAA,CAAA,YAAA,EAAe,UAAU,CAAA,CAAE,CAAC;IAC9C;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,IAAI,CACV,CAAA,qDAAA,EAAwD,uBAAuB,CAAA,oBAAA,CAAsB;AACnG,YAAA,CAAA,GAAA,EAAM,UAAU,CAAA,kCAAA,CAAoC,EACtD,KAAK,CACN;AACD,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,CAAC,IAAI,CACV,CAAA,qEAAA,EAAwE,uBAAuB,CAAA,EAAA,CAAI;QACjG,wGAAwG;QACxG,CAAA,iCAAA,EAAoC,UAAU,CAAA,CAAA,CAAG,CACpD;AACD,IAAA,MAAM,cAAc,CAAC,EAAE,CAAC;AACxB,IAAA,MAAM,CAAC,4DAA4D,EAAE,uBAAuB,EAAE,UAAU,CAAC;AACzG,IAAA,OAAO,IAAI;AACb;;"}
@@ -1,16 +1,19 @@
1
- import { getModelPropertyDefinitions } from './property-Broz_CWj.js';
1
+ import { getModelPropertyDefinitions } from './property-4jSqHieb.js';
2
2
  import 'pluralize';
3
- import './Item-Ld1iPicQ.js';
4
- import './tabEvents-BnBzIdEi.js';
3
+ import './Item-BU9wIT7l.js';
4
+ import './arweaveContentTags-iW_HcWJA.js';
5
5
  import '@sinclair/typebox';
6
6
  import 'debug';
7
7
  import 'nanoid';
8
8
  import 'nanoid-dictionary';
9
- import './BaseFileManager-DLou1TZS.js';
9
+ import './BaseFileManager-D-pLXQAp.js';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import 'drizzle-orm';
12
12
  import '@seedprotocol/eas';
13
13
  import '@seedprotocol/arweave';
14
+ import '@noble/hashes/sha256';
15
+ import '@noble/hashes/sha3';
16
+ import '@noble/hashes/utils';
14
17
  import 'xstate';
15
18
  import 'rxjs';
16
19
  import 'lodash-es';
@@ -42,4 +45,4 @@ function loadModelPropertyRecordSchemas(modelName, modelFileId, db) {
42
45
  }
43
46
 
44
47
  export { loadModelPropertyRecordSchemas };
45
- //# sourceMappingURL=modelPropertyRecordSchemas-se4QMXSi.js.map
48
+ //# sourceMappingURL=modelPropertyRecordSchemas-CEac3FB8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modelPropertyRecordSchemas-se4QMXSi.js","sources":["../../src/ItemProperty/service/actors/modelPropertyRecordSchemas.ts"],"sourcesContent":["import type { BaseDb } from '@/db/Db/BaseDb'\nimport { getModelPropertyDefinitions } from '@/helpers/property'\nimport type { PropertyDefinition } from '@/helpers/propertyDefinition'\n\ntype Db = NonNullable<ReturnType<typeof BaseDb.getAppDb>>\n\n/**\n * One read per model while it's in flight: an item's properties load together and would otherwise\n * each read the same model's rows. Nothing is kept once the read settles, so a later load sees\n * schema changes.\n */\nconst inFlight = new Map<string, Promise<Map<string, PropertyDefinition>>>()\n\n/**\n * Every property definition of one model ({@link getModelPropertyDefinitions}), keyed by property\n * name. Empty when the model has no row. Rejects when the model can't be resolved (e.g. an\n * ambiguous name).\n */\nexport function loadModelPropertyRecordSchemas(\n modelName: string,\n modelFileId: string | undefined,\n db: Db,\n): Promise<Map<string, PropertyDefinition>> {\n const key = JSON.stringify([modelName, modelFileId ?? null])\n const existing = inFlight.get(key)\n if (existing) return existing\n const read = getModelPropertyDefinitions(modelName, { modelFileId }, db)\n inFlight.set(key, read)\n const forget = () => {\n if (inFlight.get(key) === read) inFlight.delete(key)\n }\n read.then(forget, forget)\n return read\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA;;;;AAIG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoD;AAE5E;;;;AAIG;SACa,8BAA8B,CAC5C,SAAiB,EACjB,WAA+B,EAC/B,EAAM,EAAA;AAEN,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,WAAW,IAAI,IAAI,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;AAClC,IAAA,IAAI,QAAQ;AAAE,QAAA,OAAO,QAAQ;AAC7B,IAAA,MAAM,IAAI,GAAG,2BAA2B,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACxE,IAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC;IACvB,MAAM,MAAM,GAAG,MAAK;AAClB,QAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;AAAE,YAAA,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;AACtD,IAAA,CAAC;AACD,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;AACzB,IAAA,OAAO,IAAI;AACb;;"}
1
+ {"version":3,"file":"modelPropertyRecordSchemas-CEac3FB8.js","sources":["../../src/ItemProperty/service/actors/modelPropertyRecordSchemas.ts"],"sourcesContent":["import type { BaseDb } from '@/db/Db/BaseDb'\nimport { getModelPropertyDefinitions } from '@/helpers/property'\nimport type { PropertyDefinition } from '@/helpers/propertyDefinition'\n\ntype Db = NonNullable<ReturnType<typeof BaseDb.getAppDb>>\n\n/**\n * One read per model while it's in flight: an item's properties load together and would otherwise\n * each read the same model's rows. Nothing is kept once the read settles, so a later load sees\n * schema changes.\n */\nconst inFlight = new Map<string, Promise<Map<string, PropertyDefinition>>>()\n\n/**\n * Every property definition of one model ({@link getModelPropertyDefinitions}), keyed by property\n * name. Empty when the model has no row. Rejects when the model can't be resolved (e.g. an\n * ambiguous name).\n */\nexport function loadModelPropertyRecordSchemas(\n modelName: string,\n modelFileId: string | undefined,\n db: Db,\n): Promise<Map<string, PropertyDefinition>> {\n const key = JSON.stringify([modelName, modelFileId ?? null])\n const existing = inFlight.get(key)\n if (existing) return existing\n const read = getModelPropertyDefinitions(modelName, { modelFileId }, db)\n inFlight.set(key, read)\n const forget = () => {\n if (inFlight.get(key) === read) inFlight.delete(key)\n }\n read.then(forget, forget)\n return read\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA;;;;AAIG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoD;AAE5E;;;;AAIG;SACa,8BAA8B,CAC5C,SAAiB,EACjB,WAA+B,EAC/B,EAAM,EAAA;AAEN,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,WAAW,IAAI,IAAI,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;AAClC,IAAA,IAAI,QAAQ;AAAE,QAAA,OAAO,QAAQ;AAC7B,IAAA,MAAM,IAAI,GAAG,2BAA2B,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACxE,IAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC;IACvB,MAAM,MAAM,GAAG,MAAK;AAClB,QAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;AAAE,YAAA,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;AACtD,IAAA,CAAC;AACD,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;AACzB,IAAA,OAAO,IAAI;AACb;;"}
package/dist/node.js CHANGED
@@ -1,24 +1,27 @@
1
1
  import { enableMapSet } from 'immer';
2
- export { C as ConflictError, I as ItemCreateValidationError, M as Model, U as UnknownModelError, a as client, i as importJsonSchema, l as loadSchemaFromFile, r as readJsonImportFile, b as syncSchemaFromSource, c as transformImportToSchemaFile } from './errors-DKxFSvb3.js';
3
- export { P as Property, h as eventEmitter } from './tabEvents-BnBzIdEi.js';
2
+ export { A as ArchiveExportError, C as ConflictError, H as HtmlEmbeddedDataUriLimitError, a as HtmlSeedPropertyRefError, I as ItemCreateError, b as ItemCreateValidationError, M as Model, P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, c as RelatedItemUnpublishedError, e as RelationTargetError, U as UnknownModelError, f as client, g as exportArchive, i as importJsonSchema, l as loadSchemaFromFile, r as readJsonImportFile, h as syncSchemaFromSource, j as transformImportToSchemaFile } from './publishErrors-DZXDX3B6.js';
3
+ export { P as Property, h as eventEmitter } from './arweaveContentTags-iW_HcWJA.js';
4
4
  import 'pluralize';
5
5
  import '@seedprotocol/eas';
6
- export { a as appState, c as config, m as metadata, b as modelUids, d as models, s as seeds, v as versions } from './BaseFileManager-DLou1TZS.js';
7
- export { A as AmbiguousModelError, C as ClearNotSupportedError, I as Item, l as ItemProperty, n as ItemPropertySaveValidationError, q as OwnershipError, s as assertItemOwned, t as getCorrectId, u as isItemOwned, v as isPublishedSeedRef } from './Item-Ld1iPicQ.js';
8
- import { c as createPlatformServices } from './index.node-DV1OXCp0.js';
9
- export { N as NodeDb, a as NodeFileManager, r as resolveSdkDrizzleMigrationsDir } from './index.node-DV1OXCp0.js';
6
+ export { a as appState, c as config, m as metadata, b as modelUids, d as models, s as seeds, v as versions } from './BaseFileManager-D-pLXQAp.js';
7
+ export { A as AmbiguousModelError, C as ClearNotSupportedError, E as EntityUnloadedError, I as Item, l as ItemProperty, n as ItemPropertySaveValidationError, e as OutboxOpFailedError, q as OwnershipError, S as StagedValueMissingError, s as assertItemOwned, t as getCorrectId, u as isItemOwned, v as isPublishedSeedRef } from './Item-BU9wIT7l.js';
8
+ import 'drizzle-orm';
9
+ import { c as createPlatformServices } from './index.node-C3rI1upv.js';
10
+ export { N as NodeDb, a as NodeFileManager, r as resolveSdkDrizzleMigrationsDir } from './index.node-C3rI1upv.js';
10
11
  export { normalizeRelationPropertyValue, resolveSeedIdsFromRefString } from '@seedprotocol/arweave';
11
- import { configurePlatform } from './configurePlatform-WkmvqeTO.js';
12
+ import { configurePlatform } from './configurePlatform-BH1YOZpg.js';
12
13
  import 'xstate';
13
14
  import 'debug';
14
- import 'drizzle-orm';
15
15
  import '@sinclair/typebox';
16
16
  import 'lodash-es';
17
+ import '@seedprotocol/query';
18
+ import '@seedprotocol/archive';
19
+ import 'parse5';
17
20
  import '@noble/hashes/sha3';
18
21
  import '@noble/hashes/utils';
19
- import '@seedprotocol/query';
20
22
  import 'nanoid';
21
23
  import 'nanoid-dictionary';
24
+ import '@noble/hashes/sha256';
22
25
  import 'drizzle-orm/sqlite-core';
23
26
  import 'rxjs';
24
27
  import 'fs/promises';
@@ -26,11 +29,11 @@ import 'fs';
26
29
  import 'path';
27
30
  import 'url';
28
31
  import 'node:url';
29
- import './index-BjWk0x4-.js';
32
+ import './index-2PaIhvOU.js';
30
33
  import '@libsql/client';
31
34
  import 'drizzle-orm/libsql';
32
35
  import 'drizzle-orm/libsql/migrator';
33
- import './minimumUpgradeVersion-BDhHvHtr.js';
36
+ import './minimumUpgradeVersion-Dg2MguFf.js';
34
37
  import '@seedprotocol/eas/node';
35
38
 
36
39
  configurePlatform(createPlatformServices());
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":["../../src/node/index.ts"],"sourcesContent":["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, ClearNotSupportedError } 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 { NodeFileManager } from './helpers/FileManager'\nexport { NodeDb, 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 { isPublishedSeedRef } from '../helpers/relationSeedRef'\nexport { normalizeRelationPropertyValue, resolveSeedIdsFromRefString } from '@seedprotocol/arweave'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\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// Register the Node platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE"}
1
+ {"version":3,"file":"node.js","sources":["../../src/node/index.ts"],"sourcesContent":["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, ClearNotSupportedError } from '../ItemProperty/ItemProperty'\nexport type { IItem, IItemProperty } from '../interfaces'\n\n// Errors. Every error class the main entry exports that Node code can throw is exported here too\n// (__tests__/node/nodeEntryErrors.test.ts checks).\nexport { AmbiguousModelError } from '../Model/errors'\nexport {\n ItemCreateError,\n ItemCreateValidationError,\n UnknownModelError,\n type ItemCreateErrorCode,\n type ItemCreateProblem,\n} from '../Item/errors'\nexport { ConflictError, type ConflictResult } from '../Schema/errors'\nexport { OwnershipError, assertItemOwned, isItemOwned } from '../helpers/ownership'\nexport { EntityUnloadedError } from '../helpers/entity/entityLifecycle'\nexport { OutboxOpFailedError } from '../outbox/outbox'\nexport { RelationTargetError } from '../outbox/itemAppliers'\nexport { StagedValueMissingError } from '../storageValue/stage'\nexport { PublishValidationFailedError, type PublishValidationError } from '../db/read/getPublishPayload'\nexport { RelatedItemUnpublishedError, RELATED_ITEM_UNPUBLISHED_CODE } from '../db/read/publishErrors'\nexport { HtmlEmbeddedDataUriLimitError, HtmlSeedPropertyRefError } from '../helpers/htmlEmbeddedDataUriPublish'\n\n// Archive export\nexport {\n ArchiveExportError,\n exportArchive,\n type ArchiveExportErrorCode,\n type ArchiveOmission,\n type ExportArchiveOptions,\n type ExportArchiveResult,\n} from '../archive/exportArchive'\n\n// Node.js specific exports\nexport { NodeFileManager } from './helpers/FileManager'\nexport { NodeDb, 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 { isPublishedSeedRef } from '../helpers/relationSeedRef'\nexport { normalizeRelationPropertyValue, resolveSeedIdsFromRefString } from '@seedprotocol/arweave'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\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// Register the Node platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE"}
@@ -1,24 +1,23 @@
1
- export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-D9oC-KKx.js';
1
+ export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-BkcOQGhw.js';
2
2
  import '@seedprotocol/arweave';
3
3
  import '@seedprotocol/eas';
4
- export { configurePlatform } from './configurePlatform-WkmvqeTO.js';
5
- import './tabEvents-BnBzIdEi.js';
4
+ export { configurePlatform } from './configurePlatform-BH1YOZpg.js';
5
+ import './arweaveContentTags-iW_HcWJA.js';
6
6
  import '@sinclair/typebox';
7
7
  import 'debug';
8
8
  import 'nanoid';
9
9
  import 'nanoid-dictionary';
10
- import './BaseFileManager-DLou1TZS.js';
10
+ import './BaseFileManager-D-pLXQAp.js';
11
11
  import 'drizzle-orm/sqlite-core';
12
12
  import 'drizzle-orm';
13
- import './arweaveContentTags-Bh4wCTal.js';
14
13
  import '@noble/hashes/sha256';
15
14
  import '@noble/hashes/sha3';
16
15
  import '@noble/hashes/utils';
17
16
  import './browserSupport-C64rX-2I.js';
18
17
  import 'drizzle-orm/sqlite-proxy';
19
18
  import 'pluralize';
20
- import './index-BjWk0x4-.js';
19
+ import './index-2PaIhvOU.js';
21
20
  import 'sqlocal/drizzle';
22
- import './minimumUpgradeVersion-BDhHvHtr.js';
21
+ import './minimumUpgradeVersion-Dg2MguFf.js';
23
22
  import 'rxjs';
24
23
  //# sourceMappingURL=platform.browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"platform.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,21 +1,21 @@
1
- export { c as createPlatformServices, b as resolveFilesDir } from './index.node-DV1OXCp0.js';
1
+ export { c as createPlatformServices, b as resolveFilesDir } from './index.node-C3rI1upv.js';
2
2
  import '@seedprotocol/arweave';
3
3
  import '@seedprotocol/eas';
4
4
  import '@seedprotocol/eas/node';
5
- export { configurePlatform } from './configurePlatform-WkmvqeTO.js';
5
+ export { configurePlatform } from './configurePlatform-BH1YOZpg.js';
6
6
  import 'fs/promises';
7
7
  import 'fs';
8
- import './BaseFileManager-DLou1TZS.js';
8
+ import './BaseFileManager-D-pLXQAp.js';
9
9
  import 'debug';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import 'drizzle-orm';
12
12
  import 'path';
13
13
  import 'url';
14
14
  import 'node:url';
15
- import './index-BjWk0x4-.js';
15
+ import './index-2PaIhvOU.js';
16
16
  import '@libsql/client';
17
17
  import 'drizzle-orm/libsql';
18
18
  import 'drizzle-orm/libsql/migrator';
19
19
  import 'rxjs';
20
- import './minimumUpgradeVersion-BDhHvHtr.js';
20
+ import './minimumUpgradeVersion-Dg2MguFf.js';
21
21
  //# sourceMappingURL=platform.node.js.map
@@ -1,7 +1,7 @@
1
1
  import pluralize from 'pluralize';
2
- import { x as propertyKeyFromStoredName } from './Item-Ld1iPicQ.js';
3
- import { B as BaseDb } from './BaseFileManager-DLou1TZS.js';
4
- 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, g as normalizePropertyRecordSchema } from './tabEvents-BnBzIdEi.js';
2
+ import { x as propertyKeyFromStoredName } from './Item-BU9wIT7l.js';
3
+ import { B as BaseDb } from './BaseFileManager-D-pLXQAp.js';
4
+ 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, g as normalizePropertyRecordSchema } from './arweaveContentTags-iW_HcWJA.js';
5
5
  import 'xstate';
6
6
  import 'debug';
7
7
  import '@seedprotocol/eas';
@@ -13,6 +13,9 @@ import '@seedprotocol/arweave';
13
13
  import '@sinclair/typebox';
14
14
  import 'nanoid';
15
15
  import 'nanoid-dictionary';
16
+ import '@noble/hashes/sha256';
17
+ import '@noble/hashes/sha3';
18
+ import '@noble/hashes/utils';
16
19
 
17
20
  /**
18
21
  * The key in `defs` a property name refers to: the key itself, a stored metadata name
@@ -40,14 +43,14 @@ function resolvePropertyKey(defs, propertyName) {
40
43
  async function getModelPropertyDefinitions(modelName, scope = {}, db = BaseDb.getAppDb()) {
41
44
  if (!db)
42
45
  return new Map();
43
- const _mod_0 = await import('./Item-Ld1iPicQ.js');
44
- const _ns_0 = _mod_0.bO;
46
+ const _mod_0 = await import('./Item-BU9wIT7l.js');
47
+ const _ns_0 = _mod_0.bP;
45
48
  const { resolveModelRecord } = _ns_0;
46
49
  const modelRecord = await resolveModelRecord(modelName, scope, db);
47
50
  if (!modelRecord?.id)
48
51
  return new Map();
49
- const _mod_1 = await import('./Item-Ld1iPicQ.js');
50
- const _ns_1 = _mod_1.bP;
52
+ const _mod_1 = await import('./Item-BU9wIT7l.js');
53
+ const _ns_1 = _mod_1.bQ;
51
54
  const { getPropertyDefinitions } = _ns_1;
52
55
  return getPropertyDefinitions(modelRecord.id, db);
53
56
  }
@@ -81,4 +84,4 @@ scope = {}) => {
81
84
  };
82
85
 
83
86
  export { getModelPropertyDefinitions, getPropertySchema, resolvePropertyKey };
84
- //# sourceMappingURL=property-Broz_CWj.js.map
87
+ //# sourceMappingURL=property-4jSqHieb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-4jSqHieb.js","sources":["../../src/helpers/property.ts"],"sourcesContent":["import { Static } from '@sinclair/typebox'\nimport { TProperty } from '@/Schema'\nimport pluralize from 'pluralize'\nimport { propertyKeyFromStoredName } from '@/helpers/metadataPropertyNames'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport type { ModelScope } from '@/db/read/resolveModelRecord'\nimport type { PropertyDefinition } from '@/helpers/propertyDefinition'\n\n// Re-export everything from property/index.ts to make it available when importing from helpers/property\nexport * from './property/index'\n\n/**\n * The key in `defs` a property name refers to: the key itself, a stored metadata name\n * (`authorId` → `author`, `authorIdentityIds` → `authors`), or the name minus `Id` / `Ids`\n * (pluralized).\n */\nexport function resolvePropertyKey(defs: Record<string, any>, propertyName: string): string | undefined {\n if (defs[propertyName]) return propertyName\n const storedKey = propertyKeyFromStoredName(defs, propertyName)\n if (storedKey && defs[storedKey]) return storedKey\n const base = propertyName.endsWith('Ids')\n ? pluralize(propertyName.slice(0, -3))\n : propertyName.endsWith('Id')\n ? propertyName.slice(0, -2)\n : undefined\n return base && defs[base] ? base : undefined\n}\n\n/**\n * Every property definition of one model ({@link getPropertyDefinitions}), with the model row\n * resolved from its name and scope. Empty when the model has no row. Throws AmbiguousModelError\n * for a bare name two schemas define.\n */\nexport async function getModelPropertyDefinitions(\n modelName: string | undefined,\n scope: ModelScope = {},\n db = BaseDb.getAppDb(),\n): Promise<Map<string, PropertyDefinition>> {\n if (!db) return new Map()\n const { resolveModelRecord } = await import('../db/read/resolveModelRecord')\n const modelRecord = await resolveModelRecord(modelName, scope, db)\n if (!modelRecord?.id) return new Map()\n const { getPropertyDefinitions } = await import('./propertyDefinition')\n return getPropertyDefinitions(modelRecord.id, db)\n}\n\n/**\n * A property's definition, from its row ({@link getPropertyDefinition}), by model name and\n * property name. The name may be a stored metadata name (`authorId`, `tagIds`); the result's\n * `name` is the property's key. Undefined when the model or the property has no row.\n *\n * @example\n * ```typescript\n * const schema = await getPropertySchema('Article', 'title')\n * // { dataType: 'Text', name: 'title', id: '<schema file id>', validation: ..., ... }\n * const relation = await getPropertySchema('Article', 'authorId')\n * // { dataType: 'Relation', ref: 'Author', name: 'author', ... }\n * ```\n */\nexport const getPropertySchema = async (\n modelName: string,\n propertyName: string,\n /** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */\n scope: { modelFileId?: string | null; schemaName?: string | null } = {},\n): Promise<(Static<typeof TProperty> & PropertyDefinition & { _propertyFileId?: string }) | undefined> => {\n const definitions = await getModelPropertyDefinitions(modelName, scope)\n const defs = Object.fromEntries(definitions)\n const key = resolvePropertyKey(defs, propertyName)\n if (!key) return undefined\n const definition = definitions.get(key)!\n return {\n ...definition,\n modelName,\n _propertyFileId: definition.id,\n } as Static<typeof TProperty> & PropertyDefinition & { _propertyFileId?: string }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,CAAA,CAAA;;;;AAIG,CAAA,CAAA;AACG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAC,CAAA,CAAA,CAAA,CAAyB,CAAA,CAAE,YAAoB,CAAA,CAAA;IAChF,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAC;AAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY;IAC3C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,SAAS,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB,CAA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