@seedprotocol/sdk 0.5.1 → 0.5.3

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 (154) hide show
  1. package/dist/{BasePathResolver-BDgc7c4T.js → BasePathResolver-DWY_hb8w.js} +2 -2
  2. package/dist/{BasePathResolver-BDgc7c4T.js.map → BasePathResolver-DWY_hb8w.js.map} +1 -1
  3. package/dist/{ModelProperty-D-ysg8zA.js → ModelProperty-DGJf78CS.js} +22 -21
  4. package/dist/ModelProperty-DGJf78CS.js.map +1 -0
  5. package/dist/{Schema-CyCftnKI.js → Schema-Drmce3q-.js} +39 -39
  6. package/dist/{Schema-CyCftnKI.js.map → Schema-Drmce3q-.js.map} +1 -1
  7. package/dist/{SchemaValidationService-POM6jHbJ.js → SchemaValidationService-a_sfnpDV.js} +6 -5
  8. package/dist/{SchemaValidationService-POM6jHbJ.js.map → SchemaValidationService-a_sfnpDV.js.map} +1 -1
  9. package/dist/{backfillMetadataPropertyIds-DzZw57iJ.js → backfillMetadataPropertyIds-CZcOi-cK.js} +3 -3
  10. package/dist/{backfillMetadataPropertyIds-DzZw57iJ.js.map → backfillMetadataPropertyIds-CZcOi-cK.js.map} +1 -1
  11. package/dist/cjs/{ModelProperty-CmuGJvyi.js → ModelProperty-BA26rMV8.js} +18 -18
  12. package/dist/cjs/{ModelProperty-CmuGJvyi.js.map → ModelProperty-BA26rMV8.js.map} +1 -1
  13. package/dist/cjs/{Schema-gpFnZMhB.js → Schema-Hgwq3L34.js} +21 -21
  14. package/dist/cjs/{Schema-gpFnZMhB.js.map → Schema-Hgwq3L34.js.map} +1 -1
  15. package/dist/cjs/{SchemaValidationService-E3xTSRai.js → SchemaValidationService-DVmOGZao.js} +3 -3
  16. package/dist/cjs/{SchemaValidationService-E3xTSRai.js.map → SchemaValidationService-DVmOGZao.js.map} +1 -1
  17. package/dist/cjs/{backfillMetadataPropertyIds-_bivrvRs.js → backfillMetadataPropertyIds-BWJI4eCj.js} +3 -3
  18. package/dist/cjs/{backfillMetadataPropertyIds-_bivrvRs.js.map → backfillMetadataPropertyIds-BWJI4eCj.js.map} +1 -1
  19. package/dist/cjs/{eas-BwDKJmlb.js → eas-BJ8FtbU9.js} +4 -4
  20. package/dist/cjs/{eas-BwDKJmlb.js.map → eas-BJ8FtbU9.js.map} +1 -1
  21. package/dist/cjs/{getItem-MShQw3sz.js → getItem-DdBKeEEU.js} +3 -3
  22. package/dist/cjs/{getItem-MShQw3sz.js.map → getItem-DdBKeEEU.js.map} +1 -1
  23. package/dist/cjs/{getPublishPayload-C1nOOXp_.js → getPublishPayload-DSBLjMKl.js} +12 -12
  24. package/dist/cjs/{getPublishPayload-C1nOOXp_.js.map → getPublishPayload-DSBLjMKl.js.map} +1 -1
  25. package/dist/cjs/{getPublishUploads-BjgxgrKD.js → getPublishUploads-DMKnK2_R.js} +5 -5
  26. package/dist/cjs/{getPublishUploads-BjgxgrKD.js.map → getPublishUploads-DMKnK2_R.js.map} +1 -1
  27. package/dist/cjs/{getSegmentedItemProperties-Cuw7wcxb.js → getSegmentedItemProperties-D0ZzTmvi.js} +3 -3
  28. package/dist/cjs/{getSegmentedItemProperties-Cuw7wcxb.js.map → getSegmentedItemProperties-D0ZzTmvi.js.map} +1 -1
  29. package/dist/cjs/{index-vk2DeF2D.js → index-BD1b6zAi.js} +935 -60
  30. package/dist/cjs/index-BD1b6zAi.js.map +1 -0
  31. package/dist/cjs/{index-9Z2FOvLD.js → index-DQggpLqI.js} +4 -4
  32. package/dist/cjs/index-DQggpLqI.js.map +1 -0
  33. package/dist/cjs/index.browser-BSf8HpnU.js.map +1 -1
  34. package/dist/cjs/{property-D3Ww2_Qh.js → property-D4IB0zBz.js} +5 -5
  35. package/dist/cjs/{property-D3Ww2_Qh.js.map → property-D4IB0zBz.js.map} +1 -1
  36. package/dist/cjs/{syncDbWithEas-Dht3_7UD.js → syncDbWithEas-BYvFJc7N.js} +46 -49
  37. package/dist/cjs/syncDbWithEas-BYvFJc7N.js.map +1 -0
  38. package/dist/{configurePlatform-R5neRbQ9.js → configurePlatform-CXQCT7N8.js} +4 -3
  39. package/dist/{configurePlatform-R5neRbQ9.js.map → configurePlatform-CXQCT7N8.js.map} +1 -1
  40. package/dist/{constants-B5S5JPDK.js → constants-B7aNfB_1.js} +14 -19
  41. package/dist/constants-B7aNfB_1.js.map +1 -0
  42. package/dist/constants-DMHTYMgJ.js.map +1 -1
  43. package/dist/{db-Cvh84NY7.js → db-Bad8QKfZ.js} +18 -18
  44. package/dist/{db-Cvh84NY7.js.map → db-Bad8QKfZ.js.map} +1 -1
  45. package/dist/{eas-D9b7z2Wn.js → eas-BB9hVW68.js} +7 -6
  46. package/dist/eas-BB9hVW68.js.map +1 -0
  47. package/dist/{getItem-B81V3m4S.js → getItem-Cina46nb.js} +6 -5
  48. package/dist/{getItem-B81V3m4S.js.map → getItem-Cina46nb.js.map} +1 -1
  49. package/dist/{getPublishPayload-CNYsn8-6.js → getPublishPayload-BEO52UOv.js} +17 -16
  50. package/dist/getPublishPayload-BEO52UOv.js.map +1 -0
  51. package/dist/{getPublishUploads-D9rPHkB7.js → getPublishUploads-CJjfqJi9.js} +8 -7
  52. package/dist/{getPublishUploads-D9rPHkB7.js.map → getPublishUploads-CJjfqJi9.js.map} +1 -1
  53. package/dist/{getSegmentedItemProperties-Bg3_b-b1.js → getSegmentedItemProperties-CbzFDgFr.js} +5 -5
  54. package/dist/{getSegmentedItemProperties-Bg3_b-b1.js.map → getSegmentedItemProperties-CbzFDgFr.js.map} +1 -1
  55. package/dist/{index--F3Wolt5.js → index-B4In0GEO.js} +863 -67
  56. package/dist/index-B4In0GEO.js.map +1 -0
  57. package/dist/index-DNOCl06b.js +28 -0
  58. package/dist/index-DNOCl06b.js.map +1 -0
  59. package/dist/{index-QMrBK-L3.js → index-DrEkRiuK.js} +2 -2
  60. package/dist/index-DrEkRiuK.js.map +1 -0
  61. package/dist/{index.node-Bow8kHew.js → index.node-CnP9s4cV.js} +4 -4
  62. package/dist/{index.node-Bow8kHew.js.map → index.node-CnP9s4cV.js.map} +1 -1
  63. package/dist/main.cjs +3 -6
  64. package/dist/main.cjs.map +1 -1
  65. package/dist/main.js +21 -21
  66. package/dist/node.js +33 -12
  67. package/dist/node.js.map +1 -1
  68. package/dist/platform.browser.js +18 -5
  69. package/dist/platform.browser.js.map +1 -1
  70. package/dist/platform.node.js +3 -3
  71. package/dist/{property-BdyDfcSc.js → property-DIN1zQ_c.js} +9 -8
  72. package/dist/property-DIN1zQ_c.js.map +1 -0
  73. package/dist/src/Item/Item.d.ts +5 -0
  74. package/dist/src/Item/Item.d.ts.map +1 -1
  75. package/dist/src/Item/service/actors/saveDataToDb.d.ts.map +1 -1
  76. package/dist/src/Item/service/itemMachineSingle.d.ts +2 -2
  77. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  78. package/dist/src/ItemProperty/ItemProperty.d.ts +1 -1
  79. package/dist/src/ItemProperty/service/propertyMachine.d.ts +2 -2
  80. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  81. package/dist/src/Model/service/modelMachine.d.ts +10 -18
  82. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  83. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +5 -13
  84. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  85. package/dist/src/Schema/service/addModelsMachine.d.ts +8 -8
  86. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  87. package/dist/src/Schema/service/schemaMachine.d.ts +22 -30
  88. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  89. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  90. package/dist/src/client/ClientManager.d.ts +16 -6
  91. package/dist/src/client/ClientManager.d.ts.map +1 -1
  92. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  93. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  94. package/dist/src/client/clientManagerMachine.d.ts +2 -2
  95. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  96. package/dist/src/client/events.d.ts +7 -0
  97. package/dist/src/client/events.d.ts.map +1 -1
  98. package/dist/src/db/read/getItemData.d.ts +8 -0
  99. package/dist/src/db/read/getItemData.d.ts.map +1 -1
  100. package/dist/src/db/write/removeLocalCopiesForAddresses.d.ts +20 -0
  101. package/dist/src/db/write/removeLocalCopiesForAddresses.d.ts.map +1 -0
  102. package/dist/src/events/item/easSyncManager.d.ts +2 -2
  103. package/dist/src/events/item/easSyncManager.d.ts.map +1 -1
  104. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  105. package/dist/src/helpers/file/download/index.d.ts +2 -2
  106. package/dist/src/helpers/file/download/index.d.ts.map +1 -1
  107. package/dist/src/helpers/file/fetchAll/index.d.ts +2 -2
  108. package/dist/src/helpers/file/fetchAll/index.d.ts.map +1 -1
  109. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts +1 -1
  110. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts.map +1 -1
  111. package/dist/src/helpers/index.d.ts +1 -5
  112. package/dist/src/helpers/index.d.ts.map +1 -1
  113. package/dist/src/helpers/mediaRef.d.ts +3 -0
  114. package/dist/src/helpers/mediaRef.d.ts.map +1 -1
  115. package/dist/src/helpers/ownership.d.ts +7 -0
  116. package/dist/src/helpers/ownership.d.ts.map +1 -1
  117. package/dist/src/index.d.ts +6 -2
  118. package/dist/src/index.d.ts.map +1 -1
  119. package/dist/src/node/webpack/index.d.ts +4 -1
  120. package/dist/src/node/webpack/index.d.ts.map +1 -1
  121. package/dist/src/query/createLocalQueryDataSource.d.ts +6 -0
  122. package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -0
  123. package/dist/src/query/index.d.ts +4 -0
  124. package/dist/src/query/index.d.ts.map +1 -0
  125. package/dist/src/query/registerSeedQueryLocalSource.d.ts +25 -0
  126. package/dist/src/query/registerSeedQueryLocalSource.d.ts.map +1 -0
  127. package/dist/src/services/publish/publishMachine.d.ts +1 -1
  128. package/dist/src/services/publish/publishMachine.d.ts.map +1 -1
  129. package/dist/src/services/write/writeProcessMachine.d.ts +2 -6
  130. package/dist/src/services/write/writeProcessMachine.d.ts.map +1 -1
  131. package/dist/src/types/machines.d.ts +2 -0
  132. package/dist/src/types/machines.d.ts.map +1 -1
  133. package/dist/{syncDbWithEas-DMOJHtkP.js → syncDbWithEas-ceVUuWSZ.js} +52 -54
  134. package/dist/syncDbWithEas-ceVUuWSZ.js.map +1 -0
  135. package/dist/{updateSeedRevokedAt-Ba0OhDQj.js → updateSeedRevokedAt-CtRjZiyh.js} +2 -2
  136. package/dist/{updateSeedRevokedAt-Ba0OhDQj.js.map → updateSeedRevokedAt-CtRjZiyh.js.map} +1 -1
  137. package/package.json +23 -6
  138. package/dist/ModelProperty-D-ysg8zA.js.map +0 -1
  139. package/dist/cjs/index-9Z2FOvLD.js.map +0 -1
  140. package/dist/cjs/index-vk2DeF2D.js.map +0 -1
  141. package/dist/cjs/ownership-DhWda0J9.js +0 -105
  142. package/dist/cjs/ownership-DhWda0J9.js.map +0 -1
  143. package/dist/cjs/syncDbWithEas-Dht3_7UD.js.map +0 -1
  144. package/dist/constants-B5S5JPDK.js.map +0 -1
  145. package/dist/eas-D9b7z2Wn.js.map +0 -1
  146. package/dist/getPublishPayload-CNYsn8-6.js.map +0 -1
  147. package/dist/index--F3Wolt5.js.map +0 -1
  148. package/dist/index-QMrBK-L3.js.map +0 -1
  149. package/dist/index-oi4roUVf.js +0 -22
  150. package/dist/index-oi4roUVf.js.map +0 -1
  151. package/dist/ownership-BF_ZUKIp.js +0 -105
  152. package/dist/ownership-BF_ZUKIp.js.map +0 -1
  153. package/dist/property-BdyDfcSc.js.map +0 -1
  154. package/dist/syncDbWithEas-DMOJHtkP.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ import 'reflect-metadata';
