@seedprotocol/sdk 0.6.7 → 0.6.9

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 (201) hide show
  1. package/dist/{BasePathResolver-qV0apdVY.js → BasePathResolver-B6CKqoKw.js} +16 -5
  2. package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
  3. package/dist/{ClientManager-Y5EWQuJj.js → ClientManager-ChcmUL47.js} +619 -264
  4. package/dist/ClientManager-ChcmUL47.js.map +1 -0
  5. package/dist/{ModelProperty-DuB5nk6A.js → ModelProperty-D79uV42p.js} +33 -30
  6. package/dist/ModelProperty-D79uV42p.js.map +1 -0
  7. package/dist/{Schema-BYM-GNdE.js → Schema-a8uO-hIZ.js} +43 -43
  8. package/dist/Schema-a8uO-hIZ.js.map +1 -0
  9. package/dist/{SchemaValidationService-Dr6nmwPm.js → SchemaValidationService-Y49vqast.js} +13 -12
  10. package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
  11. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js → backfillMetadataPropertyIds-CBsf7LnU.js} +5 -3
  12. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
  13. package/dist/cjs/{ModelProperty-CDTOx5zi.js → ModelProperty-D9FGaGuE.js} +21 -17
  14. package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
  15. package/dist/cjs/{Schema-XXcwj3hV.js → Schema-BiJIPLEL.js} +25 -24
  16. package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
  17. package/dist/cjs/{SchemaValidationService-Z7OhtGn5.js → SchemaValidationService-DtYs_CNY.js} +5 -3
  18. package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
  19. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js → backfillMetadataPropertyIds-2XaN3b9S.js} +3 -2
  20. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
  21. package/dist/cjs/{eas-DdI-4vwl.js → eas-CMNppmGE.js} +4 -3
  22. package/dist/cjs/{eas-DdI-4vwl.js.map → eas-CMNppmGE.js.map} +1 -1
  23. package/dist/cjs/{getItem-B_2GeTQf.js → getItem-B6jEINjW.js} +3 -2
  24. package/dist/cjs/{getItem-B_2GeTQf.js.map → getItem-B6jEINjW.js.map} +1 -1
  25. package/dist/cjs/{getPublishPayload-Jmgi1RUj.js → getPublishPayload-D5DhLGvN.js} +64 -59
  26. package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
  27. package/dist/cjs/{getPublishUploads-DNULcrN5.js → getPublishUploads-DMhCCKYF.js} +17 -10
  28. package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
  29. package/dist/cjs/{getSegmentedItemProperties-DK82kjri.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
  30. package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
  31. package/dist/cjs/{index-DM1WR83P.js → index-CSNtEnbF.js} +879 -467
  32. package/dist/cjs/index-CSNtEnbF.js.map +1 -0
  33. package/dist/cjs/{index-tpO1Nj4v.js → index-DPp9rdRL.js} +6 -3
  34. package/dist/cjs/index-DPp9rdRL.js.map +1 -0
  35. package/dist/cjs/{property-DmvgA8FD.js → property-DlKiAWt4.js} +7 -4
  36. package/dist/cjs/{property-DmvgA8FD.js.map → property-DlKiAWt4.js.map} +1 -1
  37. package/dist/cjs/{syncDbWithEas-3hOoPdu1.js → syncDbWithEas-C6n34o_Q.js} +11 -6
  38. package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
  39. package/dist/{configurePlatform-CCYQruij.js → configurePlatform-CE0Vew17.js} +5 -5
  40. package/dist/{configurePlatform-CCYQruij.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
  41. package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
  42. package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
  43. package/dist/db/drizzle/meta/_journal.json +7 -0
  44. package/dist/{db-CceyWksv.js → db-WbrzEf7c.js} +254 -35
  45. package/dist/db-WbrzEf7c.js.map +1 -0
  46. package/dist/{eas-CH8iFIST.js → eas-CfYCu4IX.js} +6 -6
  47. package/dist/{eas-CH8iFIST.js.map → eas-CfYCu4IX.js.map} +1 -1
  48. package/dist/{getItem-C7Mtfz6O.js → getItem-Br-bGNFO.js} +6 -6
  49. package/dist/{getItem-C7Mtfz6O.js.map → getItem-Br-bGNFO.js.map} +1 -1
  50. package/dist/{getPublishPayload-2gnnDdMh.js → getPublishPayload-BIrTVUxb.js} +66 -62
  51. package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
  52. package/dist/{getPublishUploads-AKISt3JA.js → getPublishUploads-C6cDeZdz.js} +19 -13
  53. package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
  54. package/dist/{getSegmentedItemProperties-eIjvhCP_.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
  55. package/dist/{getSegmentedItemProperties-eIjvhCP_.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
  56. package/dist/{constants-DSqHBPNe.js → index-280bL-n4.js} +32 -257
  57. package/dist/index-280bL-n4.js.map +1 -0
  58. package/dist/{index-CHi212ST.js → index-ClSv5pTA.js} +13 -13
  59. package/dist/index-ClSv5pTA.js.map +1 -0
  60. package/dist/{index-CsmiM0RI.js → index-Djd3667v.js} +2 -2
  61. package/dist/index-Djd3667v.js.map +1 -0
  62. package/dist/{index-BFpbtEsg.js → index-HRHkbVQd.js} +24 -24
  63. package/dist/{index-BFpbtEsg.js.map → index-HRHkbVQd.js.map} +1 -1
  64. package/dist/{index.node-CbWB4MDz.js → index.node-DBtQkEfz.js} +8 -6
  65. package/dist/index.node-DBtQkEfz.js.map +1 -0
  66. package/dist/main.cjs +6 -1
  67. package/dist/main.cjs.map +1 -1
  68. package/dist/main.js +36 -38
  69. package/dist/main.js.map +1 -1
  70. package/dist/node.js +15 -14
  71. package/dist/node.js.map +1 -1
  72. package/dist/platform.browser.js +108 -46
  73. package/dist/platform.browser.js.map +1 -1
  74. package/dist/platform.node.js +4 -3
  75. package/dist/platform.node.js.map +1 -1
  76. package/dist/{property-CWKcZ5YZ.js → property-CQjuZ4JW.js} +14 -13
  77. package/dist/property-CQjuZ4JW.js.map +1 -0
  78. package/dist/seedSchema/PublishProcessSchema.ts +1 -0
  79. package/dist/src/Item/Item.d.ts +6 -0
  80. package/dist/src/Item/Item.d.ts.map +1 -1
  81. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  82. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
  83. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  85. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  86. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  87. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  88. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  89. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
  90. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  91. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
  92. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  93. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  94. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  95. package/dist/src/browser/helpers/EasClient.d.ts +2 -1
  96. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  97. package/dist/src/browser/helpers/FileManager.d.ts +1 -1
  98. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  99. package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
  100. package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
  101. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  102. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  103. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  104. package/dist/src/client/constants.d.ts +4 -0
  105. package/dist/src/client/constants.d.ts.map +1 -1
  106. package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
  107. package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
  108. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  109. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  110. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
  111. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  112. package/dist/src/events/files/download.d.ts.map +1 -1
  113. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  114. package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
  115. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
  116. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  117. package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
  118. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
  119. package/dist/src/helpers/constants.d.ts +8 -0
  120. package/dist/src/helpers/constants.d.ts.map +1 -1
  121. package/dist/src/helpers/db.d.ts +6 -0
  122. package/dist/src/helpers/db.d.ts.map +1 -1
  123. package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
  124. package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
  125. package/dist/src/helpers/localDbChain.d.ts +22 -0
  126. package/dist/src/helpers/localDbChain.d.ts.map +1 -0
  127. package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
  128. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  129. package/dist/src/helpers/property/index.d.ts +12 -0
  130. package/dist/src/helpers/property/index.d.ts.map +1 -1
  131. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
  132. package/dist/src/helpers/relationSeedRef.d.ts +8 -0
  133. package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
  134. package/dist/src/index.d.ts +9 -5
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/src/node/easLodashHook.d.ts +2 -0
  137. package/dist/src/node/easLodashHook.d.ts.map +1 -0
  138. package/dist/src/node/easLodashRegister.d.ts +2 -0
  139. package/dist/src/node/easLodashRegister.d.ts.map +1 -0
  140. package/dist/src/node/helpers/FileManager.d.ts +2 -1
  141. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  142. package/dist/src/node/index.d.ts +2 -1
  143. package/dist/src/node/index.d.ts.map +1 -1
  144. package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
  145. package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
  146. package/dist/src/types/fileManager.d.ts +4 -0
  147. package/dist/src/types/fileManager.d.ts.map +1 -1
  148. package/dist/src/types/index.d.ts +15 -1
  149. package/dist/src/types/index.d.ts.map +1 -1
  150. package/dist/{syncDbWithEas-5kZneTEL.js → syncDbWithEas-CuARXfyN.js} +16 -12
  151. package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
  152. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
  153. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
  154. package/package.json +11 -7
  155. package/src/node/easLodashHook.js +22 -0
  156. package/src/node/easLodashRegister.js +13 -0
  157. package/dist/BasePathResolver-qV0apdVY.js.map +0 -1
  158. package/dist/ClientManager-Y5EWQuJj.js.map +0 -1
  159. package/dist/ModelProperty-DuB5nk6A.js.map +0 -1
  160. package/dist/Schema-BYM-GNdE.js.map +0 -1
  161. package/dist/SchemaValidationService-Dr6nmwPm.js.map +0 -1
  162. package/dist/cjs/ModelProperty-CDTOx5zi.js.map +0 -1
  163. package/dist/cjs/Schema-XXcwj3hV.js.map +0 -1
  164. package/dist/cjs/SchemaValidationService-Z7OhtGn5.js.map +0 -1
  165. package/dist/cjs/getPublishPayload-Jmgi1RUj.js.map +0 -1
  166. package/dist/cjs/getPublishUploads-DNULcrN5.js.map +0 -1
  167. package/dist/cjs/getSegmentedItemProperties-DK82kjri.js.map +0 -1
  168. package/dist/cjs/index-DM1WR83P.js.map +0 -1
  169. package/dist/cjs/index-tpO1Nj4v.js.map +0 -1
  170. package/dist/cjs/syncDbWithEas-3hOoPdu1.js.map +0 -1
  171. package/dist/constants-DSqHBPNe.js.map +0 -1
  172. package/dist/db-CceyWksv.js.map +0 -1
  173. package/dist/getPublishPayload-2gnnDdMh.js.map +0 -1
  174. package/dist/getPublishUploads-AKISt3JA.js.map +0 -1
  175. package/dist/index-CHi212ST.js.map +0 -1
  176. package/dist/index-CsmiM0RI.js.map +0 -1
  177. package/dist/index.node-CbWB4MDz.js.map +0 -1
  178. package/dist/property-CWKcZ5YZ.js.map +0 -1
  179. package/dist/seedSchema/AppStateSchema.d.ts +0 -82
  180. package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
  181. package/dist/seedSchema/ConfigSchema.d.ts +0 -101
  182. package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
  183. package/dist/seedSchema/MetadataSchema.d.ts +0 -422
  184. package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
  185. package/dist/seedSchema/ModelSchema.d.ts +0 -243
  186. package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
  187. package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
  188. package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
  189. package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
  190. package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
  191. package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
  192. package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
  193. package/dist/seedSchema/SchemaSchema.d.ts +0 -169
  194. package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
  195. package/dist/seedSchema/SeedSchema.d.ts +0 -192
  196. package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
  197. package/dist/seedSchema/VersionSchema.d.ts +0 -194
  198. package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
  199. package/dist/seedSchema/index.d.ts +0 -14
  200. package/dist/seedSchema/index.d.ts.map +0 -1
  201. package/dist/syncDbWithEas-5kZneTEL.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import debug from 'debug';
2
2
  import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot, fromPromise } from 'xstate';
3
- import { n as normalizePublisher, o as getOwnedAddressesFromDb, j as normalizeAddressList, b as normalizeHexAddress, h as getAddressesForItemsFilter, e as escapeSqliteString, g as getPropertyIdForModelAndName, i as normalizeAddressConfig, m as loadModelsFromDbForSchema, l as addSchemaToDb, p as getWatchedAddressesFromDb } from './db-CceyWksv.js';
4
- import { n as normalizeDataType, t as toSnakeCase, p as MachineIds, A as getStorageTransactionIdForSeedUid, G as convertTxIdToImage, v as ensureImageLocal, K as downloadTransactionIdWithDedupe, M as ModelPropertyDataTypes, O as getDataTypeFromString, Q as getMimeType, m as eventEmitter, l as getCorrectId, S as isBrowser, U as isNode, V as downloadAllFilesRequestHandler, W as downloadAllFilesBinaryRequestHandler, X as ClientManagerEvents, C as ClientManagerState } from './constants-DSqHBPNe.js';
5
- import { a as BaseDb, r as seeds, j as modelUids, m as models$1, v as versions, b as metadata$1, s as schemas, i as modelSchemas, Z as ZERO_BYTES32, B as BaseFileManager, I as INTERNAL_PROPERTY_NAMES, C as ImageSize, p as properties, x as INTERNAL_DATA_TYPES, P as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, f as easSyncProcesses, t as BasePathResolver, c as appState, G as isInternalSchema, H as INTERNAL_SCHEMA_IDS, D as SEED_PROTOCOL_SCHEMA_NAME, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses, J as CLIENT_NOT_INITIALIZED } from './BasePathResolver-qV0apdVY.js';
6
- import { and, isNotNull, not, eq, or, max, count, getTableColumns, sql, isNull, desc, inArray, gt } from 'drizzle-orm';
7
- import { getResolvedSeedGatewayEndpoints, getReadGatewayHostsForConfig, getDefaultArweaveReadGatewayHostsOrdered, getArweaveReadGatewayHostsForPrimary, seedGatewayConfigFromSeedConfig, resolveSeedGatewayEndpoints, setResolvedSeedGatewayEndpoints, BaseArweaveClient, ensureReadGatewaySelected, DEFAULT_ARWEAVE_HOST } from '@seedprotocol/arweave';
8
- import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, isPlaceholderUid, getEasSchemaUidForSchemaDefinition, GET_SCHEMA_BY_NAME } from '@seedprotocol/eas';
3
+ import { n as normalizeDataType, o as normalizePublisher, G as getOwnedAddressesFromDb, x as normalizeAddressList, r as normalizeHexAddress, v as getAddressesForItemsFilter, k as isDataType, M as ModelPropertyDataTypes, q as escapeSqliteString, K as getPropertyIdForSchemaFileId, m as getPropertyIdForModelAndName, l as normalizePropertyRecordSchema, w as normalizeAddressConfig, E as loadModelsFromDbForSchema, A as addSchemaToDb, O as getWatchedAddressesFromDb } from './db-WbrzEf7c.js';
4
+ import { a as BaseDb, r as seeds, j as modelUids, m as models$1, v as versions, b as metadata$1, s as schemas, i as modelSchemas, Z as ZERO_BYTES32, B as BaseFileManager, I as INTERNAL_PROPERTY_NAMES, C as ImageSize, p as properties, x as INTERNAL_DATA_TYPES, P as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, f as easSyncProcesses, t as BasePathResolver, c as appState, J as isInternalSchema, K as INTERNAL_SCHEMA_IDS, D as SEED_PROTOCOL_SCHEMA_NAME, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses, L as CLIENT_NOT_INITIALIZED } from './BasePathResolver-B6CKqoKw.js';
5
+ import { and, isNotNull, not, eq, or, max, count, getTableColumns, sql, isNull, desc, inArray, gt, ne } from 'drizzle-orm';
6
+ import { t as toSnakeCase, m as getStorageTransactionIdForSeedUid, o as convertTxIdToImage, f as ensureImageLocal, p as downloadTransactionIdWithDedupe, q as getDataTypeFromString, u as getMimeType, e as eventEmitter, g as getCorrectId, a as isStorageSeedRef, v as isNode, w as isBrowser, x as downloadAllFilesRequestHandler, y as downloadAllFilesBinaryRequestHandler } from './index-280bL-n4.js';
7
+ import { fetchArweaveRawTextAcrossGateways, seedGatewayConfigFromSeedConfig, setPreferredArweaveReadBaseUrls, resolveSeedGatewayEndpoints, setResolvedSeedGatewayEndpoints, BaseArweaveClient, ensureReadGatewaySelected, DEFAULT_ARWEAVE_HOST } from '@seedprotocol/arweave';
8
+ import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, isPlaceholderUid, getEasSchemaUidForSchemaDefinition, GET_SCHEMA_BY_NAME, configureEasReadChain, isEasReadChainConfigured, getEasReadChainId, whenEasReadChainSettled, DEFAULT_EAS_CHAIN_ID } from '@seedprotocol/eas';
9
9
  import pluralize from 'pluralize';
10
10
  import { sha3_256 } from '@noble/hashes/sha3';
11
11
  import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
@@ -132,20 +132,34 @@ var publishConfig = /*#__PURE__*/Object.freeze({
132
132
  setUploadExecutor: setUploadExecutor
133
133
  });
134
134
 
135
- /**
136
- * For a schema property key like `authors` (List of Relation to Identity), returns the
137
- * internal storage/EAS name: `authorIdentityIds` (singular + ref + Ids).
138
- */
139
- function listRelationStoragePropertyName(propertySchemas, schemaPropertyKey) {
140
- const propDef = propertySchemas[schemaPropertyKey];
135
+ /** Ref model name when propDef is a List of Relation, else undefined. */
136
+ function listRelationRef(propDef) {
141
137
  if (!propDef)
142
138
  return undefined;
143
139
  if (normalizeDataType(propDef.dataType) !== 'List')
144
140
  return undefined;
145
- const ref = propDef.ref || propDef.refModelName;
146
- if (!ref)
141
+ return propDef.ref || propDef.refModelName || undefined;
142
+ }
143
+ /**
144
+ * Storage/EAS name for a List-of-relation property (`authorIdentityIds`), given either its
145
+ * schema key (`authors`) or its storage name. A name already in storage form is returned as-is,
146
+ * so this is safe on ItemProperties built before their schema was known.
147
+ * Returns undefined when propDef is not a List of Relation.
148
+ */
149
+ function listRelationEasPropertyName(propertyName, propDef) {
150
+ const ref = listRelationRef(propDef);
151
+ if (!ref || !propertyName)
147
152
  return undefined;
148
- return `${pluralize(schemaPropertyKey, 1)}${ref}Ids`;
153
+ if (propertyName.endsWith(`${ref}Ids`))
154
+ return propertyName;
155
+ return `${pluralize(propertyName, 1)}${ref}Ids`;
156
+ }
157
+ /**
158
+ * For a schema property key like `authors` (List of Relation to Identity), returns the
159
+ * internal storage/EAS name: `authorIdentityIds` (singular + ref + Ids).
160
+ */
161
+ function listRelationStoragePropertyName(propertySchemas, schemaPropertyKey) {
162
+ return listRelationEasPropertyName(schemaPropertyKey, propertySchemas[schemaPropertyKey]);
149
163
  }
150
164
  /**
151
165
  * Reverse of listRelationStoragePropertyName: maps DB/EAS name `authorIdentityIds` to schema key `authors`.
@@ -367,6 +381,95 @@ function createReactiveProxy(config) {
367
381
  return proxy;
368
382
  }
369
383
 
384
+ const ENV = (typeof process !== 'undefined' && process.env)
385
+ ? process.env
386
+ : (typeof window !== 'undefined' && window.env)
387
+ ? window.env
388
+ : {};
389
+ var MachineIds;
390
+ (function (MachineIds) {
391
+ MachineIds["CLIENT_MANAGER"] = "@seedSdk/clientManager";
392
+ MachineIds["EAS_SYNC_MANAGER"] = "@seedSdk/easSyncManager";
393
+ MachineIds["GLOBAL"] = "@seedSdk/global";
394
+ MachineIds["INTERNAL"] = "@seedSdk/internal";
395
+ MachineIds["EAS"] = "@seedSdk/eas";
396
+ MachineIds["ITEM"] = "@seedSdk/item";
397
+ MachineIds["ALL_ITEMS"] = "@seedSdk/allItems";
398
+ MachineIds["MODEL"] = "@seedSdk/model";
399
+ MachineIds["FILE_SYSTEM"] = "@seedSdk/fileSystem";
400
+ })(MachineIds || (MachineIds = {}));
401
+ const { INTERNAL, GLOBAL, EAS, MODEL } = MachineIds;
402
+ var ClientManagerState;
403
+ (function (ClientManagerState) {
404
+ ClientManagerState["UNINITIALIZED"] = "uninitialized";
405
+ ClientManagerState["PLATFORM_CLASSES_INIT"] = "platformClassesInit";
406
+ ClientManagerState["FILE_SYSTEM_INIT"] = "fileSystemInit";
407
+ ClientManagerState["DB_INIT"] = "dbInit";
408
+ ClientManagerState["SAVE_CONFIG"] = "saveConfig";
409
+ ClientManagerState["ADD_MODELS_TO_STORE"] = "addModelsToStore";
410
+ ClientManagerState["ADD_MODELS_TO_DB"] = "addModelsToDb";
411
+ ClientManagerState["PROCESS_SCHEMA_FILES"] = "processSchemaFiles";
412
+ ClientManagerState["IDLE"] = "idle";
413
+ ClientManagerState["INIT_FAILED"] = "initFailed";
414
+ })(ClientManagerState || (ClientManagerState = {}));
415
+ var ClientManagerEvents;
416
+ (function (ClientManagerEvents) {
417
+ ClientManagerEvents["UPDATE_CONTEXT"] = "updateContext";
418
+ ClientManagerEvents["PLATFORM_CLASSES_READY"] = "platformClassesReady";
419
+ ClientManagerEvents["FILE_SYSTEM_READY"] = "fileSystemReady";
420
+ ClientManagerEvents["DB_READY"] = "dbReady";
421
+ ClientManagerEvents["SAVE_CONFIG_SUCCESS"] = "saveConfigSuccess";
422
+ ClientManagerEvents["SAVE_APP_STATE_SUCCESS"] = "saveAppStateSuccess";
423
+ ClientManagerEvents["SAVE_APP_STATE_ERROR"] = "saveAppStateError";
424
+ ClientManagerEvents["SET_ADDRESSES"] = "setAddresses";
425
+ ClientManagerEvents["ADD_MODELS_TO_STORE_SUCCESS"] = "addModelsToStoreSuccess";
426
+ ClientManagerEvents["ADD_MODELS_TO_DB_SUCCESS"] = "addModelsToDbSuccess";
427
+ ClientManagerEvents["PROCESS_SCHEMA_FILES_SUCCESS"] = "processSchemaFilesSuccess";
428
+ })(ClientManagerEvents || (ClientManagerEvents = {}));
429
+ var GlobalState;
430
+ (function (GlobalState) {
431
+ GlobalState["UNINITIALIZED"] = "uninitialized";
432
+ GlobalState["INITIALIZING"] = "initializing";
433
+ GlobalState["INITIALIZED"] = "initialized";
434
+ GlobalState["PUBLISHING_ITEM"] = "publishingItem";
435
+ GlobalState["ADDING_MODELS_TO_DB"] = "addingModelsToDb";
436
+ })(GlobalState || (GlobalState = {}));
437
+ const { UNINITIALIZED: GLOBAL_UNINITIALIZED, INITIALIZING, INITIALIZED, PUBLISHING_ITEM, ADDING_MODELS_TO_DB, } = GlobalState;
438
+ var InternalState;
439
+ (function (InternalState) {
440
+ InternalState["IDLE"] = "idle";
441
+ InternalState["INITIALIZING"] = "initializing";
442
+ InternalState["VALIDATING_INPUT"] = "validatingInput";
443
+ InternalState["CONFIGURING_FS"] = "configuringFs";
444
+ InternalState["LOADING_SEED_DB"] = "loadingSeedDb";
445
+ InternalState["SAVING_CONFIG"] = "savingConfig";
446
+ InternalState["LOADING_APP_DB"] = "loadingAppDb";
447
+ InternalState["LOADING_SDK_DB"] = "loadingSdkDb";
448
+ })(InternalState || (InternalState = {}));
449
+ const { VALIDATING_INPUT, CONFIGURING_FS, LOADING_SEED_DB, LOADING_APP_DB } = InternalState;
450
+ var PublishMachineStates;
451
+ (function (PublishMachineStates) {
452
+ PublishMachineStates["VALIDATING_ITEM_DATA"] = "validatingItemData";
453
+ PublishMachineStates["CREATING_PUBLISH_ATTEMPT"] = "creatingPublishAttempt";
454
+ PublishMachineStates["UPLOADING"] = "uploading";
455
+ PublishMachineStates["PREPARING_PUBLISH_REQUEST_DATA"] = "preparingPublishRequestData";
456
+ PublishMachineStates["PUBLISHING"] = "publishing";
457
+ PublishMachineStates["IDLE"] = "idle";
458
+ })(PublishMachineStates || (PublishMachineStates = {}));
459
+ /**
460
+ * @deprecated Evaluated once at import and ignores `SeedConfig.eas` / publish chain config.
461
+ * Use `getEasEndpoint()` from `@seedprotocol/eas`.
462
+ */
463
+ ENV.NEXT_PUBLIC_EAS_ENDPOINT ||
464
+ ENV.EAS_ENDPOINT ||
465
+ 'https://optimism-sepolia.easscan.org/graphql';
466
+ /**
467
+ * @deprecated Use BaseArweaveClient.getHost() instead.
468
+ * This constant is kept for backward compatibility but will be removed in a future version.
469
+ * Migration: import { BaseArweaveClient } from '@/helpers' and use BaseArweaveClient.getHost()
470
+ */
471
+ ENV.NEXT_PUBLIC_ARWEAVE_HOST || 'ar.seedprotocol.io';
472
+
370
473
  debug('seedSdk:item:service:actors:waitForDb');
371
474
  const waitForDb$1 = fromCallback(({ sendBack }) => {
372
475
  const _waitForDb = new Promise((resolve) => {
@@ -665,7 +768,7 @@ const fetchDataFromEas = fromCallback(({ sendBack, input: { context } }) => {
665
768
  }
666
769
  else if (modelName) {
667
770
  // Dynamic import to break circular dependency
668
- const _mod_0 = await import('./index-BFpbtEsg.js');
771
+ const _mod_0 = await import('./index-HRHkbVQd.js');
669
772
  const _ns_0 = _mod_0.b;
670
773
  const modelMod = _ns_0;
671
774
  const { Model } = modelMod;
@@ -854,7 +957,7 @@ function compareMetadataRowsLatestFirst(a, b) {
854
957
  return kb.localId.localeCompare(ka.localId);
855
958
  }
856
959
 
857
- const logger$j = debug('seedSdk:item:actors:loadOrCreateItem');
960
+ const logger$k = debug('seedSdk:item:actors:loadOrCreateItem');
858
961
  /**
859
962
  * Maps metadata.property_name to the ItemProperty Map key (same rules as the instance loop below).
860
963
  */
@@ -928,7 +1031,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
928
1031
  const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
929
1032
  const { ItemProperty } = itemPropertyMod;
930
1033
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
931
- const _mod_1 = await import('./index-BFpbtEsg.js');
1034
+ const _mod_1 = await import('./index-HRHkbVQd.js');
932
1035
  const _ns_1 = _mod_1.b;
933
1036
  const { Model } = _ns_1;
934
1037
  // Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
@@ -946,18 +1049,18 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
946
1049
  const schemaNameToTry = model?.schemaName;
947
1050
  if (schemaNameToTry) {
948
1051
  try {
949
- const _mod_2 = await import('./Schema-BYM-GNdE.js');
1052
+ const _mod_2 = await import('./Schema-a8uO-hIZ.js');
950
1053
  const _ns_2 = _mod_2.b;
951
1054
  const { Schema } = _ns_2;
952
1055
  const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
953
1056
  const schemaContext = schemaInstance.getService().getSnapshot().context;
954
1057
  if (schemaContext.models?.[modelName]?.properties) {
955
1058
  propertySchemas = schemaContext.models[modelName].properties;
956
- logger$j(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from Schema context for ${modelName}`);
1059
+ logger$k(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from Schema context for ${modelName}`);
957
1060
  }
958
1061
  }
959
1062
  catch (err) {
960
- logger$j(`Fallback Schema context failed for ${modelName}: ${err}`);
1063
+ logger$k(`Fallback Schema context failed for ${modelName}: ${err}`);
961
1064
  }
962
1065
  }
963
1066
  if (Object.keys(propertySchemas).length === 0) {
@@ -968,20 +1071,20 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
968
1071
  const models = schemaFile.models;
969
1072
  if (models?.[modelName]?.properties) {
970
1073
  propertySchemas = models[modelName].properties;
971
- logger$j(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from loadAllSchemasFromDb for ${modelName}`);
1074
+ logger$k(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from loadAllSchemasFromDb for ${modelName}`);
972
1075
  break;
973
1076
  }
974
1077
  }
975
1078
  }
976
1079
  catch (err) {
977
- logger$j(`Fallback loadAllSchemasFromDb failed for ${modelName}: ${err}`);
1080
+ logger$k(`Fallback loadAllSchemasFromDb failed for ${modelName}: ${err}`);
978
1081
  }
979
1082
  }
980
1083
  if (Object.keys(propertySchemas).length === 0) {
981
1084
  try {
982
1085
  const { listCompleteSchemaFiles } = await Promise.resolve().then(function () { return schema; });
983
- const _mod_3 = await import('./BasePathResolver-qV0apdVY.js');
984
- const _ns_3 = _mod_3.K;
1086
+ const _mod_3 = await import('./BasePathResolver-B6CKqoKw.js');
1087
+ const _ns_3 = _mod_3.N;
985
1088
  const { BaseFileManager } = _ns_3;
986
1089
  const schemaFiles = await listCompleteSchemaFiles();
987
1090
  for (const { filePath } of schemaFiles) {
@@ -989,17 +1092,17 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
989
1092
  const schemaFile = JSON.parse(content);
990
1093
  if (schemaFile.models?.[modelName]?.properties) {
991
1094
  propertySchemas = schemaFile.models[modelName].properties;
992
- logger$j(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from schema file for ${modelName}`);
1095
+ logger$k(`Fallback: got ${Object.keys(propertySchemas).length} property schemas from schema file for ${modelName}`);
993
1096
  break;
994
1097
  }
995
1098
  }
996
1099
  }
997
1100
  catch (err) {
998
- logger$j(`Fallback schema file scan failed for ${modelName}: ${err}`);
1101
+ logger$k(`Fallback schema file scan failed for ${modelName}: ${err}`);
999
1102
  }
1000
1103
  }
1001
1104
  if (Object.keys(propertySchemas).length === 0) {
1002
- const schemaMod = await import('./index-CHi212ST.js');
1105
+ const schemaMod = await import('./index-ClSv5pTA.js');
1003
1106
  const { ModelPropertyDataTypes } = schemaMod;
1004
1107
  const KNOWN_MODEL_FALLBACKS = {
1005
1108
  Post: {
@@ -1011,10 +1114,13 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1011
1114
  };
1012
1115
  if (KNOWN_MODEL_FALLBACKS[modelName]) {
1013
1116
  propertySchemas = KNOWN_MODEL_FALLBACKS[modelName];
1014
- logger$j(`Fallback: using known model schema for ${modelName} (${Object.keys(propertySchemas).length} properties)`);
1117
+ logger$k(`Fallback: using known model schema for ${modelName} (${Object.keys(propertySchemas).length} properties)`);
1015
1118
  }
1016
1119
  }
1017
1120
  }
1121
+ // Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
1122
+ const { normalizePropertyRecordSchema } = await import('./property-CQjuZ4JW.js');
1123
+ propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
1018
1124
  // Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
1019
1125
  // ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
1020
1126
  // let an empty "authors" row overwrite a populated storage row.
@@ -1026,7 +1132,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1026
1132
  try {
1027
1133
  let propertyName = metaRow.propertyName;
1028
1134
  if (!propertyName) {
1029
- logger$j(`Metadata row missing propertyName, skipping`);
1135
+ logger$k(`Metadata row missing propertyName, skipping`);
1030
1136
  continue;
1031
1137
  }
1032
1138
  const listSchemaKey = resolveStorageNameToSchemaName(propertySchemas, propertyName);
@@ -1046,7 +1152,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1046
1152
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
1047
1153
  let propSchema = propertySchemas[propertyName];
1048
1154
  if (!propSchema && isRefTypeFromMeta) {
1049
- const schemaMod = await import('./index-CHi212ST.js');
1155
+ const schemaMod = await import('./index-ClSv5pTA.js');
1050
1156
  const { ModelPropertyDataTypes } = schemaMod;
1051
1157
  propSchema = {
1052
1158
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -1074,14 +1180,14 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1074
1180
  const property = ItemProperty.create(createProps, { waitForReady: false });
1075
1181
  if (property) {
1076
1182
  propertyInstances.set(propertyName, property);
1077
- logger$j(`Created/cached ItemProperty instance for propertyName "${propertyName}" with propertyRecordSchema: ${!!createProps.propertyRecordSchema}`);
1183
+ logger$k(`Created/cached ItemProperty instance for propertyName "${propertyName}" with propertyRecordSchema: ${!!createProps.propertyRecordSchema}`);
1078
1184
  }
1079
1185
  else {
1080
- logger$j(`ItemProperty.create returned undefined for propertyName "${propertyName}"`);
1186
+ logger$k(`ItemProperty.create returned undefined for propertyName "${propertyName}"`);
1081
1187
  }
1082
1188
  }
1083
1189
  catch (error) {
1084
- logger$j(`Error creating ItemProperty instance for propertyName "${metaRow.propertyName}": ${error}`);
1190
+ logger$k(`Error creating ItemProperty instance for propertyName "${metaRow.propertyName}": ${error}`);
1085
1191
  }
1086
1192
  }
1087
1193
  // Create placeholder ItemProperty instances for model schema properties without metadata
@@ -1103,17 +1209,17 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1103
1209
  const property = ItemProperty.create(createProps, { waitForReady: false });
1104
1210
  if (property) {
1105
1211
  propertyInstances.set(propertyName, property);
1106
- logger$j(`Created placeholder ItemProperty for model property "${propertyName}" (no metadata)`);
1212
+ logger$k(`Created placeholder ItemProperty for model property "${propertyName}" (no metadata)`);
1107
1213
  }
1108
1214
  }
1109
1215
  catch (error) {
1110
- logger$j(`Error creating placeholder ItemProperty for "${propertyName}": ${error}`);
1216
+ logger$k(`Error creating placeholder ItemProperty for "${propertyName}": ${error}`);
1111
1217
  }
1112
1218
  }
1113
- logger$j(`Finished creating/caching ${propertyInstances.size} ItemProperty instances`);
1219
+ logger$k(`Finished creating/caching ${propertyInstances.size} ItemProperty instances`);
1114
1220
  }
1115
1221
  catch (error) {
1116
- logger$j(`Error in createItemPropertyInstances: ${error}`);
1222
+ logger$k(`Error in createItemPropertyInstances: ${error}`);
1117
1223
  // Don't throw - this is best-effort to pre-populate cache
1118
1224
  }
1119
1225
  return propertyInstances;
@@ -1121,7 +1227,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
1121
1227
  const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1122
1228
  const _loadOrCreateItem = async () => {
1123
1229
  const { seedLocalId, seedUid, modelName } = context;
1124
- logger$j(`loadOrCreateItem called for modelName: ${modelName}, seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
1230
+ logger$k(`loadOrCreateItem called for modelName: ${modelName}, seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
1125
1231
  if (!seedLocalId && !seedUid) {
1126
1232
  throw new Error('seedLocalId or seedUid is required');
1127
1233
  }
@@ -1151,7 +1257,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1151
1257
  .limit(1);
1152
1258
  if (seedRecords.length === 0) {
1153
1259
  // Seed not found - this is a new item, will be created elsewhere
1154
- logger$j(`Seed not found in database for seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
1260
+ logger$k(`Seed not found in database for seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
1155
1261
  sendBack({
1156
1262
  type: 'loadOrCreateItemSuccess',
1157
1263
  item: {
@@ -1192,7 +1298,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1192
1298
  .where(eq(seeds.localId, resolvedSeedLocalId))
1193
1299
  .limit(1);
1194
1300
  if (versionRecords.length === 0) {
1195
- logger$j(`No version data found for seedLocalId: ${resolvedSeedLocalId}`);
1301
+ logger$k(`No version data found for seedLocalId: ${resolvedSeedLocalId}`);
1196
1302
  sendBack({
1197
1303
  type: 'loadOrCreateItemSuccess',
1198
1304
  item: {
@@ -1216,7 +1322,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1216
1322
  const latestVersionLocalId = versionRecord.latestVersionLocalId;
1217
1323
  const latestVersionUid = versionRecord.latestVersionUid || undefined;
1218
1324
  if (!latestVersionLocalId) {
1219
- logger$j(`No latest version found for seedLocalId: ${resolvedSeedLocalId}`);
1325
+ logger$k(`No latest version found for seedLocalId: ${resolvedSeedLocalId}`);
1220
1326
  sendBack({
1221
1327
  type: 'loadOrCreateItemSuccess',
1222
1328
  item: {
@@ -1247,7 +1353,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1247
1353
  .select()
1248
1354
  .from(metadataLatest)
1249
1355
  .where(eq(metadataLatest.rowNum, 1));
1250
- logger$j(`Found ${metadataRecords.length} latest-per-property metadata rows for seed ${resolvedSeedLocalId} (latestVersionLocalId=${latestVersionLocalId} used for placeholders only)`);
1356
+ logger$k(`Found ${metadataRecords.length} latest-per-property metadata rows for seed ${resolvedSeedLocalId} (latestVersionLocalId=${latestVersionLocalId} used for placeholders only)`);
1251
1357
  // Step 4: Create ItemProperty instances from metadata records + placeholders for model schema properties
1252
1358
  // Always call when we have a valid version so placeholders are created for properties without metadata
1253
1359
  const propertyInstances = await createItemPropertyInstances(metadataRecords, resolvedSeedLocalId, resolvedSeedUid, modelName, latestVersionLocalId, latestVersionUid);
@@ -1279,7 +1385,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1279
1385
  });
1280
1386
  };
1281
1387
  _loadOrCreateItem().catch((error) => {
1282
- logger$j(`Error in loadOrCreateItem: ${error}`);
1388
+ logger$k(`Error in loadOrCreateItem: ${error}`);
1283
1389
  sendBack({
1284
1390
  type: 'loadOrCreateItemError',
1285
1391
  error: error instanceof Error ? error.message : String(error),
@@ -1287,7 +1393,7 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1287
1393
  });
1288
1394
  });
1289
1395
 
1290
- const logger$i = debug('seedSdk:Item:runPublish');
1396
+ const logger$j = debug('seedSdk:Item:runPublish');
1291
1397
  const runPublish = fromCallback(({ sendBack, input: { context } }) => {
1292
1398
  const { seedLocalId } = context;
1293
1399
  const _runPublish = async () => {
@@ -1303,9 +1409,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
1303
1409
  sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
1304
1410
  return;
1305
1411
  }
1306
- const getPublishUploadsMod = await import('./getPublishUploads-AKISt3JA.js');
1412
+ const getPublishUploadsMod = await import('./getPublishUploads-C6cDeZdz.js');
1307
1413
  const { getPublishUploads } = getPublishUploadsMod;
1308
- const getPublishPayloadMod = await import('./getPublishPayload-2gnnDdMh.js');
1414
+ const getPublishPayloadMod = await import('./getPublishPayload-BIrTVUxb.js');
1309
1415
  const { getPublishPayload } = getPublishPayloadMod;
1310
1416
  const uploads = await getPublishUploads(item);
1311
1417
  let uploadedTransactions = [];
@@ -1321,12 +1427,12 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
1321
1427
  }
1322
1428
  }
1323
1429
  await getPublishPayload(item, uploadedTransactions);
1324
- logger$i('runPublish: payload prepared (upload/EAS submit stubbed)');
1430
+ logger$j('runPublish: payload prepared (upload/EAS submit stubbed)');
1325
1431
  sendBack({ type: 'publishSuccess' });
1326
1432
  }
1327
1433
  catch (err) {
1328
1434
  const error = err instanceof Error ? err : new Error(String(err));
1329
- logger$i('runPublish error:', error);
1435
+ logger$j('runPublish error:', error);
1330
1436
  sendBack({ type: 'publishError', error });
1331
1437
  }
1332
1438
  };
@@ -1685,7 +1791,7 @@ async function getLatestPublishedVersionRow(seedLocalId) {
1685
1791
  return null;
1686
1792
  }
1687
1793
 
1688
- const logger$h = debug('seedSdk:db:read:getItemData');
1794
+ const logger$i = debug('seedSdk:db:read:getItemData');
1689
1795
  /**
1690
1796
  * Assemble flat ItemData for Item / liveQuery / draft-head authoring.
1691
1797
  *
@@ -1701,7 +1807,7 @@ const getItemData = async ({ modelName, seedLocalId, seedUid, }) => {
1701
1807
  if (seedUid && !seedLocalId) {
1702
1808
  const seedData = await getSeedData({ seedUid });
1703
1809
  if (!seedData) {
1704
- logger$h('[db/queries] [getItem] no seedData seedUid', seedUid);
1810
+ logger$i('[db/queries] [getItem] no seedData seedUid', seedUid);
1705
1811
  return;
1706
1812
  }
1707
1813
  seedLocalId = seedData.localId || undefined;
@@ -1728,9 +1834,9 @@ const getItemData = async ({ modelName, seedLocalId, seedUid, }) => {
1728
1834
  .from(seeds)
1729
1835
  .where(and(...whereClauses))
1730
1836
  .limit(1);
1731
- logger$h('[getItemData] Seed query result', { rowsCount: seedRows?.length || 0, firstRow: seedRows?.[0] });
1837
+ logger$i('[getItemData] Seed query result', { rowsCount: seedRows?.length || 0, firstRow: seedRows?.[0] });
1732
1838
  if (!seedRows || seedRows.length === 0) {
1733
- logger$h('[db/queries] [getItemDataFromDb] no seedRows found', { modelName, seedLocalId, seedUid });
1839
+ logger$i('[db/queries] [getItemDataFromDb] no seedRows found', { modelName, seedLocalId, seedUid });
1734
1840
  return;
1735
1841
  }
1736
1842
  const seedRow = seedRows[0];
@@ -1752,7 +1858,7 @@ const getItemData = async ({ modelName, seedLocalId, seedUid, }) => {
1752
1858
  }
1753
1859
  }
1754
1860
  catch (error) {
1755
- logger$h('[getItemData] Error deriving schemaName:', error);
1861
+ logger$i('[getItemData] Error deriving schemaName:', error);
1756
1862
  }
1757
1863
  }
1758
1864
  // Now get version data if it exists - query versions table directly
@@ -2141,12 +2247,12 @@ const resolveRemoteStorage = fromCallback(({ sendBack, input: { context } }) =>
2141
2247
  });
2142
2248
  });
2143
2249
 
2144
- const logger$g = debug('seedSdk:ItemProperty:service:actors:waitForDb');
2250
+ const logger$h = debug('seedSdk:ItemProperty:service:actors:waitForDb');
2145
2251
  const waitForDb = fromCallback(({ sendBack }) => {
2146
2252
  // Check immediately first
2147
2253
  const appDb = BaseDb.getAppDb();
2148
2254
  if (appDb) {
2149
- logger$g('Database is ready (immediate check)');
2255
+ logger$h('Database is ready (immediate check)');
2150
2256
  sendBack({ type: 'waitForDbSuccess' });
2151
2257
  return;
2152
2258
  }
@@ -2158,24 +2264,24 @@ const waitForDb = fromCallback(({ sendBack }) => {
2158
2264
  const appDb = BaseDb.getAppDb();
2159
2265
  if (appDb) {
2160
2266
  clearInterval(interval);
2161
- logger$g('Database is ready (after polling)');
2267
+ logger$h('Database is ready (after polling)');
2162
2268
  resolve();
2163
2269
  }
2164
2270
  else if (Date.now() - startTime > timeout) {
2165
2271
  clearInterval(interval);
2166
2272
  const error = new Error('Database not available after timeout');
2167
- logger$g(`Database wait timeout: ${error.message}`);
2273
+ logger$h(`Database wait timeout: ${error.message}`);
2168
2274
  reject(error);
2169
2275
  }
2170
2276
  }, 100);
2171
2277
  });
2172
2278
  _waitForDb
2173
2279
  .then(() => {
2174
- logger$g('Sending waitForDbSuccess event');
2280
+ logger$h('Sending waitForDbSuccess event');
2175
2281
  sendBack({ type: 'waitForDbSuccess' });
2176
2282
  })
2177
2283
  .catch((error) => {
2178
- logger$g(`Error waiting for database: ${error}`);
2284
+ logger$h(`Error waiting for database: ${error}`);
2179
2285
  sendBack({ type: 'waitForDbError', error: error.message });
2180
2286
  });
2181
2287
  });
@@ -2269,7 +2375,7 @@ const getRelationValueData = async (propertyValue) => {
2269
2375
 
2270
2376
  // Dynamic import to break circular dependency: schema/index -> ... -> resolveRelatedValue -> schema/index
2271
2377
  // import { ModelPropertyDataTypes } from '@/schema'
2272
- const logger$f = debug('seedSdk:property:actors:resolveRelatedValue');
2378
+ const logger$g = debug('seedSdk:property:actors:resolveRelatedValue');
2273
2379
  const storageTransactionIdToContentUrl = new Map();
2274
2380
  const refResolvedValueToContentUrl = new Map();
2275
2381
  const seedUidToContentUrl = new Map();
@@ -2277,14 +2383,14 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2277
2383
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
2278
2384
  const _resolveRelatedValue = async () => {
2279
2385
  // Use dynamic import to break circular dependency
2280
- const schemaMod = await import('./index-CHi212ST.js');
2386
+ const schemaMod = await import('./index-ClSv5pTA.js');
2281
2387
  const { ModelPropertyDataTypes } = schemaMod;
2282
2388
  if (!propertyValue || !isRelation || populatedFromDb) {
2283
2389
  return;
2284
2390
  }
2285
2391
  if (Array.isArray(propertyValue)) {
2286
2392
  // TODO: Handle array of seedUids
2287
- logger$f(`${propertyName} value is an array of seedUids`);
2393
+ logger$g(`${propertyName} value is an array of seedUids`);
2288
2394
  return;
2289
2395
  }
2290
2396
  if (typeof propertyValue === 'object') {
@@ -2296,7 +2402,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2296
2402
  parsedValue = JSON.parse(relationKey);
2297
2403
  }
2298
2404
  catch (error) {
2299
- logger$f(`${propertyName} value is not a JSON string.`);
2405
+ logger$g(`${propertyName} value is not a JSON string.`);
2300
2406
  }
2301
2407
  if (!parsedValue && seedUidToContentUrl.has(relationKey)) {
2302
2408
  const contentUrl = seedUidToContentUrl.get(relationKey);
@@ -2311,7 +2417,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2311
2417
  return true;
2312
2418
  }
2313
2419
  if (Array.isArray(parsedValue)) {
2314
- logger$f(`${propertyName} value is a stringified array of seedUids`);
2420
+ logger$g(`${propertyName} value is a stringified array of seedUids`);
2315
2421
  return;
2316
2422
  }
2317
2423
  const storageTransactionId = await getStorageTransactionIdForSeedUid(relationKey);
@@ -2351,7 +2457,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2351
2457
  // This handles a local-only relation value and resolves from the filesystem
2352
2458
  if (refResolvedValue &&
2353
2459
  propertyRecordSchema &&
2354
- propertyRecordSchema.dataType === ModelPropertyDataTypes.Relation &&
2460
+ isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Relation) &&
2355
2461
  propertyValueFromDb &&
2356
2462
  typeof propertyValueFromDb === 'string' &&
2357
2463
  propertyValueFromDb.length === 10 &&
@@ -2654,48 +2760,15 @@ function extractArweaveTransactionId(raw) {
2654
2760
  return t;
2655
2761
  }
2656
2762
  /**
2657
- * GET /raw/{txId} on each configured gateway. Avoids arweave.js /tx/.../offset which often 404s on
2658
- * arweave.net while another gateway (e.g. ar.seedprotocol.io) still serves the data.
2763
+ * GET /raw/{txId} on each read gateway, preferred ones ({@link setPreferredArweaveReadBaseUrls})
2764
+ * first. Avoids arweave.js /tx/.../offset which often 404s on arweave.net while another gateway
2765
+ * (e.g. ar.seedprotocol.io, or the one the item was just uploaded through) still serves the data.
2659
2766
  */
2660
2767
  async function fetchHtmlViaRawAcrossGateways(txId) {
2661
2768
  const id = extractArweaveTransactionId(txId);
2662
2769
  if (!id || SEED_UID_HEX_RE.test(id))
2663
2770
  return undefined;
2664
- try {
2665
- const resolved = getResolvedSeedGatewayEndpoints();
2666
- if (!resolved || (resolved.activePath !== 'hyper-sidecar' && resolved.activePath !== 'http-proxy')) {
2667
- const { ensureReadGatewaySelected } = await import('@seedprotocol/arweave');
2668
- await ensureReadGatewaySelected().catch(() => { });
2669
- }
2670
- }
2671
- catch {
2672
- /* optional */
2673
- }
2674
- const { BaseArweaveClient } = await import('@seedprotocol/arweave');
2675
- const protocol = BaseArweaveClient.getProtocol();
2676
- const resolved = getResolvedSeedGatewayEndpoints();
2677
- const hosts = resolved
2678
- ? getReadGatewayHostsForConfig(resolved, getDefaultArweaveReadGatewayHostsOrdered())
2679
- : getArweaveReadGatewayHostsForPrimary(BaseArweaveClient.getHost());
2680
- for (const host of hosts) {
2681
- const h = host.trim().replace(/\/$/, '');
2682
- if (!h)
2683
- continue;
2684
- const url = `${protocol}://${h}/raw/${encodeURIComponent(id)}`;
2685
- try {
2686
- const res = await fetch(url, { method: 'GET', credentials: 'omit' });
2687
- if (!res.ok)
2688
- continue;
2689
- const text = await res.text();
2690
- if (typeof text === 'string' && text.length > 0) {
2691
- return text;
2692
- }
2693
- }
2694
- catch {
2695
- /* next gateway */
2696
- }
2697
- }
2698
- return undefined;
2771
+ return fetchArweaveRawTextAcrossGateways(id);
2699
2772
  }
2700
2773
  /**
2701
2774
  * Resolve the Html storage seed's `local_id` used for the `{localId}.html` file name.
@@ -2745,8 +2818,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
2745
2818
  /* offline / bad tx id */
2746
2819
  }
2747
2820
  try {
2748
- const _mod_4 = await import('./constants-DSqHBPNe.js');
2749
- const _ns_4 = _mod_4.Y;
2821
+ const _mod_4 = await import('./index-280bL-n4.js');
2822
+ const _ns_4 = _mod_4.z;
2750
2823
  const { downloadTransactionIdWithDedupe } = _ns_4;
2751
2824
  await downloadTransactionIdWithDedupe(txId);
2752
2825
  const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
@@ -2795,7 +2868,7 @@ async function readHtmlBodyForStorageSeedPropertyValue(propertyValue) {
2795
2868
 
2796
2869
  // Dynamic import to break circular dependency: schema/index -> ... -> hydrateFromDb -> schema/index
2797
2870
  // import { ModelPropertyDataTypes } from '@/schema'
2798
- const logger$e = debug('seedSdk:property:actors:hydrateFromDb');
2871
+ const logger$f = debug('seedSdk:property:actors:hydrateFromDb');
2799
2872
  const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2800
2873
  const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyRecordSchema, modelName, } = context;
2801
2874
  if (!propertyNameRaw) {
@@ -2806,7 +2879,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2806
2879
  // to use dynamically imported ModelPropertyDataTypes
2807
2880
  const _hydrateFromDb = async () => {
2808
2881
  // Use dynamic import to break circular dependency
2809
- const schemaMod = await import('./index-CHi212ST.js');
2882
+ const schemaMod = await import('./index-ClSv5pTA.js');
2810
2883
  const { ModelPropertyDataTypes } = schemaMod;
2811
2884
  const appDb = BaseDb.getAppDb();
2812
2885
  const whereClauses = [];
@@ -2912,7 +2985,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2912
2985
  }
2913
2986
  }
2914
2987
  catch (e) {
2915
- logger$e('[hydrateFromDb] Image file resolution error', e);
2988
+ logger$f('[hydrateFromDb] Image file resolution error', e);
2916
2989
  }
2917
2990
  }
2918
2991
  }
@@ -2943,7 +3016,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2943
3016
  }
2944
3017
  }
2945
3018
  catch (e) {
2946
- logger$e('[hydrateFromDb] File resolution error', e);
3019
+ logger$f('[hydrateFromDb] File resolution error', e);
2947
3020
  }
2948
3021
  }
2949
3022
  if (propertyRecordSchema &&
@@ -3046,11 +3119,11 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
3046
3119
  });
3047
3120
  });
3048
3121
 
3049
- const logger$d = debug('seedSdk:itemProperty:actors:loadOrCreateProperty');
3122
+ const logger$e = debug('seedSdk:itemProperty:actors:loadOrCreateProperty');
3050
3123
  const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) => {
3051
3124
  const _loadOrCreateProperty = async () => {
3052
3125
  const { seedLocalId, seedUid, propertyName, versionLocalId } = context;
3053
- logger$d(`loadOrCreateProperty called for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
3126
+ logger$e(`loadOrCreateProperty called for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}, seedUid: ${seedUid}`);
3054
3127
  if (!seedLocalId && !seedUid) {
3055
3128
  throw new Error('seedLocalId or seedUid is required');
3056
3129
  }
@@ -3085,7 +3158,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3085
3158
  const modelNameForNew = context.modelName;
3086
3159
  if (modelNameForNew) {
3087
3160
  try {
3088
- const _mod_5 = await import('./index-BFpbtEsg.js');
3161
+ const _mod_5 = await import('./index-HRHkbVQd.js');
3089
3162
  const _ns_5 = _mod_5.b;
3090
3163
  const { Model } = _ns_5;
3091
3164
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
@@ -3098,15 +3171,15 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3098
3171
  const schemas = modelPropertiesToObject(model.properties);
3099
3172
  propertyRecordSchema = schemas[propertyName];
3100
3173
  if (propertyRecordSchema) {
3101
- logger$d(`Metadata not found: loaded propertyRecordSchema from Model for propertyName "${propertyName}"`);
3174
+ logger$e(`Metadata not found: loaded propertyRecordSchema from Model for propertyName "${propertyName}"`);
3102
3175
  }
3103
3176
  }
3104
3177
  }
3105
3178
  catch (error) {
3106
- logger$d(`Metadata not found: Model fallback failed for propertyName "${propertyName}": ${error}`);
3179
+ logger$e(`Metadata not found: Model fallback failed for propertyName "${propertyName}": ${error}`);
3107
3180
  }
3108
3181
  }
3109
- logger$d(`Metadata not found in database for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}`);
3182
+ logger$e(`Metadata not found in database for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}`);
3110
3183
  sendBack({
3111
3184
  type: 'loadOrCreatePropertySuccess',
3112
3185
  property: {
@@ -3172,15 +3245,15 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3172
3245
  };
3173
3246
  // Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
3174
3247
  try {
3175
- const { getPropertySchema } = await import('./property-CWKcZ5YZ.js');
3248
+ const { getPropertySchema } = await import('./property-CQjuZ4JW.js');
3176
3249
  let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName);
3177
3250
  if (!schemaFromFile?.validation) {
3178
3251
  // Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
3179
- const _mod_6 = await import('./BasePathResolver-qV0apdVY.js');
3180
- const _ns_6 = _mod_6.L;
3252
+ const _mod_6 = await import('./BasePathResolver-B6CKqoKw.js');
3253
+ const _ns_6 = _mod_6.O;
3181
3254
  const { schemas: schemasTable } = _ns_6;
3182
- const _mod_7 = await import('./BasePathResolver-qV0apdVY.js');
3183
- const _ns_7 = _mod_7.N;
3255
+ const _mod_7 = await import('./BasePathResolver-B6CKqoKw.js');
3256
+ const _ns_7 = _mod_7.Q;
3184
3257
  const { modelSchemas } = _ns_7;
3185
3258
  const modelSchemaRows = await db
3186
3259
  .select({ schemaId: modelSchemas.schemaId })
@@ -3214,13 +3287,13 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3214
3287
  }
3215
3288
  }
3216
3289
  catch (error) {
3217
- logger$d(`Error loading propertyRecordSchema from database: ${error}`);
3290
+ logger$e(`Error loading propertyRecordSchema from database: ${error}`);
3218
3291
  // Continue without propertyRecordSchema
3219
3292
  }
3220
3293
  }
3221
3294
  if (!propertyRecordSchema && modelName) {
3222
3295
  try {
3223
- const _mod_8 = await import('./index-BFpbtEsg.js');
3296
+ const _mod_8 = await import('./index-HRHkbVQd.js');
3224
3297
  const _ns_8 = _mod_8.b;
3225
3298
  const { Model } = _ns_8;
3226
3299
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
@@ -3234,12 +3307,12 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3234
3307
  const schemas = modelPropertiesToObject(model.properties);
3235
3308
  propertyRecordSchema = schemas[propertyName];
3236
3309
  if (propertyRecordSchema) {
3237
- logger$d(`Fallback: loaded propertyRecordSchema from Model for propertyName "${propertyName}"`);
3310
+ logger$e(`Fallback: loaded propertyRecordSchema from Model for propertyName "${propertyName}"`);
3238
3311
  }
3239
3312
  }
3240
3313
  }
3241
3314
  catch (error) {
3242
- logger$d(`Fallback Model lookup failed for propertyName "${propertyName}": ${error}`);
3315
+ logger$e(`Fallback Model lookup failed for propertyName "${propertyName}": ${error}`);
3243
3316
  }
3244
3317
  }
3245
3318
  // For Html: read file content for renderValue (propertyValue is seed ID; blob URLs in DB are invalid after reload)
@@ -3280,7 +3353,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3280
3353
  }
3281
3354
  }
3282
3355
  catch (e) {
3283
- logger$d(`Failed to read Html file for ${propertyName}: ${e}`);
3356
+ logger$e(`Failed to read Html file for ${propertyName}: ${e}`);
3284
3357
  }
3285
3358
  }
3286
3359
  // Covers missing ref row, wrong ref, or DB dataType casing "html" (handled by isHtml above).
@@ -3338,7 +3411,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3338
3411
  });
3339
3412
  }
3340
3413
  catch (e) {
3341
- logger$d(`loadOrCreateProperty: updateMetadata refResolvedValue failed for ${propertyName}:`, e);
3414
+ logger$e(`loadOrCreateProperty: updateMetadata refResolvedValue failed for ${propertyName}:`, e);
3342
3415
  }
3343
3416
  }
3344
3417
  }
@@ -3360,7 +3433,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3360
3433
  }
3361
3434
  }
3362
3435
  catch (e) {
3363
- logger$d(`Failed to resolve Image file for ${propertyName}: ${e}`);
3436
+ logger$e(`Failed to resolve Image file for ${propertyName}: ${e}`);
3364
3437
  }
3365
3438
  }
3366
3439
  const isFile = refSeedType === 'file' ||
@@ -3378,7 +3451,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3378
3451
  }
3379
3452
  }
3380
3453
  catch (e) {
3381
- logger$d(`Failed to resolve File for ${propertyName}: ${e}`);
3454
+ logger$e(`Failed to resolve File for ${propertyName}: ${e}`);
3382
3455
  }
3383
3456
  }
3384
3457
  let propertyValueOut = metadataRecord.propertyValue || undefined;
@@ -3410,7 +3483,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3410
3483
  });
3411
3484
  };
3412
3485
  _loadOrCreateProperty().catch((error) => {
3413
- logger$d(`Error in loadOrCreateProperty: ${error}`);
3486
+ logger$e(`Error in loadOrCreateProperty: ${error}`);
3414
3487
  sendBack({
3415
3488
  type: 'loadOrCreatePropertyError',
3416
3489
  error: error instanceof Error ? error.message : String(error),
@@ -3440,10 +3513,10 @@ const getVersionData = async ({ localId, seedLocalId, uid, }) => {
3440
3513
  return queryRows[0];
3441
3514
  };
3442
3515
 
3443
- const logger$c = debug('seedSdk:write:updateItemPropertyValue');
3516
+ const logger$d = debug('seedSdk:write:updateItemPropertyValue');
3444
3517
  const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, newValue, seedUid, seedLocalId, modelName, refSeedType, refResolvedValue, refResolvedDisplayValue, versionLocalId, versionUid, schemaUid, localStorageDir, dataType, refValueType, }) => {
3445
3518
  if (!localIdParam && !seedLocalId) {
3446
- logger$c(`[db/write] [updateItemPropertyValue] no propertyLocalId or seedLocalId for property: ${propertyName}`);
3519
+ logger$d(`[db/write] [updateItemPropertyValue] no propertyLocalId or seedLocalId for property: ${propertyName}`);
3447
3520
  return;
3448
3521
  }
3449
3522
  let safeNewValue = newValue;
@@ -3516,7 +3589,7 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3516
3589
  modelType === modelName?.toLowerCase() &&
3517
3590
  refSeedTypeFromDb === refSeedType &&
3518
3591
  refResolvedValueFromDb === refResolvedValue) {
3519
- logger$c(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
3592
+ logger$d(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
3520
3593
  return;
3521
3594
  }
3522
3595
  // This means we already have a local-only record so we should just update that one
@@ -3644,9 +3717,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3644
3717
  }
3645
3718
  const _analyzeInput = async () => {
3646
3719
  // Use dynamic import to break circular dependency
3647
- const schemaMod = await import('./index-CHi212ST.js');
3720
+ const schemaMod = await import('./index-ClSv5pTA.js');
3648
3721
  const { ModelPropertyDataTypes } = schemaMod;
3649
- const { SchemaValidationService } = await import('./SchemaValidationService-Dr6nmwPm.js');
3722
+ const { SchemaValidationService } = await import('./SchemaValidationService-Y49vqast.js');
3650
3723
  let propertyName = propertyNameRaw;
3651
3724
  if (!propertyName) {
3652
3725
  throw new Error('propertyName is required');
@@ -3821,6 +3894,12 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3821
3894
  if (!metadataValues.modelType && metadataValues.modelName) {
3822
3895
  metadataValues.modelType = toSnakeCase$1(metadataValues.modelName);
3823
3896
  }
3897
+ // List of Relation rows live under the storage name (authors → authorIdentityIds), never the schema key.
3898
+ if (metadataValues.propertyName) {
3899
+ const storageName = listRelationEasPropertyName(metadataValues.propertyName, propertyRecordSchema);
3900
+ if (storageName)
3901
+ metadataValues.propertyName = storageName;
3902
+ }
3824
3903
  const isItemStorage = propertyRecordSchema && propertyRecordSchema.storageType === 'ItemStorage';
3825
3904
  // if (
3826
3905
  // propertyRecordSchema &&
@@ -3835,7 +3914,11 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3835
3914
  // }
3836
3915
  // Convert propertyValue to string if it's not already (metadata table expects text)
3837
3916
  if (metadataValues.propertyValue !== undefined && metadataValues.propertyValue !== null) {
3838
- if (typeof metadataValues.propertyValue !== 'string') {
3917
+ if (Array.isArray(metadataValues.propertyValue)) {
3918
+ // List values: JSON array is the storage format (String() would give legacy comma-separated ids)
3919
+ metadataValues.propertyValue = JSON.stringify(metadataValues.propertyValue);
3920
+ }
3921
+ else if (typeof metadataValues.propertyValue !== 'string') {
3839
3922
  metadataValues.propertyValue = String(metadataValues.propertyValue);
3840
3923
  }
3841
3924
  }
@@ -3844,7 +3927,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3844
3927
  propertyRecordSchema?.validation &&
3845
3928
  metadataValues.propertyValue != null &&
3846
3929
  metadataValues.propertyValue !== '') {
3847
- const { SchemaValidationService } = await import('./SchemaValidationService-Dr6nmwPm.js');
3930
+ const { SchemaValidationService } = await import('./SchemaValidationService-Y49vqast.js');
3848
3931
  const validationService = new SchemaValidationService();
3849
3932
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
3850
3933
  ? normalizeDataType(String(propertyRecordSchema.refValueType))
@@ -3895,29 +3978,44 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3895
3978
  }
3896
3979
  }
3897
3980
  }
3898
- // Resolve property_id for FK: prefer explicit value, then propertyRecordSchema.id, else lookup
3981
+ // Resolve property_id for FK: prefer explicit value, then propertyRecordSchema.id, else lookup.
3982
+ // propertyRecordSchema.id is the integer properties.id only when built from a DB row; from schema
3983
+ // files and Model it is the schemaFileId string, which must be looked up (Number() gives NaN).
3899
3984
  if (metadataValues.propertyId == null) {
3900
- if (propertyRecordSchema?.id != null) {
3901
- metadataValues.propertyId =
3902
- typeof propertyRecordSchema.id === 'number'
3903
- ? propertyRecordSchema.id
3904
- : Number(propertyRecordSchema.id);
3905
- }
3906
- else if (metadataValues.propertyName &&
3907
- (metadataValues.modelName || metadataValues.modelType)) {
3908
- const modelKey = metadataValues.modelName ?? metadataValues.modelType;
3909
- metadataValues.propertyId =
3910
- (await getPropertyIdForModelAndName(modelKey, metadataValues.propertyName)) ?? undefined;
3911
- }
3912
- }
3913
- const inserted = await appDb
3914
- .insert(metadata$1)
3915
- .values({
3916
- ...metadataValues,
3917
- createdAt: Date.now(),
3918
- updatedAt: Date.now(),
3919
- })
3920
- .returning();
3985
+ const schemaId = propertyRecordSchema?.id;
3986
+ const modelKey = metadataValues.modelName ?? metadataValues.modelType ?? undefined;
3987
+ if (typeof schemaId === 'number' && Number.isInteger(schemaId)) {
3988
+ metadataValues.propertyId = schemaId;
3989
+ }
3990
+ else if (modelKey) {
3991
+ if (typeof schemaId === 'string' && schemaId) {
3992
+ metadataValues.propertyId =
3993
+ (await getPropertyIdForSchemaFileId(modelKey, schemaId)) ?? undefined;
3994
+ }
3995
+ if (metadataValues.propertyId == null && metadataValues.propertyName) {
3996
+ metadataValues.propertyId =
3997
+ (await getPropertyIdForModelAndName(modelKey, metadataValues.propertyName)) ?? undefined;
3998
+ }
3999
+ }
4000
+ }
4001
+ let inserted;
4002
+ try {
4003
+ inserted = await appDb
4004
+ .insert(metadata$1)
4005
+ .values({
4006
+ ...metadataValues,
4007
+ createdAt: Date.now(),
4008
+ updatedAt: Date.now(),
4009
+ })
4010
+ .returning();
4011
+ }
4012
+ catch (error) {
4013
+ // Drizzle's message is the full SQL; the driver error that explains it is only on `cause`.
4014
+ const cause = error?.cause;
4015
+ const reason = cause instanceof Error ? cause.message : cause != null ? String(cause) : undefined;
4016
+ throw new Error(`Failed to insert metadata for property ${metadataValues.propertyName}` +
4017
+ (reason ? `: ${reason}` : `: ${error instanceof Error ? error.message : String(error)}`), { cause: error });
4018
+ }
3921
4019
  if (!inserted || inserted.length === 0) {
3922
4020
  throw new Error(`Failed to insert metadata record for property ${metadataValues.propertyName}`);
3923
4021
  }
@@ -4437,7 +4535,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
4437
4535
  }
4438
4536
  const _saveRelation = async () => {
4439
4537
  // Use dynamic import to break circular dependency
4440
- const schemaMod = await import('./index-CHi212ST.js');
4538
+ const schemaMod = await import('./index-ClSv5pTA.js');
4441
4539
  const { ModelPropertyDataTypes } = schemaMod;
4442
4540
  if (!propertyNameRaw) {
4443
4541
  throw new Error('propertyName is required');
@@ -4450,7 +4548,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
4450
4548
  if (newValue instanceof File) {
4451
4549
  newValueType = 'file';
4452
4550
  }
4453
- if (propertyRecordSchema.dataType === ModelPropertyDataTypes.Image) {
4551
+ if (isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Image)) {
4454
4552
  sendBack({
4455
4553
  type: 'saveImage',
4456
4554
  newValue,
@@ -4640,7 +4738,19 @@ const saveItemStorage = fromCallback(({ sendBack, input: { context, event } }) =
4640
4738
  });
4641
4739
  });
4642
4740
 
4643
- // import { updateMachineContext } from '@/helpers'
4741
+ /**
4742
+ * A List-of-relation schema can arrive after construction (item loaded before its model).
4743
+ * Move the context to the storage name (staff → staffIdentityIds) so saves and publish use one name;
4744
+ * ItemProperty keeps exposing the schema key.
4745
+ */
4746
+ const withListRelationStorageName = (context) => {
4747
+ if (!context.propertyName || !context.propertyRecordSchema)
4748
+ return context;
4749
+ const storageName = listRelationEasPropertyName(context.propertyName, normalizePropertyRecordSchema(context.propertyRecordSchema));
4750
+ if (!storageName || storageName === context.propertyName)
4751
+ return context;
4752
+ return { ...context, propertyName: storageName, isRelation: true };
4753
+ };
4644
4754
  const propertyMachine = setup({
4645
4755
  types: {
4646
4756
  context: {},
@@ -4681,6 +4791,7 @@ const propertyMachine = setup({
4681
4791
  actions: assign({
4682
4792
  isSaving: true,
4683
4793
  _saveError: undefined,
4794
+ _saveValidationErrors: undefined,
4684
4795
  }),
4685
4796
  target: '.saving',
4686
4797
  },
@@ -4694,7 +4805,9 @@ const propertyMachine = setup({
4694
4805
  }
4695
4806
  newContext[key] = event[key];
4696
4807
  }
4697
- return newContext;
4808
+ return 'propertyRecordSchema' in event
4809
+ ? withListRelationStorageName(newContext)
4810
+ : newContext;
4698
4811
  }),
4699
4812
  },
4700
4813
  destroyStarted: {
@@ -4753,7 +4866,7 @@ const propertyMachine = setup({
4753
4866
  target: 'idle',
4754
4867
  actions: assign(({ context, event }) => {
4755
4868
  const property = event.property;
4756
- return {
4869
+ return withListRelationStorageName({
4757
4870
  ...context,
4758
4871
  propertyName: property.propertyName || context.propertyName,
4759
4872
  propertyValue: property.propertyValue !== undefined ? property.propertyValue : context.propertyValue,
@@ -4771,7 +4884,7 @@ const propertyMachine = setup({
4771
4884
  refResolvedValue: property.refResolvedValue !== undefined ? property.refResolvedValue : context.refResolvedValue,
4772
4885
  refResolvedDisplayValue: property.refResolvedDisplayValue !== undefined ? property.refResolvedDisplayValue : context.refResolvedDisplayValue,
4773
4886
  localStorageDir: property.localStorageDir !== undefined ? property.localStorageDir : context.localStorageDir,
4774
- };
4887
+ });
4775
4888
  }),
4776
4889
  },
4777
4890
  loadOrCreatePropertyError: {
@@ -5002,7 +5115,7 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
5002
5115
  let names = [...getMetadataPropertyNamesForQuery(propertyName)];
5003
5116
  if (modelName) {
5004
5117
  try {
5005
- const _mod_9 = await import('./index-BFpbtEsg.js');
5118
+ const _mod_9 = await import('./index-HRHkbVQd.js');
5006
5119
  const _ns_9 = _mod_9.b;
5007
5120
  const { Model } = _ns_9;
5008
5121
  const normalizedModelName = modelName;
@@ -5243,7 +5356,7 @@ const resolvePropertyRecordSchemaFromModel = async (modelName, propertyName, mod
5243
5356
  return undefined;
5244
5357
  }
5245
5358
  try {
5246
- const _mod_10 = await import('./index-BFpbtEsg.js');
5359
+ const _mod_10 = await import('./index-HRHkbVQd.js');
5247
5360
  const _ns_10 = _mod_10.b;
5248
5361
  const { Model } = _ns_10;
5249
5362
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
@@ -5262,7 +5375,8 @@ const resolvePropertyRecordSchemaFromModel = async (modelName, propertyName, mod
5262
5375
  // Fallback: resolve from schema JSON when Model not in cache/DB (e.g. PermaPress sync failed but schema in DB)
5263
5376
  const schemaProp = await resolvePropertyRecordSchemaFromSchemaData(modelName, propertyName, modelType);
5264
5377
  if (schemaProp) {
5265
- return schemaProp;
5378
+ // Schema JSON uses file shape ({ type: 'Html' }); callers read dataType.
5379
+ return normalizePropertyRecordSchema(schemaProp);
5266
5380
  }
5267
5381
  return undefined;
5268
5382
  }
@@ -5282,7 +5396,7 @@ const resolvePropertyRecordSchemaFromModel = async (modelName, propertyName, mod
5282
5396
  };
5283
5397
  /** Convert modelType (snake_case from DB) to Model name (PascalCase). startCase adds spaces ("Test Post"); Model names are "TestPost". */
5284
5398
  const modelTypeToModelName = (modelType) => modelType ? upperFirst(camelCase(modelType)) : '';
5285
- const logger$b = debug('seedSdk:property:class');
5399
+ const logger$c = debug('seedSdk:property:class');
5286
5400
  // Define tracked properties for the Proxy
5287
5401
  // These properties will be read from/written to the actor context
5288
5402
  const TRACKED_PROPERTIES$1 = [
@@ -5303,18 +5417,29 @@ const TRACKED_PROPERTIES$1 = [
5303
5417
  // WeakMap to store mutable state per ItemProperty instance
5304
5418
  // This avoids issues with read-only properties when instances are frozen by Immer
5305
5419
  const itemPropertyInstanceState = new WeakMap();
5420
+ /** Thrown by ItemProperty.save() when the value failed validation (enum, pattern, minLength, maxLength). */
5421
+ class ItemPropertySaveValidationError extends Error {
5422
+ constructor(message, validationErrors) {
5423
+ super(message);
5424
+ this.validationErrors = validationErrors;
5425
+ this.name = 'ItemPropertySaveValidationError';
5426
+ }
5427
+ }
5306
5428
  class ItemProperty {
5307
5429
  constructor(initialValues) {
5308
5430
  this._isRelation = false;
5309
5431
  this._isList = false;
5310
5432
  this.find = ItemProperty.find;
5311
5433
  const { modelName, propertyName, propertyValue, seedLocalId, seedUid, versionLocalId, versionUid, storageTransactionId, schemaUid, refResolvedValue, refResolvedDisplayValue, localStorageDir, refSeedType } = initialValues;
5434
+ // Fallback schema sources can hand us schema-file shape ({ type: 'html' }); everything below reads dataType.
5435
+ const propertyRecordSchema = normalizePropertyRecordSchema(initialValues.propertyRecordSchema);
5312
5436
  if (!modelName) {
5313
5437
  throw new Error('Model name is required');
5314
5438
  }
5315
5439
  if (!propertyName) {
5316
5440
  throw new Error(`Property name not provided`);
5317
5441
  }
5442
+ this._constructedPropertyName = propertyName;
5318
5443
  // ItemProperty no longer depends on Model - property schema will be loaded from database
5319
5444
  // via loadOrCreateProperty actor or can be provided in initialValues
5320
5445
  const serviceInput = {
@@ -5328,7 +5453,7 @@ class ItemProperty {
5328
5453
  storageTransactionId,
5329
5454
  // propertyRecordSchema will be loaded from database via loadOrCreateProperty actor
5330
5455
  // or can be provided in initialValues if available
5331
- propertyRecordSchema: initialValues.propertyRecordSchema,
5456
+ propertyRecordSchema,
5332
5457
  schemaUid,
5333
5458
  isSaving: false,
5334
5459
  isRelation: false,
@@ -5340,16 +5465,13 @@ class ItemProperty {
5340
5465
  };
5341
5466
  // Property schema will be loaded from database via loadOrCreateProperty actor
5342
5467
  // For now, use propertyRecordSchema from initialValues if provided
5343
- const propertyRecordSchema = initialValues.propertyRecordSchema;
5344
5468
  if (propertyRecordSchema) {
5345
- this._dataType = propertyRecordSchema.dataType;
5469
+ this._dataType = normalizeDataType(propertyRecordSchema.dataType);
5346
5470
  serviceInput.propertyRecordSchema = propertyRecordSchema;
5347
- // Use string literals to avoid circular dependency in constructor
5348
- // ModelPropertyDataTypes values are stable string constants
5349
- if (propertyRecordSchema.dataType === 'Relation') {
5471
+ if (isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Relation)) {
5350
5472
  this._isRelation = true;
5351
5473
  }
5352
- if (propertyRecordSchema.dataType === 'List') {
5474
+ if (isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.List)) {
5353
5475
  this._isList = true;
5354
5476
  const listRef = propertyRecordSchema.ref ||
5355
5477
  propertyRecordSchema.refModelName;
@@ -5364,7 +5486,7 @@ class ItemProperty {
5364
5486
  serviceInput.propertyValue = JSON.parse(propertyValue);
5365
5487
  }
5366
5488
  catch (e) {
5367
- logger$b('List property value is not JSON', e);
5489
+ logger$c('List property value is not JSON', e);
5368
5490
  }
5369
5491
  }
5370
5492
  }
@@ -5387,7 +5509,7 @@ class ItemProperty {
5387
5509
  return;
5388
5510
  }
5389
5511
  // Use dynamic import to break circular dependency
5390
- const schemaMod = await import('./index-CHi212ST.js');
5512
+ const schemaMod = await import('./index-ClSv5pTA.js');
5391
5513
  const { ModelPropertyDataTypes } = schemaMod;
5392
5514
  const { context } = snapshot;
5393
5515
  const { propertyRecordSchema } = context;
@@ -5402,9 +5524,9 @@ class ItemProperty {
5402
5524
  }
5403
5525
  let renderValue;
5404
5526
  const isImage = propertyRecordSchema &&
5405
- propertyRecordSchema.dataType === ModelPropertyDataTypes.Image;
5527
+ isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Image);
5406
5528
  const isFile = propertyRecordSchema &&
5407
- propertyRecordSchema.dataType === ModelPropertyDataTypes.File;
5529
+ isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.File);
5408
5530
  const isItemStorage = propertyRecordSchema &&
5409
5531
  propertyRecordSchema.storageType &&
5410
5532
  propertyRecordSchema.storageType === 'ItemStorage' &&
@@ -5481,7 +5603,7 @@ class ItemProperty {
5481
5603
  }
5482
5604
  }
5483
5605
  catch (e) {
5484
- logger$b(`[ItemProperty] [${context.seedLocalId}] [${context.propertyName}] [storageType] error`, e);
5606
+ logger$c(`[ItemProperty] [${context.seedLocalId}] [${context.propertyName}] [storageType] error`, e);
5485
5607
  renderValue = isHtml ? undefined : 'No file found';
5486
5608
  }
5487
5609
  }
@@ -5558,7 +5680,7 @@ class ItemProperty {
5558
5680
  const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
5559
5681
  const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
5560
5682
  const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
5561
- const _mod_11 = await import('./index-CsmiM0RI.js');
5683
+ const _mod_11 = await import('./index-Djd3667v.js');
5562
5684
  const _ns_11 = _mod_11.s;
5563
5685
  const seedSchemaMod = _ns_11;
5564
5686
  const { metadata } = seedSchemaMod;
@@ -5811,8 +5933,8 @@ class ItemProperty {
5811
5933
  propertyRecordSchema,
5812
5934
  });
5813
5935
  // Update instance fields to match new schema (mirror constructor logic)
5814
- this._dataType = propertyRecordSchema.dataType;
5815
- if (propertyRecordSchema.dataType === 'Relation') {
5936
+ this._dataType = normalizeDataType(propertyRecordSchema.dataType);
5937
+ if (isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Relation)) {
5816
5938
  ;
5817
5939
  this._isRelation = true;
5818
5940
  }
@@ -5820,7 +5942,7 @@ class ItemProperty {
5820
5942
  ;
5821
5943
  this._isRelation = false;
5822
5944
  }
5823
- if (propertyRecordSchema.dataType === 'List') {
5945
+ if (isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.List)) {
5824
5946
  ;
5825
5947
  this._isList = true;
5826
5948
  this._isRelation = !!(propertyRecordSchema.ref);
@@ -5892,11 +6014,11 @@ class ItemProperty {
5892
6014
  // but cached instance doesn't (e.g. Item constructor created from schema first, then loadOrCreateItem
5893
6015
  // has metadata with refResolvedValue - we must not lose display data).
5894
6016
  const ctx = instance._getSnapshotContext();
5895
- const incomingSchema = props.propertyRecordSchema;
6017
+ const incomingSchema = normalizePropertyRecordSchema(props.propertyRecordSchema);
5896
6018
  if (incomingSchema && !ctx.propertyRecordSchema) {
5897
- instance._dataType = incomingSchema.dataType;
5898
- instance._isRelation = incomingSchema.dataType === 'Relation';
5899
- instance._isList = incomingSchema.dataType === 'List';
6019
+ instance._dataType = normalizeDataType(incomingSchema.dataType);
6020
+ instance._isRelation = isDataType(incomingSchema.dataType, ModelPropertyDataTypes.Relation);
6021
+ instance._isList = isDataType(incomingSchema.dataType, ModelPropertyDataTypes.List);
5900
6022
  instance._service.send({
5901
6023
  type: 'updateContext',
5902
6024
  propertyRecordSchema: incomingSchema,
@@ -6099,7 +6221,7 @@ class ItemProperty {
6099
6221
  }
6100
6222
  else if (baseName) {
6101
6223
  try {
6102
- const _mod_12 = await import('./index-BFpbtEsg.js');
6224
+ const _mod_12 = await import('./index-HRHkbVQd.js');
6103
6225
  const _ns_12 = _mod_12.b;
6104
6226
  const { Model } = _ns_12;
6105
6227
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
@@ -6116,7 +6238,7 @@ class ItemProperty {
6116
6238
  }
6117
6239
  if (modelName && propertyName) {
6118
6240
  try {
6119
- const _mod_13 = await import('./index-BFpbtEsg.js');
6241
+ const _mod_13 = await import('./index-HRHkbVQd.js');
6120
6242
  const _ns_13 = _mod_13.b;
6121
6243
  const { Model } = _ns_13;
6122
6244
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
@@ -6198,7 +6320,16 @@ class ItemProperty {
6198
6320
  if (this._alias) {
6199
6321
  return this._alias;
6200
6322
  }
6201
- return this._getSnapshotContext().propertyName || '';
6323
+ const context = this._getSnapshotContext();
6324
+ const name = context.propertyName || '';
6325
+ // Built under its schema key before the schema was known, then renamed to the storage name
6326
+ // (staff → staffIdentityIds) when a List-of-relation schema arrived: keep the schema key public.
6327
+ if (this._constructedPropertyName &&
6328
+ name !== this._constructedPropertyName &&
6329
+ listRelationEasPropertyName(this._constructedPropertyName, context.propertyRecordSchema) === name) {
6330
+ return this._constructedPropertyName;
6331
+ }
6332
+ return name;
6202
6333
  }
6203
6334
  /** DB / EAS / metadata column name (e.g. authorIdentityIds). Use for storage; prefer `propertyName` for public API. */
6204
6335
  get storagePropertyName() {
@@ -6235,7 +6366,7 @@ class ItemProperty {
6235
6366
  get status() {
6236
6367
  return this._getSnapshot().value;
6237
6368
  }
6238
- /** Validation errors from last failed save (enum, pattern, minLength, maxLength). Cleared on successful save. */
6369
+ /** Validation errors from last failed save (enum, pattern, minLength, maxLength). Cleared when the next save starts. */
6239
6370
  get saveValidationErrors() {
6240
6371
  return this._getSnapshotContext()._saveValidationErrors ?? [];
6241
6372
  }
@@ -6273,11 +6404,17 @@ class ItemProperty {
6273
6404
  // If no propertyRecordSchema, try to resolve from Model before persisting (fixes external app persistence)
6274
6405
  if (!context.propertyRecordSchema) {
6275
6406
  const { modelName, propertyName, modelType } = context;
6276
- void resolvePropertyRecordSchemaFromModel(modelName ?? '', propertyName ?? '', modelType).then((schema) => {
6277
- if (schema) {
6278
- this._service.send({ type: 'updateContext', propertyRecordSchema: schema });
6279
- this._service.send({ type: 'save', newValue: value });
6280
- }
6407
+ const pending = resolvePropertyRecordSchemaFromModel(modelName ?? '', propertyName ?? '', modelType).then((schema) => {
6408
+ if (!schema)
6409
+ return false;
6410
+ this._service.send({ type: 'updateContext', propertyRecordSchema: schema });
6411
+ this._service.send({ type: 'save', newValue: value });
6412
+ return true;
6413
+ }, () => false);
6414
+ this._pendingSchemaSave = pending;
6415
+ void pending.finally(() => {
6416
+ if (this._pendingSchemaSave === pending)
6417
+ this._pendingSchemaSave = undefined;
6281
6418
  });
6282
6419
  }
6283
6420
  else {
@@ -6307,9 +6444,23 @@ class ItemProperty {
6307
6444
  seedLocalId: ctx?.seedLocalId ?? undefined,
6308
6445
  seedUid: ctx?.seedUid ?? undefined,
6309
6446
  });
6310
- await waitFor(this._service, (snapshot) => !snapshot.context.isSaving && snapshot.value === 'idle', {
6447
+ // Without this, save() would see `idle` before the deferred `save` event and resolve unsaved.
6448
+ if (this._pendingSchemaSave && !(await this._pendingSchemaSave)) {
6449
+ throw new Error(`Failed to save property ${ctx?.propertyName}: no schema found for ${ctx?.modelName}.${ctx?.propertyName}`);
6450
+ }
6451
+ const settled = await waitFor(this._service, (snapshot) => !snapshot.context.isSaving && snapshot.value === 'idle', {
6311
6452
  timeout: 10000,
6312
6453
  });
6454
+ const { _saveError: saveError, _saveValidationErrors: validationErrors, propertyName } = settled.context;
6455
+ if (saveError) {
6456
+ const error = new Error(`Failed to save property ${propertyName}: ${saveError.message}`);
6457
+ if (saveError.name)
6458
+ error.name = saveError.name;
6459
+ throw error;
6460
+ }
6461
+ if (validationErrors?.length) {
6462
+ throw new ItemPropertySaveValidationError(`Invalid value for property ${propertyName}: ${validationErrors.map((e) => e.message).join('; ')}`, validationErrors);
6463
+ }
6313
6464
  const canonicalId = ctx?.seedLocalId ?? ctx?.seedUid;
6314
6465
  if (canonicalId) {
6315
6466
  eventEmitter.emit('itemProperty.saved', { seedLocalId: ctx.seedLocalId, seedUid: ctx.seedUid });
@@ -6334,6 +6485,14 @@ class ItemProperty {
6334
6485
  if (cacheKey && cacheKey !== 'Item__') {
6335
6486
  cacheKeys.push(cacheKey);
6336
6487
  }
6488
+ // Renamed after construction (List of relation): also drop the entry cached under the old name.
6489
+ const publicName = this.propertyName;
6490
+ if (publicName && publicName !== context.propertyName) {
6491
+ const aliasKey = ItemProperty.cacheKey(context.seedUid || context.seedLocalId || '', publicName);
6492
+ if (aliasKey && aliasKey !== 'Item__' && ItemProperty.instanceCache.get(aliasKey)?.instance === this) {
6493
+ cacheKeys.push(aliasKey);
6494
+ }
6495
+ }
6337
6496
  unloadEntity(this, {
6338
6497
  getCacheKeys: () => cacheKeys,
6339
6498
  caches: [ItemProperty.instanceCache],
@@ -6395,7 +6554,7 @@ class ItemProperty {
6395
6554
  if (!propertyName || (!seedLocalId && !seedUid))
6396
6555
  return;
6397
6556
  if (db) {
6398
- const _mod_14 = await import('./index-CsmiM0RI.js');
6557
+ const _mod_14 = await import('./index-Djd3667v.js');
6399
6558
  const _ns_14 = _mod_14.s;
6400
6559
  const seedSchemaMod = _ns_14;
6401
6560
  const { metadata } = seedSchemaMod;
@@ -6429,7 +6588,8 @@ ItemProperty.instanceCache = new Map();
6429
6588
 
6430
6589
  var ItemProperty$1 = /*#__PURE__*/Object.freeze({
6431
6590
  __proto__: null,
6432
- ItemProperty: ItemProperty
6591
+ ItemProperty: ItemProperty,
6592
+ ItemPropertySaveValidationError: ItemPropertySaveValidationError
6433
6593
  });
6434
6594
 
6435
6595
  // Dynamic import to break circular dependency: Model -> BaseItem -> createNewItem -> Model
@@ -6442,7 +6602,7 @@ const createNewItem = async ({ modelName, ...propertyData }) => {
6442
6602
  const newSeedId = await createSeed({ type: seedType });
6443
6603
  const newVersionId = await createVersion({ seedLocalId: newSeedId, seedType: toSnakeCase$1(modelName) });
6444
6604
  // Dynamic import to break circular dependency
6445
- const _mod_15 = await import('./index-BFpbtEsg.js');
6605
+ const _mod_15 = await import('./index-HRHkbVQd.js');
6446
6606
  const _ns_15 = _mod_15.b;
6447
6607
  const modelMod = _ns_15;
6448
6608
  const { Model } = modelMod;
@@ -6586,7 +6746,7 @@ const getModel = () => {
6586
6746
  // the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
6587
6747
  if (!modelImportPromise) {
6588
6748
  modelImportPromise = (async () => {
6589
- const _mod_16 = await import('./index-BFpbtEsg.js');
6749
+ const _mod_16 = await import('./index-HRHkbVQd.js');
6590
6750
  const _ns_16 = _mod_16.b;
6591
6751
  const mod = _ns_16;
6592
6752
  ModelClass = mod.Model;
@@ -6619,6 +6779,15 @@ const getModel = () => {
6619
6779
  };
6620
6780
  // Define tracked properties for the Proxy
6621
6781
  // These properties will be read from/written to the actor context
6782
+ /** Raw File/Image/Html content (not already a storage seed reference) needs ItemProperty.save(). */
6783
+ function needsStorageSavePipeline(dataType, value) {
6784
+ if (value == null || value === '')
6785
+ return false;
6786
+ const isStorageType = isDataType(dataType, ModelPropertyDataTypes.File) ||
6787
+ isDataType(dataType, ModelPropertyDataTypes.Image) ||
6788
+ isDataType(dataType, ModelPropertyDataTypes.Html);
6789
+ return isStorageType && !isStorageSeedRef(value);
6790
+ }
6622
6791
  const TRACKED_PROPERTIES = [
6623
6792
  'seedLocalId',
6624
6793
  'seedUid',
@@ -6710,12 +6879,12 @@ class Item {
6710
6879
  };
6711
6880
  this.getPublishUploads = async (options) => {
6712
6881
  // Use dynamic import to break circular dependency
6713
- const getPublishUploadsMod = await import('./getPublishUploads-AKISt3JA.js');
6882
+ const getPublishUploadsMod = await import('./getPublishUploads-C6cDeZdz.js');
6714
6883
  const { getPublishUploads } = getPublishUploadsMod;
6715
6884
  return await getPublishUploads(this, [], undefined, options);
6716
6885
  };
6717
6886
  this.getPublishPayload = async (uploadedTransactions, options) => {
6718
- const getPublishPayloadMod = await import('./getPublishPayload-2gnnDdMh.js');
6887
+ const getPublishPayloadMod = await import('./getPublishPayload-BIrTVUxb.js');
6719
6888
  const { getPublishPayload } = getPublishPayloadMod;
6720
6889
  return await getPublishPayload(this, uploadedTransactions, options);
6721
6890
  };
@@ -7176,6 +7345,7 @@ class Item {
7176
7345
  const schemaName = props.schemaName;
7177
7346
  // Get property names directly from database to make Item independent from Model
7178
7347
  let propertyNames = [];
7348
+ const dataTypeByPropertyName = new Map();
7179
7349
  const db = BaseDb.getAppDb();
7180
7350
  if (db && props.modelName) {
7181
7351
  // Query properties table directly by model name
@@ -7183,12 +7353,12 @@ class Item {
7183
7353
  let modelRecords;
7184
7354
  // If we have a schema name, join with modelSchemas to filter by schema
7185
7355
  if (schemaName) {
7186
- const _mod_17 = await import('./BasePathResolver-qV0apdVY.js');
7187
- const _ns_17 = _mod_17.N;
7356
+ const _mod_17 = await import('./BasePathResolver-B6CKqoKw.js');
7357
+ const _ns_17 = _mod_17.Q;
7188
7358
  const modelSchemaSchemaMod = _ns_17;
7189
7359
  const { modelSchemas } = modelSchemaSchemaMod;
7190
- const _mod_18 = await import('./BasePathResolver-qV0apdVY.js');
7191
- const _ns_18 = _mod_18.L;
7360
+ const _mod_18 = await import('./BasePathResolver-B6CKqoKw.js');
7361
+ const _ns_18 = _mod_18.O;
7192
7362
  const schemaSchemaMod = _ns_18;
7193
7363
  const { schemas: schemasTable } = schemaSchemaMod;
7194
7364
  modelRecords = await db
@@ -7208,13 +7378,20 @@ class Item {
7208
7378
  }
7209
7379
  if (modelRecords.length > 0 && modelRecords[0].id) {
7210
7380
  const propertyRecords = await db
7211
- .select({ name: properties.name })
7381
+ .select({ name: properties.name, dataType: properties.dataType })
7212
7382
  .from(properties)
7213
7383
  .where(eq(properties.modelId, modelRecords[0].id));
7214
7384
  propertyNames = propertyRecords.map((r) => r.name).filter((name) => Boolean(name));
7385
+ for (const r of propertyRecords) {
7386
+ if (r.name && r.dataType)
7387
+ dataTypeByPropertyName.set(r.name, r.dataType);
7388
+ }
7215
7389
  }
7216
7390
  }
7217
7391
  const modelPropertyData = { modelName: props.modelName };
7392
+ // File/Image/Html values that are raw content (html string, data URI, URL, File) must go through
7393
+ // the property's save pipeline to become storage seeds; createNewItem would store them verbatim.
7394
+ const pipelineValues = [];
7218
7395
  // Only include properties that are in the model schema
7219
7396
  // Exclude modelInstance, modelName, and schemaName as they're metadata, not item properties
7220
7397
  for (const [key, value] of Object.entries(props)) {
@@ -7223,6 +7400,10 @@ class Item {
7223
7400
  continue;
7224
7401
  }
7225
7402
  if (propertyNames.length === 0 || propertyNames.includes(key)) {
7403
+ if (needsStorageSavePipeline(dataTypeByPropertyName.get(key), value)) {
7404
+ pipelineValues.push([key, value]);
7405
+ continue;
7406
+ }
7226
7407
  // If we couldn't get property names from DB, include all properties
7227
7408
  // Type assertion: we've filtered out modelInstance above, so value should be a valid property value
7228
7409
  modelPropertyData[key] = value;
@@ -7231,6 +7412,11 @@ class Item {
7231
7412
  const { seedLocalId, versionLocalId, } = await createNewItem(modelPropertyData);
7232
7413
  props.seedLocalId = seedLocalId;
7233
7414
  props.latestVersionLocalId = versionLocalId;
7415
+ // Don't seed property instances with raw storage content: the value setter skips unchanged
7416
+ // values, so savePipelineValues would never trigger a save.
7417
+ for (const [key] of pipelineValues) {
7418
+ delete props[key];
7419
+ }
7234
7420
  // Item no longer needs modelInstance - it loads properties from database independently
7235
7421
  // Exclude latestVersionUid from props as it has incompatible types (string vs VersionsType)
7236
7422
  const { latestVersionUid, ...propsWithoutVersionUid } = props;
@@ -7330,7 +7516,8 @@ class Item {
7330
7516
  },
7331
7517
  });
7332
7518
  this.registerItemInInstanceCache(proxiedInstance);
7333
- if (!waitForReady)
7519
+ // Storage values must be saved before returning, so wait for readiness even when not requested.
7520
+ if (!waitForReady && pipelineValues.length === 0)
7334
7521
  return proxiedInstance;
7335
7522
  try {
7336
7523
  await this.waitForItemInstanceReadyForRead(proxiedInstance, readyTimeout);
@@ -7344,8 +7531,46 @@ class Item {
7344
7531
  }
7345
7532
  throw err;
7346
7533
  }
7534
+ await this.savePipelineValues(proxiedInstance, pipelineValues, readyTimeout);
7347
7535
  return proxiedInstance;
7348
7536
  }
7537
+ /**
7538
+ * Run each File/Image/Html initial value through its ItemProperty save pipeline (sequentially, to
7539
+ * avoid SQLite write contention). Rejects on the first failure; the item itself has been created.
7540
+ */
7541
+ static async savePipelineValues(item, pipelineValues, timeout) {
7542
+ for (const [propertyName, value] of pipelineValues) {
7543
+ const property = await this.waitForPropertyInstance(item, propertyName, timeout);
7544
+ if (!property) {
7545
+ throw new Error(`Item.create: property ${item.modelName}.${propertyName} did not load for item ${item.seedLocalId}; value was not saved`);
7546
+ }
7547
+ property.value = value;
7548
+ try {
7549
+ await property.save();
7550
+ }
7551
+ catch (error) {
7552
+ throw new Error(`Item.create: failed to save ${item.modelName}.${propertyName} for item ${item.seedLocalId}: ` +
7553
+ (error instanceof Error ? error.message : String(error)), { cause: error });
7554
+ }
7555
+ }
7556
+ }
7557
+ static async waitForPropertyInstance(item, propertyName, timeout) {
7558
+ const find = (ctx) => {
7559
+ const instances = ctx?.propertyInstances;
7560
+ const altKey = getAlternatePropertyNameForInstanceLookup(propertyName);
7561
+ return instances?.get(propertyName) ?? (altKey ? instances?.get(altKey) : undefined);
7562
+ };
7563
+ const existing = find(item.getService().getSnapshot().context);
7564
+ if (existing)
7565
+ return existing;
7566
+ try {
7567
+ const snap = await waitFor(item.getService(), (s) => !!find(s.context), { timeout });
7568
+ return find(snap.context);
7569
+ }
7570
+ catch {
7571
+ return undefined;
7572
+ }
7573
+ }
7349
7574
  /**
7350
7575
  * Get Item instance by ID from cache
7351
7576
  * The ID can be either seedUid or seedLocalId
@@ -7484,7 +7709,7 @@ class Item {
7484
7709
  if (!appDb || Item.instanceCache.size === 0) {
7485
7710
  return;
7486
7711
  }
7487
- const _mod_19 = await import('./index-CsmiM0RI.js');
7712
+ const _mod_19 = await import('./index-Djd3667v.js');
7488
7713
  const _ns_19 = _mod_19.s;
7489
7714
  const { metadata } = _ns_19;
7490
7715
  const { eq, and } = await import('drizzle-orm');
@@ -7936,7 +8161,7 @@ class Item {
7936
8161
  itemActor.send(event);
7937
8162
  };
7938
8163
  try {
7939
- const _mod_20 = await import('./index-CsmiM0RI.js');
8164
+ const _mod_20 = await import('./index-Djd3667v.js');
7940
8165
  const _ns_20 = _mod_20.s;
7941
8166
  const seedSchemaMod = _ns_20;
7942
8167
  const { seeds, versions, metadata } = seedSchemaMod;
@@ -8368,7 +8593,7 @@ const runEasSync = fromPromise(async ({ input, }) => {
8368
8593
  requestPayload: input.requestPayload,
8369
8594
  persistedSnapshot: input.runningSnapshot,
8370
8595
  });
8371
- const { runSyncFromEas } = await import('./syncDbWithEas-5kZneTEL.js');
8596
+ const { runSyncFromEas } = await import('./syncDbWithEas-CuARXfyN.js');
8372
8597
  try {
8373
8598
  await runSyncFromEas(toRunSyncArg(input.options));
8374
8599
  await finalizeEasSyncProcessRow(rowId, {
@@ -8585,10 +8810,10 @@ var easSyncManager = /*#__PURE__*/Object.freeze({
8585
8810
  startEasSyncActor: startEasSyncActor
8586
8811
  });
8587
8812
 
8588
- const logger$a = debug('seedSdk:services:events');
8813
+ const logger$b = debug('seedSdk:services:events');
8589
8814
  const handleServiceSaveState = (event) => {
8590
8815
  const { state, serviceId } = event;
8591
- logger$a(`[browser] [service.saveState.request] serviceId: ${serviceId}`);
8816
+ logger$b(`[browser] [service.saveState.request] serviceId: ${serviceId}`);
8592
8817
  // TODO: This is called from Node as well. Do we need it? If so, need to generalize this to all platforms.
8593
8818
  // localStorage.setItem(`seed_sdk_service_${serviceId}`, JSON.stringify(state))
8594
8819
  };
@@ -8614,9 +8839,32 @@ const setupServiceHandlers = () => {
8614
8839
  eventEmitter.addListener('service.save', saveServiceHandler);
8615
8840
  };
8616
8841
 
8617
- const logger$9 = debug('seedSdk:ClientManager:initialize');
8842
+ /**
8843
+ * On Node, storage uses `filesDir`. `endpoints.filePaths` and `endpoints.files` are
8844
+ * required by init but have no separate Node consumer, so fill them from `filesDir`.
8845
+ * Browser configs are left unchanged.
8846
+ */
8847
+ function normalizeSeedConfigEndpoints(config) {
8848
+ if (!config)
8849
+ return config;
8850
+ const endpoints = config.endpoints;
8851
+ if (endpoints?.filePaths && endpoints?.files)
8852
+ return config;
8853
+ if (!(isNode() && !isBrowser()))
8854
+ return config;
8855
+ const filesDir = config.filesDir;
8856
+ if (!filesDir)
8857
+ return config;
8858
+ const next = {
8859
+ filePaths: endpoints?.filePaths || filesDir,
8860
+ files: endpoints?.files || filesDir,
8861
+ };
8862
+ return { ...config, endpoints: next };
8863
+ }
8864
+
8865
+ const logger$a = debug('seedSdk:ClientManager:initialize');
8618
8866
  const platformClassesInit = fromCallback(({ sendBack, input: { context, event } }) => {
8619
- logger$9('initialize from ClientManager');
8867
+ logger$a('initialize from ClientManager');
8620
8868
  const { isInitialized } = context;
8621
8869
  if (!event || !('options' in event)) {
8622
8870
  throw new Error('Initialize event must include options');
@@ -8640,14 +8888,16 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
8640
8888
  if (cancelled) {
8641
8889
  return;
8642
8890
  }
8643
- const { config, addresses } = options;
8644
- // Validate required endpoints - this should happen early in the initialization process
8891
+ const { addresses } = options;
8892
+ const config = normalizeSeedConfigEndpoints(options.config);
8893
+ // Validate required endpoints - this should happen early in the initialization process.
8894
+ // Node fills these from filesDir; browser callers still pass them.
8645
8895
  if (!config?.endpoints || !config.endpoints.filePaths || !config.endpoints.files) {
8646
8896
  throw new Error('Config must include endpoints with filePaths and files');
8647
8897
  }
8648
8898
  // Prefer the condition-resolved factory when available; fall back to explicit
8649
8899
  // platform imports so source/vitest resolution stays reliable.
8650
- const { configurePlatform } = await import('./configurePlatform-CCYQruij.js');
8900
+ const { configurePlatform } = await import('./configurePlatform-CE0Vew17.js');
8651
8901
  if (isBrowser()) {
8652
8902
  const { createPlatformServices } = await import('./platform.browser.js');
8653
8903
  configurePlatform(createPlatformServices());
@@ -8663,13 +8913,20 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
8663
8913
  if (cancelled) {
8664
8914
  return;
8665
8915
  }
8666
- const { models, endpoints, arweaveDomain, dbConfig, filesDir, schemaFile, schema, gateway, uploadApiBaseUrl } = config;
8916
+ const { models, endpoints, arweaveDomain, dbConfig, filesDir, schemaFile, schema, gateway, uploadApiBaseUrl, eas } = config;
8917
+ if (eas) {
8918
+ configureEasReadChain('sdk', { chainId: eas.chainId, indexerUrl: eas.indexerUrl });
8919
+ }
8667
8920
  const gatewayConfig = seedGatewayConfigFromSeedConfig({
8668
8921
  ...config,
8669
8922
  arweaveDomain,
8670
8923
  uploadApiBaseUrl,
8671
8924
  gateway,
8672
8925
  });
8926
+ // Only when configured, so a host app's own setPreferredArweaveReadBaseUrls() call survives init.
8927
+ if (gatewayConfig.preferredReadBaseUrls) {
8928
+ setPreferredArweaveReadBaseUrls(gatewayConfig.preferredReadBaseUrls);
8929
+ }
8673
8930
  const resolvedGateway = await resolveSeedGatewayEndpoints(gatewayConfig);
8674
8931
  setResolvedSeedGatewayEndpoints(resolvedGateway);
8675
8932
  BaseArweaveClient.setHost(`${resolvedGateway.arweaveProtocol}://${resolvedGateway.arweaveHost}`);
@@ -8775,7 +9032,7 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
8775
9032
  };
8776
9033
  });
