@seedprotocol/sdk 0.4.18 → 0.4.19

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 (115) hide show
  1. package/dist/{ArweaveClient-CpShI0B0.js → ArweaveClient-CAdWVQnJ.js} +3 -3
  2. package/dist/{ArweaveClient-CpShI0B0.js.map → ArweaveClient-CAdWVQnJ.js.map} +1 -1
  3. package/dist/{ArweaveClient-WfxkMgxb.js → ArweaveClient-V62RJhsZ.js} +3 -3
  4. package/dist/{ArweaveClient-WfxkMgxb.js.map → ArweaveClient-V62RJhsZ.js.map} +1 -1
  5. package/dist/{Db-29bu0gJx.js → Db-8N3-le9a.js} +4 -4
  6. package/dist/{Db-29bu0gJx.js.map → Db-8N3-le9a.js.map} +1 -1
  7. package/dist/{Db-DWvxJG22.js → Db-DS2GBY6h.js} +133 -6
  8. package/dist/Db-DS2GBY6h.js.map +1 -0
  9. package/dist/{EasClient-BwBg9Kkd.js → EasClient-D1eibg8b.js} +2 -2
  10. package/dist/{EasClient-CtLqK_qz.js.map → EasClient-D1eibg8b.js.map} +1 -1
  11. package/dist/{EasClient-CtLqK_qz.js → EasClient-nOmY5meW.js} +2 -2
  12. package/dist/{EasClient-BwBg9Kkd.js.map → EasClient-nOmY5meW.js.map} +1 -1
  13. package/dist/{FileManager-DgraLHZS.js → FileManager-Cze8qmS1.js} +2 -2
  14. package/dist/{FileManager-DgraLHZS.js.map → FileManager-Cze8qmS1.js.map} +1 -1
  15. package/dist/{FileManager-DSihj6Sj.js → FileManager-DSTAwkqw.js} +2 -2
  16. package/dist/{FileManager-DSihj6Sj.js.map → FileManager-DSTAwkqw.js.map} +1 -1
  17. package/dist/{ModelProperty-Bz3V3LoI.js → ModelProperty-ChevZoUy.js} +24 -24
  18. package/dist/{ModelProperty-Bz3V3LoI.js.map → ModelProperty-ChevZoUy.js.map} +1 -1
  19. package/dist/{PathResolver-DOu-0k75.js → PathResolver-3TuYA9yv.js} +2 -2
  20. package/dist/{PathResolver-DOu-0k75.js.map → PathResolver-3TuYA9yv.js.map} +1 -1
  21. package/dist/{PathResolver-DQ5hyu8X.js → PathResolver-C5gj9EU2.js} +2 -2
  22. package/dist/{PathResolver-DQ5hyu8X.js.map → PathResolver-C5gj9EU2.js.map} +1 -1
  23. package/dist/{QueryClient-DYaqIx7e.js → QueryClient-BGv6JOls.js} +2 -2
  24. package/dist/{QueryClient-DYaqIx7e.js.map → QueryClient-BGv6JOls.js.map} +1 -1
  25. package/dist/{QueryClient-CJV1m2rc.js → QueryClient-By2vdhIz.js} +2 -2
  26. package/dist/{QueryClient-CJV1m2rc.js.map → QueryClient-By2vdhIz.js.map} +1 -1
  27. package/dist/{Schema-CFMbnImW.js → Schema-BQ5W3aOW.js} +38 -38
  28. package/dist/{Schema-CFMbnImW.js.map → Schema-BQ5W3aOW.js.map} +1 -1
  29. package/dist/{SchemaValidationService-D4ZVetLE.js → SchemaValidationService-DQx83Cte.js} +2 -2
  30. package/dist/{SchemaValidationService-D4ZVetLE.js.map → SchemaValidationService-DQx83Cte.js.map} +1 -1
  31. package/dist/{backfillMetadataPropertyIds-DptGKVzG.js → backfillMetadataPropertyIds-CMsU83q9.js} +2 -2
  32. package/dist/{backfillMetadataPropertyIds-DptGKVzG.js.map → backfillMetadataPropertyIds-CMsU83q9.js.map} +1 -1
  33. package/dist/cjs/{ModelProperty-TPey_B4m.js → ModelProperty-Cuj839nX.js} +17 -17
  34. package/dist/cjs/{ModelProperty-TPey_B4m.js.map → ModelProperty-Cuj839nX.js.map} +1 -1
  35. package/dist/cjs/{Schema-B-IQEtpX.js → Schema-TFe24NNG.js} +20 -20
  36. package/dist/cjs/{Schema-B-IQEtpX.js.map → Schema-TFe24NNG.js.map} +1 -1
  37. package/dist/cjs/{SchemaValidationService-IQ0Gc9HM.js → SchemaValidationService-DVQrRpse.js} +2 -2
  38. package/dist/cjs/{SchemaValidationService-IQ0Gc9HM.js.map → SchemaValidationService-DVQrRpse.js.map} +1 -1
  39. package/dist/cjs/{backfillMetadataPropertyIds-BBPgBc2W.js → backfillMetadataPropertyIds-BiXK4hT1.js} +2 -2
  40. package/dist/cjs/{backfillMetadataPropertyIds-BBPgBc2W.js.map → backfillMetadataPropertyIds-BiXK4hT1.js.map} +1 -1
  41. package/dist/cjs/{getItem-CWf0OO0F.js → getItem-FgLv9abh.js} +2 -2
  42. package/dist/cjs/{getItem-CWf0OO0F.js.map → getItem-FgLv9abh.js.map} +1 -1
  43. package/dist/cjs/{getPublishPayload-muuS1j0F.js → getPublishPayload-h_Rz8nVX.js} +18 -10
  44. package/dist/cjs/getPublishPayload-h_Rz8nVX.js.map +1 -0
  45. package/dist/cjs/{getPublishUploads-CONYV9QQ.js → getPublishUploads-DdSwst2x.js} +4 -4
  46. package/dist/cjs/{getPublishUploads-CONYV9QQ.js.map → getPublishUploads-DdSwst2x.js.map} +1 -1
  47. package/dist/cjs/{getSegmentedItemProperties-Dl3J_uCe.js → getSegmentedItemProperties-Bu4P_MG8.js} +3 -3
  48. package/dist/cjs/{getSegmentedItemProperties-Dl3J_uCe.js.map → getSegmentedItemProperties-Bu4P_MG8.js.map} +1 -1
  49. package/dist/cjs/{index-D7a8oFJP.js → index-CKJeh6ic.js} +3 -3
  50. package/dist/cjs/index-CKJeh6ic.js.map +1 -0
  51. package/dist/cjs/{index-Bte-I6OD.js → index-pyKmk9hA.js} +161 -38
  52. package/dist/cjs/index-pyKmk9hA.js.map +1 -0
  53. package/dist/cjs/{ownership-Bxv6CUrH.js → ownership-gfm5thj7.js} +2 -2
  54. package/dist/cjs/{ownership-Bxv6CUrH.js.map → ownership-gfm5thj7.js.map} +1 -1
  55. package/dist/cjs/{property-xOF5k4ka.js → property-Dw0b_Sf8.js} +4 -4
  56. package/dist/cjs/{property-xOF5k4ka.js.map → property-Dw0b_Sf8.js.map} +1 -1
  57. package/dist/db/drizzle/drizzle/0010_add_arweave_l1_finalize_jobs.sql +16 -0
  58. package/dist/db/drizzle/drizzle/meta/0010_snapshot.json +1182 -0
  59. package/dist/db/drizzle/drizzle/meta/_journal.json +7 -0
  60. package/dist/{getItem-Hubs_yxu.js → getItem-Bd9U9Yih.js} +2 -2
  61. package/dist/{getItem-Hubs_yxu.js.map → getItem-Bd9U9Yih.js.map} +1 -1
  62. package/dist/{getPublishPayload-CqUCIlu1.js → getPublishPayload-eJL7ktes.js} +21 -13
  63. package/dist/getPublishPayload-eJL7ktes.js.map +1 -0
  64. package/dist/{getPublishUploads-QgfPyhcs.js → getPublishUploads-CKm5dsL6.js} +4 -4
  65. package/dist/{getPublishUploads-QgfPyhcs.js.map → getPublishUploads-CKm5dsL6.js.map} +1 -1
  66. package/dist/{getSegmentedItemProperties-Dzscmm_m.js → getSegmentedItemProperties-B74LN_bz.js} +3 -3
  67. package/dist/{getSegmentedItemProperties-Dzscmm_m.js.map → getSegmentedItemProperties-B74LN_bz.js.map} +1 -1
  68. package/dist/{index-QSl4EYun.js → index-BQv2k74p.js} +3 -2
  69. package/dist/index-BQv2k74p.js.map +1 -0
  70. package/dist/{index-CtzvJMAE.js → index-BvZCYMxA.js} +188 -53
  71. package/dist/index-BvZCYMxA.js.map +1 -0
  72. package/dist/{index-VmIdPfTW.js → index-BxfqPvtu.js} +3 -3
  73. package/dist/index-BxfqPvtu.js.map +1 -0
  74. package/dist/main.cjs +1 -1
  75. package/dist/main.js +55 -14
  76. package/dist/main.js.map +1 -1
  77. package/dist/node.js +10 -10
  78. package/dist/{ownership-loPNh3_a.js → ownership-tVhYQomL.js} +2 -2
  79. package/dist/{ownership-loPNh3_a.js.map → ownership-tVhYQomL.js.map} +1 -1
  80. package/dist/{property-D8HimAKw.js → property-BOdk-wW1.js} +6 -6
  81. package/dist/{property-D8HimAKw.js.map → property-BOdk-wW1.js.map} +1 -1
  82. package/dist/{queries-DPADHnwy.js → queries-DBqVwEdv.js} +2 -2
  83. package/dist/{queries-DPADHnwy.js.map → queries-DBqVwEdv.js.map} +1 -1
  84. package/dist/seedSchema/ArweaveL1FinalizeSchema.ts +28 -0
  85. package/dist/seedSchema/index.d.ts +3 -0
  86. package/dist/seedSchema/index.ts +1 -0
  87. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  88. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  89. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  90. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts +12 -0
  91. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +1 -0
  92. package/dist/src/eas.d.ts +6 -0
  93. package/dist/src/eas.d.ts.map +1 -1
  94. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  95. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +46 -0
  96. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +1 -0
  97. package/dist/src/helpers/constants.d.ts +2 -0
  98. package/dist/src/helpers/constants.d.ts.map +1 -1
  99. package/dist/src/helpers/index.d.ts +1 -0
  100. package/dist/src/helpers/index.d.ts.map +1 -1
  101. package/dist/src/index.d.ts +6 -4
  102. package/dist/src/index.d.ts.map +1 -1
  103. package/dist/src/seedSchema/ArweaveL1FinalizeSchema.d.ts +233 -0
  104. package/dist/src/seedSchema/ArweaveL1FinalizeSchema.d.ts.map +1 -0
  105. package/dist/src/seedSchema/index.d.ts +1 -0
  106. package/dist/src/seedSchema/index.d.ts.map +1 -1
  107. package/package.json +1 -1
  108. package/dist/Db-DWvxJG22.js.map +0 -1
  109. package/dist/cjs/getPublishPayload-muuS1j0F.js.map +0 -1
  110. package/dist/cjs/index-Bte-I6OD.js.map +0 -1
  111. package/dist/cjs/index-D7a8oFJP.js.map +0 -1
  112. package/dist/getPublishPayload-CqUCIlu1.js.map +0 -1
  113. package/dist/index-CtzvJMAE.js.map +0 -1
  114. package/dist/index-QSl4EYun.js.map +0 -1
  115. package/dist/index-VmIdPfTW.js.map +0 -1