2
+ export { M as Model, T as TModelSchema, a as TModelValues } from './index-B4In0GEO.js';
3
+ import { M as ModelPropertyDataTypes } from './constants-B7aNfB_1.js';
4
+ export { B as Boolean, D as DEFAULT_TEXT_MAX_LENGTH, a as Date, F as File, H as Html, I as Image, J as Json, L as List, N as Number, P as Property, b as PropertyConstructor, c as PropertyMetadataKey, R as Relation, T as THtmlEmbeddedDataUriPolicy, d as TProperty, e as TPropertyConstructor, f as TPropertyDataType, g as TPropertyDefs, h as TStorageType, i as TValidationRules, j as Text, n as normalizeDataType } from './constants-B7aNfB_1.js';
5
+ export { getPropertySchema } from './property-DIN1zQ_c.js';
6
+ import 'xstate';
7
+ import './BasePathResolver-DWY_hb8w.js';
8
+ import 'drizzle-orm/sqlite-core';
9
+ import 'drizzle-orm';
10
+ import 'debug';
11
+ import 'nanoid';
12
+ import 'nanoid-dictionary';
13
+ import './db-Bad8QKfZ.js';
14
+ import 'drizzle-orm/casing';
15
+ import 'lodash-es';
16
+ import 'pluralize';
17
+ import '@seedprotocol/eas';
18
+ import './constants-DMHTYMgJ.js';
19
+ import '@seedprotocol/arweave';
20
+ import 'rxjs';
21
+ import 'js-sha3';
22
+ import '@seedprotocol/query';
23
+ import '@sinclair/typebox';
24
+
25
+
26
+
27
+ export { ModelPropertyDataTypes };
28
+ //# sourceMappingURL=index-DNOCl06b.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DNOCl06b.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { b as appState, c as arweaveL1FinalizeJobs, d as config, e as easSyncProcesses, h as htmlEmbeddedImageCoPublish, f as metadata, g as modelRelations, i as modelSchemas, j as modelUids, m as models, k as modelsRelations, p as properties, l as propertiesRelations, n as propertyUidRelations, o as propertyUids, q as publishProcesses, r as schemas, s as seeds, u as uploadProcesses, v as versions } from './BasePathResolver-BDgc7c4T.js';
1
+ import { b as metadata, c as appState, d as arweaveL1FinalizeJobs, e as config, f as easSyncProcesses, h as htmlEmbeddedImageCoPublish, g as modelRelations, i as modelSchemas, j as modelUids, m as models, k as modelsRelations, p as properties, l as propertiesRelations, n as propertyUidRelations, o as propertyUids, q as publishProcesses, s as schemas, r as seeds, u as uploadProcesses, v as versions } from './BasePathResolver-DWY_hb8w.js';
2
2
 