8777
9034
 
8778
- const logger$8 = debug('seedSdk:client:writeToDb');
9035
+ const logger$9 = debug('seedSdk:client:writeToDb');
8779
9036
  const saveAppState = fromCallback(({ sendBack, input: { key, value } }) => {
8780
9037
  const _saveAppState = async () => {
8781
9038
  try {
@@ -8783,7 +9040,7 @@ const saveAppState = fromCallback(({ sendBack, input: { key, value } }) => {
8783
9040
  if (!appDb) {
8784
9041
  // In test environments, continue anyway
8785
9042
  if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {
8786
- logger$8('[client/actors] [saveAppState] App DB not found, but continuing in test environment');
9043
+ logger$9('[client/actors] [saveAppState] App DB not found, but continuing in test environment');
8787
9044
  return;
8788
9045
  }
8789
9046
  throw new Error('App DB not found');
@@ -8799,13 +9056,13 @@ const saveAppState = fromCallback(({ sendBack, input: { key, value } }) => {
8799
9056
  value: JSON.stringify(value),
8800
9057
  },
8801
9058
  });
8802
- logger$8('result', result);
9059
+ logger$9('result', result);
8803
9060
  }
8804
9061
  catch (error) {
8805
- logger$8('[client/actors] [saveAppState] Error saving app state:', error);
9062
+ logger$9('[client/actors] [saveAppState] Error saving app state:', error);
8806
9063
  // In test environments, continue anyway
8807
9064
  if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {
8808
- logger$8('[client/actors] [saveAppState] Continuing despite error in test environment');
9065
+ logger$9('[client/actors] [saveAppState] Continuing despite error in test environment');
8809
9066
  return;
8810
9067
  }
8811
9068
  throw error;
@@ -8820,10 +9077,10 @@ const saveAppState = fromCallback(({ sendBack, input: { key, value } }) => {
8820
9077
  });
8821
9078
  })
8822
9079
  .catch((error) => {
8823
- logger$8('[client/actors] [saveAppState] Error in promise chain:', error);
9080
+ logger$9('[client/actors] [saveAppState] Error in promise chain:', error);
8824
9081
  // In test environments, still send success to allow state machine to progress
8825
9082
  if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {
8826
- logger$8('[client/actors] [saveAppState] Sending success despite error in test environment');
9083
+ logger$9('[client/actors] [saveAppState] Sending success despite error in test environment');
8827
9084
  sendBack({
8828
9085
  type: 'saveAppStateSuccess',
8829
9086
  key,
@@ -8893,7 +9150,7 @@ const fileSystemInit = fromCallback(({ sendBack, input: { context }, }) => {
8893
9150
  };
8894
9151
  });
8895
9152
 
8896
- const logger$7 = debug('seedSdk:client:actors:dbInit');
9153
+ const logger$8 = debug('seedSdk:client:actors:dbInit');
8897
9154
  const dbInit = fromCallback(({ sendBack, input: { context } }) => {
8898
9155
  const _dbInit = async () => {
8899
9156
  const { filesDir } = context;
@@ -8907,14 +9164,14 @@ const dbInit = fromCallback(({ sendBack, input: { context } }) => {
8907
9164
  if (!appDb) {
8908
9165
  throw new Error('Database not available after preparation');
8909
9166
  }
8910
- logger$7('[client/actors] [dbInit] Database prepared and ready');
9167
+ logger$8('[client/actors] [dbInit] Database prepared and ready');
8911
9168
  };
8912
9169
  _dbInit()
8913
9170
  .then(() => {
8914
9171
  sendBack({ type: ClientManagerEvents.DB_READY });
8915
9172
  })
8916
9173
  .catch((error) => {
8917
- logger$7('Error in dbInit:', error);
9174
+ logger$8('Error in dbInit:', error);
8918
9175
  sendBack({
8919
9176
  type: 'error',
8920
9177
  error: error instanceof Error ? error : new Error(String(error))
@@ -8922,7 +9179,7 @@ const dbInit = fromCallback(({ sendBack, input: { context } }) => {
8922
9179
  });
8923
9180
  });
8924
9181
 
8925
- const logger$6 = debug('seedSdk:client:actors:addModelsToStore');
9182
+ const logger$7 = debug('seedSdk:client:actors:addModelsToStore');
8926
9183
  const addModelsToStore = fromCallback(({ sendBack, input: { context } }) => {
8927
9184
  const _addModelsToStore = async () => {
8928
9185
  let { models } = context;
@@ -8936,7 +9193,7 @@ const addModelsToStore = fromCallback(({ sendBack, input: { context } }) => {
8936
9193
  // Models are now Model instances, no registration needed
8937
9194
  // They should be created via Model.create() and are accessible via Model static methods
8938
9195
  for (const [key] of Object.entries(allModels)) {
8939
- logger$6('model available:', key);
9196
+ logger$7('model available:', key);
8940
9197
  }
8941
9198
  };
8942
9199
  _addModelsToStore()
@@ -8944,7 +9201,7 @@ const addModelsToStore = fromCallback(({ sendBack, input: { context } }) => {
8944
9201
  sendBack({ type: ClientManagerEvents.ADD_MODELS_TO_STORE_SUCCESS });
8945
9202
  })
8946
9203
  .catch((error) => {
8947
- logger$6('[client/actors] [addModelsToStore] Error:', error);
9204
+ logger$7('[client/actors] [addModelsToStore] Error:', error);
8948
9205
  sendBack({
8949
9206
  type: 'error',
8950
9207
  error: error instanceof Error ? error : new Error(String(error)),
@@ -8952,7 +9209,7 @@ const addModelsToStore = fromCallback(({ sendBack, input: { context } }) => {
8952
9209
  });
8953
9210
  });
8954
9211
 
8955
- const logger$5 = debug('seedSdk:client:actors:addModelsToDb');
9212
+ const logger$6 = debug('seedSdk:client:actors:addModelsToDb');
8956
9213
  const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
8957
9214
  const { models } = context;
8958
9215
  const _addModelsToDb = async () => {
@@ -8990,14 +9247,14 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
8990
9247
  existingByName.set(m.name, m);
8991
9248
  }
8992
9249
  for (const name of modelsToInsert) {
8993
- logger$5('[client/actors] [addModelsToDb] inserted model:', name);
9250
+ logger$6('[client/actors] [addModelsToDb] inserted model:', name);
8994
9251
  }
8995
9252
  }
8996
9253
  let hasModelsInDb = true;
8997
9254
  for (const modelName of modelNames) {
8998
9255
  const foundModel = existingByName.get(modelName);
8999
9256
  if (!foundModel) {
9000
- logger$5('[client/actors] [addModelsToDb] Warning: Could not find or create model:', modelName);
9257
+ logger$6('[client/actors] [addModelsToDb] Warning: Could not find or create model:', modelName);
9001
9258
  hasModelsInDb = false;
9002
9259
  continue;
9003
9260
  }
@@ -9008,7 +9265,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
9008
9265
  }
9009
9266
  // If we have no models to process, still send success (empty models is valid)
9010
9267
  if (schemaDefsByModelName.size === 0) {
9011
- logger$5('[client/actors] [addModelsToDb] No models to process, but continuing');
9268
+ logger$6('[client/actors] [addModelsToDb] No models to process, but continuing');
9012
9269
  sendBack({ type: ClientManagerEvents.ADD_MODELS_TO_DB_SUCCESS });
9013
9270
  return;
9014
9271
  }
@@ -9051,15 +9308,15 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
9051
9308
  requestEasSyncFromModelsInit();
9052
9309
  }
9053
9310
  else {
9054
- logger$5('[client/actors] [addModelsToDb] No schemas found from EAS, but continuing');
9311
+ logger$6('[client/actors] [addModelsToDb] No schemas found from EAS, but continuing');
9055
9312
  }
9056
9313
  }
9057
9314
  catch (error) {
9058
9315
  if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {
9059
- logger$5('[client/actors] [addModelsToDb] Warning: Could not fetch schemas from EAS (background):', error.message);
9316
+ logger$6('[client/actors] [addModelsToDb] Warning: Could not fetch schemas from EAS (background):', error.message);
9060
9317
  }
9061
9318
  else {
9062
- logger$5('[client/actors] [addModelsToDb] Error fetching schemas (background):', error.message);
9319
+ logger$6('[client/actors] [addModelsToDb] Error fetching schemas (background):', error.message);
9063
9320
  }
9064
9321
  }
9065
9322
  };
@@ -9071,10 +9328,10 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
9071
9328
  sendBack({ type: ClientManagerEvents.ADD_MODELS_TO_DB_SUCCESS });
9072
9329
  })
9073
9330
  .catch((error) => {
9074
- logger$5('[client/actors] [addModelsToDb] Error:', error);
9331
+ logger$6('[client/actors] [addModelsToDb] Error:', error);
9075
9332
  // In test environments, still send success to allow initialization to complete
9076
9333
  if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {
9077
- logger$5('[client/actors] [addModelsToDb] Continuing despite error in test environment');
9334
+ logger$6('[client/actors] [addModelsToDb] Continuing despite error in test environment');
9078
9335
  sendBack({ type: ClientManagerEvents.ADD_MODELS_TO_DB_SUCCESS });
9079
9336
  }
9080
9337
  else {
@@ -9087,6 +9344,102 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
9087
9344
  return () => { };
9088
9345
  });
9089
9346
 
9347
+ const logger$5 = debug('seedSdk:helpers:localDbChain');
9348
+ /** appState key recording which EAS chain the local database holds attestations from. */
9349
+ const EAS_CHAIN_ID_APP_STATE_KEY = 'easChainId';
9350
+ /**
9351
+ * Databases written before the chain was recorded only ever held Optimism Sepolia data
9352
+ * (the only chain the SDK supported then).
9353
+ */
9354
+ const LEGACY_CHAIN_ID = DEFAULT_EAS_CHAIN_ID;
9355
+ async function readRecordedChainId(appDb) {
9356
+ const rows = await appDb
9357
+ .select({ value: appState.value })
9358
+ .from(appState)
9359
+ .where(eq(appState.key, EAS_CHAIN_ID_APP_STATE_KEY))
9360
+ .limit(1);
9361
+ const parsed = Number(rows[0]?.value);
9362
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined;
9363
+ }
9364
+ async function recordChainId(appDb, chainId) {
9365
+ const value = String(chainId);
9366
+ await appDb
9367
+ .insert(appState)
9368
+ .values({ key: EAS_CHAIN_ID_APP_STATE_KEY, value })
9369
+ .onConflictDoUpdate({ target: appState.key, set: { value } });
9370
+ }
9371
+ async function hasOnChainData(appDb) {
9372
+ const rows = await appDb
9373
+ .select({ uid: seeds.uid })
9374
+ .from(seeds)
9375
+ .where(and(isNotNull(seeds.uid), ne(seeds.uid, '')))
9376
+ .limit(1);
9377
+ return rows.length > 0;
9378
+ }
9379
+ /**
9380
+ * Chain the local DB holds data from: the recorded one, or Optimism Sepolia for an unrecorded
9381
+ * DB that already has attestations. Records the legacy value so later checks are cheap.
9382
+ */
9383
+ async function resolveLocalDbChainId(appDb) {
9384
+ const recorded = await readRecordedChainId(appDb);
9385
+ if (recorded !== undefined)
9386
+ return recorded;
9387
+ if (await hasOnChainData(appDb)) {
9388
+ await recordChainId(appDb, LEGACY_CHAIN_ID);
9389
+ return LEGACY_CHAIN_ID;
9390
+ }
9391
+ return undefined;
9392
+ }
9393
+ /** How long EAS sync waits for `initPublish` to set the chain before using the current one. */
9394
+ const EAS_CHAIN_SETTLE_TIMEOUT_MS = 30000;
9395
+ /**
9396
+ * Wait until the read chain is known before syncing. Only waits when `@seedprotocol/publish`
9397
+ * is loaded but `initPublish` has not run, and no chain is configured or recorded locally.
9398
+ */
9399
+ async function waitForEasReadChain(timeoutMs = EAS_CHAIN_SETTLE_TIMEOUT_MS) {
9400
+ if (await whenEasReadChainSettled(timeoutMs))
9401
+ return;
9402
+ console.warn(`[Seed Protocol] EAS sync waited ${Math.round(timeoutMs / 1000)}s for initPublish to set the chain and is continuing on chain ${getEasReadChainId()}. Set SeedConfig.eas.chainId to skip the wait.`);
9403
+ }
9404
+ /**
9405
+ * Called at SDK init once the DB is ready. Registers the DB's chain with the EAS read side so
9406
+ * reads start on that chain even before publish is initialized, and throws when SeedConfig.eas
9407
+ * or PublishConfig.chain names a different chain. An empty DB is recorded only when a chain
9408
+ * is configured explicitly; otherwise the first sync or publish records it.
9409
+ */
9410
+ async function loadLocalDbChain() {
9411
+ const appDb = BaseDb.getAppDb();
9412
+ if (!appDb)
9413
+ return;
9414
+ const localChainId = await resolveLocalDbChainId(appDb);
9415
+ if (localChainId !== undefined) {
9416
+ configureEasReadChain('localDb', { chainId: localChainId });
9417
+ logger$5('local DB holds chain %d', localChainId);
9418
+ return;
9419
+ }
9420
+ if (isEasReadChainConfigured()) {
9421
+ const chainId = getEasReadChainId();
9422
+ await recordChainId(appDb, chainId);
9423
+ configureEasReadChain('localDb', { chainId });
9424
+ }
9425
+ }
9426
+ /**
9427
+ * Call before writing chain data to the local DB (EAS sync, publish, revoke). Records the
9428
+ * current chain on an empty DB; throws when the DB holds data from a different chain.
9429
+ */
9430
+ async function assertLocalDbChain() {
9431
+ const appDb = BaseDb.getAppDb();
9432
+ if (!appDb)
9433
+ return;
9434
+ const chainId = getEasReadChainId();
9435
+ const localChainId = await resolveLocalDbChainId(appDb);
9436
+ if (localChainId === undefined) {
9437
+ await recordChainId(appDb, chainId);
9438
+ }
9439
+ // Throws with a remediation message when the local chain differs from the configured one.
9440
+ configureEasReadChain('localDb', { chainId: localChainId ?? chainId });
9441
+ }
9442
+
9090
9443
  const logger$4 = debug('seedSdk:client:actors:saveConfig');
9091
9444
  const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
9092
9445
  logger$4('saveConfig starting');
@@ -9169,6 +9522,8 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
9169
9522
  await persistKey('gatewaySidecarPort', String(gatewaySidecarPort));
9170
9523
  }
9171
9524
  await persistKey('gatewayProxyBaseUrl', gatewayProxyBaseUrl);
9525
+ // Throws when the DB holds attestations from a different chain than the one configured.
9526
+ await loadLocalDbChain();
9172
9527
  }
9173
9528
  catch (error) {
9174
9529
  logger$4('[internal/actors] [saveConfig] Error saving config:', error);
@@ -9897,7 +10252,7 @@ function getRefValueType(prop) {
9897
10252
  * @returns Promise that resolves when properties are found, or rejects if not found after max retries
9898
10253
  */
9899
10254
  const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
9900
- const _mod_21 = await import('./BasePathResolver-qV0apdVY.js');
10255
+ const _mod_21 = await import('./BasePathResolver-B6CKqoKw.js');
9901
10256
  const _ns_21 = _mod_21.M;
9902
10257
  const modelSchemaMod = _ns_21;
9903
10258
  const { properties: propertiesTable } = modelSchemaMod;
@@ -10245,8 +10600,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
10245
10600
  // Check DB for existing schema by name+version (same as minimal path)
10246
10601
  const db = BaseDb.getAppDb();
10247
10602
  if (db) {
10248
- const _mod_22 = await import('./BasePathResolver-qV0apdVY.js');
10249
- const _ns_22 = _mod_22.L;
10603
+ const _mod_22 = await import('./BasePathResolver-B6CKqoKw.js');
10604
+ const _ns_22 = _mod_22.O;
10250
10605
  const schemaSchemaMod = _ns_22;
10251
10606
  const { schemas: schemasTable } = schemaSchemaMod;
10252
10607
  const drizzleMod = await import('drizzle-orm');
@@ -10329,8 +10684,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
10329
10684
  // For minimal imports: check DB for existing schema before creating new file
10330
10685
  const db = BaseDb.getAppDb();
10331
10686
  if (db) {
10332
- const _mod_23 = await import('./BasePathResolver-qV0apdVY.js');
10333
- const _ns_23 = _mod_23.L;
10687
+ const _mod_23 = await import('./BasePathResolver-B6CKqoKw.js');
10688
+ const _ns_23 = _mod_23.O;
10334
10689
  const schemaSchemaMod = _ns_23;
10335
10690
  const { schemas: schemasTable } = schemaSchemaMod;
10336
10691
  const drizzleMod = await import('drizzle-orm');
@@ -10508,8 +10863,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
10508
10863
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
10509
10864
  };
10510
10865
  // Use dynamic import to break circular dependency
10511
- const _mod_24 = await import('./db-CceyWksv.js');
10512
- const _ns_24 = _mod_24.q;
10866
+ const _mod_24 = await import('./db-WbrzEf7c.js');
10867
+ const _ns_24 = _mod_24.Q;
10513
10868
  const dbMod = _ns_24;
10514
10869
  const { addSchemaToDb, addModelsToDb } = dbMod;
10515
10870
  // Try to add schema and models to database if database is available
@@ -10530,11 +10885,11 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
10530
10885
  });
10531
10886
  // Verify expected models are linked (single attempt - addModelsToDb already confirmed)
10532
10887
  const expectedModelNames = Object.keys(schemaFile.models || {});
10533
- const _mod_25 = await import('./BasePathResolver-qV0apdVY.js');
10534
- const _ns_25 = _mod_25.N;
10888
+ const _mod_25 = await import('./BasePathResolver-B6CKqoKw.js');
10889
+ const _ns_25 = _mod_25.Q;
10535
10890
  const modelSchemaSchemaMod = _ns_25;
10536
10891
  const { modelSchemas } = modelSchemaSchemaMod;
10537
- const _mod_26 = await import('./BasePathResolver-qV0apdVY.js');
10892
+ const _mod_26 = await import('./BasePathResolver-B6CKqoKw.js');
10538
10893
  const _ns_26 = _mod_26.M;
10539
10894
  const modelSchemaMod = _ns_26;
10540
10895
  const { models: modelsTable } = modelSchemaMod;
@@ -10737,8 +11092,8 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
10737
11092
  createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
10738
11093
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
10739
11094
  };
10740
- const _mod_27 = await import('./db-CceyWksv.js');
10741
- const _ns_27 = _mod_27.q;
11095
+ const _mod_27 = await import('./db-WbrzEf7c.js');
11096
+ const _ns_27 = _mod_27.Q;
10742
11097
  const dbMod = _ns_27;
10743
11098
  const { addSchemaToDb, addModelsToDb } = dbMod;
10744
11099
  const db = BaseDb.getAppDb();
@@ -10897,11 +11252,11 @@ const loadSchemaFromFile = async (schemaFilePath) => {
10897
11252
  if (db) {
10898
11253
  const { schemaRecord } = await applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, propertyFileIds);
10899
11254
  // Query the database to get model IDs that were just created
10900
- const _mod_28 = await import('./BasePathResolver-qV0apdVY.js');
10901
- const _ns_28 = _mod_28.N;
11255
+ const _mod_28 = await import('./BasePathResolver-B6CKqoKw.js');
11256
+ const _ns_28 = _mod_28.Q;
10902
11257
  const modelSchemaSchemaMod = _ns_28;
10903
11258
  const { modelSchemas } = modelSchemaSchemaMod;
10904
- const _mod_29 = await import('./BasePathResolver-qV0apdVY.js');
11259
+ const _mod_29 = await import('./BasePathResolver-B6CKqoKw.js');
10905
11260
  const _ns_29 = _mod_29.M;
10906
11261
  const modelSchemaMod = _ns_29;
10907
11262
  const { models: modelsTable } = modelSchemaMod;
@@ -10967,7 +11322,7 @@ const loadSchemaFromFile = async (schemaFilePath) => {
10967
11322
  // After properties are created (file path), ensure schemaFile has the correct IDs from database
10968
11323
  // Query the database to get the actual schemaFileId values that were used
10969
11324
  // This ensures schemaData matches what's actually in the database
10970
- const _mod_30 = await import('./BasePathResolver-qV0apdVY.js');
11325
+ const _mod_30 = await import('./BasePathResolver-B6CKqoKw.js');
10971
11326
  const _ns_30 = _mod_30.M;
10972
11327
  const modelSchemaMod2 = _ns_30;
10973
11328
  const { properties: propertiesTable } = modelSchemaMod2;
@@ -11003,8 +11358,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
11003
11358
  // This is important even if nothing changed, to ensure consistency
11004
11359
  const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
11005
11360
  // Update the schema record in the database with current schemaData
11006
- const _mod_31 = await import('./BasePathResolver-qV0apdVY.js');
11007
- const _ns_31 = _mod_31.L;
11361
+ const _mod_31 = await import('./BasePathResolver-B6CKqoKw.js');
11362
+ const _ns_31 = _mod_31.O;
11008
11363
  const schemaSchemaMod = _ns_31;
11009
11364
  const { schemas: schemasTable } = schemaSchemaMod;
11010
11365
  await db
@@ -11046,7 +11401,7 @@ const loadSchemaFromFile = async (schemaFilePath) => {
11046
11401
  */
11047
11402
  const createModelFromJson = async (modelName, modelDef, schemaName, modelFileId, // Optional modelFileId from JSON file
11048
11403
  propertyFileIds) => {
11049
- const _mod_32 = await import('./index-BFpbtEsg.js');
11404
+ const _mod_32 = await import('./index-HRHkbVQd.js');
11050
11405
  const _ns_32 = _mod_32.b;
11051
11406
  const modelMod = _ns_32;
11052
11407
  const { Model } = modelMod;
@@ -12774,5 +13129,5 @@ var ClientManager$1 = /*#__PURE__*/Object.freeze({
12774
13129
  getClient: getClient
12775
13130
  });
12776
13131
 
12777
- export { requestEasSyncFromEventBus as $, ADDRESSES_PERSISTED_EVENT as A, getClient as B, ClientManager as C, getGetPublisherForNewSeeds as D, getMetadataLatest as E, getPublishedSeedRecord as F, getRevokeExecutor as G, getSchemaNameFromId as H, Item as I, getUploadExecutor as J, getVersionData$1 as K, LOCAL_COPIES_REMOVED_EVENT as L, isItemOwned as M, isLocalUnsealedDraft as N, isSeedQueryLocalSourceRegistered as O, isSeedRowOwned as P, listCompleteSchemaFiles as Q, loadAllSchemasFromDb as R, mergeEasSyncRequestIntents as S, ownedPublisherSql as T, parseAddressesPersistedPayload as U, propertyMachine as V, publisherInAddressListSql as W, publisherIsInOwnedSet as X, readSchema as Y, registerSeedQueryLocalSource as Z, requestEasSyncFromAddressChange as _, getItemData as a, requestEasSyncFromModelsInit as a0, sendEasSyncClientRequest as a1, setAdditionalSyncAddresses as a2, setGetPublisherForNewSeeds as a3, setRevokeExecutor as a4, setUploadExecutor as a5, startEasSyncActor as a6, unregisterSeedQueryLocalSource as a7, getInvariantSafePropertyDescriptor as a8, unloadEntity as a9, clearDestroySubscriptions as aa, createModelsFromJson as ab, getLatestSchemaVersion as ac, createModelFromJson as ad, getPropertyData$1 as ae, Item$1 as af, schema as ag, SEEDPROTOCOL_Seed_Protocol_v1 as ah, ClientManager$1 as ai, getEasSchemaUidForModel as b, getLatestPublishedVersionRow as c, getEasSchemaForItemProperty as d, getGetAdditionalSyncAddresses as e, ItemProperty as f, getContentHash as g, getRefValueType as h, importJsonSchema as i, readJsonImportFile as j, createReactiveProxy as k, loadSchemaFromFile as l, findEntity as m, forceRemoveFromCaches as n, runDestroyLifecycle as o, parseListPropertyValueFromStorage as p, compareMetadataRowsLatestFirst as q, resolveStorageNameToSchemaName as r, syncSchemaFromSource as s, transformImportToSchemaFile as t, claimUnpublishedDrafts as u, createLocalQueryDataSource as v, waitForEntityIdle as w, createNewItem as x, createSchema as y, easSyncActor as z };
12778
- //# sourceMappingURL=ClientManager-Y5EWQuJj.js.map
13132
+ export { parseAddressesPersistedPayload as $, ADDRESSES_PERSISTED_EVENT as A, createLocalQueryDataSource as B, ClientManager as C, createNewItem as D, EAS_CHAIN_ID_APP_STATE_KEY as E, createSchema as F, easSyncActor as G, getClient as H, Item as I, getEasSchemaForItemProperty as J, getGetPublisherForNewSeeds as K, LOCAL_COPIES_REMOVED_EVENT as L, MachineIds as M, getMetadataLatest as N, getPublishedSeedRecord as O, getRevokeExecutor as P, getSchemaNameFromId as Q, getUploadExecutor as R, getVersionData$1 as S, isItemOwned as T, isLocalUnsealedDraft as U, isSeedQueryLocalSourceRegistered as V, isSeedRowOwned as W, listCompleteSchemaFiles as X, loadAllSchemasFromDb as Y, mergeEasSyncRequestIntents as Z, ownedPublisherSql as _, getItemData as a, propertyMachine as a0, publisherInAddressListSql as a1, publisherIsInOwnedSet as a2, readSchema as a3, registerSeedQueryLocalSource as a4, requestEasSyncFromAddressChange as a5, requestEasSyncFromEventBus as a6, requestEasSyncFromModelsInit as a7, sendEasSyncClientRequest as a8, setAdditionalSyncAddresses as a9, setGetPublisherForNewSeeds as aa, setRevokeExecutor as ab, setUploadExecutor as ac, startEasSyncActor as ad, unregisterSeedQueryLocalSource as ae, getInvariantSafePropertyDescriptor as af, unloadEntity as ag, clearDestroySubscriptions as ah, createModelsFromJson as ai, getLatestSchemaVersion as aj, createModelFromJson as ak, getPropertyData$1 as al, Item$1 as am, schema as an, SEEDPROTOCOL_Seed_Protocol_v1 as ao, ClientManager$1 as ap, getEasSchemaUidForModel as b, getLatestPublishedVersionRow as c, assertLocalDbChain as d, getGetAdditionalSyncAddresses as e, ItemProperty as f, getContentHash as g, ItemPropertySaveValidationError as h, getRefValueType as i, importJsonSchema as j, loadSchemaFromFile as k, listRelationEasPropertyName as l, readJsonImportFile as m, waitForEntityIdle as n, createReactiveProxy as o, parseListPropertyValueFromStorage as p, findEntity as q, resolveStorageNameToSchemaName as r, syncSchemaFromSource as s, transformImportToSchemaFile as t, forceRemoveFromCaches as u, runDestroyLifecycle as v, waitForEasReadChain as w, compareMetadataRowsLatestFirst as x, ClientManagerState as y, claimUnpublishedDrafts as z };
13133
+ //# sourceMappingURL=ClientManager-ChcmUL47.js.map