@seedprotocol/sdk 0.5.2 → 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 (124) 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-BBXBvgvy.js → ModelProperty-DGJf78CS.js} +21 -21
  4. package/dist/{ModelProperty-BBXBvgvy.js.map → ModelProperty-DGJf78CS.js.map} +1 -1
  5. package/dist/{Schema-xAt7jWlW.js → Schema-Drmce3q-.js} +39 -39
  6. package/dist/{Schema-xAt7jWlW.js.map → Schema-Drmce3q-.js.map} +1 -1
  7. package/dist/{SchemaValidationService-CLzAdBm-.js → SchemaValidationService-a_sfnpDV.js} +5 -5
  8. package/dist/{SchemaValidationService-CLzAdBm-.js.map → SchemaValidationService-a_sfnpDV.js.map} +1 -1
  9. package/dist/{backfillMetadataPropertyIds-DBVaIs7O.js → backfillMetadataPropertyIds-CZcOi-cK.js} +3 -3
  10. package/dist/{backfillMetadataPropertyIds-DBVaIs7O.js.map → backfillMetadataPropertyIds-CZcOi-cK.js.map} +1 -1
  11. package/dist/cjs/{ModelProperty-Dgd4tGrB.js → ModelProperty-BA26rMV8.js} +17 -17
  12. package/dist/cjs/{ModelProperty-Dgd4tGrB.js.map → ModelProperty-BA26rMV8.js.map} +1 -1
  13. package/dist/cjs/{Schema-dkd-eo3B.js → Schema-Hgwq3L34.js} +20 -20
  14. package/dist/cjs/{Schema-dkd-eo3B.js.map → Schema-Hgwq3L34.js.map} +1 -1
  15. package/dist/cjs/{SchemaValidationService-BMnjcVWV.js → SchemaValidationService-DVmOGZao.js} +2 -2
  16. package/dist/cjs/{SchemaValidationService-BMnjcVWV.js.map → SchemaValidationService-DVmOGZao.js.map} +1 -1
  17. package/dist/cjs/{backfillMetadataPropertyIds-ClLuj3s6.js → backfillMetadataPropertyIds-BWJI4eCj.js} +2 -2
  18. package/dist/cjs/{backfillMetadataPropertyIds-ClLuj3s6.js.map → backfillMetadataPropertyIds-BWJI4eCj.js.map} +1 -1
  19. package/dist/cjs/{eas-nWAzbl_F.js → eas-BJ8FtbU9.js} +3 -3
  20. package/dist/cjs/{eas-nWAzbl_F.js.map → eas-BJ8FtbU9.js.map} +1 -1
  21. package/dist/cjs/{getItem-B08FgglK.js → getItem-DdBKeEEU.js} +2 -2
  22. package/dist/cjs/{getItem-B08FgglK.js.map → getItem-DdBKeEEU.js.map} +1 -1
  23. package/dist/cjs/{getPublishPayload-B_G_6qkE.js → getPublishPayload-DSBLjMKl.js} +11 -11
  24. package/dist/cjs/{getPublishPayload-B_G_6qkE.js.map → getPublishPayload-DSBLjMKl.js.map} +1 -1
  25. package/dist/cjs/{getPublishUploads-Dt-DS-lo.js → getPublishUploads-DMKnK2_R.js} +4 -4
  26. package/dist/cjs/{getPublishUploads-Dt-DS-lo.js.map → getPublishUploads-DMKnK2_R.js.map} +1 -1
  27. package/dist/cjs/{getSegmentedItemProperties-BDGbeDW7.js → getSegmentedItemProperties-D0ZzTmvi.js} +3 -3
  28. package/dist/cjs/{getSegmentedItemProperties-BDGbeDW7.js.map → getSegmentedItemProperties-D0ZzTmvi.js.map} +1 -1
  29. package/dist/cjs/{index-CRBI6dSD.js → index-BD1b6zAi.js} +498 -40
  30. package/dist/cjs/index-BD1b6zAi.js.map +1 -0
  31. package/dist/cjs/{index-Dx19j60c.js → index-DQggpLqI.js} +3 -3
  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-628qAHpN.js → property-D4IB0zBz.js} +4 -4
  35. package/dist/cjs/{property-628qAHpN.js.map → property-D4IB0zBz.js.map} +1 -1
  36. package/dist/cjs/{syncDbWithEas-DOBtMPw-.js → syncDbWithEas-BYvFJc7N.js} +6 -6
  37. package/dist/cjs/{syncDbWithEas-DOBtMPw-.js.map → syncDbWithEas-BYvFJc7N.js.map} +1 -1
  38. package/dist/{configurePlatform-Ce6NIKRP.js → configurePlatform-CXQCT7N8.js} +3 -3
  39. package/dist/{configurePlatform-Ce6NIKRP.js.map → configurePlatform-CXQCT7N8.js.map} +1 -1
  40. package/dist/{constants-slkc9uq0.js → constants-B7aNfB_1.js} +3 -3
  41. package/dist/{constants-slkc9uq0.js.map → constants-B7aNfB_1.js.map} +1 -1
  42. package/dist/constants-DMHTYMgJ.js.map +1 -1
  43. package/dist/{db-CSmK0c3e.js → db-Bad8QKfZ.js} +18 -18
  44. package/dist/{db-CSmK0c3e.js.map → db-Bad8QKfZ.js.map} +1 -1
  45. package/dist/{eas-rx1grht5.js → eas-BB9hVW68.js} +6 -6
  46. package/dist/{eas-rx1grht5.js.map → eas-BB9hVW68.js.map} +1 -1
  47. package/dist/{getItem-hPBJU5JF.js → getItem-Cina46nb.js} +5 -5
  48. package/dist/{getItem-hPBJU5JF.js.map → getItem-Cina46nb.js.map} +1 -1
  49. package/dist/{getPublishPayload-5ugovGK5.js → getPublishPayload-BEO52UOv.js} +16 -16
  50. package/dist/{getPublishPayload-5ugovGK5.js.map → getPublishPayload-BEO52UOv.js.map} +1 -1
  51. package/dist/{getPublishUploads-CdWeci-s.js → getPublishUploads-CJjfqJi9.js} +7 -7
  52. package/dist/{getPublishUploads-CdWeci-s.js.map → getPublishUploads-CJjfqJi9.js.map} +1 -1
  53. package/dist/{getSegmentedItemProperties-DV2LHElJ.js → getSegmentedItemProperties-CbzFDgFr.js} +5 -5
  54. package/dist/{getSegmentedItemProperties-DV2LHElJ.js.map → getSegmentedItemProperties-CbzFDgFr.js.map} +1 -1
  55. package/dist/{index-ClwdGWfr.js → index-B4In0GEO.js} +428 -64
  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-CrXwRoiB.js → index.node-CnP9s4cV.js} +4 -4
  62. package/dist/{index.node-CrXwRoiB.js.map → index.node-CnP9s4cV.js.map} +1 -1
  63. package/dist/main.cjs +1 -1
  64. package/dist/main.js +19 -20
  65. package/dist/main.js.map +1 -1
  66. package/dist/node.js +10 -10
  67. package/dist/node.js.map +1 -1
  68. package/dist/platform.browser.js +4 -4
  69. package/dist/platform.browser.js.map +1 -1
  70. package/dist/platform.node.js +3 -3
  71. package/dist/{property-CKhOxRNt.js → property-DIN1zQ_c.js} +8 -8
  72. package/dist/{property-CKhOxRNt.js.map → property-DIN1zQ_c.js.map} +1 -1
  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/itemMachineSingle.d.ts +2 -2
  76. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  77. package/dist/src/ItemProperty/ItemProperty.d.ts +1 -1
  78. package/dist/src/ItemProperty/service/propertyMachine.d.ts +2 -2
  79. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  80. package/dist/src/Model/service/modelMachine.d.ts +10 -18
  81. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  82. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +5 -13
  83. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  84. package/dist/src/Schema/service/addModelsMachine.d.ts +8 -8
  85. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  86. package/dist/src/Schema/service/schemaMachine.d.ts +22 -30
  87. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  88. package/dist/src/client/ClientManager.d.ts +16 -6
  89. package/dist/src/client/ClientManager.d.ts.map +1 -1
  90. package/dist/src/client/clientManagerMachine.d.ts +2 -2
  91. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  92. package/dist/src/client/events.d.ts +7 -0
  93. package/dist/src/client/events.d.ts.map +1 -1
  94. package/dist/src/db/write/removeLocalCopiesForAddresses.d.ts +20 -0
  95. package/dist/src/db/write/removeLocalCopiesForAddresses.d.ts.map +1 -0
  96. package/dist/src/events/item/easSyncManager.d.ts +2 -2
  97. package/dist/src/events/item/easSyncManager.d.ts.map +1 -1
  98. package/dist/src/helpers/file/download/index.d.ts +2 -2
  99. package/dist/src/helpers/file/download/index.d.ts.map +1 -1
  100. package/dist/src/helpers/file/fetchAll/index.d.ts +2 -2
  101. package/dist/src/helpers/file/fetchAll/index.d.ts.map +1 -1
  102. package/dist/src/helpers/ownership.d.ts +7 -0
  103. package/dist/src/helpers/ownership.d.ts.map +1 -1
  104. package/dist/src/index.d.ts +2 -2
  105. package/dist/src/index.d.ts.map +1 -1
  106. package/dist/src/services/publish/publishMachine.d.ts +1 -1
  107. package/dist/src/services/publish/publishMachine.d.ts.map +1 -1
  108. package/dist/src/services/write/writeProcessMachine.d.ts +2 -6
  109. package/dist/src/services/write/writeProcessMachine.d.ts.map +1 -1
  110. package/dist/{syncDbWithEas-GsaXzTIY.js → syncDbWithEas-ceVUuWSZ.js} +13 -13
  111. package/dist/{syncDbWithEas-GsaXzTIY.js.map → syncDbWithEas-ceVUuWSZ.js.map} +1 -1
  112. package/dist/{updateSeedRevokedAt-Ba0OhDQj.js → updateSeedRevokedAt-CtRjZiyh.js} +2 -2
  113. package/dist/{updateSeedRevokedAt-Ba0OhDQj.js.map → updateSeedRevokedAt-CtRjZiyh.js.map} +1 -1
  114. package/package.json +23 -6
  115. package/dist/cjs/index-CRBI6dSD.js.map +0 -1
  116. package/dist/cjs/index-Dx19j60c.js.map +0 -1
  117. package/dist/cjs/ownership-3Tc1-Yrc.js +0 -105
  118. package/dist/cjs/ownership-3Tc1-Yrc.js.map +0 -1
  119. package/dist/index-CcH2e0Zr.js +0 -23
  120. package/dist/index-CcH2e0Zr.js.map +0 -1
  121. package/dist/index-ClwdGWfr.js.map +0 -1
  122. package/dist/index-QMrBK-L3.js.map +0 -1
  123. package/dist/ownership-58i0iyD9.js +0 -106
  124. package/dist/ownership-58i0iyD9.js.map +0 -1
