@seedprotocol/sdk 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/{BasePathResolver-DWY_hb8w.js → BasePathResolver-0IHnXxtL.js} +5 -1
  2. package/dist/BasePathResolver-0IHnXxtL.js.map +1 -0
  3. package/dist/{ModelProperty-CHIxRLfS.js → ModelProperty-BiDQu5rE.js} +40 -30
  4. package/dist/ModelProperty-BiDQu5rE.js.map +1 -0
  5. package/dist/{Schema-BaVOWeUb.js → Schema-qciDB7Nu.js} +43 -39
  6. package/dist/{Schema-BaVOWeUb.js.map → Schema-qciDB7Nu.js.map} +1 -1
  7. package/dist/{SchemaValidationService-BX4GcEKY.js → SchemaValidationService-BaOkRjsU.js} +6 -6
  8. package/dist/{SchemaValidationService-BX4GcEKY.js.map → SchemaValidationService-BaOkRjsU.js.map} +1 -1
  9. package/dist/{backfillMetadataPropertyIds-6kBwLScb.js → backfillMetadataPropertyIds-oypxoBXv.js} +3 -3
  10. package/dist/{backfillMetadataPropertyIds-6kBwLScb.js.map → backfillMetadataPropertyIds-oypxoBXv.js.map} +1 -1
  11. package/dist/cjs/{ModelProperty-BphJm1e3.js → ModelProperty-DvIIhBnK.js} +17 -17
  12. package/dist/cjs/{ModelProperty-BphJm1e3.js.map → ModelProperty-DvIIhBnK.js.map} +1 -1
  13. package/dist/cjs/{Schema-z1fBr4Rv.js → Schema-FdzNqyGo.js} +20 -20
  14. package/dist/cjs/{Schema-z1fBr4Rv.js.map → Schema-FdzNqyGo.js.map} +1 -1
  15. package/dist/cjs/{SchemaValidationService-DWmIhQqz.js → SchemaValidationService-pxRoOs79.js} +2 -2
  16. package/dist/cjs/{SchemaValidationService-DWmIhQqz.js.map → SchemaValidationService-pxRoOs79.js.map} +1 -1
  17. package/dist/cjs/{backfillMetadataPropertyIds--9WN2zaG.js → backfillMetadataPropertyIds-D0o5VwBh.js} +2 -2
  18. package/dist/cjs/{backfillMetadataPropertyIds--9WN2zaG.js.map → backfillMetadataPropertyIds-D0o5VwBh.js.map} +1 -1
  19. package/dist/cjs/{eas-YuOI6X_v.js → eas-DSZkoDUn.js} +3 -3
  20. package/dist/cjs/{eas-YuOI6X_v.js.map → eas-DSZkoDUn.js.map} +1 -1
  21. package/dist/cjs/{getItem-CKDdJztx.js → getItem-CPcdcFuS.js} +2 -2
  22. package/dist/cjs/{getItem-CKDdJztx.js.map → getItem-CPcdcFuS.js.map} +1 -1
  23. package/dist/cjs/{getPublishPayload-DXHDgXU3.js → getPublishPayload-BvmVTKoc.js} +11 -11
  24. package/dist/cjs/{getPublishPayload-DXHDgXU3.js.map → getPublishPayload-BvmVTKoc.js.map} +1 -1
  25. package/dist/cjs/{getPublishUploads-yFW9CKSW.js → getPublishUploads-D2VZHZnu.js} +4 -4
  26. package/dist/cjs/{getPublishUploads-yFW9CKSW.js.map → getPublishUploads-D2VZHZnu.js.map} +1 -1
  27. package/dist/cjs/{getSegmentedItemProperties-BLdMFDBt.js → getSegmentedItemProperties-Bm1TEvBS.js} +3 -3
  28. package/dist/cjs/{getSegmentedItemProperties-BLdMFDBt.js.map → getSegmentedItemProperties-Bm1TEvBS.js.map} +1 -1
  29. package/dist/cjs/{index-WOQkKWSU.js → index-C-POwaLs.js} +445 -315
  30. package/dist/cjs/index-C-POwaLs.js.map +1 -0
  31. package/dist/cjs/{index-Bp16LrkZ.js → index-D_ph4zut.js} +3 -3
  32. package/dist/cjs/index-D_ph4zut.js.map +1 -0
  33. package/dist/cjs/{property-DSh60oEw.js → property-DkUtJxV2.js} +4 -4
  34. package/dist/cjs/{property-DSh60oEw.js.map → property-DkUtJxV2.js.map} +1 -1
  35. package/dist/cjs/{syncDbWithEas-pVjTHk3y.js → syncDbWithEas-DRoys7eo.js} +17 -10
  36. package/dist/cjs/syncDbWithEas-DRoys7eo.js.map +1 -0
  37. package/dist/{configurePlatform-CXQCT7N8.js → configurePlatform-Df4BlXwQ.js} +3 -3
  38. package/dist/{configurePlatform-CXQCT7N8.js.map → configurePlatform-Df4BlXwQ.js.map} +1 -1
  39. package/dist/{constants-DMHTYMgJ.js → constants-Bre6dTJR.js} +3 -1
  40. package/dist/constants-Bre6dTJR.js.map +1 -0
  41. package/dist/{constants-B7aNfB_1.js → constants-CROrIRd-.js} +2 -2
  42. package/dist/{constants-B7aNfB_1.js.map → constants-CROrIRd-.js.map} +1 -1
  43. package/dist/{db-CMQ3TG6N.js → db-DVsy4QZe.js} +121 -56
  44. package/dist/db-DVsy4QZe.js.map +1 -0
  45. package/dist/{eas-BG3zRyHC.js → eas-z4W41ith.js} +5 -5
  46. package/dist/{eas-BG3zRyHC.js.map → eas-z4W41ith.js.map} +1 -1
  47. package/dist/{getItem-BFDi98NG.js → getItem-BiE_b7Fu.js} +6 -6
  48. package/dist/{getItem-BFDi98NG.js.map → getItem-BiE_b7Fu.js.map} +1 -1
  49. package/dist/{getPublishPayload-B2D-72EC.js → getPublishPayload-CuRGEZa5.js} +17 -17
  50. package/dist/{getPublishPayload-B2D-72EC.js.map → getPublishPayload-CuRGEZa5.js.map} +1 -1
  51. package/dist/{getPublishUploads-D-fMspZI.js → getPublishUploads-CMgzBCzZ.js} +8 -8
  52. package/dist/{getPublishUploads-D-fMspZI.js.map → getPublishUploads-CMgzBCzZ.js.map} +1 -1
  53. package/dist/{getSegmentedItemProperties-DzjK6JE5.js → getSegmentedItemProperties-BCCSwTxr.js} +5 -5
  54. package/dist/{getSegmentedItemProperties-DzjK6JE5.js.map → getSegmentedItemProperties-BCCSwTxr.js.map} +1 -1
  55. package/dist/{index-BaPbRFSy.js → index-C41UZTmQ.js} +8 -8
  56. package/dist/index-C41UZTmQ.js.map +1 -0
  57. package/dist/{index-Dx0RL3Tx.js → index-DjwIC6U3.js} +418 -343
  58. package/dist/index-DjwIC6U3.js.map +1 -0
  59. package/dist/{index-DrEkRiuK.js → index-xNWgPtlN.js} +2 -2
  60. package/dist/index-xNWgPtlN.js.map +1 -0
  61. package/dist/{index.node-hhs7zosf.js → index.node-DQZ3cPe-.js} +14 -5
  62. package/dist/index.node-DQZ3cPe-.js.map +1 -0
  63. package/dist/main.cjs +1 -1
  64. package/dist/main.js +300 -24
  65. package/dist/main.js.map +1 -1
  66. package/dist/node.js +11 -11
  67. package/dist/platform.browser.js +14 -4
  68. package/dist/platform.browser.js.map +1 -1
  69. package/dist/platform.node.js +4 -4
  70. package/dist/{property-B2xdCZz_.js → property-Bs3a4Dna.js} +9 -9
  71. package/dist/{property-B2xdCZz_.js.map → property-Bs3a4Dna.js.map} +1 -1
  72. package/dist/src/Item/Item.d.ts.map +1 -1
  73. package/dist/src/Model/Model.d.ts.map +1 -1
  74. package/dist/src/browser/helpers/FileManager.d.ts +1 -0
  75. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  76. package/dist/src/client/ClientManager.d.ts +12 -0
  77. package/dist/src/client/ClientManager.d.ts.map +1 -1
  78. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  79. package/dist/src/db/read/getItems.d.ts.map +1 -1
  80. package/dist/src/db/read/summarizePublishWork.d.ts +24 -0
  81. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -0
  82. package/dist/src/db/write/claimUnpublishedDrafts.d.ts +11 -0
  83. package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -0
  84. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  85. package/dist/src/db/write/createSeed.d.ts.map +1 -1
  86. package/dist/src/db/write/createSeeds.d.ts.map +1 -1
  87. package/dist/src/db/write/createVersion.d.ts.map +1 -1
  88. package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
  89. package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
  90. package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
  91. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  92. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -0
  93. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  94. package/dist/src/helpers/FileManager/IFileManager.d.ts +2 -0
  95. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
  96. package/dist/src/helpers/addresses.d.ts +14 -0
  97. package/dist/src/helpers/addresses.d.ts.map +1 -1
  98. package/dist/src/helpers/constants.d.ts.map +1 -1
  99. package/dist/src/helpers/db.d.ts +2 -2
  100. package/dist/src/helpers/db.d.ts.map +1 -1
  101. package/dist/src/helpers/ownership.d.ts +36 -8
  102. package/dist/src/helpers/ownership.d.ts.map +1 -1
  103. package/dist/src/helpers/publishConfig.d.ts +4 -3
  104. package/dist/src/helpers/publishConfig.d.ts.map +1 -1
  105. package/dist/src/helpers/reactiveProxy.d.ts +10 -0
  106. package/dist/src/helpers/reactiveProxy.d.ts.map +1 -1
  107. package/dist/src/index.d.ts +4 -1
  108. package/dist/src/index.d.ts.map +1 -1
  109. package/dist/src/node/helpers/FileManager.d.ts +1 -0
  110. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  111. package/dist/src/types/index.d.ts +6 -1
  112. package/dist/src/types/index.d.ts.map +1 -1
  113. package/dist/{syncDbWithEas-B9Riqty1.js → syncDbWithEas-DRpLRxwb.js} +25 -18
  114. package/dist/syncDbWithEas-DRpLRxwb.js.map +1 -0
  115. package/dist/{updateSeedRevokedAt-CtRjZiyh.js → updateSeedRevokedAt-F0ZDvwOO.js} +2 -2
  116. package/dist/{updateSeedRevokedAt-CtRjZiyh.js.map → updateSeedRevokedAt-F0ZDvwOO.js.map} +1 -1
  117. package/package.json +5 -5
  118. package/dist/BasePathResolver-DWY_hb8w.js.map +0 -1
  119. package/dist/ModelProperty-CHIxRLfS.js.map +0 -1
  120. package/dist/cjs/index-Bp16LrkZ.js.map +0 -1
  121. package/dist/cjs/index-WOQkKWSU.js.map +0 -1
  122. package/dist/cjs/syncDbWithEas-pVjTHk3y.js.map +0 -1
  123. package/dist/constants-DMHTYMgJ.js.map +0 -1
  124. package/dist/db-CMQ3TG6N.js.map +0 -1
  125. package/dist/index-BaPbRFSy.js.map +0 -1
  126. package/dist/index-DrEkRiuK.js.map +0 -1
  127. package/dist/index-Dx0RL3Tx.js.map +0 -1
  128. package/dist/index.node-hhs7zosf.js.map +0 -1
  129. package/dist/syncDbWithEas-B9Riqty1.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { waitFor, fromCallback, fromPromise, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
2
- import { a as BaseDb, m as models$1, p as properties, r as seeds, j as modelUids, v as versions, b as metadata$1, s as schemas, i as modelSchemas, B as BaseFileManager, c as appState, f as easSyncProcesses, t as BasePathResolver, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses } from './BasePathResolver-DWY_hb8w.js';
2
+ import { a as BaseDb, m as models$1, p as properties, r as seeds, j as modelUids, v as versions, b as metadata$1, s as schemas, i as modelSchemas, B as BaseFileManager, c as appState, f as easSyncProcesses, t as BasePathResolver, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses } from './BasePathResolver-0IHnXxtL.js';
3
3
  import { eq, and, isNotNull, not, or, max, count, getTableColumns, sql, isNull, desc, inArray, gt } from 'drizzle-orm';
4
- import { n as normalizeDataType, t as toSnakeCase, o as MachineIds, v as getStorageTransactionIdForSeedUid, w as convertTxIdToImage, M as ModelPropertyDataTypes, x as getDataTypeFromString, y as getMimeType, l as getCorrectId, z as ClientManagerEvents, C as ClientManagerState, d as TProperty } from './constants-B7aNfB_1.js';
4
+ import { n as normalizeDataType, t as toSnakeCase, o as MachineIds, v as getStorageTransactionIdForSeedUid, w as convertTxIdToImage, M as ModelPropertyDataTypes, x as getDataTypeFromString, y as getMimeType, l as getCorrectId, z as ClientManagerEvents, C as ClientManagerState, d as TProperty } from './constants-CROrIRd-.js';
5
5
  import debug from 'debug';
6
6
  import { customAlphabet } from 'nanoid';
7
7
  import { alphanumeric } from 'nanoid-dictionary';
8
- import { writeModelToDb, writePropertyToDb, addSchemaToDb, getAddressesForItemsFilter, getAllAddressesFromDb, escapeSqliteString, getPropertyIdForModelAndName, loadModelsFromDbForSchema, getOwnedAddressesFromDb, getWatchedAddressesFromDb, renameModelInDb } from './db-CMQ3TG6N.js';
8
+ import { w as writeModelToDb, m as writePropertyToDb, k as addSchemaToDb, n as normalizePublisher, o as getOwnedAddressesFromDb, j as normalizeAddressList, b as normalizeHexAddress, h as getAddressesForItemsFilter, a as getAllAddressesFromDb, e as escapeSqliteString, g as getPropertyIdForModelAndName, i as normalizeAddressConfig, l as loadModelsFromDbForSchema, p as getWatchedAddressesFromDb, r as renameModelInDb } from './db-DVsy4QZe.js';
9
9
  import pluralize from 'pluralize';
10
- import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition, GET_FILES_METADATA, GET_SCHEMA_BY_NAME } from '@seedprotocol/eas';
11
- import { ZERO_BYTES32, INTERNAL_PROPERTY_NAMES, INTERNAL_DATA_TYPES, ImageSize, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, isInternalSchema, INTERNAL_SCHEMA_IDS, SEED_PROTOCOL_SCHEMA_NAME, CLIENT_NOT_INITIALIZED } from './constants-DMHTYMgJ.js';
10
+ import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, isPlaceholderUid, getEasSchemaUidForSchemaDefinition, GET_FILES_METADATA, GET_SCHEMA_BY_NAME } from '@seedprotocol/eas';
11
+ import { ZERO_BYTES32, INTERNAL_PROPERTY_NAMES, INTERNAL_DATA_TYPES, ImageSize, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, isInternalSchema, INTERNAL_SCHEMA_IDS, SEED_PROTOCOL_SCHEMA_NAME, CLIENT_NOT_INITIALIZED } from './constants-Bre6dTJR.js';
12
12
  import { BehaviorSubject } from 'rxjs';