@@ -626,6 +626,103 @@ async function getUploadPipelineTransactionStatus(uploadApiBaseUrl, txOrDataItem
626
626
  }
627
627
  }
628
628
 
629
+ const GATEWAY_TX_QUERY = `
630
+ query ArweaveGatewayTransaction($id: String!) {
631
+ transaction(id: $id) {
632
+ id
633
+ bundledIn {
634
+ id
635
+ }
636
+ block {
637
+ height
638
+ timestamp
639
+ }
640
+ }
641
+ }
642
+ `;
643
+ function getUploadApiArweaveStatusUrl(baseUrl, dataItemId) {
644
+ const base = normalizeUploadApiBaseUrl(baseUrl);
645
+ const id = encodeURIComponent(dataItemId);
646
+ return `${base}/api/upload/arweave/status/${id}`;
647
+ }
648
+ /**
649
+ * Whether L1 anchoring is complete per upload API status JSON.
650
+ */
651
+ function isArweaveL1AnchoringComplete(status) {
652
+ const l1 = status.l1;
653
+ if (!l1)
654
+ return false;
655
+ if (l1.meetsMinConfirmations === true)
656
+ return true;
657
+ if (l1.confirmed === true)
658
+ return true;
659
+ return false;
660
+ }
661
+ /**
662
+ * Fetches JSON from `GET /api/upload/arweave/status/{dataItemId}`.
663
+ * Returns `null` if the response is not OK or body is not JSON.
664
+ */
665
+ async function getArweaveUploadStatus(uploadApiBaseUrl, dataItemId) {
666
+ const url = getUploadApiArweaveStatusUrl(uploadApiBaseUrl, dataItemId);
667
+ try {
668
+ const response = await fetch(url);
669
+ if (!response.ok) {
670
+ return null;
671
+ }
672
+ const body = (await response.json());
673
+ return body && typeof body === 'object' ? body : null;
674
+ }
675
+ catch {
676
+ return null;
677
+ }
678
+ }
679
+ /**
680
+ * Queries an Arweave gateway GraphQL API for transaction + bundle info.
681
+ */
682
+ async function queryArweaveGatewayTransaction(graphqlUrl, dataItemId, init) {
683
+ const url = graphqlUrl.trim();
684
+ if (!url)
685
+ return null;
686
+ try {
687
+ const response = await fetch(url, {
688
+ method: 'POST',
689
+ headers: {
690
+ 'Content-Type': 'application/json',
691
+ },
692
+ body: JSON.stringify({
693
+ query: GATEWAY_TX_QUERY,
694
+ variables: { id: dataItemId },
695
+ }),
696
+ signal: init?.signal,
697
+ });
698
+ if (!response.ok) {
699
+ return null;
700
+ }
701
+ const json = (await response.json());
702
+ if (json.errors) {
703
+ return null;
704
+ }
705
+ const tx = json.data?.transaction;
706
+ if (!tx) {
707
+ return {
708
+ transactionId: null,
709
+ bundledInId: null,
710
+ blockHeight: null,
711
+ blockTimestamp: null,
712
+ };
713
+ }
714
+ return {
715
+ transactionId: typeof tx.id === 'string' ? tx.id : null,
716
+ bundledInId: tx.bundledIn?.id != null ? String(tx.bundledIn.id) : null,
717
+ blockHeight: tx.block?.height ?? null,
718
+ blockTimestamp: tx.block?.timestamp ?? null,
719
+ };
720
+ }
721
+ catch {
722
+ return null;
723
+ }
724
+ }
725
+
629
726
  class BaseEasClient {
630
727
  static setPlatformClass(platformClass) {
631
728
  if (!platformClass) {
@@ -1284,6 +1381,7 @@ var index = /*#__PURE__*/Object.freeze({
1284
1381
  convertTxIdToImage: convertTxIdToImage,
1285
1382
  generateId: generateId,
1286
1383
  getAlternatePropertyNameForInstanceLookup: getAlternatePropertyNameForInstanceLookup,
1384
+ getArweaveUploadStatus: getArweaveUploadStatus,
1287
1385
  getArweaveUrlForTransaction: getArweaveUrlForTransaction,
1288
1386
  getCorrectId: getCorrectId,
1289
1387
  getDataTypeFromString: getDataTypeFromString,
@@ -1295,9 +1393,11 @@ var index = /*#__PURE__*/Object.freeze({
1295
1393
  getPublisherForNewSeedsWithTimeout: getPublisherForNewSeedsWithTimeout,
1296
1394
  getRevokeExecutor: getRevokeExecutor,
1297
1395
  getUploadApiArweaveDataUrl: getUploadApiArweaveDataUrl,
1396
+ getUploadApiArweaveStatusUrl: getUploadApiArweaveStatusUrl,
1298
1397
  getUploadExecutor: getUploadExecutor,
1299
1398
  getUploadPipelineTransactionStatus: getUploadPipelineTransactionStatus,
1300
1399
  identifyString: identifyString,
1400
+ isArweaveL1AnchoringComplete: isArweaveL1AnchoringComplete,
1301
1401
  isBinary: isBinary,
1302
1402
  listRelationStoragePropertyName: listRelationStoragePropertyName,
1303
1403
  needsMetadataIdSuffix: needsMetadataIdSuffix,
@@ -1305,6 +1405,7 @@ var index = /*#__PURE__*/Object.freeze({
1305
1405
  normalizeUploadApiBaseUrl: normalizeUploadApiBaseUrl,
1306
1406
  parseEasRelationPropertyName: parseEasRelationPropertyName,
1307
1407
  pickLatestPropertyAttestationsByRefAndSchema: pickLatestPropertyAttestationsByRefAndSchema,
1408
+ queryArweaveGatewayTransaction: queryArweaveGatewayTransaction,
1308
1409
  resolveMetadataRecord: resolveMetadataRecord,
1309
1410
  resolveSeedIdsFromRefString: resolveSeedIdsFromRefString,
1310
1411
  resolveStorageNameToSchemaName: resolveStorageNameToSchemaName,
@@ -1330,7 +1431,7 @@ const createPropertyInstances = async (propertyFileIds) => {
1330
1431
  return;
1331
1432
  }
1332
1433
  try {
1333
- const mod = await Promise.resolve().then(function () { return require('./ModelProperty-TPey_B4m.js'); });
1434
+ const mod = await Promise.resolve().then(function () { return require('./ModelProperty-Cuj839nX.js'); });
1334
1435
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
1335
1436
  if (!ModelProperty) {
1336
1437
  logger$y('createPropertyInstances: ModelProperty not available from dynamic import');
@@ -1514,7 +1615,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context } })
1514
1615
  // Step 2: Fallback to Schema context (only if database doesn't have the model)
1515
1616
  // This handles the case where model exists in schema file but not yet in database
1516
1617
  try {
1517
- const schemaMod = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
1618
+ const schemaMod = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
1518
1619
  const { Schema } = schemaMod;
1519
1620
  const schema = Schema.create(schemaName, { waitForReady: false });
1520
1621
  const schemaSnapshot = schema.getService().getSnapshot();
@@ -1758,7 +1859,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context } })
1758
1859
  }
1759
1860
  // Mark schema as draft when a new model is created so saveNewVersion() can persist it
1760
1861
  try {
1761
- const schemaMod = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
1862
+ const schemaMod = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
1762
1863
  const { Schema } = schemaMod;
1763
1864
  const schema = Schema.create(schemaName, { waitForReady: false });
1764
1865
  schema.getService().send({ type: 'markAsDraft', propertyKey: 'schema:models' });
@@ -1802,10 +1903,10 @@ const validateModel = xstate.fromCallback(({ sendBack, input: { context } }) =>
1802
1903
  const _validateModel = async () => {
1803
1904
  try {
1804
1905
  // Use dynamic imports to break circular dependencies
1805
- const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
1906
+ const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
1806
1907
  const { SchemaValidationService } = validationServiceMod;
1807
1908
  const validationService = new SchemaValidationService();
1808
- const schemaMod = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
1909
+ const schemaMod = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
1809
1910
  const { Schema } = schemaMod;
1810
1911
  // Validate model structure
1811
1912
  const structureResult = validationService.validateModelStructure(context);
@@ -1915,7 +2016,7 @@ const createModelProperties = xstate.fromCallback(({ sendBack, input }) => {
1915
2016
  return;
1916
2017
  }
1917
2018
  logger$w(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
1918
- const mod = await Promise.resolve().then(function () { return require('./ModelProperty-TPey_B4m.js'); });
2019
+ const mod = await Promise.resolve().then(function () { return require('./ModelProperty-Cuj839nX.js'); });
1919
2020
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
1920
2021
  if (!ModelProperty) {
1921
2022
  logger$w('ModelProperty not available from dynamic import');
@@ -2019,7 +2120,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
2019
2120
  const structureMsg = `[validateEntity] Validating model structure`;
2020
2121
  logger$v(structureMsg);
2021
2122
  // Use existing Model validation
2022
- const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
2123
+ const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
2023
2124
  const { SchemaValidationService } = validationServiceMod;
2024
2125
  const validationService = new SchemaValidationService();
2025
2126
  // Validate model structure
@@ -2037,7 +2138,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
2037
2138
  if (entityInput.entityData.schemaName) {
2038
2139
  try {
2039
2140
  logger$v(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
2040
- const schemaMod = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
2141
+ const schemaMod = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
2041
2142
  const { Schema } = schemaMod;
2042
2143
  const schema = Schema.create(entityInput.entityData.schemaName, {
2043
2144
  waitForReady: false,
@@ -2073,7 +2174,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
2073
2174
  }
2074
2175
  else if (entityInput.entityType === 'modelProperty') {
2075
2176
  // Use existing ModelProperty validation
2076
- const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
2177
+ const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
2077
2178
  const { SchemaValidationService } = validationServiceMod;
2078
2179
  const validationService = new SchemaValidationService();
2079
2180
  // Validate property structure
@@ -2088,7 +2189,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
2088
2189
  // If schema name and model name provided, validate against schema
2089
2190
  if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
2090
2191
  try {
2091
- const schemaMod = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
2192
+ const schemaMod = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
2092
2193
  const { Schema } = schemaMod;
2093
2194
  const schema = Schema.create(entityInput.entityData._schemaName, {
2094
2195
  waitForReady: false,
@@ -2117,7 +2218,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
2117
2218
  }
2118
2219
  else if (entityInput.entityType === 'schema') {
2119
2220
  // Schema validation - use existing validation
2120
- const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
2221
+ const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
2121
2222
  const { SchemaValidationService } = validationServiceMod;
2122
2223
  const validationService = new SchemaValidationService();
2123
2224
  const schemaResult = validationService.validateSchema(entityInput.entityData);
@@ -2300,9 +2401,30 @@ const uploadProcesses = sqliteCore.sqliteTable('upload_processes', {
2300
2401
  updatedAt: sqliteCore.int('updated_at'),
2301
2402
  });
2302
2403
 
2404
+ /** Background job: resolve L1 tx id and wait for L1 confirmation after bundler publish. */
2405
+ const arweaveL1FinalizeJobs = sqliteCore.sqliteTable('arweave_l1_finalize_jobs', {
2406
+ id: sqliteCore.int('id').primaryKey({ autoIncrement: true }),
2407
+ seedLocalId: sqliteCore.text('seed_local_id').notNull(),
2408
+ dataItemId: sqliteCore.text('data_item_id').notNull(),
2409
+ /** L1 bundle / anchor transaction id from gateway GraphQL `bundledIn.id`. */
2410
+ l1TransactionId: sqliteCore.text('l1_transaction_id'),
2411
+ bundleId: sqliteCore.text('bundle_id'),
2412
+ versionLocalId: sqliteCore.text('version_local_id'),
2413
+ itemPropertyName: sqliteCore.text('item_property_name'),
2414
+ /** `pending_l1` | `confirmed` | `failed` */
2415
+ phase: sqliteCore.text('phase').notNull(),
2416
+ statusJson: sqliteCore.text('status_json'),
2417
+ errorMessage: sqliteCore.text('error_message'),
2418
+ createdAt: sqliteCore.int('created_at').notNull(),
2419
+ updatedAt: sqliteCore.int('updated_at').notNull(),
2420
+ }, (table) => ({
2421
+ dataItemIdUnique: sqliteCore.uniqueIndex('arweave_l1_finalize_jobs_data_item_id_unique').on(table.dataItemId),
2422
+ }));
2423
+
2303
2424
  var schema$1 = /*#__PURE__*/Object.freeze({
2304
2425
  __proto__: null,
2305
2426
  appState: appState,
2427
+ arweaveL1FinalizeJobs: arweaveL1FinalizeJobs,
2306
2428
  config: config,
2307
2429
  metadata: metadata$1,
2308
2430
  modelRelations: modelRelations,
@@ -4244,7 +4366,7 @@ const writeToDatabase = xstate.fromCallback(({ sendBack, input }) => {
4244
4366
  // initial write completes is not overwritten by the stale requestWrite payload.
4245
4367
  let dataToWrite = input.entityData;
4246
4368
  try {
4247
- const mod = await Promise.resolve().then(function () { return require('./ModelProperty-TPey_B4m.js'); });
4369
+ const mod = await Promise.resolve().then(function () { return require('./ModelProperty-Cuj839nX.js'); });
4248
4370
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
4249
4371
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
4250
4372
  const instance = ModelProperty.getById(input.entityId);
@@ -4624,7 +4746,7 @@ const modelMachine = xstate.setup({
4624
4746
  // Create ModelProperty instances for any new property IDs
4625
4747
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
4626
4748
  // Import and create instances asynchronously (fire-and-forget)
4627
- Promise.resolve().then(function () { return require('./ModelProperty-TPey_B4m.js'); }).then(({ ModelProperty }) => {
4749
+ Promise.resolve().then(function () { return require('./ModelProperty-Cuj839nX.js'); }).then(({ ModelProperty }) => {
4628
4750
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
4629
4751
  try {
4630
4752
  const property = await ModelProperty.createById(propertyFileId);
@@ -5869,7 +5991,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
5869
5991
  const schemaNameToTry = model$1?.schemaName;
5870
5992
  if (schemaNameToTry) {
5871
5993
  try {
5872
- const { Schema } = await Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); });
5994
+ const { Schema } = await Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); });
5873
5995
  const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
5874
5996
  const schemaContext = schemaInstance.getService().getSnapshot().context;
5875
5997
  if (schemaContext.models?.[modelName]?.properties) {
@@ -5918,7 +6040,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
5918
6040
  }
5919
6041
  }
5920
6042
  if (Object.keys(propertySchemas).length === 0) {
5921
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
6043
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
5922
6044
  const { ModelPropertyDataTypes } = schemaMod;
5923
6045
  const KNOWN_MODEL_FALLBACKS = {
5924
6046
  Post: {
@@ -5967,7 +6089,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
5967
6089
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
5968
6090
  let propSchema = propertySchemas[propertyName];
5969
6091
  if (!propSchema && isRefTypeFromMeta) {
5970
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
6092
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
5971
6093
  const { ModelPropertyDataTypes } = schemaMod;
5972
6094
  propSchema = {
5973
6095
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -6215,9 +6337,9 @@ const runPublish = xstate.fromCallback(({ sendBack, input: { context } }) => {
6215
6337
  sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
6216
6338
  return;
6217
6339
  }
6218
- const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-CONYV9QQ.js'); });
6340
+ const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-DdSwst2x.js'); });
6219
6341
  const { getPublishUploads } = getPublishUploadsMod;
6220
- const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-muuS1j0F.js'); });
6342
+ const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-h_Rz8nVX.js'); });
6221
6343
  const { getPublishPayload } = getPublishPayloadMod;
6222
6344
  const uploads = await getPublishUploads(item);
6223
6345
  let uploadedTransactions = [];
@@ -6982,7 +7104,7 @@ const resolveRelatedValue = xstate.fromCallback(({ sendBack, input: { context }
6982
7104
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
6983
7105
  const _resolveRelatedValue = async () => {
6984
7106
  // Use dynamic import to break circular dependency
6985
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
7107
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
6986
7108
  const { ModelPropertyDataTypes } = schemaMod;
6987
7109
  if (!propertyValue || !isRelation || populatedFromDb) {
6988
7110
  return;
@@ -7358,7 +7480,7 @@ const hydrateFromDb = xstate.fromCallback(({ sendBack, input: { context } }) =>
7358
7480
  // to use dynamically imported ModelPropertyDataTypes
7359
7481
  const _hydrateFromDb = async () => {
7360
7482
  // Use dynamic import to break circular dependency
7361
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
7483
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
7362
7484
  const { ModelPropertyDataTypes } = schemaMod;
7363
7485
  const appDb = BaseDb.getAppDb();
7364
7486
  const whereClauses = [];
@@ -7663,7 +7785,7 @@ const loadOrCreateProperty = xstate.fromCallback(({ sendBack, input: { context }
7663
7785
  };
7664
7786
  // Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
7665
7787
  try {
7666
- const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-xOF5k4ka.js'); });
7788
+ const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-Dw0b_Sf8.js'); });
7667
7789
  let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName);
7668
7790
  if (!schemaFromFile?.validation) {
7669
7791
  // Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
@@ -8047,9 +8169,9 @@ const analyzeInput = xstate.fromCallback(({ sendBack, input: { context, event }
8047
8169
  }
8048
8170
  const _analyzeInput = async () => {
8049
8171
  // Use dynamic import to break circular dependency
8050
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
8172
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
8051
8173
  const { ModelPropertyDataTypes } = schemaMod;
8052
- const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
8174
+ const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
8053
8175
  let propertyName = propertyNameRaw;
8054
8176
  if (!propertyName) {
8055
8177
  throw new Error('propertyName is required');
@@ -8247,7 +8369,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
8247
8369
  propertyRecordSchema?.validation &&
8248
8370
  metadataValues.propertyValue != null &&
8249
8371
  metadataValues.propertyValue !== '') {
8250
- const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-IQ0Gc9HM.js'); });
8372
+ const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-DVQrRpse.js'); });
8251
8373
  const validationService = new SchemaValidationService();
8252
8374
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, propertyRecordSchema.dataType, propertyRecordSchema.validation, propertyRecordSchema.refValueType);
8253
8375
  if (!validationResult.isValid && validationResult.errors.length > 0) {
@@ -8834,7 +8956,7 @@ const saveRelation = xstate.fromCallback(({ sendBack, input: { context, event }
8834
8956
  }
8835
8957
  const _saveRelation = async () => {
8836
8958
  // Use dynamic import to break circular dependency
8837
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
8959
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
8838
8960
  const { ModelPropertyDataTypes } = schemaMod;
8839
8961
  if (!propertyNameRaw) {
8840
8962
  throw new Error('propertyName is required');
@@ -9866,7 +9988,7 @@ class ItemProperty {
9866
9988
  return;
9867
9989
  }
9868
9990
  // Use dynamic import to break circular dependency
9869
- const schemaMod = await Promise.resolve().then(function () { return require('./index-D7a8oFJP.js'); });
9991
+ const schemaMod = await Promise.resolve().then(function () { return require('./index-CKJeh6ic.js'); });
9870
9992
  const { ModelPropertyDataTypes } = schemaMod;
9871
9993
  const { context } = snapshot;
9872
9994
  const { propertyRecordSchema } = context;
@@ -10723,7 +10845,7 @@ class ItemProperty {
10723
10845
  }
10724
10846
  async save() {
10725
10847
  const ctx = this._getSnapshotContext();
10726
- const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-Bxv6CUrH.js'); });
10848
+ const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-gfm5thj7.js'); });
10727
10849
  await assertItemOwned({
10728
10850
  seedLocalId: ctx?.seedLocalId ?? undefined,
10729
10851
  seedUid: ctx?.seedUid ?? undefined,
@@ -11061,7 +11183,7 @@ class Item {
11061
11183
  });
11062
11184
  };
11063
11185
  this.unpublish = async () => {
11064
- const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-Bxv6CUrH.js'); });
11186
+ const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-gfm5thj7.js'); });
11065
11187
  const { getRevokeExecutor } = await Promise.resolve().then(function () { return publishConfig; });
11066
11188
  await assertItemOwned(this);
11067
11189
  const seedUid = this.seedUid;
@@ -11085,7 +11207,7 @@ class Item {
11085
11207
  this._service.send({ type: 'updateContext', revokedAt });
11086
11208
  };
11087
11209
  this.publish = async () => {
11088
- const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-Bxv6CUrH.js'); });
11210
+ const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-gfm5thj7.js'); });
11089
11211
  await assertItemOwned(this);
11090
11212
  this._service.send({ type: 'startPublish' });
11091
11213
  return new Promise((resolve, reject) => {
@@ -11121,12 +11243,12 @@ class Item {
11121
11243
  };
11122
11244
  this.getPublishUploads = async () => {
11123
11245
  // Use dynamic import to break circular dependency
11124
- const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-CONYV9QQ.js'); });
11246
+ const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-DdSwst2x.js'); });
11125
11247
  const { getPublishUploads } = getPublishUploadsMod;
11126
11248
  return await getPublishUploads(this);
11127
11249
  };
11128
11250
  this.getPublishPayload = async (uploadedTransactions, options) => {
11129
- const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-muuS1j0F.js'); });
11251
+ const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-h_Rz8nVX.js'); });
11130
11252
  const { getPublishPayload } = getPublishPayloadMod;
11131
11253
  return await getPublishPayload(this, uploadedTransactions, options);
11132
11254
  };
@@ -12326,7 +12448,7 @@ class Item {
12326
12448
  * Destroy the item: soft delete in DB, remove from caches, clean up subscriptions, stop service.
12327
12449
  */
12328
12450
  async destroy() {
12329
- const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-Bxv6CUrH.js'); });
12451
+ const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-gfm5thj7.js'); });
12330
12452
  await assertItemOwned(this);
12331
12453
  const context = this._getSnapshotContext();
12332
12454
  const cacheKey = context.seedUid || context.seedLocalId;
@@ -12970,10 +13092,11 @@ const runSyncFromEas = async (options) => {
12970
13092
  const { versionUids } = await saveEasVersionsToDb({
12971
13093
  itemVersions,
12972
13094
  });
12973
- const itemProperties = await getItemPropertiesFromEas({
13095
+ const rawProperties = await getItemPropertiesFromEas({
12974
13096
  versionUids,
12975
13097
  excludeRevoked: false,
12976
13098
  });
13099
+ const itemProperties = pickLatestPropertyAttestationsByRefAndSchema(rawProperties);
12977
13100
  await saveEasPropertiesToDb({
12978
13101
  itemProperties,
12979
13102
  itemSeeds,
@@ -16500,7 +16623,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
16500
16623
  // Lazy import cache for ModelProperty to avoid circular dependency
16501
16624
  // Eagerly start loading to minimize delay on first access
16502
16625
  let ModelPropertyClass = null;
16503
- const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-TPey_B4m.js'); })
16626
+ const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-Cuj839nX.js'); })
16504
16627
  .then(module => {
16505
16628
  ModelPropertyClass = module.ModelProperty;
16506
16629
  return ModelPropertyClass;
@@ -16517,7 +16640,7 @@ function getModelProperty() {
16517
16640
  }
16518
16641
  // Lazy import cache for Schema to avoid circular dependency
16519
16642
  let SchemaClass = null;
16520
- const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-B-IQEtpX.js'); })
16643
+ const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-TFe24NNG.js'); })
16521
16644
  .then(module => {
16522
16645
  SchemaClass = module.Schema;
16523
16646
  return SchemaClass;
@@ -18471,7 +18594,7 @@ class Db extends BaseDb {
18471
18594
  // You can inspect what will happen before applying
18472
18595
  await apply();
18473
18596
  this.db = db;
18474
- const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-BBPgBc2W.js'); });
18597
+ const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-BiXK4hT1.js'); });
18475
18598
  await backfillMetadataPropertyIds();
18476
18599
  return this.db;
18477
18600
  }
@@ -19118,7 +19241,7 @@ const getTsImport = async (filePath) => {
19118
19241
 
19119
19242
  // Get the directory of this file to resolve relative paths
19120
19243
  // @ts-ignore - rollup plugin-typescript doesn't recognize import.meta with module: "preserve"
19121
- const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-Bte-I6OD.js', document.baseURI).href)));
19244
+ const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-pyKmk9hA.js', document.baseURI).href)));
19122
19245
  path.dirname(__filename$1);
19123
19246
  const commandExists = (command) => {
19124
19247
  try {
@@ -19693,4 +19816,4 @@ exports.versions = versions;
19693
19816
  exports.waitForEntityIdle = waitForEntityIdle;
19694
19817
  exports.withSeed = withSeed;
19695
19818
  exports.writeProcessMachine = writeProcessMachine;
19696
- //# sourceMappingURL=index-Bte-I6OD.js.map
19819
+ //# sourceMappingURL=index-pyKmk9hA.js.map