package/dist/node.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { enableMapSet } from 'immer';
2
2
  import 'reflect-metadata';
3
- export { I as Item, j as ItemProperty, M as Model, C as client, h as eventEmitter, k as getRefValueType, l as importJsonSchema, n as loadSchemaFromFile, o as readJsonImportFile, q as syncSchemaFromSource, t as transformImportToSchemaFile } from './index-ClwdGWfr.js';
4
- import { M as ModelPropertyDataTypes, P as Property } from './constants-slkc9uq0.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-slkc9uq0.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-CrXwRoiB.js';
11
- export { D as Db, F as FileManager, P as PathResolver, r as resolveSdkDrizzleMigrationsDir } from './index.node-CrXwRoiB.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-CSmK0c3e.js';
14
+ import { addModelsToDb } from './db-Bad8QKfZ.js';
15
15
  import { execSync } from 'child_process';
16
16
  import path from 'path';
17
17
  export { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from './constants-DMHTYMgJ.js';
18
- import { configurePlatform } from './configurePlatform-Ce6NIKRP.js';
18
+ import { configurePlatform } from './configurePlatform-CXQCT7N8.js';
19
19
  import 'xstate';
20
20
  import 'debug';
21
21
  import 'nanoid';
@@ -31,7 +31,7 @@ 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';
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":["../../src/imports/markdown.ts","../../src/node/webpack/index.ts","../../src/node/helpers/scripts.ts","../../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n /** For List: element type when primitive (e.g. 'Text', 'Number'). Use target for list of relations. */\n itemsType?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target, itemsType } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (itemsType) {\n // List of primitives: itemsType = 'Text', 'Number', etc.\n if (itemsType === ModelPropertyDataTypes.Relation && target) {\n schema[propertyName] = Property.List('Relation', target)\n } else if (itemsType !== ModelPropertyDataTypes.Relation) {\n schema[propertyName] = Property.List(itemsType as any)\n } else {\n throw new Error(\n `List of relations requires target model for property ${propertyName}`,\n )\n }\n } else if (target) {\n // Backward compat: target = model name for list of relations\n schema[propertyName] = Property.List('Relation', target)\n } else {\n throw new Error(\n `List property ${propertyName} requires either itemsType (e.g. 'Text') or target (model name for list of relations)`,\n )\n }\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n 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,CAC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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,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AI,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,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-slkc9uq0.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';
@@ -3068,7 +3068,7 @@ class BrowserDb {
3068
3068
  logger$1('[Db.prepareDb] database prepared');
3069
3069
  await this.runMigrations(db);
3070
3070
  this.appDb = db;
3071
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DBVaIs7O.js');
3071
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CZcOi-cK.js');
3072
3072
  await backfillMetadataPropertyIds();
3073
3073
  return this.appDb;
3074
3074
  }