3
3
  var schema = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -25,4 +25,4 @@ var schema = /*#__PURE__*/Object.freeze({
25
25
  });
26
26
 
27
27
  export { schema as s };
28
- //# sourceMappingURL=index-QMrBK-L3.js.map
28
+ //# sourceMappingURL=index-DrEkRiuK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DrEkRiuK.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,11 +2,11 @@ import path from 'path';
2
2
  import * as fs from 'fs';
3
3
  import fs__default from 'fs';
4
4
  import { SEED_CONFIG_FILE, SEED_CONFIG_FALLBACKS } from './constants-DMHTYMgJ.js';
5
- import { a as BaseFileManager, b as appState, t as BasePathResolver, B as BaseDb } from './BasePathResolver-BDgc7c4T.js';
5
+ import { B as BaseFileManager, c as appState, t as BasePathResolver, a as BaseDb } from './BasePathResolver-DWY_hb8w.js';
6
6
  import debug from 'debug';
7
7
  import * as fsAsync from 'fs/promises';
8
8
  import { fileURLToPath } from 'node:url';
9
- import { s as schema } from './index-QMrBK-L3.js';
9
+ import { s as schema } from './index-DrEkRiuK.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';
@@ -249,7 +249,7 @@ class NodeDb {
249
249
  logger$1('[Db.prepareDb] running migrations from %s', outDir);
250
250
  await migrate(db, { migrationsFolder: outDir });
251
251
  this.db = db;
252
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DzZw57iJ.js');
252
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CZcOi-cK.js');
253
253
  await backfillMetadataPropertyIds();
254
254
  return this.db;
255
255
  }