13
13
  import { startCase, throttle, upperFirst, camelCase, orderBy } from 'lodash-es';
14
14
  import { toSnakeCase as toSnakeCase$1 } from 'drizzle-orm/casing';
@@ -283,7 +283,7 @@ const createPropertyInstances = async (propertyFileIds) => {
283
283
  return;
284
284
  }
285
285
  try {
286
- const mod = await import('./ModelProperty-CHIxRLfS.js');
286
+ const mod = await import('./ModelProperty-BiDQu5rE.js');
287
287
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
288
288
  if (!ModelProperty) {
289
289
  logger$s('createPropertyInstances: ModelProperty not available from dynamic import');
@@ -467,7 +467,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
467
467
  // Step 2: Fallback to Schema context (only if database doesn't have the model)
468
468
  // This handles the case where model exists in schema file but not yet in database
469
469
  try {
470
- const _mod_0 = await import('./Schema-BaVOWeUb.js');
470
+ const _mod_0 = await import('./Schema-qciDB7Nu.js');
471
471
  const _ns_0 = _mod_0.b;
472
472
  const schemaMod = _ns_0;
473
473
  const { Schema } = schemaMod;
@@ -541,7 +541,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
541
541
  let finalModelName = modelName;
542
542
  if (db) {
543
543
  // Check if this is an internal schema (Seed Protocol)
544
- const constantsMod = await import('./constants-DMHTYMgJ.js');
544
+ const constantsMod = await import('./constants-Bre6dTJR.js');
545
545
  const { isInternalSchema } = constantsMod;
546
546
  const isInternal = isInternalSchema(schemaName);
547
547
  // Only skip duplicate check if:
@@ -617,11 +617,11 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
617
617
  }
618
618
  // Also check database for models (in case they're persisted but not in Schema context)
619
619
  if (db) {
620
- const _mod_1 = await import('./BasePathResolver-DWY_hb8w.js');
620
+ const _mod_1 = await import('./BasePathResolver-0IHnXxtL.js');
621
621
  const _ns_1 = _mod_1.x;
622
622
  const modelSchemaSchemaMod = _ns_1;
623
623
  const { modelSchemas } = modelSchemaSchemaMod;
624
- const _mod_2 = await import('./BasePathResolver-DWY_hb8w.js');
624
+ const _mod_2 = await import('./BasePathResolver-0IHnXxtL.js');
625
625
  const _ns_2 = _mod_2.S;
626
626
  const schemaSchemaMod = _ns_2;
627
627
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -717,7 +717,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
717
717
  }
718
718
  // Mark schema as draft when a new model is created so saveNewVersion() can persist it
719
719
  try {
720
- const _mod_3 = await import('./Schema-BaVOWeUb.js');
720
+ const _mod_3 = await import('./Schema-qciDB7Nu.js');
721
721
  const _ns_3 = _mod_3.b;
722
722
  const schemaMod = _ns_3;
723
723
  const { Schema } = schemaMod;
@@ -763,10 +763,10 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
763
763
  const _validateModel = async () => {
764
764
  try {
765
765
  // Use dynamic imports to break circular dependencies
766
- const validationServiceMod = await import('./SchemaValidationService-BX4GcEKY.js');
766
+ const validationServiceMod = await import('./SchemaValidationService-BaOkRjsU.js');
767
767
  const { SchemaValidationService } = validationServiceMod;
768
768
  const validationService = new SchemaValidationService();
769
- const _mod_4 = await import('./Schema-BaVOWeUb.js');
769
+ const _mod_4 = await import('./Schema-qciDB7Nu.js');
770
770
  const _ns_4 = _mod_4.b;
771
771
  const schemaMod = _ns_4;
772
772
  const { Schema } = schemaMod;
@@ -878,7 +878,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
878
878
  return;
879
879
  }
880
880
  logger$q(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
881
- const mod = await import('./ModelProperty-CHIxRLfS.js');
881
+ const mod = await import('./ModelProperty-BiDQu5rE.js');
882
882
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
883
883
  if (!ModelProperty) {
884
884
  logger$q('ModelProperty not available from dynamic import');
@@ -981,7 +981,7 @@ const validateEntity = fromPromise(async ({ input }) => {
981
981
  const structureMsg = `[validateEntity] Validating model structure`;
982
982
  logger$p(structureMsg);
983
983
  // Use existing Model validation
984
- const validationServiceMod = await import('./SchemaValidationService-BX4GcEKY.js');
984
+ const validationServiceMod = await import('./SchemaValidationService-BaOkRjsU.js');
985
985
  const { SchemaValidationService } = validationServiceMod;
986
986
  const validationService = new SchemaValidationService();
987
987
  // Validate model structure
@@ -999,7 +999,7 @@ const validateEntity = fromPromise(async ({ input }) => {
999
999
  if (entityInput.entityData.schemaName) {
1000
1000
  try {
1001
1001
  logger$p(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
1002
- const _mod_5 = await import('./Schema-BaVOWeUb.js');
1002
+ const _mod_5 = await import('./Schema-qciDB7Nu.js');
1003
1003
  const _ns_5 = _mod_5.b;
1004
1004
  const schemaMod = _ns_5;
1005
1005
  const { Schema } = schemaMod;
@@ -1037,7 +1037,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1037
1037
  }
1038
1038
  else if (entityInput.entityType === 'modelProperty') {
1039
1039
  // Use existing ModelProperty validation
1040
- const validationServiceMod = await import('./SchemaValidationService-BX4GcEKY.js');
1040
+ const validationServiceMod = await import('./SchemaValidationService-BaOkRjsU.js');
1041
1041
  const { SchemaValidationService } = validationServiceMod;
1042
1042
  const validationService = new SchemaValidationService();
1043
1043
  // Validate property structure
@@ -1052,7 +1052,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1052
1052
  // If schema name and model name provided, validate against schema
1053
1053
  if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
1054
1054
  try {
1055
- const _mod_6 = await import('./Schema-BaVOWeUb.js');
1055
+ const _mod_6 = await import('./Schema-qciDB7Nu.js');
1056
1056
  const _ns_6 = _mod_6.b;
1057
1057
  const schemaMod = _ns_6;
1058
1058
  const { Schema } = schemaMod;
@@ -1083,7 +1083,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1083
1083
  }
1084
1084
  else if (entityInput.entityType === 'schema') {
1085
1085
  // Schema validation - use existing validation
1086
- const validationServiceMod = await import('./SchemaValidationService-BX4GcEKY.js');
1086
+ const validationServiceMod = await import('./SchemaValidationService-BaOkRjsU.js');
1087
1087
  const { SchemaValidationService } = validationServiceMod;
1088
1088
  const validationService = new SchemaValidationService();
1089
1089
  const schemaResult = validationService.validateSchema(entityInput.entityData);
@@ -1156,7 +1156,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
1156
1156
  // initial write completes is not overwritten by the stale requestWrite payload.
1157
1157
  let dataToWrite = input.entityData;
1158
1158
  try {
1159
- const mod = await import('./ModelProperty-CHIxRLfS.js');
1159
+ const mod = await import('./ModelProperty-BiDQu5rE.js');
1160
1160
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
1161
1161
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
1162
1162
  const instance = ModelProperty.getById(input.entityId);
@@ -1536,7 +1536,7 @@ const modelMachine = setup({
1536
1536
  // Create ModelProperty instances for any new property IDs
1537
1537
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
1538
1538
  // Import and create instances asynchronously (fire-and-forget)
1539
- import('./ModelProperty-CHIxRLfS.js').then(({ ModelProperty }) => {
1539
+ import('./ModelProperty-BiDQu5rE.js').then(({ ModelProperty }) => {
1540
1540
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
1541
1541
  try {
1542
1542
  const property = await ModelProperty.createById(propertyFileId);
@@ -1831,6 +1831,111 @@ const modelMachine = setup({
1831
1831
  },
1832
1832
  });
1833
1833
 
1834
+ /**
1835
+ * Proxy [[GetOwnProperty]] that stays compatible with the target.
1836
+ * Never overrides an own descriptor, never invents on a non-extensible target,
1837
+ * and never promotes a prototype accessor to an own descriptor.
1838
+ */
1839
+ function getInvariantSafePropertyDescriptor(target, prop, invent) {
1840
+ const own = Reflect.getOwnPropertyDescriptor(target, prop);
1841
+ if (own)
1842
+ return own;
1843
+ if (!invent)
1844
+ return undefined;
1845
+ if (!Object.isExtensible(target))
1846
+ return undefined;
1847
+ return {
1848
+ enumerable: true,
1849
+ configurable: true,
1850
+ value: invent.value,
1851
+ writable: invent.writable ?? true,
1852
+ };
1853
+ }
1854
+ /**
1855
+ * Creates a reactive Proxy that intercepts property access and assignment
1856
+ * to read from and write to an actor service's context.
1857
+ *
1858
+ * This enables automatic React re-renders when properties change, as the
1859
+ * React hooks subscribe to the actor service which gets updated when properties
1860
+ * are set via the proxy.
1861
+ *
1862
+ * @param config Configuration object
1863
+ * @returns A proxied instance that behaves like the original but with reactive properties
1864
+ *
1865
+ * @note TypeScript's Proxy type doesn't automatically preserve method signatures,
1866
+ * so we use Proxied<T> to ensure all methods and properties are recognized.
1867
+ * The Proxy implementation preserves all methods via Reflect.get, so this is safe.
1868
+ */
1869
+ function createReactiveProxy(config) {
1870
+ const { instance, trackedProperties, getContext, sendUpdate } = config;
1871
+ // Convert readonly array to regular array for includes() checks
1872
+ const trackedPropsSet = new Set(trackedProperties);
1873
+ // Create the proxy - TypeScript needs explicit type assertion to preserve all methods
1874
+ // The Proxy preserves all methods via Reflect.get, so we assert it maintains type T
1875
+ // Using 'as unknown as T' forces TypeScript to recognize all methods and properties
1876
+ const proxy = new Proxy(instance, {
1877
+ get(target, prop) {
1878
+ // Handle special properties that should not be proxied
1879
+ // These need direct access to the underlying instance
1880
+ if (prop === '_service') {
1881
+ return Reflect.get(target, prop);
1882
+ }
1883
+ // If it's a tracked property, read from actor context
1884
+ if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
1885
+ const context = getContext(instance);
1886
+ return context[prop];
1887
+ }
1888
+ // For methods and non-tracked properties, use Reflect
1889
+ return Reflect.get(target, prop);
1890
+ },
1891
+ set(target, prop, value) {
1892
+ // Handle special properties
1893
+ if (prop === '_service') {
1894
+ return Reflect.set(target, prop, value);
1895
+ }
1896
+ // If it's a tracked property, send update to actor
1897
+ if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
1898
+ sendUpdate(instance, prop, value);
1899
+ return true; // Indicate success
1900
+ }
1901
+ // For non-tracked properties, use Reflect. Also trigger sendUpdate for virtual
1902
+ // 'value' so the callback runs when .value is assigned (e.g. ItemProperty).
1903
+ if (typeof prop === 'string' && prop === 'value') {
1904
+ sendUpdate(instance, prop, value);
1905
+ }
1906
+ return Reflect.set(target, prop, value);
1907
+ },
1908
+ has(target, prop) {
1909
+ // Check if property exists in context or on target
1910
+ if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
1911
+ const context = getContext(instance);
1912
+ return prop in context;
1913
+ }
1914
+ return Reflect.has(target, prop);
1915
+ },
1916
+ ownKeys(target) {
1917
+ // Only return keys that actually exist on the target object
1918
+ // This is required when the target is non-extensible (e.g., frozen by Immer)
1919
+ // Tracked properties are virtual (read from context), so we don't include them here
1920
+ // They're accessible via the get trap, but don't appear in ownKeys
1921
+ return Reflect.ownKeys(target);
1922
+ },
1923
+ getOwnPropertyDescriptor(target, prop) {
1924
+ let invent;
1925
+ if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
1926
+ const context = getContext(instance);
1927
+ if (prop in context) {
1928
+ invent = { value: context[prop] };
1929
+ }
1930
+ }
1931
+ return getInvariantSafePropertyDescriptor(target, prop, invent);
1932
+ }
1933
+ });
1934
+ // Force TypeScript to recognize all methods and properties are preserved
1935
+ // The Proxy implementation preserves all methods via Reflect.get, so this is safe
1936
+ return proxy;
1937
+ }
1938
+
1834
1939
  debug('seedSdk:item:service:actors:waitForDb');
1835
1940
  const waitForDb$1 = fromCallback(({ sendBack }) => {
1836
1941
  const _waitForDb = new Promise((resolve) => {
@@ -2068,14 +2173,14 @@ const createSeed = async ({ type, seedUid }) => {
2068
2173
  // if the EAS schema hasn't been published yet
2069
2174
  const appDb = BaseDb.getAppDb();
2070
2175
  const newSeedLocalId = generateId();
2071
- const publisher = await getPublisherForNewSeedsWithTimeout();
2176
+ const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
2072
2177
  await appDb.insert(seeds).values({
2073
2178
  localId: newSeedLocalId,
2074
2179
  type,
2075
2180
  uid: seedUid,
2076
2181
  createdAt: Date.now(),
2077
2182
  schemaUid: schemaUid || null,
2078
- ...(publisher != null && publisher !== '' && { publisher }),
2183
+ ...(publisher && { publisher }),
2079
2184
  });
2080
2185
  return newSeedLocalId;
2081
2186
  };
@@ -2083,7 +2188,7 @@ const createSeed = async ({ type, seedUid }) => {
2083
2188
  const createVersion = async ({ seedLocalId, seedUid, seedType, uid, }) => {
2084
2189
  const appDb = BaseDb.getAppDb();
2085
2190
  const newVersionLocalId = generateId();
2086
- const publisher = await getPublisherForNewSeedsWithTimeout();
2191
+ const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
2087
2192
  await appDb.insert(versions).values({
2088
2193
  localId: newVersionLocalId,
2089
2194
  createdAt: Date.now(),
@@ -2091,7 +2196,7 @@ const createVersion = async ({ seedLocalId, seedUid, seedType, uid, }) => {
2091
2196
  seedUid: seedUid ?? null,
2092
2197
  seedType,
2093
2198
  uid: uid ?? null,
2094
- ...(publisher != null && publisher !== '' && { publisher }),
2199
+ ...(publisher && { publisher }),
2095
2200
  });
2096
2201
  return newVersionLocalId;
2097
2202
  };
@@ -2434,7 +2539,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
2434
2539
  const schemaNameToTry = model$1?.schemaName;
2435
2540
  if (schemaNameToTry) {
2436
2541
  try {
2437
- const _mod_7 = await import('./Schema-BaVOWeUb.js');
2542
+ const _mod_7 = await import('./Schema-qciDB7Nu.js');
2438
2543
  const _ns_7 = _mod_7.b;
2439
2544
  const { Schema } = _ns_7;
2440
2545
  const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
@@ -2468,7 +2573,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
2468
2573
  if (Object.keys(propertySchemas).length === 0) {
2469
2574
  try {
2470
2575
  const { listCompleteSchemaFiles } = await Promise.resolve().then(function () { return schema; });
2471
- const _mod_8 = await import('./BasePathResolver-DWY_hb8w.js');
2576
+ const _mod_8 = await import('./BasePathResolver-0IHnXxtL.js');
2472
2577
  const _ns_8 = _mod_8.w;
2473
2578
  const { BaseFileManager } = _ns_8;
2474
2579
  const schemaFiles = await listCompleteSchemaFiles();
@@ -2487,7 +2592,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
2487
2592
  }
2488
2593
  }
2489
2594
  if (Object.keys(propertySchemas).length === 0) {
2490
- const schemaMod = await import('./index-BaPbRFSy.js');
2595
+ const schemaMod = await import('./index-C41UZTmQ.js');
2491
2596
  const { ModelPropertyDataTypes } = schemaMod;
2492
2597
  const KNOWN_MODEL_FALLBACKS = {
2493
2598
  Post: {
@@ -2534,7 +2639,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
2534
2639
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
2535
2640
  let propSchema = propertySchemas[propertyName];
2536
2641
  if (!propSchema && isRefTypeFromMeta) {
2537
- const schemaMod = await import('./index-BaPbRFSy.js');
2642
+ const schemaMod = await import('./index-C41UZTmQ.js');
2538
2643
  const { ModelPropertyDataTypes } = schemaMod;
2539
2644
  propSchema = {
2540
2645
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -2791,9 +2896,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
2791
2896
  sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
2792
2897
  return;
2793
2898
  }
2794
- const getPublishUploadsMod = await import('./getPublishUploads-D-fMspZI.js');
2899
+ const getPublishUploadsMod = await import('./getPublishUploads-CMgzBCzZ.js');
2795
2900
  const { getPublishUploads } = getPublishUploadsMod;
2796
- const getPublishPayloadMod = await import('./getPublishPayload-B2D-72EC.js');
2901
+ const getPublishPayloadMod = await import('./getPublishPayload-CuRGEZa5.js');
2797
2902
  const { getPublishPayload } = getPublishPayloadMod;
2798
2903
  const uploads = await getPublishUploads(item);
2799
2904
  let uploadedTransactions = [];
@@ -3370,6 +3475,135 @@ async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
3370
3475
  return out;
3371
3476
  }
3372
3477
 
3478
+ const READ_ONLY_ERROR = 'Item is read-only: you do not own this item';
3479
+ async function getSeedRowForItem(item) {
3480
+ const appDb = BaseDb.getAppDb();
3481
+ if (!appDb)
3482
+ return null;
3483
+ const conditions = [];
3484
+ if (item.seedLocalId)
3485
+ conditions.push(eq(seeds.localId, item.seedLocalId));
3486
+ if (item.seedUid)
3487
+ conditions.push(eq(seeds.uid, item.seedUid));
3488
+ if (conditions.length === 0)
3489
+ return null;
3490
+ const seedRows = await appDb
3491
+ .select({
3492
+ publisher: seeds.publisher,
3493
+ attestationRaw: seeds.attestationRaw,
3494
+ uid: seeds.uid,
3495
+ })
3496
+ .from(seeds)
3497
+ .where(conditions.length === 1 ? conditions[0] : or(...conditions))
3498
+ .limit(1);
3499
+ if (!seedRows || seedRows.length === 0)
3500
+ return null;
3501
+ return seedRows[0];
3502
+ }
3503
+ /** Resolve publisher from seed row: `publisher` column, else `attestationRaw.attester`. */
3504
+ function resolvePublisherFromSeedRow(row) {
3505
+ if (row.publisher)
3506
+ return row.publisher;
3507
+ if (row.attestationRaw) {
3508
+ try {
3509
+ const parsed = JSON.parse(row.attestationRaw);
3510
+ return parsed.attester ?? null;
3511
+ }
3512
+ catch {
3513
+ return null;
3514
+ }
3515
+ }
3516
+ return null;
3517
+ }
3518
+ /**
3519
+ * Local draft that has never been attested: no publisher, no real uid, no attestationRaw.
3520
+ */
3521
+ function isLocalUnsealedDraft(row) {
3522
+ const publisher = row.publisher;
3523
+ if (publisher != null && publisher !== '')
3524
+ return false;
3525
+ if (!isPlaceholderUid(row.uid))
3526
+ return false;
3527
+ if (row.attestationRaw != null && row.attestationRaw !== '')
3528
+ return false;
3529
+ return true;
3530
+ }
3531
+ /** Case-insensitive membership in the persisted owned set. */
3532
+ function publisherIsInOwnedSet(publisher, ownedAddresses) {
3533
+ if (publisher == null || publisher === '')
3534
+ return false;
3535
+ const ownedSet = new Set(normalizeAddressList(ownedAddresses));
3536
+ return ownedSet.has(normalizeHexAddress(publisher));
3537
+ }
3538
+ /**
3539
+ * Shared ownership predicate.
3540
+ * - Session has owned addresses: only a publisher in that set is owned (null is never owned).
3541
+ * - Session has no owned addresses: local unsealed drafts are owned so pre-connect authoring works.
3542
+ */
3543
+ function isSeedRowOwned(row, ownedAddresses) {
3544
+ const publisher = resolvePublisherFromSeedRow(row);
3545
+ if (ownedAddresses.length === 0) {
3546
+ return isLocalUnsealedDraft({ ...row, publisher: publisher ?? row.publisher });
3547
+ }
3548
+ return publisherIsInOwnedSet(publisher, ownedAddresses);
3549
+ }
3550
+ /**
3551
+ * SQL for `addressFilter: 'owned' | 'watched'`. Empty list → no rows (`1=0`).
3552
+ * Compares `lower(publisher)` so checksummed rows match persisted lowercase owned.
3553
+ */
3554
+ function publisherInAddressListSql(column, addresses) {
3555
+ const normalized = normalizeAddressList(addresses);
3556
+ if (normalized.length === 0) {
3557
+ return sql `1=0`;
3558
+ }
3559
+ return inArray(sql `lower(${column})`, normalized);
3560
+ }
3561
+ /** Owned-list SQL on `seeds.publisher`. */
3562
+ function ownedPublisherSql(ownedAddresses) {
3563
+ return publisherInAddressListSql(seeds.publisher, ownedAddresses);
3564
+ }
3565
+ /**
3566
+ * Checks if the current user owns the item (publisher is in persisted owned addresses).
3567
+ *
3568
+ * When the session has owned addresses, only a matching publisher is owned —
3569
+ * `publisher IS NULL` is not treated as owned. Call `claimUnpublishedDrafts`
3570
+ * after connect to stamp local drafts.
3571
+ *
3572
+ * When owned is empty, local unsealed drafts (no publisher, no real uid, no
3573
+ * attestationRaw) are still owned so create/edit works before a wallet is connected.
3574
+ *
3575
+ * Does not include `getAdditionalSyncAddresses` (those are extra EAS indexers,
3576
+ * not wallets the user controls).
3577
+ */
3578
+ async function isItemOwned(item) {
3579
+ const row = await getSeedRowForItem(item);
3580
+ if (!row)
3581
+ return false;
3582
+ const ownedAddresses = await getOwnedAddressesFromDb();
3583
+ return isSeedRowOwned(row, ownedAddresses);
3584
+ }
3585
+ /**
3586
+ * Throws if the item is not owned. Use before write operations (publish, save, destroy).
3587
+ */
3588
+ async function assertItemOwned(item) {
3589
+ const owned = await isItemOwned(item);
3590
+ if (!owned) {
3591
+ throw new Error(READ_ONLY_ERROR);
3592
+ }
3593
+ }
3594
+
3595
+ var ownership = /*#__PURE__*/Object.freeze({
3596
+ __proto__: null,
3597
+ assertItemOwned: assertItemOwned,
3598
+ isItemOwned: isItemOwned,
3599
+ isLocalUnsealedDraft: isLocalUnsealedDraft,
3600
+ isSeedRowOwned: isSeedRowOwned,
3601
+ ownedPublisherSql: ownedPublisherSql,
3602
+ publisherInAddressListSql: publisherInAddressListSql,
3603
+ publisherIsInOwnedSet: publisherIsInOwnedSet,
3604
+ resolvePublisherFromSeedRow: resolvePublisherFromSeedRow
3605
+ });
3606
+
3373
3607
  /**
3374
3608
  * List item rows for list UIs. Only includes seeds that have at least one version.
3375
3609
  *
@@ -3390,16 +3624,11 @@ const getItemsData = async ({ modelName, deleted, includeEas = false, addressFil
3390
3624
  }
3391
3625
  if (addressFilter === 'owned') {
3392
3626
  const ownedAddresses = await getAddressesForItemsFilter('owned');
3393
- if (ownedAddresses.length > 0) {
3394
- conditions.push(or(inArray(seeds.publisher, ownedAddresses), isNull(seeds.publisher)));
3395
- }
3627
+ conditions.push(publisherInAddressListSql(seeds.publisher, ownedAddresses));
3396
3628
  }
3397
3629
  else if (addressFilter === 'watched') {
3398
3630
  const watchedAddresses = await getAddressesForItemsFilter('watched');
3399
- if (watchedAddresses.length === 0) {
3400
- return [];
3401
- }
3402
- conditions.push(inArray(seeds.publisher, watchedAddresses));
3631
+ conditions.push(publisherInAddressListSql(seeds.publisher, watchedAddresses));
3403
3632
  }
3404
3633
  if (deleted) {
3405
3634
  conditions.push(or(isNotNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 1)));
@@ -3641,7 +3870,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
3641
3870
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
3642
3871
  const _resolveRelatedValue = async () => {
3643
3872
  // Use dynamic import to break circular dependency
3644
- const schemaMod = await import('./index-BaPbRFSy.js');
3873
+ const schemaMod = await import('./index-C41UZTmQ.js');
3645
3874
  const { ModelPropertyDataTypes } = schemaMod;
3646
3875
  if (!propertyValue || !isRelation || populatedFromDb) {
3647
3876
  return;
@@ -3960,6 +4189,7 @@ const updateMetadata = async (metadataValues, propertyRecordSchema) => {
3960
4189
  }
3961
4190
  // Publisher is immutable once set: do not overwrite existing publisher
3962
4191
  if (rest.publisher != null && rest.publisher !== '') {
4192
+ rest.publisher = normalizePublisher(rest.publisher) ?? rest.publisher;
3963
4193
  const [row] = await appDb
3964
4194
  .select({ publisher: metadata$1.publisher })
3965
4195
  .from(metadata$1)
@@ -4644,7 +4874,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
4644
4874
  // to use dynamically imported ModelPropertyDataTypes
4645
4875
  const _hydrateFromDb = async () => {
4646
4876
  // Use dynamic import to break circular dependency
4647
- const schemaMod = await import('./index-BaPbRFSy.js');
4877
+ const schemaMod = await import('./index-C41UZTmQ.js');
4648
4878
  const { ModelPropertyDataTypes } = schemaMod;
4649
4879
  const appDb = BaseDb.getAppDb();
4650
4880
  const whereClauses = [];
@@ -5007,14 +5237,14 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
5007
5237
  };
5008
5238
  // Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
5009
5239
  try {
5010
- const { getPropertySchema } = await import('./property-B2xdCZz_.js');
5240
+ const { getPropertySchema } = await import('./property-Bs3a4Dna.js');
5011
5241
  let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName);
5012
5242
  if (!schemaFromFile?.validation) {
5013
5243
  // Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
5014
- const _mod_9 = await import('./BasePathResolver-DWY_hb8w.js');
5244
+ const _mod_9 = await import('./BasePathResolver-0IHnXxtL.js');
5015
5245
  const _ns_9 = _mod_9.S;
5016
5246
  const { schemas: schemasTable } = _ns_9;
5017
- const _mod_10 = await import('./BasePathResolver-DWY_hb8w.js');
5247
+ const _mod_10 = await import('./BasePathResolver-0IHnXxtL.js');
5018
5248
  const _ns_10 = _mod_10.x;
5019
5249
  const { modelSchemas } = _ns_10;
5020
5250
  const modelSchemaRows = await db
@@ -5476,9 +5706,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
5476
5706
  }
5477
5707
  const _analyzeInput = async () => {
5478
5708
  // Use dynamic import to break circular dependency
5479
- const schemaMod = await import('./index-BaPbRFSy.js');
5709
+ const schemaMod = await import('./index-C41UZTmQ.js');
5480
5710
  const { ModelPropertyDataTypes } = schemaMod;
5481
- const { SchemaValidationService } = await import('./SchemaValidationService-BX4GcEKY.js');
5711
+ const { SchemaValidationService } = await import('./SchemaValidationService-BaOkRjsU.js');
5482
5712
  let propertyName = propertyNameRaw;
5483
5713
  if (!propertyName) {
5484
5714
  throw new Error('propertyName is required');
@@ -5646,8 +5876,8 @@ class MetadataValidationError extends Error {
5646
5876
  const createMetadata = async (metadataValues, propertyRecordSchema, options) => {
5647
5877
  const appDb = BaseDb.getAppDb();
5648
5878
  metadataValues.localId = generateId();
5649
- const publisher = await getPublisherForNewSeedsWithTimeout();
5650
- if (publisher != null && publisher !== '') {
5879
+ const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
5880
+ if (publisher) {
5651
5881
  metadataValues.publisher = publisher;
5652
5882
  }
5653
5883
  if (!metadataValues.modelType && metadataValues.modelName) {
@@ -5676,7 +5906,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
5676
5906
  propertyRecordSchema?.validation &&
5677
5907
  metadataValues.propertyValue != null &&
5678
5908
  metadataValues.propertyValue !== '') {
5679
- const { SchemaValidationService } = await import('./SchemaValidationService-BX4GcEKY.js');
5909
+ const { SchemaValidationService } = await import('./SchemaValidationService-BaOkRjsU.js');
5680
5910
  const validationService = new SchemaValidationService();
5681
5911
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
5682
5912
  ? normalizeDataType(String(propertyRecordSchema.refValueType))
@@ -6269,7 +6499,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
6269
6499
  }
6270
6500
  const _saveRelation = async () => {
6271
6501
  // Use dynamic import to break circular dependency
6272
- const schemaMod = await import('./index-BaPbRFSy.js');
6502
+ const schemaMod = await import('./index-C41UZTmQ.js');
6273
6503
  const { ModelPropertyDataTypes } = schemaMod;
6274
6504
  if (!propertyNameRaw) {
6275
6505
  throw new Error('propertyName is required');
@@ -7018,95 +7248,6 @@ async function runDestroyLifecycle(instance, config) {
7018
7248
  }
7019
7249
  }
7020
7250
 
7021
- /**
7022
- * Creates a reactive Proxy that intercepts property access and assignment
7023
- * to read from and write to an actor service's context.
7024
- *
7025
- * This enables automatic React re-renders when properties change, as the
7026
- * React hooks subscribe to the actor service which gets updated when properties
7027
- * are set via the proxy.
7028
- *
7029
- * @param config Configuration object
7030
- * @returns A proxied instance that behaves like the original but with reactive properties
7031
- *
7032
- * @note TypeScript's Proxy type doesn't automatically preserve method signatures,
7033
- * so we use Proxied<T> to ensure all methods and properties are recognized.
7034
- * The Proxy implementation preserves all methods via Reflect.get, so this is safe.
7035
- */
7036
- function createReactiveProxy(config) {
7037
- const { instance, trackedProperties, getContext, sendUpdate } = config;
7038
- // Convert readonly array to regular array for includes() checks
7039
- const trackedPropsSet = new Set(trackedProperties);
7040
- // Create the proxy - TypeScript needs explicit type assertion to preserve all methods
7041
- // The Proxy preserves all methods via Reflect.get, so we assert it maintains type T
7042
- // Using 'as unknown as T' forces TypeScript to recognize all methods and properties
7043
- const proxy = new Proxy(instance, {
7044
- get(target, prop) {
7045
- // Handle special properties that should not be proxied
7046
- // These need direct access to the underlying instance
7047
- if (prop === '_service') {
7048
- return Reflect.get(target, prop);
7049
- }
7050
- // If it's a tracked property, read from actor context
7051
- if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
7052
- const context = getContext(instance);
7053
- return context[prop];
7054
- }
7055
- // For methods and non-tracked properties, use Reflect
7056
- return Reflect.get(target, prop);
7057
- },
7058
- set(target, prop, value) {
7059
- // Handle special properties
7060
- if (prop === '_service') {
7061
- return Reflect.set(target, prop, value);
7062
- }
7063
- // If it's a tracked property, send update to actor
7064
- if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
7065
- sendUpdate(instance, prop, value);
7066
- return true; // Indicate success
7067
- }
7068
- // For non-tracked properties, use Reflect. Also trigger sendUpdate for virtual
7069
- // 'value' so the callback runs when .value is assigned (e.g. ItemProperty).
7070
- if (typeof prop === 'string' && prop === 'value') {
7071
- sendUpdate(instance, prop, value);
7072
- }
7073
- return Reflect.set(target, prop, value);
7074
- },
7075
- has(target, prop) {
7076
- // Check if property exists in context or on target
7077
- if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
7078
- const context = getContext(instance);
7079
- return prop in context;
7080
- }
7081
- return Reflect.has(target, prop);
7082
- },
7083
- ownKeys(target) {
7084
- // Only return keys that actually exist on the target object
7085
- // This is required when the target is non-extensible (e.g., frozen by Immer)
7086
- // Tracked properties are virtual (read from context), so we don't include them here
7087
- // They're accessible via the get trap, but don't appear in ownKeys
7088
- return Reflect.ownKeys(target);
7089
- },
7090
- getOwnPropertyDescriptor(target, prop) {
7091
- if (typeof prop === 'string' && trackedPropsSet.has(prop)) {
7092
- const context = getContext(instance);
7093
- if (prop in context) {
7094
- return {
7095
- enumerable: true,
7096
- configurable: true,
7097
- value: context[prop],
7098
- writable: true,
7099
- };
7100
- }
7101
- }
7102
- return Reflect.getOwnPropertyDescriptor(target, prop);
7103
- }
7104
- });
7105
- // Force TypeScript to recognize all methods and properties are preserved
7106
- // The Proxy implementation preserves all methods via Reflect.get, so this is safe
7107
- return proxy;
7108
- }
7109
-
7110
7251
  /** Parent Html property `propertyValue` after publish (66-char seed uid). */
7111
7252
  const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
7112
7253
  // Start loading Model at module load time (non-blocking)
@@ -7313,7 +7454,7 @@ class ItemProperty {
7313
7454
  return;
7314
7455
  }
7315
7456
  // Use dynamic import to break circular dependency
7316
- const schemaMod = await import('./index-BaPbRFSy.js');
7457
+ const schemaMod = await import('./index-C41UZTmQ.js');
7317
7458
  const { ModelPropertyDataTypes } = schemaMod;
7318
7459
  const { context } = snapshot;
7319
7460
  const { propertyRecordSchema } = context;
@@ -7484,7 +7625,7 @@ class ItemProperty {
7484
7625
  const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
7485
7626
  const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
7486
7627
  const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
7487
- const _mod_11 = await import('./index-DrEkRiuK.js');
7628
+ const _mod_11 = await import('./index-xNWgPtlN.js');
7488
7629
  const _ns_11 = _mod_11.s;
7489
7630
  const seedSchemaMod = _ns_11;
7490
7631
  const { metadata } = seedSchemaMod;
@@ -8317,7 +8458,7 @@ class ItemProperty {
8317
8458
  if (!propertyName || (!seedLocalId && !seedUid))
8318
8459
  return;
8319
8460
  if (db) {
8320
- const _mod_12 = await import('./index-DrEkRiuK.js');
8461
+ const _mod_12 = await import('./index-xNWgPtlN.js');
8321
8462
  const _ns_12 = _mod_12.s;
8322
8463
  const seedSchemaMod = _ns_12;
8323
8464
  const { metadata } = seedSchemaMod;
@@ -8468,7 +8609,8 @@ const updateSeedUid = async ({ seedLocalId, seedUid, publisher, attestationCreat
8468
8609
  return;
8469
8610
  }
8470
8611
  const appDb = BaseDb.getAppDb();
8471
- let shouldSetPublisher = publisher != null && publisher !== '';
8612
+ const normalizedPublisher = normalizePublisher(publisher);
8613
+ let shouldSetPublisher = normalizedPublisher != null;
8472
8614
  if (shouldSetPublisher) {
8473
8615
  const [row] = await appDb
8474
8616
  .select({ publisher: seeds.publisher })
@@ -8483,7 +8625,7 @@ const updateSeedUid = async ({ seedLocalId, seedUid, publisher, attestationCreat
8483
8625
  .update(seeds)
8484
8626
  .set({
8485
8627
  uid: seedUid,
8486
- ...(shouldSetPublisher && { publisher }),
8628
+ ...(shouldSetPublisher && { publisher: normalizedPublisher }),
8487
8629
  ...(attestationCreatedAt != null && { attestationCreatedAt }),
8488
8630
  updatedAt: Date.now(),
8489
8631
  })
@@ -8625,12 +8767,12 @@ class Item {
8625
8767
  };
8626
8768
  this.getPublishUploads = async (options) => {
8627
8769
  // Use dynamic import to break circular dependency
8628
- const getPublishUploadsMod = await import('./getPublishUploads-D-fMspZI.js');
8770
+ const getPublishUploadsMod = await import('./getPublishUploads-CMgzBCzZ.js');
8629
8771
  const { getPublishUploads } = getPublishUploadsMod;
8630
8772
  return await getPublishUploads(this, [], undefined, options);
8631
8773
  };
8632
8774
  this.getPublishPayload = async (uploadedTransactions, options) => {
8633
- const getPublishPayloadMod = await import('./getPublishPayload-B2D-72EC.js');
8775
+ const getPublishPayloadMod = await import('./getPublishPayload-CuRGEZa5.js');
8634
8776
  const { getPublishPayload } = getPublishPayloadMod;
8635
8777
  return await getPublishPayload(this, uploadedTransactions, options);
8636
8778
  };
@@ -8749,6 +8891,7 @@ class Item {
8749
8891
  'latestVersionUid',
8750
8892
  'publishedVersionUid',
8751
8893
  'publishedVersionLocalId',
8894
+ 'revokedAt',
8752
8895
  ];
8753
8896
  const keysFromInitial = Object.keys(initialValues).filter((key) => !metadataKeys.includes(key));
8754
8897
  const schemaNameForModel = initialValues.schemaName;
@@ -9054,19 +9197,14 @@ class Item {
9054
9197
  return Reflect.ownKeys(target);
9055
9198
  },
9056
9199
  getOwnPropertyDescriptor(target, prop) {
9057
- // Handle tracked properties
9200
+ let invent;
9058
9201
  if (typeof prop === 'string' && TRACKED_PROPERTIES$1.includes(prop)) {
9059
9202
  const context = target._getSnapshotContext();
9060
9203
  if (prop in context) {
9061
- return {
9062
- enumerable: true,
9063
- configurable: true,
9064
- value: context[prop],
9065
- writable: true,
9066
- };
9204
+ invent = { value: context[prop] };
9067
9205
  }
9068
9206
  }
9069
- return Reflect.getOwnPropertyDescriptor(target, prop);
9207
+ return getInvariantSafePropertyDescriptor(target, prop, invent);
9070
9208
  },
9071
9209
  });
9072
9210
  this.registerItemInInstanceCache(proxiedInstance);
@@ -9102,11 +9240,11 @@ class Item {
9102
9240
  let modelRecords;
9103
9241
  // If we have a schema name, join with modelSchemas to filter by schema
9104
9242
  if (schemaName) {
9105
- const _mod_13 = await import('./BasePathResolver-DWY_hb8w.js');
9243
+ const _mod_13 = await import('./BasePathResolver-0IHnXxtL.js');
9106
9244
  const _ns_13 = _mod_13.x;
9107
9245
  const modelSchemaSchemaMod = _ns_13;
9108
9246
  const { modelSchemas } = modelSchemaSchemaMod;
9109
- const _mod_14 = await import('./BasePathResolver-DWY_hb8w.js');
9247
+ const _mod_14 = await import('./BasePathResolver-0IHnXxtL.js');
9110
9248
  const _ns_14 = _mod_14.S;
9111
9249
  const schemaSchemaMod = _ns_14;
9112
9250
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -9238,19 +9376,14 @@ class Item {
9238
9376
  return Reflect.ownKeys(target);
9239
9377
  },
9240
9378
  getOwnPropertyDescriptor(target, prop) {
9241
- // Handle tracked properties
9379
+ let invent;
9242
9380
  if (typeof prop === 'string' && TRACKED_PROPERTIES$1.includes(prop)) {
9243
9381
  const context = target._getSnapshotContext();
9244
9382
  if (prop in context) {
9245
- return {
9246
- enumerable: true,
9247
- configurable: true,
9248
- value: context[prop],
9249
- writable: true,
9250
- };
9383
+ invent = { value: context[prop] };
9251
9384
  }
9252
9385
  }
9253
- return Reflect.getOwnPropertyDescriptor(target, prop);
9386
+ return getInvariantSafePropertyDescriptor(target, prop, invent);
9254
9387
  },
9255
9388
  });
9256
9389
  this.registerItemInInstanceCache(proxiedInstance);
@@ -9408,7 +9541,7 @@ class Item {
9408
9541
  if (!appDb || Item.instanceCache.size === 0) {
9409
9542
  return;
9410
9543
  }
9411
- const _mod_15 = await import('./index-DrEkRiuK.js');
9544
+ const _mod_15 = await import('./index-xNWgPtlN.js');
9412
9545
  const _ns_15 = _mod_15.s;
9413
9546
  const { metadata } = _ns_15;
9414
9547
  const { eq, and } = await import('drizzle-orm');
@@ -9564,6 +9697,7 @@ class Item {
9564
9697
  }
9565
9698
  },
9566
9699
  enumerable: true,
9700
+ configurable: true,
9567
9701
  });
9568
9702
  state.definedPropertyNames.add(propertyName);
9569
9703
  }
@@ -9859,7 +9993,7 @@ class Item {
9859
9993
  itemActor.send(event);
9860
9994
  };
9861
9995
  try {
9862
- const _mod_16 = await import('./index-DrEkRiuK.js');
9996
+ const _mod_16 = await import('./index-xNWgPtlN.js');
9863
9997
  const _ns_16 = _mod_16.s;
9864
9998
  const seedSchemaMod = _ns_16;
9865
9999
  const { seeds, versions, metadata } = seedSchemaMod;
@@ -10207,24 +10341,6 @@ class ConflictError extends Error {
10207
10341
  }
10208
10342
  }
10209
10343
 
10210
- /**
10211
- * Normalizes AddressConfiguration to { owned, watched }.
10212
- * - string[] -> { owned: addresses, watched: [] }
10213
- * - { owned, watched? } -> { owned, watched: watched ?? [] }
10214
- */
10215
- function normalizeAddressConfig(addresses) {
10216
- if (!addresses) {
10217
- return { owned: [], watched: [] };
10218
- }
10219
- if (Array.isArray(addresses)) {
10220
- return { owned: addresses, watched: [] };
10221
- }
10222
- return {
10223
- owned: addresses.owned ?? [],
10224
- watched: addresses.watched ?? [],
10225
- };
10226
- }
10227
-
10228
10344
  let writeTail = Promise.resolve();
10229
10345
  function enqueueEasSyncDbWrite(fn) {
10230
10346
  const next = writeTail.then(fn);
@@ -10321,7 +10437,7 @@ const runEasSync = fromPromise(async ({ input, }) => {
10321
10437
  requestPayload: input.requestPayload,
10322
10438
  persistedSnapshot: input.runningSnapshot,
10323
10439
  });
10324
- const { runSyncFromEas } = await import('./syncDbWithEas-B9Riqty1.js');
10440
+ const { runSyncFromEas } = await import('./syncDbWithEas-DRpLRxwb.js');
10325
10441
  try {
10326
10442
  await runSyncFromEas(toRunSyncArg(input.options));
10327
10443
  await finalizeEasSyncProcessRow(rowId, {
@@ -10600,7 +10716,7 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
10600
10716
  }
10601
10717
  // Prefer the condition-resolved factory when available; fall back to explicit
10602
10718
  // platform imports so source/vitest resolution stays reliable.
10603
- const { configurePlatform } = await import('./configurePlatform-CXQCT7N8.js');
10719
+ const { configurePlatform } = await import('./configurePlatform-Df4BlXwQ.js');
10604
10720
  if (isBrowser()) {
10605
10721
  const { createPlatformServices } = await import('./platform.browser.js');
10606
10722
  configurePlatform(createPlatformServices());
@@ -11047,8 +11163,8 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
11047
11163
  throw new Error('App DB not found');
11048
11164
  }
11049
11165
  const endpointsValueString = JSON.stringify(endpoints);
11050
- const owned = ownedAddresses ?? addresses ?? [];
11051
- const watched = watchedAddresses ?? [];
11166
+ const owned = normalizeAddressList(ownedAddresses ?? addresses ?? []);
11167
+ const watched = normalizeAddressList(watchedAddresses ?? []);
11052
11168
  const addressesValueString = JSON.stringify({ owned, watched });
11053
11169
  // TODO: Figure out how to define on conflict with multiple rows added
11054
11170
  await appDb
@@ -11063,20 +11179,18 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
11063
11179
  value: endpointsValueString,
11064
11180
  },
11065
11181
  });
11066
- if (owned.length > 0 || watched.length > 0) {
11067
- await appDb
11068
- .insert(appState)
11069
- .values({
11070
- key: 'addresses',
11182
+ await appDb
11183
+ .insert(appState)
11184
+ .values({
11185
+ key: 'addresses',
11186
+ value: addressesValueString,
11187
+ })
11188
+ .onConflictDoUpdate({
11189
+ target: appState.key,
11190
+ set: {
11071
11191
  value: addressesValueString,
11072
- })
11073
- .onConflictDoUpdate({
11074
- target: appState.key,
11075
- set: {
11076
- value: addressesValueString,
11077
- },
11078
- });
11079
- }
11192
+ },
11193
+ });
11080
11194
  await appDb
11081
11195
  .insert(appState)
11082
11196
  .values({
@@ -11827,7 +11941,7 @@ function getRefValueType(prop) {
11827
11941
  * @returns Promise that resolves when properties are found, or rejects if not found after max retries
11828
11942
  */
11829
11943
  const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
11830
- const _mod_17 = await import('./BasePathResolver-DWY_hb8w.js');
11944
+ const _mod_17 = await import('./BasePathResolver-0IHnXxtL.js');
11831
11945
  const _ns_17 = _mod_17.M;
11832
11946
  const modelSchemaMod = _ns_17;
11833
11947
  const { properties: propertiesTable } = modelSchemaMod;
@@ -12175,7 +12289,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
12175
12289
  // Check DB for existing schema by name+version (same as minimal path)
12176
12290
  const db = BaseDb.getAppDb();
12177
12291
  if (db) {
12178
- const _mod_18 = await import('./BasePathResolver-DWY_hb8w.js');
12292
+ const _mod_18 = await import('./BasePathResolver-0IHnXxtL.js');
12179
12293
  const _ns_18 = _mod_18.S;
12180
12294
  const schemaSchemaMod = _ns_18;
12181
12295
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -12259,7 +12373,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
12259
12373
  // For minimal imports: check DB for existing schema before creating new file
12260
12374
  const db = BaseDb.getAppDb();
12261
12375
  if (db) {
12262
- const _mod_19 = await import('./BasePathResolver-DWY_hb8w.js');
12376
+ const _mod_19 = await import('./BasePathResolver-0IHnXxtL.js');
12263
12377
  const _ns_19 = _mod_19.S;
12264
12378
  const schemaSchemaMod = _ns_19;
12265
12379
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -12337,7 +12451,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
12337
12451
  }
12338
12452
  }
12339
12453
  // Check if this is an internal SDK schema (should not create files in app directory)
12340
- const constantsMod = await import('./constants-DMHTYMgJ.js');
12454
+ const constantsMod = await import('./constants-Bre6dTJR.js');
12341
12455
  const { isInternalSchema, INTERNAL_SCHEMA_IDS } = constantsMod;
12342
12456
  const isInternal = isInternalSchema(schemaFile.metadata.name, schemaFile.id);
12343
12457
  if (isInternal) {
@@ -12440,7 +12554,9 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
12440
12554
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
12441
12555
  };
12442
12556
  // Use dynamic import to break circular dependency
12443
- const dbMod = await import('./db-CMQ3TG6N.js');
12557
+ const _mod_20 = await import('./db-DVsy4QZe.js');
12558
+ const _ns_20 = _mod_20.q;
12559
+ const dbMod = _ns_20;
12444
12560
  const { addSchemaToDb, addModelsToDb } = dbMod;
12445
12561
  // Try to add schema and models to database if database is available
12446
12562
  try {
@@ -12460,13 +12576,13 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
12460
12576
  });
12461
12577
  // Verify expected models are linked (single attempt - addModelsToDb already confirmed)
12462
12578
  const expectedModelNames = Object.keys(schemaFile.models || {});
12463
- const _mod_20 = await import('./BasePathResolver-DWY_hb8w.js');
12464
- const _ns_20 = _mod_20.x;
12465
- const modelSchemaSchemaMod = _ns_20;
12579
+ const _mod_21 = await import('./BasePathResolver-0IHnXxtL.js');
12580
+ const _ns_21 = _mod_21.x;
12581
+ const modelSchemaSchemaMod = _ns_21;
12466
12582
  const { modelSchemas } = modelSchemaSchemaMod;
12467
- const _mod_21 = await import('./BasePathResolver-DWY_hb8w.js');
12468
- const _ns_21 = _mod_21.M;
12469
- const modelSchemaMod = _ns_21;
12583
+ const _mod_22 = await import('./BasePathResolver-0IHnXxtL.js');
12584
+ const _ns_22 = _mod_22.M;
12585
+ const modelSchemaMod = _ns_22;
12470
12586
  const { models: modelsTable } = modelSchemaMod;
12471
12587
  const drizzleMod = await import('drizzle-orm');
12472
12588
  const { eq, and } = drizzleMod;
@@ -12667,7 +12783,9 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
12667
12783
  createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
12668
12784
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
12669
12785
  };
12670
- const dbMod = await import('./db-CMQ3TG6N.js');
12786
+ const _mod_23 = await import('./db-DVsy4QZe.js');
12787
+ const _ns_23 = _mod_23.q;
12788
+ const dbMod = _ns_23;
12671
12789
  const { addSchemaToDb, addModelsToDb } = dbMod;
12672
12790
  const db = BaseDb.getAppDb();
12673
12791
  if (!db) {
@@ -12825,13 +12943,13 @@ const loadSchemaFromFile = async (schemaFilePath) => {
12825
12943
  if (db) {
12826
12944
  const { schemaRecord } = await applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, propertyFileIds);
12827
12945
  // Query the database to get model IDs that were just created
12828
- const _mod_22 = await import('./BasePathResolver-DWY_hb8w.js');
12829
- const _ns_22 = _mod_22.x;
12830
- const modelSchemaSchemaMod = _ns_22;
12946
+ const _mod_24 = await import('./BasePathResolver-0IHnXxtL.js');
12947
+ const _ns_24 = _mod_24.x;
12948
+ const modelSchemaSchemaMod = _ns_24;
12831
12949
  const { modelSchemas } = modelSchemaSchemaMod;
12832
- const _mod_23 = await import('./BasePathResolver-DWY_hb8w.js');
12833
- const _ns_23 = _mod_23.M;
12834
- const modelSchemaMod = _ns_23;
12950
+ const _mod_25 = await import('./BasePathResolver-0IHnXxtL.js');
12951
+ const _ns_25 = _mod_25.M;
12952
+ const modelSchemaMod = _ns_25;
12835
12953
  const { models: modelsTable } = modelSchemaMod;
12836
12954
  const drizzleMod = await import('drizzle-orm');
12837
12955
  const { eq } = drizzleMod;
@@ -12895,9 +13013,9 @@ const loadSchemaFromFile = async (schemaFilePath) => {
12895
13013
  // After properties are created (file path), ensure schemaFile has the correct IDs from database
12896
13014
  // Query the database to get the actual schemaFileId values that were used
12897
13015
  // This ensures schemaData matches what's actually in the database
12898
- const _mod_24 = await import('./BasePathResolver-DWY_hb8w.js');
12899
- const _ns_24 = _mod_24.M;
12900
- const modelSchemaMod2 = _ns_24;
13016
+ const _mod_26 = await import('./BasePathResolver-0IHnXxtL.js');
13017
+ const _ns_26 = _mod_26.M;
13018
+ const modelSchemaMod2 = _ns_26;
12901
13019
  const { properties: propertiesTable } = modelSchemaMod2;
12902
13020
  let schemaFileUpdated = false;
12903
13021
  for (const [modelName, modelFileId] of modelFileIds.entries()) {
@@ -12931,9 +13049,9 @@ const loadSchemaFromFile = async (schemaFilePath) => {
12931
13049
  // This is important even if nothing changed, to ensure consistency
12932
13050
  const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
12933
13051
  // Update the schema record in the database with current schemaData
12934
- const _mod_25 = await import('./BasePathResolver-DWY_hb8w.js');
12935
- const _ns_25 = _mod_25.S;
12936
- const schemaSchemaMod = _ns_25;
13052
+ const _mod_27 = await import('./BasePathResolver-0IHnXxtL.js');
13053
+ const _ns_27 = _mod_27.S;
13054
+ const schemaSchemaMod = _ns_27;
12937
13055
  const { schemas: schemasTable } = schemaSchemaMod;
12938
13056
  await db
12939
13057
  .update(schemasTable)
@@ -14292,98 +14410,7 @@ async function getPublishedSeedRecord(seedUid, options) {
14292
14410
  return getSeed(seedUid, { ...options, source });
14293
14411
  }
14294
14412
 
14295
- const READ_ONLY_ERROR = 'Item is read-only: you do not own this item';
14296
- async function getSeedRowForItem(item) {
14297
- const appDb = BaseDb.getAppDb();
14298
- if (!appDb)
14299
- return null;
14300
- const conditions = [];
14301
- if (item.seedLocalId)
14302
- conditions.push(eq(seeds.localId, item.seedLocalId));
14303
- if (item.seedUid)
14304
- conditions.push(eq(seeds.uid, item.seedUid));
14305
- if (conditions.length === 0)
14306
- return null;
14307
- const seedRows = await appDb
14308
- .select({
14309
- publisher: seeds.publisher,
14310
- attestationRaw: seeds.attestationRaw,
14311
- uid: seeds.uid,
14312
- })
14313
- .from(seeds)
14314
- .where(conditions.length === 1 ? conditions[0] : or(...conditions))
14315
- .limit(1);
14316
- if (!seedRows || seedRows.length === 0)
14317
- return null;
14318
- return seedRows[0];
14319
- }
14320
- /** Resolve publisher from seed row: `publisher` column, else `attestationRaw.attester`. */
14321
- function resolvePublisherFromSeedRow(row) {
14322
- if (row.publisher)
14323
- return row.publisher;
14324
- if (row.attestationRaw) {
14325
- try {
14326
- const parsed = JSON.parse(row.attestationRaw);
14327
- return parsed.attester ?? null;
14328
- }
14329
- catch {
14330
- return null;
14331
- }
14332
- }
14333
- return null;
14334
- }
14335
- /**
14336
- * Checks if the current user owns the item (publisher is in owned addresses).
14337
- * Locally created items (no publisher, no attestationRaw) are considered owned.
14338
- * Includes getAdditionalSyncAddresses (e.g. `modularAccountModuleContract` when configured)
14339
- * so ownership aligns with EAS sync when the publisher/attester matches those addresses.
14340
- */
14341
- async function isItemOwned(item) {
14342
- const row = await getSeedRowForItem(item);
14343
- if (!row)
14344
- return false;
14345
- const publisher = resolvePublisherFromSeedRow(row);
14346
- if (!publisher) {
14347
- if (!row.uid && !row.attestationRaw) {
14348
- return true;
14349
- }
14350
- return false;
14351
- }
14352
- let addressesToCheck = await getOwnedAddressesFromDb();
14353
- const additionalGetter = getGetAdditionalSyncAddresses();
14354
- if (additionalGetter) {
14355
- const additional = await additionalGetter();
14356
- if (additional?.length) {
14357
- const seen = new Set(addressesToCheck.map((a) => a.toLowerCase()));
14358
- for (const addr of additional) {
14359
- if (addr && !seen.has(addr.toLowerCase())) {
14360
- seen.add(addr.toLowerCase());
14361
- addressesToCheck = [...addressesToCheck, addr];
14362
- }
14363
- }
14364
- }
14365
- }
14366
- const ownedSet = new Set(addressesToCheck.map((a) => a.toLowerCase()));
14367
- return ownedSet.has(publisher.toLowerCase());
14368
- }
14369
- /**
14370
- * Throws if the item is not owned. Use before write operations (publish, save, destroy).
14371
- */
14372
- async function assertItemOwned(item) {
14373
- const owned = await isItemOwned(item);
14374
- if (!owned) {
14375
- throw new Error(READ_ONLY_ERROR);
14376
- }
14377
- }
14378
-
14379
- var ownership = /*#__PURE__*/Object.freeze({
14380
- __proto__: null,
14381
- assertItemOwned: assertItemOwned,
14382
- isItemOwned: isItemOwned,
14383
- resolvePublisherFromSeedRow: resolvePublisherFromSeedRow
14384
- });
14385
-
14386
- const emptyResult = () => ({
14413
+ const emptyResult$1 = () => ({
14387
14414
  removedSeedLocalIds: [],
14388
14415
  removedSeedUids: [],
14389
14416
  });
@@ -14401,11 +14428,11 @@ function normalizeAddresses(addresses) {
14401
14428
  async function findLocalOnchainCopiesForAddresses(addresses) {
14402
14429
  const normalized = normalizeAddresses(addresses);
14403
14430
  if (normalized.length === 0) {
14404
- return emptyResult();
14431
+ return emptyResult$1();
14405
14432
  }
14406
14433
  const appDb = BaseDb.getAppDb();
14407
14434
  if (!appDb) {
14408
- return emptyResult();
14435
+ return emptyResult$1();
14409
14436
  }
14410
14437
  const addressSet = new Set(normalized);
14411
14438
  const candidateRows = (await appDb
@@ -14454,6 +14481,57 @@ async function hardDeleteLocalSeedsByLocalIds(seedLocalIds) {
14454
14481
  await appDb.delete(seeds).where(inArray(seeds.localId, seedLocalIds));
14455
14482
  }
14456
14483
 
14484
+ const emptyResult = () => ({
14485
+ seeds: 0,
14486
+ versions: 0,
14487
+ metadata: 0,
14488
+ });
14489
+ /**
14490
+ * Stamp local seeds/versions/metadata that have no publisher and no real uid.
14491
+ * Does not touch sealed rows (real EAS uid or attestationRaw).
14492
+ */
14493
+ async function claimUnpublishedDrafts(publisher) {
14494
+ const normalized = normalizePublisher(publisher);
14495
+ if (!normalized)
14496
+ return emptyResult();
14497
+ const appDb = BaseDb.getAppDb();
14498
+ if (!appDb)
14499
+ return emptyResult();
14500
+ const now = Date.now();
14501
+ const claimTable = async (table) => {
14502
+ const rows = (await appDb
14503
+ .select({
14504
+ localId: table.localId,
14505
+ uid: table.uid,
14506
+ publisher: table.publisher,
14507
+ attestationRaw: table.attestationRaw,
14508
+ })
14509
+ .from(table));
14510
+ const ids = rows
14511
+ .filter((row) => typeof row.localId === 'string' &&
14512
+ row.localId !== '' &&
14513
+ isLocalUnsealedDraft(row))
14514
+ .map((row) => row.localId);
14515
+ if (ids.length === 0)
14516
+ return 0;
14517
+ await appDb
14518
+ .update(table)
14519
+ .set({ publisher: normalized, updatedAt: now })
14520
+ .where(inArray(table.localId, ids));
14521
+ return ids.length;
14522
+ };
14523
+ const [seedCount, versionCount, metadataCount] = await Promise.all([
14524
+ claimTable(seeds),
14525
+ claimTable(versions),
14526
+ claimTable(metadata$1),
14527
+ ]);
14528
+ return {
14529
+ seeds: seedCount,
14530
+ versions: versionCount,
14531
+ metadata: metadataCount,
14532
+ };
14533
+ }
14534
+
14457
14535
  const logger$1 = debug('seedSdk:client');
14458
14536
  const clientManager = createActor(clientManagerMachine, {
14459
14537
  input: {
@@ -14582,6 +14660,15 @@ const clientInstance = {
14582
14660
  ensureInitialized();
14583
14661
  return getWatchedAddressesFromDb();
14584
14662
  },
14663
+ /**
14664
+ * Stamp local seeds/versions/metadata that have no publisher and no real uid.
14665
+ * Sealed rows (real EAS uid or attestationRaw) are left unchanged.
14666
+ * Use after `setAddresses` on connect; `setPublishWallet` does this automatically.
14667
+ */
14668
+ claimUnpublishedDrafts: async (publisher) => {
14669
+ ensureInitialized();
14670
+ return claimUnpublishedDrafts(publisher);
14671
+ },
14585
14672
  /**
14586
14673
  * Hard-delete local on-chain seed copies for the given publisher addresses.
14587
14674
  * Drafts (no uid / attestationRaw) are kept. Chain is untouched; reconnect can rehydrate via syncFromEas.
@@ -14832,7 +14919,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
14832
14919
  // Lazy import cache for ModelProperty to avoid circular dependency
14833
14920
  // Eagerly start loading to minimize delay on first access
14834
14921
  let ModelPropertyClass = null;
14835
- const modelPropertyImportPromise = import('./ModelProperty-CHIxRLfS.js')
14922
+ const modelPropertyImportPromise = import('./ModelProperty-BiDQu5rE.js')
14836
14923
  .then(module => {
14837
14924
  ModelPropertyClass = module.ModelProperty;
14838
14925
  return ModelPropertyClass;
@@ -14849,7 +14936,7 @@ function getModelProperty() {
14849
14936
  }
14850
14937
  // Lazy import cache for Schema to avoid circular dependency
14851
14938
  let SchemaClass = null;
14852
- const schemaImportPromise = (async () => { const _mod_26 = await import('./Schema-BaVOWeUb.js'); return _mod_26.b; })()
14939
+ const schemaImportPromise = (async () => { const _mod_28 = await import('./Schema-qciDB7Nu.js'); return _mod_28.b; })()
14853
14940
  .then(module => {
14854
14941
  SchemaClass = module.Schema;
14855
14942
  return SchemaClass;
@@ -15307,37 +15394,25 @@ class Model {
15307
15394
  getOwnPropertyDescriptor(target, prop) {
15308
15395
  // Handle 'name' as an alias for 'modelName'
15309
15396
  if (prop === 'name') {
15310
- const context = target._getSnapshotContext();
15311
- return {
15312
- enumerable: true,
15313
- configurable: true,
15314
- value: context.modelName,
15315
- writable: true,
15316
- };
15397
+ return getInvariantSafePropertyDescriptor(target, prop, {
15398
+ value: target._getSnapshotContext().modelName,
15399
+ });
15317
15400
  }
15318
15401
  // Handle 'id' property - returns the modelFileId
15319
15402
  if (prop === 'id') {
15320
- const context = target._getSnapshotContext();
15321
- return {
15322
- enumerable: true,
15323
- configurable: true,
15324
- value: context.id, // id is now the schemaFileId (string)
15403
+ return getInvariantSafePropertyDescriptor(target, prop, {
15404
+ value: target._getSnapshotContext().id, // id is now the schemaFileId (string)
15325
15405
  writable: false, // id is read-only
15326
- };
15406
+ });
15327
15407
  }
15328
- // Handle tracked properties
15408
+ let invent;
15329
15409
  if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
15330
15410
  const context = target._getSnapshotContext();
15331
15411
  if (prop in context) {
15332
- return {
15333
- enumerable: true,
15334
- configurable: true,
15335
- value: context[prop],
15336
- writable: true,
15337
- };
15412
+ invent = { value: context[prop] };
15338
15413
  }
15339
15414
  }
15340
- return Reflect.getOwnPropertyDescriptor(target, prop);
15415
+ return getInvariantSafePropertyDescriptor(target, prop, invent);
15341
15416
  },
15342
15417
  });
15343
15418
  // Step 8: Store in new ID-based cache
@@ -16589,5 +16664,5 @@ var Model$1 = /*#__PURE__*/Object.freeze({
16589
16664
  const TModelValues = Type.Record(Type.String(), Type.Any());
16590
16665
  const TModelSchema = Type.Record(Type.String(), TProperty);
16591
16666
 
16592
- export { registerSeedQueryLocalSource as $, compareMetadataRowsLatestFirst as A, ADDRESSES_PERSISTED_EVENT as B, ClientManager as C, createLocalQueryDataSource as D, createNewItem as E, createSchema as F, easSyncActor as G, getClient as H, Item as I, getGetPublisherForNewSeeds as J, getMetadataLatest as K, LOCAL_COPIES_REMOVED_EVENT as L, Model as M, getPublishedSeedRecord as N, getRevokeExecutor as O, getSchemaNameFromId as P, getUploadExecutor as Q, getVersionData$1 as R, isItemOwned as S, TModelSchema as T, isSeedQueryLocalSourceRegistered as U, listCompleteSchemaFiles as V, loadAllSchemasFromDb as W, mergeEasSyncRequestIntents as X, parseAddressesPersistedPayload as Y, propertyMachine as Z, readSchema as _, TModelValues as a, requestEasSyncFromAddressChange as a0, requestEasSyncFromEventBus as a1, requestEasSyncFromModelsInit as a2, sendEasSyncClientRequest as a3, setAdditionalSyncAddresses as a4, setGetPublisherForNewSeeds as a5, setRevokeExecutor as a6, setUploadExecutor as a7, startEasSyncActor as a8, unregisterSeedQueryLocalSource as a9, createModelsFromJson as aa, getLatestSchemaVersion as ab, createModelFromJson as ac, ConflictError as ad, unloadEntity as ae, clearDestroySubscriptions as af, setupEntityLiveQuery as ag, publishConfig as ah, generateId$1 as ai, model as aj, getPropertyData$1 as ak, Item$1 as al, schema as am, SEEDPROTOCOL_Seed_Protocol_v1 as an, Model$1 as ao, getItemData as b, getEasSchemaUidForModel as c, getLatestPublishedVersionRow as d, getEasSchemaForItemProperty as e, eventEmitter as f, getContentHash as g, generateId as h, getGetAdditionalSyncAddresses as i, ItemProperty as j, getRefValueType as k, importJsonSchema as l, modelPropertiesToObject as m, loadSchemaFromFile as n, readJsonImportFile as o, parseListPropertyValueFromStorage as p, syncSchemaFromSource as q, resolveStorageNameToSchemaName as r, scheduleBulkFilesDownloadFromEasSync as s, transformImportToSchemaFile as t, waitForEntityIdle as u, createReactiveProxy as v, writeProcessMachine as w, findEntity as x, forceRemoveFromCaches as y, runDestroyLifecycle as z };
16593
- //# sourceMappingURL=index-Dx0RL3Tx.js.map
16667
+ export { ownedPublisherSql as $, compareMetadataRowsLatestFirst as A, ADDRESSES_PERSISTED_EVENT as B, ClientManager as C, claimUnpublishedDrafts as D, createLocalQueryDataSource as E, createNewItem as F, createSchema as G, easSyncActor as H, Item as I, getClient as J, getGetPublisherForNewSeeds as K, LOCAL_COPIES_REMOVED_EVENT as L, Model as M, getMetadataLatest as N, getPublishedSeedRecord as O, getRevokeExecutor as P, getSchemaNameFromId as Q, getUploadExecutor as R, getVersionData$1 as S, TModelSchema as T, isItemOwned as U, isLocalUnsealedDraft as V, isSeedQueryLocalSourceRegistered as W, isSeedRowOwned as X, listCompleteSchemaFiles as Y, loadAllSchemasFromDb as Z, mergeEasSyncRequestIntents as _, TModelValues as a, parseAddressesPersistedPayload as a0, propertyMachine as a1, publisherInAddressListSql as a2, publisherIsInOwnedSet as a3, readSchema as a4, registerSeedQueryLocalSource as a5, requestEasSyncFromAddressChange as a6, requestEasSyncFromEventBus as a7, requestEasSyncFromModelsInit as a8, sendEasSyncClientRequest as a9, setAdditionalSyncAddresses as aa, setGetPublisherForNewSeeds as ab, setRevokeExecutor as ac, setUploadExecutor as ad, startEasSyncActor as ae, unregisterSeedQueryLocalSource as af, createModelsFromJson as ag, getLatestSchemaVersion as ah, createModelFromJson as ai, ConflictError as aj, unloadEntity as ak, clearDestroySubscriptions as al, setupEntityLiveQuery as am, generateId$1 as an, model as ao, getPropertyData$1 as ap, Item$1 as aq, schema as ar, SEEDPROTOCOL_Seed_Protocol_v1 as as, Model$1 as at, getItemData as b, getEasSchemaUidForModel as c, getLatestPublishedVersionRow as d, getEasSchemaForItemProperty as e, eventEmitter as f, getContentHash as g, generateId as h, getGetAdditionalSyncAddresses as i, ItemProperty as j, getRefValueType as k, importJsonSchema as l, modelPropertiesToObject as m, loadSchemaFromFile as n, readJsonImportFile as o, parseListPropertyValueFromStorage as p, syncSchemaFromSource as q, resolveStorageNameToSchemaName as r, scheduleBulkFilesDownloadFromEasSync as s, transformImportToSchemaFile as t, waitForEntityIdle as u, createReactiveProxy as v, writeProcessMachine as w, findEntity as x, forceRemoveFromCaches as y, runDestroyLifecycle as z };
16668
+ //# sourceMappingURL=index-DjwIC6U3.js.map