@@ -500,4 +500,4 @@ function createPlatformServices() {
500
500
  }
501
501
 
502
502
  export { Db as D, FileManager as F, PathResolver as P, createPlatformServices as c, resolveSdkDrizzleMigrationsDir as r };
503
- //# sourceMappingURL=index.node-Bow8kHew.js.map
503
+ //# sourceMappingURL=index.node-CnP9s4cV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.node-Bow8kHew.js","sources":["../../src/node/helpers/FileManager.ts","../../src/node/db/Db.ts","../../src/node/helpers/PathResolver.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'\n\nexport class NodeFileManager implements IFileManager {\n async getFs() {\n return fs\n }\n\n getFsSync() {\n return fs\n }\n\n async getContentUrlFromPath(_path: string): Promise<string | undefined> {\n throw new Error('Not implemented')\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 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 // Also resolve relative to this module so temp-cwd tests / odd roots still find\n // packages/sdk/src/db/drizzle (or dist/db/drizzle after publish).\n const moduleDir = path.dirname(fileURLToPath(import.meta.url))\n\n const candidates = [\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 path.join(moduleDir, '..', '..', 'db', 'drizzle'), // src/node/db -> src/db/drizzle\n path.join(moduleDir, '..', '..', '..', 'src', 'db', 'drizzle'), // dist/node -> src\n path.join(moduleDir, '..', 'db', 'drizzle'), // dist layout variants\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\nexport class NodeDb implements IDb {\n db: any\n\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return true\n }\n\n /**\n * Copy prebuilt SQL migrations into the app db directory (overwrite to stay current).\n */\n copyDrizzleFiles(filesDir: string, migrationsSourceDir?: string): string {\n const { outDir } = resolveDbPaths(filesDir)\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)\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 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 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 // Default to production environment\n // This should be {projectDir}/node_modules/@seedprotocol/sdk/dist\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk', 'dist')\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 { 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"],"names":["logger","fs"],"mappings":";;;;;;;;;;;;;;;;MAMa,eAAe,CAAA;AAC1B,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,EAAE;IACX;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,EAAE;IACX;IAEA,MAAM,qBAAqB,CAAC,KAAa,EAAA;AACvC,QAAA,MAAM,I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AEF,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;YAChC,UAAU;YACV,cAAc;YACd,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;YAC7C,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;YACrC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC;SAChD;IACH;AACD;AAED;AACO,MAAM,YAAY,GAAG;AAE5B,gBAAgB,CAAC,SAAS,CAAC,IAAI,gBAAgB,EAAE,CAAC;;SCrMlC,sBAAsB,GAAA;IACpC,OAAO;QACL,YAAY,EAAE,IAAI,gBAAgB,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;;;;"}
1
+ {"version":3,"file":"index.node-CnP9s4cV.js","sources":["../../src/node/helpers/FileManager.ts","../../src/node/db/Db.ts","../../src/node/helpers/PathResolver.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'\n\nexport class NodeFileManager implements IFileManager {\n async getFs() {\n return fs\n }\n\n getFsSync() {\n return fs\n }\n\n async getContentUrlFromPath(_path: string): Promise<string | undefined> {\n throw new Error('Not implemented')\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 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 // Also resolve relative to this module so temp-cwd tests / odd roots still find\n // packages/sdk/src/db/drizzle (or dist/db/drizzle after publish).\n const moduleDir = path.dirname(fileURLToPath(import.meta.url))\n\n const candidates = [\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 path.join(moduleDir, '..', '..', 'db', 'drizzle'), // src/node/db -> src/db/drizzle\n path.join(moduleDir, '..', '..', '..', 'src', 'db', 'drizzle'), // dist/node -> src\n path.join(moduleDir, '..', 'db', 'drizzle'), // dist layout variants\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\nexport class NodeDb implements IDb {\n db: any\n\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return true\n }\n\n /**\n * Copy prebuilt SQL migrations into the app db directory (overwrite to stay current).\n */\n copyDrizzleFiles(filesDir: string, migrationsSourceDir?: string): string {\n const { outDir } = resolveDbPaths(filesDir)\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)\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 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 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 // Default to production environment\n // This should be {projectDir}/node_modules/@seedprotocol/sdk/dist\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk', 'dist')\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 { 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"],"names":["logger","fs"],"mappings":";;;;;;;;;;;;;;;;MAMa,eAAe,CAAA;AAC1B,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,EAAE;IACX;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,EAAE;IACX;IAEA,MAAM,qBAAqB,CAAC,KAAa,EAAA;AACvC,QAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;IACpC;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;AAEA,IAAA,MAAM,cAAc,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IACjC;IAEA,MAAM,SAAS,CAAC,GAAW,EAAA;QACzB,MAAM,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QA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main_cjs = require('./cjs/index-BD1b6zAi.js');
6
6
  require('pluralize');
7
7
  require('drizzle-orm');
8
- var webpack = require('@seedprotocol/webpack');
9
8
  require('xstate');
10
9
  require('drizzle-orm/sqlite-core');
11
10
  require('debug');
@@ -14,6 +13,7 @@ require('@seedprotocol/eas');
14
13
  require('@sinclair/typebox');
15
14
  require('nanoid');
16
15
  require('nanoid-dictionary');
16
+ require('@seedprotocol/query');
17
17
  require('drizzle-orm/casing');
18
18
  require('lodash-es');
19
19
  require('rxjs');
@@ -74,8 +74,5 @@ exports.seeds = main_cjs.seeds;
74
74
  exports.syncSchemaFromSource = main_cjs.syncSchemaFromSource;
75
75
  exports.transformImportToSchemaFile = main_cjs.transformImportToSchemaFile;
76
76
  exports.versions = main_cjs.versions;
77
- Object.defineProperty(exports, "withSeed", {
78
- enumerable: true,
79
- get: function () { return webpack.withSeed; }
80
- });
77
+ exports.withSeed = main_cjs.withSeed;
81
78
  //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"main.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/main.js CHANGED
@@ -1,25 +1,24 @@
1
1
  import 'reflect-metadata';
2
- import { A as compareMetadataRowsLatestFirst, e as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, I as Item, u as waitForEntityIdle, b as getContentHash } from './index--F3Wolt5.js';
3
- export { B as ADDRESSES_PERSISTED_EVENT, h as ItemProperty, M as Model, C as client, F as createNewItem, U as createSchema, Y as easSyncActor, i as eventEmitter, q as generateId, E as getClient, f as getEasSchemaForItemProperty, g as getGetAdditionalSyncAddresses, P as getGetPublisherForNewSeeds, H as getMetadataLatest, R as getRevokeExecutor, X as getSchemaNameFromId, N as getUploadExecutor, G as getVersionData, k as importJsonSchema, W as listSchemas, J as loadAllSchemasFromDb, a2 as mergeEasSyncRequestIntents, D as parseAddressesPersistedPayload, K as propertyMachine, n as readJsonImportFile, V as readSchema, $ as requestEasSyncFromAddressChange, a0 as requestEasSyncFromEventBus, a1 as requestEasSyncFromModelsInit, _ as sendEasSyncClientRequest, S as setAdditionalSyncAddresses, O as setGetPublisherForNewSeeds, Q as setRevokeExecutor, L as setUploadExecutor, Z as startEasSyncActor, s as syncSchemaFromSource, t as transformImportToSchemaFile } from './index--F3Wolt5.js';
4
- import { k as normalizeRelationPropertyValue, r as resolveSeedIdsFromRefString, M as ModelPropertyDataTypes, m as getArweaveUrlForTransaction } from './constants-B5S5JPDK.js';
5
- export { C as ClientManagerState, o as MachineIds, q as classifyMediaRef, l as getCorrectId, v as getFeedItemStringField, u as normalizeFeedItemFields, s as resolveMediaRef } from './constants-B5S5JPDK.js';
6
- export { getPropertySchema } from './property-BdyDfcSc.js';
7
- import { B as BaseDb, v as versions, f as metadata, s as seeds, a as BaseFileManager, h as htmlEmbeddedImageCoPublish } from './BasePathResolver-BDgc7c4T.js';
8
- export { b as appState, c as arweaveL1FinalizeJobs, e as easSyncProcesses, i as modelSchemas, j as modelUids, m as models, p as properties, o as propertyUids, q as publishProcesses, r as schemas, u as uploadProcesses } from './BasePathResolver-BDgc7c4T.js';
2
+ import { A as compareMetadataRowsLatestFirst, d as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, I as Item, g as getContentHash, u as waitForEntityIdle } from './index-B4In0GEO.js';
3
+ export { B as ADDRESSES_PERSISTED_EVENT, j as ItemProperty, L as LOCAL_COPIES_REMOVED_EVENT, M as Model, C as client, D as createLocalQueryDataSource, E as createNewItem, F as createSchema, G as easSyncActor, f as eventEmitter, h as generateId, H as getClient, e as getEasSchemaForItemProperty, i as getGetAdditionalSyncAddresses, J as getGetPublisherForNewSeeds, K as getMetadataLatest, N as getPublishedSeedRecord, O as getRevokeExecutor, P as getSchemaNameFromId, Q as getUploadExecutor, R as getVersionData, l as importJsonSchema, S as isItemOwned, U as isSeedQueryLocalSourceRegistered, V as listSchemas, W as loadAllSchemasFromDb, X as mergeEasSyncRequestIntents, Y as parseAddressesPersistedPayload, Z as propertyMachine, o as readJsonImportFile, _ as readSchema, $ as registerSeedQueryLocalSource, a0 as requestEasSyncFromAddressChange, a1 as requestEasSyncFromEventBus, a2 as requestEasSyncFromModelsInit, a3 as sendEasSyncClientRequest, a4 as setAdditionalSyncAddresses, a5 as setGetPublisherForNewSeeds, a6 as setRevokeExecutor, a7 as setUploadExecutor, a8 as startEasSyncActor, q as syncSchemaFromSource, t as transformImportToSchemaFile, a9 as unregisterSeedQueryLocalSource } from './index-B4In0GEO.js';
4
+ import { k as normalizeRelationPropertyValue, r as resolveSeedIdsFromRefString, M as ModelPropertyDataTypes, m as getArweaveUrlForTransaction } from './constants-B7aNfB_1.js';
5
+ export { C as ClientManagerState, o as MachineIds, p as classifyMediaRef, l as getCorrectId, q as getFeedItemStringField, s as normalizeFeedItemFields, u as resolveMediaRef } from './constants-B7aNfB_1.js';
6
+ export { getPropertySchema } from './property-DIN1zQ_c.js';
7
+ import { a as BaseDb, v as versions, b as metadata, r as seeds, h as htmlEmbeddedImageCoPublish, B as BaseFileManager } from './BasePathResolver-DWY_hb8w.js';
8
+ export { c as appState, d as arweaveL1FinalizeJobs, f as easSyncProcesses, i as modelSchemas, j as modelUids, m as models, p as properties, o as propertyUids, q as publishProcesses, s as schemas, u as uploadProcesses } from './BasePathResolver-DWY_hb8w.js';
9
9
  import { eq, desc, or, and, isNotNull, ne } from 'drizzle-orm';
10
10
  import { isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex } from '@seedprotocol/eas';
11
11
  export { BaseEasClient as EasClient, getCanonicalItemPropertiesFromEas, getEasSchemaUidBySchemaName, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
12
- export { S as Schema, a as deleteModelFromSchema, d as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-CyCftnKI.js';
12
+ export { S as Schema, d as deleteModelFromSchema, a as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-Drmce3q-.js';
13
13
  export { EAS_SEED_DATA_SYNCED_TO_DB_EVENT, INTERNAL_DATA_TYPES, ImageSize, SEED_PROTOCOL_SCHEMA_NAME, SeedModels, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA } from './constants-DMHTYMgJ.js';
14
- export { ModelProperty } from './ModelProperty-D-ysg8zA.js';
15
- export { getModelSchemasFromEas } from './eas-D9b7z2Wn.js';
16
- export { isItemOwned } from './ownership-BF_ZUKIp.js';
17
- export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-Ba0OhDQj.js';
18
- import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-Bg3_b-b1.js';
19
- export { getAddressesForItemsFilter } from './db-Cvh84NY7.js';
20
- 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, ensureReadGatewaySelected, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getReadGatewayHostsForConfig, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isKnownArweaveGatewayHostname, mergePrimaryHostWithDefaults, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setResolvedSeedGatewayEndpoints } from '@seedprotocol/arweave';
21
- export { PublishValidationFailedError, resolvePublishPayloadValues, validateItemForPublish } from './getPublishPayload-CNYsn8-6.js';
22
- export { itemHasPublishUploadCandidates } from './getPublishUploads-D9rPHkB7.js';
14
+ export { ModelProperty } from './ModelProperty-DGJf78CS.js';
15
+ export { getModelSchemasFromEas } from './eas-BB9hVW68.js';
16
+ 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, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getReadGatewayHostsForConfig, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isEasAttestationExplorerUrl, isKnownArweaveGatewayHostname, mergePrimaryHostWithDefaults, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, resolveSeedRssImageRelationFromItem, resolveSeedRssImageRelationRef, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setResolvedSeedGatewayEndpoints } from '@seedprotocol/arweave';
17
+ export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-CtRjZiyh.js';
18
+ import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-CbzFDgFr.js';
19
+ export { getAddressesForItemsFilter } from './db-Bad8QKfZ.js';
20
+ export { PublishValidationFailedError, resolvePublishPayloadValues, validateItemForPublish } from './getPublishPayload-BEO52UOv.js';
21
+ export { itemHasPublishUploadCandidates } from './getPublishUploads-CJjfqJi9.js';
23
22
  import { parseFragment, serialize } from 'parse5';
24
23
  import 'pluralize';
25
24
  import 'js-yaml';
@@ -32,9 +31,10 @@ import 'rxjs';
32
31
  import 'lodash-es';
33
32
  import 'drizzle-orm/casing';
34
33
  import 'js-sha3';
34
+ import '@seedprotocol/query';
35
35
  import '@sinclair/typebox';
36
36
  import 'drizzle-orm/sqlite-core';
37
- import './SchemaValidationService-POM6jHbJ.js';
37
+ import './SchemaValidationService-a_sfnpDV.js';
38
38
  import '@sinclair/typebox/value';
39
39
  import '@ethereum-attestation-service/eas-sdk';
40
40
 
@@ -424,7 +424,7 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
424
424
  visited.add(seedLocalId);
425
425
  const result = [];
426
426
  const { itemRelationProperties, itemImageProperties, itemListProperties } = await getSegmentedItemProperties(item);
427
- const getItemMod = await import('./getItem-B81V3m4S.js');
427
+ const getItemMod = await import('./getItem-Cina46nb.js');
428
428
  const { getItem } = getItemMod;
429
429
  const processRelationOrImage = async (prop) => {
430
430
  const snapshot = prop.getService().getSnapshot();
@@ -445,8 +445,8 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
445
445
  if (!value && prop.propertyName && isStorageSeed) {
446
446
  const ctx = context;
447
447
  if (ctx.seedLocalId || ctx.seedUid) {
448
- const _mod_0 = await import('./index--F3Wolt5.js');
449
- const _ns_0 = _mod_0.ad;
448
+ const _mod_0 = await import('./index-B4In0GEO.js');
449
+ const _ns_0 = _mod_0.ak;
450
450
  const { getPropertyData } = _ns_0;
451
451
  const meta = await getPropertyData({
452
452
  propertyName: prop.propertyName,
package/dist/node.js CHANGED
@@ -1,22 +1,21 @@
1
1
  import { enableMapSet } from 'immer';
2
2
  import 'reflect-metadata';
3
- export { I as Item, h as ItemProperty, M as Model, C as client, i as eventEmitter, j as getRefValueType, k as importJsonSchema, l as loadSchemaFromFile, n as readJsonImportFile, s as syncSchemaFromSource, t as transformImportToSchemaFile } from './index--F3Wolt5.js';
4
- import { M as ModelPropertyDataTypes, P as Property } from './constants-B5S5JPDK.js';
5
- export { B as Boolean, D as Date, I as Image, J as Json, L as List, N as Number, R as Relation, h as Text, l as getCorrectId } from './constants-B5S5JPDK.js';
3
+ export { I as Item, j as ItemProperty, M as Model, C as client, f as eventEmitter, k as getRefValueType, l as importJsonSchema, n as loadSchemaFromFile, o as readJsonImportFile, q as syncSchemaFromSource, t as transformImportToSchemaFile } from './index-B4In0GEO.js';
4
+ import { M as ModelPropertyDataTypes, P as Property } from './constants-B7aNfB_1.js';
5
+ export { B as Boolean, a as Date, I as Image, J as Json, L as List, N as Number, R as Relation, j as Text, l as getCorrectId } from './constants-B7aNfB_1.js';
6
6
  import 'pluralize';
7
- import { B as BaseDb } from './BasePathResolver-BDgc7c4T.js';
8
- export { t as BasePathResolver, b as appState, d as config, f as metadata, j as modelUids, m as models, s as seeds, v as versions } from './BasePathResolver-BDgc7c4T.js';
7
+ import { a as BaseDb } from './BasePathResolver-DWY_hb8w.js';
8
+ export { t as BasePathResolver, c as appState, e as config, b as metadata, j as modelUids, m as models, r as seeds, v as versions } from './BasePathResolver-DWY_hb8w.js';
9
9
  import 'drizzle-orm';
10
- import { c as createPlatformServices } from './index.node-Bow8kHew.js';
11
- export { D as Db, F as FileManager, P as PathResolver, r as resolveSdkDrizzleMigrationsDir } from './index.node-Bow8kHew.js';
10
+ import { c as createPlatformServices } from './index.node-CnP9s4cV.js';
11
+ export { D as Db, F as FileManager, P as PathResolver, r as resolveSdkDrizzleMigrationsDir } from './index.node-CnP9s4cV.js';
12
12
  import yaml from 'js-yaml';
13
13
  import fs__default, { readFileSync } from 'fs';
14
- import { addModelsToDb } from './db-Cvh84NY7.js';
15
- export { withSeed } from '@seedprotocol/webpack';
14
+ import { addModelsToDb } from './db-Bad8QKfZ.js';
16
15
  import { execSync } from 'child_process';
17
16
  import path from 'path';
18
17
  export { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from './constants-DMHTYMgJ.js';
19
- import { configurePlatform } from './configurePlatform-R5neRbQ9.js';
18
+ import { configurePlatform } from './configurePlatform-CXQCT7N8.js';
20
19
  import 'xstate';
21
20
  import 'debug';
22
21
  import 'nanoid';
@@ -27,11 +26,12 @@ import 'lodash-es';
27
26
  import 'drizzle-orm/casing';
28
27
  import '@seedprotocol/arweave';
29
28
  import 'js-sha3';
29
+ import '@seedprotocol/query';
30
30
  import '@sinclair/typebox';
31
31
  import 'drizzle-orm/sqlite-core';
32
32
  import 'fs/promises';
33
33
  import 'node:url';
34
- import './index-QMrBK-L3.js';
34
+ import './index-DrEkRiuK.js';
35
35
  import '@libsql/client';
36
36
  import 'drizzle-orm/libsql';
37
37
  import 'drizzle-orm/libsql/migrator';
@@ -172,6 +172,27 @@ const saveModelsFromMarkdown = async (filePath, db) => {
172
172
  return modelDefinitions;
173
173
  };
174
174
 
175
+ /**
176
+ * Webpack / Next.js config helper for Seed Protocol apps.
177
+ */
178
+ const withSeed = (config, webpack, isServer) => {
179
+ config.plugins.push(new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
180
+ resource.request = resource.request.replace(/^node:/, '');
181
+ }));
182
+ if (!isServer) {
183
+ config.resolve.alias['fs'] = '@zenfs/core';
184
+ config.resolve.alias['node:fs'] = '@zenfs/core';
185
+ config.resolve.alias['node:path'] = 'path-browserify';
186
+ config.resolve.alias['path'] = 'path-browserify';
187
+ }
188
+ if (isServer) {
189
+ config.externals.push('@sqlite.org/sqlite-wasm');
190
+ config.externals.push('chokidar');
191
+ config.externals.push('arweave');
192
+ }
193
+ return config;
194
+ };
195
+
175
196
  const commandExists = (command) => {
176
197
  try {
177
198
  execSync(`which ${command}`, { stdio: 'ignore' });
@@ -218,5 +239,5 @@ const runSeedInit = ensureNodeDbSchema;
218
239
  configurePlatform(createPlatformServices());
219
240
  enableMapSet();
220
241
 
221
- export { Property, commandExists, ensureNodeDbSchema, findSeedBinary, parseMarkdownFrontmatter, processSeedConfig, runSeedInit, saveModelsFromMarkdown };
242
+ export { Property, commandExists, ensureNodeDbSchema, findSeedBinary, parseMarkdownFrontmatter, processSeedConfig, runSeedInit, saveModelsFromMarkdown, withSeed };
222
243
  //# sourceMappingURL=node.js.map
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":["../../src/imports/markdown.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 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","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 {\n Model,\n Property,\n Image,\n List,\n Text,\n Json,\n Relation,\n Boolean,\n Number,\n Date,\n} from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty } from '../ItemProperty/ItemProperty'\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'\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'\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,CAAwB;AACrE,QAAA,OAAO,WAAW;IACpB;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,oCAAA,EAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAC7G;IACH;AACF;AAEA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAkB,KAAsB;AACxE,IAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4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,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;;ACY3B,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 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 */\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 {\n Model,\n Property,\n Image,\n List,\n Text,\n Json,\n Relation,\n Boolean,\n Number,\n Date,\n} from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty } from '../ItemProperty/ItemProperty'\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'\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'\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,CAAwB;AACrE,QAAA,OAAO,WAAW;IACpB;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,oCAAA,EAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAC7G;IACH;AACF;AAEA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAkB,KAAsB;AACxE,IAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IAC/D;AAEA,IAAA,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC,IAAI;IAEtE,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA,IAAA,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAA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,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;;ACY3B,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE;;"}
@@ -1,11 +1,11 @@
1
- import { B as BaseDb, b as appState, t as BasePathResolver, a as BaseFileManager } from './BasePathResolver-BDgc7c4T.js';
1
+ import { a as BaseDb, c as appState, t as BasePathResolver, B as BaseFileManager } from './BasePathResolver-DWY_hb8w.js';
2
2
  import debug from 'debug';
3
3
  import { sql } from 'drizzle-orm';
4
4
  import { readMigrationFiles } from 'drizzle-orm/migrator';
5
5
  import { drizzle } from 'drizzle-orm/sqlite-proxy';
6
6
  import { migrate } from 'drizzle-orm/sqlite-proxy/migrator';
7
- import { E as EAS_ENDPOINT } from './constants-B5S5JPDK.js';
8
- import { s as schema } from './index-QMrBK-L3.js';
7
+ import { E as EAS_ENDPOINT } from './constants-B7aNfB_1.js';
8
+ import { s as schema } from './index-DrEkRiuK.js';
9
9
  import { SQLocalDrizzle } from 'sqlocal/drizzle';
10
10
  import { Observable, distinctUntilChanged } from 'rxjs';
11
11
  import { BaseArweaveClient, GET_TRANSACTION_TAGS } from '@seedprotocol/arweave';
@@ -19,6 +19,7 @@ import 'pluralize';
19
19
  import '@sinclair/typebox';
20
20
  import 'nanoid';
21
21
  import 'nanoid-dictionary';
22
+ import '@seedprotocol/query';
22
23
 
23
24
  const saveAppState = async (key, value) => {
24
25
  const appDb = BaseDb.getAppDb();
@@ -3067,7 +3068,7 @@ class BrowserDb {
3067
3068
  logger$1('[Db.prepareDb] database prepared');
3068
3069
  await this.runMigrations(db);
3069
3070
  this.appDb = db;
3070
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DzZw57iJ.js');
3071
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CZcOi-cK.js');
3071
3072
  await backfillMetadataPropertyIds();
3072
3073
  return this.appDb;
3073
3074
  }
@@ -3289,7 +3290,7 @@ const getArweaveInstance = () => {
3289
3290
  return _arweaveInstance;
3290
3291
  }
3291
3292
  _arweaveGatewayKey = gatewayKey;
3292
- const host = BaseArweaveClient.getHost();
3293
+ const host = BaseArweaveClient.getArweaveSdkHost();
3293
3294
  const protocol = BaseArweaveClient.getProtocol();
3294
3295
  // Handle both ES modules and CommonJS exports from arweave package
3295
3296
  if ("default" in Arweave && typeof Arweave.default?.init === "function") {
@@ -3343,6 +3344,18 @@ class BrowserArweaveClient {
3343
3344
  }
3344
3345
  }
3345
3346
  async getTransactionData(transactionId, options) {
3347
+ // Path-prefixed proxies (app-server Hyper proxy) are not supported by arweave.init host;
3348
+ // fetch via getRawUrl so /api/seed-gateway/... works.
3349
+ if (BaseArweaveClient.getGatewayPath()) {
3350
+ const response = await fetch(BaseArweaveClient.getRawUrl(transactionId));
3351
+ if (!response.ok) {
3352
+ throw new Error(`Failed to fetch transaction data: HTTP ${response.status}`);
3353
+ }
3354
+ if (options?.string) {
3355
+ return response.text();
3356
+ }
3357
+ return new Uint8Array(await response.arrayBuffer());
3358
+ }
3346
3359
  const arweave = getArweaveInstance();
3347
3360
  try {
3348
3361
  const data = await arweave.transactions.getData(transactionId, {