@seedprotocol/sdk 0.4.10 → 0.4.11

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 (88) hide show
  1. package/dist/{ArweaveClient-sN5h2FvY.js → ArweaveClient-CwXE3NCK.js} +3 -3
  2. package/dist/{ArweaveClient-sN5h2FvY.js.map → ArweaveClient-CwXE3NCK.js.map} +1 -1
  3. package/dist/{ArweaveClient-DFqnm5Kj.js → ArweaveClient-DyhvHiIT.js} +3 -3
  4. package/dist/{ArweaveClient-DFqnm5Kj.js.map → ArweaveClient-DyhvHiIT.js.map} +1 -1
  5. package/dist/{Db-DIythELU.js → Db-Dr6gWq8d.js} +3 -3
  6. package/dist/{Db-DIythELU.js.map → Db-Dr6gWq8d.js.map} +1 -1
  7. package/dist/{Db-Dz17KxVs.js → Db-mH9nSDfI.js} +3 -3
  8. package/dist/{Db-Dz17KxVs.js.map → Db-mH9nSDfI.js.map} +1 -1
  9. package/dist/{EasClient-BadfcFDk.js → EasClient-Yh-t7zEA.js} +2 -2
  10. package/dist/{EasClient-DosbWaZN.js.map → EasClient-Yh-t7zEA.js.map} +1 -1
  11. package/dist/{EasClient-DosbWaZN.js → EasClient-aggdMFrc.js} +2 -2
  12. package/dist/{EasClient-BadfcFDk.js.map → EasClient-aggdMFrc.js.map} +1 -1
  13. package/dist/{FileManager-Wthr5yHO.js → FileManager-ClU_rIR0.js} +2 -2
  14. package/dist/{FileManager-Wthr5yHO.js.map → FileManager-ClU_rIR0.js.map} +1 -1
  15. package/dist/{FileManager-BHuVNWT3.js → FileManager-Dl2DD4Uc.js} +2 -2
  16. package/dist/{FileManager-BHuVNWT3.js.map → FileManager-Dl2DD4Uc.js.map} +1 -1
  17. package/dist/{ModelProperty-B9Z2DRxI.js → ModelProperty-gBmew8gY.js} +94 -18
  18. package/dist/ModelProperty-gBmew8gY.js.map +1 -0
  19. package/dist/{PathResolver-NEpTSgQK.js → PathResolver-CILJPhz1.js} +2 -2
  20. package/dist/{PathResolver-NEpTSgQK.js.map → PathResolver-CILJPhz1.js.map} +1 -1
  21. package/dist/{PathResolver-Cd1PZDLG.js → PathResolver-CfA_D3wa.js} +2 -2
  22. package/dist/{PathResolver-Cd1PZDLG.js.map → PathResolver-CfA_D3wa.js.map} +1 -1
  23. package/dist/{QueryClient-C9U8oZUe.js → QueryClient-BdpWYoxo.js} +2 -2
  24. package/dist/{QueryClient-C9U8oZUe.js.map → QueryClient-BdpWYoxo.js.map} +1 -1
  25. package/dist/{QueryClient-ndmA8MYL.js → QueryClient-Dl_P8u5s.js} +2 -2
  26. package/dist/{QueryClient-ndmA8MYL.js.map → QueryClient-Dl_P8u5s.js.map} +1 -1
  27. package/dist/{Schema-D1-HjT8z.js → Schema-B-vCLIuU.js} +21 -21
  28. package/dist/{Schema-D1-HjT8z.js.map → Schema-B-vCLIuU.js.map} +1 -1
  29. package/dist/{SchemaValidationService-CIXKzSpb.js → SchemaValidationService-C_iTQIjR.js} +2 -2
  30. package/dist/{SchemaValidationService-CIXKzSpb.js.map → SchemaValidationService-C_iTQIjR.js.map} +1 -1
  31. package/dist/cjs/{ModelProperty-09hNvSBl.js → ModelProperty-DcAM5M8T.js} +94 -18
  32. package/dist/cjs/ModelProperty-DcAM5M8T.js.map +1 -0
  33. package/dist/cjs/{Schema-BcwvUABB.js → Schema-B6ifYEhD.js} +20 -20
  34. package/dist/cjs/{Schema-BcwvUABB.js.map → Schema-B6ifYEhD.js.map} +1 -1
  35. package/dist/cjs/{SchemaValidationService-zty4nfCu.js → SchemaValidationService-OFyzZIUX.js} +2 -2
  36. package/dist/cjs/{SchemaValidationService-zty4nfCu.js.map → SchemaValidationService-OFyzZIUX.js.map} +1 -1
  37. package/dist/cjs/{getItem-Dlb5YSQn.js → getItem-CAYQYTpg.js} +2 -2
  38. package/dist/cjs/{getItem-Dlb5YSQn.js.map → getItem-CAYQYTpg.js.map} +1 -1
  39. package/dist/cjs/{getPublishPayload-BqL06sEI.js → getPublishPayload-CBuGIazw.js} +5 -5
  40. package/dist/cjs/{getPublishPayload-BqL06sEI.js.map → getPublishPayload-CBuGIazw.js.map} +1 -1
  41. package/dist/cjs/{getPublishUploads-oukGI2N6.js → getPublishUploads-B7bB1OGg.js} +3 -3
  42. package/dist/cjs/{getPublishUploads-oukGI2N6.js.map → getPublishUploads-B7bB1OGg.js.map} +1 -1
  43. package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js → getSegmentedItemProperties-MVZ-0mQG.js} +2 -2
  44. package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js.map → getSegmentedItemProperties-MVZ-0mQG.js.map} +1 -1
  45. package/dist/cjs/{index-jubgGeM2.js → index-6P4MEsbO.js} +2 -2
  46. package/dist/cjs/index-6P4MEsbO.js.map +1 -0
  47. package/dist/cjs/{index-BLETlVgA.js → index-CA4i5TA7.js} +105 -46
  48. package/dist/cjs/index-CA4i5TA7.js.map +1 -0
  49. package/dist/cjs/{ownership-vfvyz3KJ.js → ownership-5TQ-v2CF.js} +2 -2
  50. package/dist/cjs/{ownership-vfvyz3KJ.js.map → ownership-5TQ-v2CF.js.map} +1 -1
  51. package/dist/{getItem-f9rNUz7I.js → getItem-xpxRXqHI.js} +2 -2
  52. package/dist/{getItem-f9rNUz7I.js.map → getItem-xpxRXqHI.js.map} +1 -1
  53. package/dist/{getPublishPayload-BBI_j9I2.js → getPublishPayload-CBeCMSeQ.js} +5 -5
  54. package/dist/{getPublishPayload-BBI_j9I2.js.map → getPublishPayload-CBeCMSeQ.js.map} +1 -1
  55. package/dist/{getPublishUploads-BFM94w5S.js → getPublishUploads-NITxWWDD.js} +3 -3
  56. package/dist/{getPublishUploads-BFM94w5S.js.map → getPublishUploads-NITxWWDD.js.map} +1 -1
  57. package/dist/{getSegmentedItemProperties-Di9vevKz.js → getSegmentedItemProperties-CYzNtJxH.js} +2 -2
  58. package/dist/{getSegmentedItemProperties-Di9vevKz.js.map → getSegmentedItemProperties-CYzNtJxH.js.map} +1 -1
  59. package/dist/{index-CSAVWKeA.js → index-BC0xKxkf.js} +3 -3
  60. package/dist/index-BC0xKxkf.js.map +1 -0
  61. package/dist/{index-j8WN8W6V.js → index-B_apqB1Q.js} +120 -61
  62. package/dist/index-B_apqB1Q.js.map +1 -0
  63. package/dist/{index-ajj6SHkh.js → index-CcXvJ2H7.js} +2 -2
  64. package/dist/index-CcXvJ2H7.js.map +1 -0
  65. package/dist/main.cjs +1 -1
  66. package/dist/main.js +11 -11
  67. package/dist/node.js +10 -10
  68. package/dist/{ownership-DLNI17NE.js → ownership-C7Afj3yr.js} +2 -2
  69. package/dist/{ownership-DLNI17NE.js.map → ownership-C7Afj3yr.js.map} +1 -1
  70. package/dist/{property-C6qoOzLG.js → property-C2gviIFJ.js} +4 -4
  71. package/dist/{property-C6qoOzLG.js.map → property-C2gviIFJ.js.map} +1 -1
  72. package/dist/{queries-jMaUn86w.js → queries-BFzkFn4Y.js} +2 -2
  73. package/dist/{queries-jMaUn86w.js.map → queries-BFzkFn4Y.js.map} +1 -1
  74. package/dist/src/ModelProperty/ModelProperty.d.ts +5 -0
  75. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  76. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  77. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  78. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  79. package/dist/src/helpers/db.d.ts.map +1 -1
  80. package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
  81. package/package.json +1 -1
  82. package/dist/ModelProperty-B9Z2DRxI.js.map +0 -1
  83. package/dist/cjs/ModelProperty-09hNvSBl.js.map +0 -1
  84. package/dist/cjs/index-BLETlVgA.js.map +0 -1
  85. package/dist/cjs/index-jubgGeM2.js.map +0 -1
  86. package/dist/index-CSAVWKeA.js.map +0 -1
  87. package/dist/index-ajj6SHkh.js.map +0 -1
  88. package/dist/index-j8WN8W6V.js.map +0 -1
@@ -770,7 +770,7 @@ const createPropertyInstances = async (propertyFileIds) => {
770
770
  return;
771
771
  }
772
772
  try {
773
- const mod = await import('./ModelProperty-B9Z2DRxI.js');
773
+ const mod = await import('./ModelProperty-gBmew8gY.js');
774
774
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
775
775
  if (!ModelProperty) {
776
776
  logger$s('createPropertyInstances: ModelProperty not available from dynamic import');
@@ -954,7 +954,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
954
954
  // Step 2: Fallback to Schema context (only if database doesn't have the model)
955
955
  // This handles the case where model exists in schema file but not yet in database
956
956
  try {
957
- const _mod_0 = await import('./Schema-D1-HjT8z.js');
957
+ const _mod_0 = await import('./Schema-B-vCLIuU.js');
958
958
  const _ns_0 = _mod_0.b;
959
959
  const schemaMod = _ns_0;
960
960
  const { Schema } = schemaMod;
@@ -1200,7 +1200,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
1200
1200
  }
1201
1201
  // Mark schema as draft when a new model is created so saveNewVersion() can persist it
1202
1202
  try {
1203
- const _mod_1 = await import('./Schema-D1-HjT8z.js');
1203
+ const _mod_1 = await import('./Schema-B-vCLIuU.js');
1204
1204
  const _ns_1 = _mod_1.b;
1205
1205
  const schemaMod = _ns_1;
1206
1206
  const { Schema } = schemaMod;
@@ -1246,10 +1246,10 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
1246
1246
  const _validateModel = async () => {
1247
1247
  try {
1248
1248
  // Use dynamic imports to break circular dependencies
1249
- const validationServiceMod = await import('./SchemaValidationService-CIXKzSpb.js');
1249
+ const validationServiceMod = await import('./SchemaValidationService-C_iTQIjR.js');
1250
1250
  const { SchemaValidationService } = validationServiceMod;
1251
1251
  const validationService = new SchemaValidationService();
1252
- const _mod_2 = await import('./Schema-D1-HjT8z.js');
1252
+ const _mod_2 = await import('./Schema-B-vCLIuU.js');
1253
1253
  const _ns_2 = _mod_2.b;
1254
1254
  const schemaMod = _ns_2;
1255
1255
  const { Schema } = schemaMod;
@@ -1361,7 +1361,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
1361
1361
  return;
1362
1362
  }
1363
1363
  logger$q(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
1364
- const mod = await import('./ModelProperty-B9Z2DRxI.js');
1364
+ const mod = await import('./ModelProperty-gBmew8gY.js');
1365
1365
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
1366
1366
  if (!ModelProperty) {
1367
1367
  logger$q('ModelProperty not available from dynamic import');
@@ -1464,7 +1464,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1464
1464
  const structureMsg = `[validateEntity] Validating model structure`;
1465
1465
  logger$p(structureMsg);
1466
1466
  // Use existing Model validation
1467
- const validationServiceMod = await import('./SchemaValidationService-CIXKzSpb.js');
1467
+ const validationServiceMod = await import('./SchemaValidationService-C_iTQIjR.js');
1468
1468
  const { SchemaValidationService } = validationServiceMod;
1469
1469
  const validationService = new SchemaValidationService();
1470
1470
  // Validate model structure
@@ -1482,7 +1482,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1482
1482
  if (entityInput.entityData.schemaName) {
1483
1483
  try {
1484
1484
  logger$p(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
1485
- const _mod_3 = await import('./Schema-D1-HjT8z.js');
1485
+ const _mod_3 = await import('./Schema-B-vCLIuU.js');
1486
1486
  const _ns_3 = _mod_3.b;
1487
1487
  const schemaMod = _ns_3;
1488
1488
  const { Schema } = schemaMod;
@@ -1520,7 +1520,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1520
1520
  }
1521
1521
  else if (entityInput.entityType === 'modelProperty') {
1522
1522
  // Use existing ModelProperty validation
1523
- const validationServiceMod = await import('./SchemaValidationService-CIXKzSpb.js');
1523
+ const validationServiceMod = await import('./SchemaValidationService-C_iTQIjR.js');
1524
1524
  const { SchemaValidationService } = validationServiceMod;
1525
1525
  const validationService = new SchemaValidationService();
1526
1526
  // Validate property structure
@@ -1535,7 +1535,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1535
1535
  // If schema name and model name provided, validate against schema
1536
1536
  if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
1537
1537
  try {
1538
- const _mod_4 = await import('./Schema-D1-HjT8z.js');
1538
+ const _mod_4 = await import('./Schema-B-vCLIuU.js');
1539
1539
  const _ns_4 = _mod_4.b;
1540
1540
  const schemaMod = _ns_4;
1541
1541
  const { Schema } = schemaMod;
@@ -1566,7 +1566,7 @@ const validateEntity = fromPromise(async ({ input }) => {
1566
1566
  }
1567
1567
  else if (entityInput.entityType === 'schema') {
1568
1568
  // Schema validation - use existing validation
1569
- const validationServiceMod = await import('./SchemaValidationService-CIXKzSpb.js');
1569
+ const validationServiceMod = await import('./SchemaValidationService-C_iTQIjR.js');
1570
1570
  const { SchemaValidationService } = validationServiceMod;
1571
1571
  const validationService = new SchemaValidationService();
1572
1572
  const schemaResult = validationService.validateSchema(entityInput.entityData);
@@ -2184,7 +2184,7 @@ async function checkIfPropertyIsEdited(modelName, propertyName, schemaFileValue)
2184
2184
  const cacheKey = `${modelName}:${propertyName}`;
2185
2185
  // First, check the in-memory cache (for current session edits)
2186
2186
  // Robust dynamic import for consumer re-bundling (named or default export)
2187
- const mod = await import('./ModelProperty-B9Z2DRxI.js');
2187
+ const mod = await import('./ModelProperty-gBmew8gY.js');
2188
2188
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
2189
2189
  if (!ModelProperty) {
2190
2190
  logger$o('ModelProperty not available from dynamic import');
@@ -2747,23 +2747,58 @@ const savePropertyToDb = async (property) => {
2747
2747
  if (!db) {
2748
2748
  throw new Error('Database not found');
2749
2749
  }
2750
- if (!property.modelName || !property.name) {
2751
- throw new Error('Model name and property name are required');
2750
+ if (!property.name) {
2751
+ throw new Error('Property name is required');
2752
2752
  }
2753
- // Find the model
2754
- const modelRecords = await db
2755
- .select()
2756
- .from(models$1)
2757
- .where(eq(models$1.name, property.modelName))
2758
- .limit(1);
2759
- if (modelRecords.length === 0) {
2760
- throw new Error(`Model ${property.modelName} not found in database`);
2753
+ // Find the model: prefer modelId (reliable), then modelName as name, then modelName as schemaFileId
2754
+ // (context.modelName can be a model schemaFileId when schema uses that as identifier)
2755
+ let modelRecord;
2756
+ if (property.modelId != null && typeof property.modelId === 'number') {
2757
+ const byId = await db
2758
+ .select()
2759
+ .from(models$1)
2760
+ .where(eq(models$1.id, property.modelId))
2761
+ .limit(1);
2762
+ modelRecord = byId[0];
2763
+ }
2764
+ if (!modelRecord && property.modelName) {
2765
+ const byName = await db
2766
+ .select()
2767
+ .from(models$1)
2768
+ .where(eq(models$1.name, property.modelName))
2769
+ .limit(1);
2770
+ modelRecord = byName[0];
2771
+ }
2772
+ if (!modelRecord && property.modelName) {
2773
+ const bySchemaFileId = await db
2774
+ .select()
2775
+ .from(models$1)
2776
+ .where(eq(models$1.schemaFileId, property.modelName))
2777
+ .limit(1);
2778
+ modelRecord = bySchemaFileId[0];
2779
+ }
2780
+ // Fallback: resolve model from existing property row (by schemaFileId) when modelName is wrong
2781
+ const schemaFileId = property._propertyFileId || (typeof property.id === 'string' ? property.id : undefined);
2782
+ if (!modelRecord && schemaFileId) {
2783
+ const propRows = await db
2784
+ .select({ modelId: properties.modelId })
2785
+ .from(properties)
2786
+ .where(eq(properties.schemaFileId, schemaFileId))
2787
+ .limit(1);
2788
+ if (propRows.length > 0 && propRows[0].modelId) {
2789
+ const byPropModelId = await db
2790
+ .select()
2791
+ .from(models$1)
2792
+ .where(eq(models$1.id, propRows[0].modelId))
2793
+ .limit(1);
2794
+ modelRecord = byPropModelId[0];
2795
+ }
2796
+ }
2797
+ if (!modelRecord) {
2798
+ throw new Error(`Model not found in database (modelId=${property.modelId}, modelName=${property.modelName})`);
2761
2799
  }
2762
- const modelRecord = modelRecords[0];
2763
2800
  // Find existing property - try multiple strategies to handle name changes
2764
2801
  // 1. First try by schemaFileId (most reliable - doesn't change when name changes)
2765
- // Use _propertyFileId first (from getPropertySchema), then id if it's a string (schemaFileId)
2766
- const schemaFileId = property._propertyFileId || (typeof property.id === 'string' ? property.id : undefined);
2767
2802
  let existingProperties = [];
2768
2803
  logger$o(`[savePropertyToDb] Looking for property ${property.modelName}:${property.name} (schemaFileId: ${schemaFileId}, originalName: ${property._originalValues?.name})`);
2769
2804
  if (schemaFileId) {
@@ -2837,6 +2872,11 @@ const savePropertyToDb = async (property) => {
2837
2872
  })
2838
2873
  .where(eq(properties.id, existingProperty.id));
2839
2874
  logger$o(`Updated property ${property.modelName}:${property._originalValues?.name || 'unknown'} -> ${property.name} in database`);
2875
+ // #region agent log
2876
+ if (typeof fetch === 'function') {
2877
+ fetch('http://127.0.0.1:7242/ingest/0978b378-ebae-46bf-8fd3-134ef2e16cdd', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '9ee076' }, body: JSON.stringify({ sessionId: '9ee076', location: 'db.ts:savePropertyToDb-update', message: 'savePropertyToDb UPDATED row', data: { oldName: property._originalValues?.name, newName: property.name, dbId: existingProperty.id }, timestamp: Date.now(), hypothesisId: 'B' }) }).catch(() => { });
2878
+ }
2879
+ // #endregion
2840
2880
  }
2841
2881
  else {
2842
2882
  // Property doesn't exist, create it
@@ -2846,6 +2886,11 @@ const savePropertyToDb = async (property) => {
2846
2886
  isEdited: true, // Runtime-created properties are edited
2847
2887
  });
2848
2888
  logger$o(`Created property ${property.modelName}:${property.name} in database`);
2889
+ // #region agent log
2890
+ if (typeof fetch === 'function') {
2891
+ fetch('http://127.0.0.1:7242/ingest/0978b378-ebae-46bf-8fd3-134ef2e16cdd', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '9ee076' }, body: JSON.stringify({ sessionId: '9ee076', location: 'db.ts:savePropertyToDb-insert', message: 'savePropertyToDb INSERTED new row', data: { name: property.name, schemaFileId }, timestamp: Date.now(), hypothesisId: 'B' }) }).catch(() => { });
2892
+ }
2893
+ // #endregion
2849
2894
  }
2850
2895
  };
2851
2896
  function parseAddressConfig(value) {
@@ -3164,11 +3209,14 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
3164
3209
  // Note: Additional property fields like storageType, localStorageDir, filenameSuffix
3165
3210
  // are not stored in the properties table but may be in the schema JSON
3166
3211
  if (existingProperties.length > 0) {
3167
- // Property exists, update it with new values
3212
+ // Property exists, update it with new values.
3213
+ // Use existing row id for WHERE (not name+modelId) so renames work: the row
3214
+ // may have the old name but we're updating to the new one.
3215
+ const existing = existingProperties[0];
3168
3216
  await db
3169
3217
  .update(properties)
3170
3218
  .set(propertyData)
3171
- .where(and(eq(properties.name, data.name), eq(properties.modelId, data.modelId)));
3219
+ .where(eq(properties.id, existing.id));
3172
3220
  logger$o(`Updated property ${data.name} (${propertyFileId}) in database`);
3173
3221
  }
3174
3222
  else {
@@ -3443,15 +3491,21 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
3443
3491
  // initial write completes is not overwritten by the stale requestWrite payload.
3444
3492
  let dataToWrite = input.entityData;
3445
3493
  try {
3446
- const mod = await import('./ModelProperty-B9Z2DRxI.js');
3494
+ const mod = await import('./ModelProperty-gBmew8gY.js');
3447
3495
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
3448
3496
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
3449
3497
  const instance = ModelProperty.getById(input.entityId);
3450
3498
  if (instance && typeof instance._getSnapshotContext === 'function') {
3451
3499
  const ctx = instance._getSnapshotContext();
3500
+ const ctxName = ctx.name ?? input.entityData.name;
3501
+ // #region agent log
3502
+ if (ctx.name !== input.entityData.name && typeof fetch === 'function') {
3503
+ fetch('http://127.0.0.1:7242/ingest/0978b378-ebae-46bf-8fd3-134ef2e16cdd', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '9ee076' }, body: JSON.stringify({ sessionId: '9ee076', location: 'writeToDatabase.ts:modelProperty', message: 'writeToDatabase using ctx name (rename detected)', data: { requestWriteName: input.entityData.name, ctxName: ctx.name, finalName: ctxName }, timestamp: Date.now(), hypothesisId: 'C' }) }).catch(() => { });
3504
+ }
3505
+ // #endregion
3452
3506
  dataToWrite = {
3453
3507
  ...input.entityData,
3454
- name: ctx.name ?? input.entityData.name,
3508
+ name: ctxName,
3455
3509
  dataType: ctx.dataType ?? input.entityData.dataType,
3456
3510
  refModelId: ctx.refModelId ?? input.entityData.refModelId,
3457
3511
  refValueType: ctx.refValueType ?? input.entityData.refValueType,
@@ -3467,6 +3521,11 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
3467
3521
  // Fall back to input.entityData if instance not available
3468
3522
  }
3469
3523
  await writePropertyToDb(input.entityId, dataToWrite);
3524
+ // #region agent log
3525
+ if (typeof fetch === 'function') {
3526
+ fetch('http://127.0.0.1:7242/ingest/0978b378-ebae-46bf-8fd3-134ef2e16cdd', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '9ee076' }, body: JSON.stringify({ sessionId: '9ee076', location: 'writeToDatabase.ts:writePropertyToDbDone', message: 'writePropertyToDb completed', data: { entityId: input.entityId, name: dataToWrite.name }, timestamp: Date.now(), hypothesisId: 'C' }) }).catch(() => { });
3527
+ }
3528
+ // #endregion
3470
3529
  output = input.entityData;
3471
3530
  }
3472
3531
  else if (input.entityType === 'schema') {
@@ -3822,7 +3881,7 @@ const modelMachine = setup({
3822
3881
  // Create ModelProperty instances for any new property IDs
3823
3882
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
3824
3883
  // Import and create instances asynchronously (fire-and-forget)
3825
- import('./ModelProperty-B9Z2DRxI.js').then(({ ModelProperty }) => {
3884
+ import('./ModelProperty-gBmew8gY.js').then(({ ModelProperty }) => {
3826
3885
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
3827
3886
  try {
3828
3887
  const property = await ModelProperty.createById(propertyFileId);
@@ -5305,9 +5364,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
5305
5364
  sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
5306
5365
  return;
5307
5366
  }
5308
- const getPublishUploadsMod = await import('./getPublishUploads-BFM94w5S.js');
5367
+ const getPublishUploadsMod = await import('./getPublishUploads-NITxWWDD.js');
5309
5368
  const { getPublishUploads } = getPublishUploadsMod;
5310
- const getPublishPayloadMod = await import('./getPublishPayload-BBI_j9I2.js');
5369
+ const getPublishPayloadMod = await import('./getPublishPayload-CBeCMSeQ.js');
5311
5370
  const { getPublishPayload } = getPublishPayloadMod;
5312
5371
  const uploads = await getPublishUploads(item);
5313
5372
  let uploadedTransactions = [];
@@ -6066,7 +6125,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
6066
6125
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
6067
6126
  const _resolveRelatedValue = async () => {
6068
6127
  // Use dynamic import to break circular dependency
6069
- const schemaMod = await import('./index-CSAVWKeA.js');
6128
+ const schemaMod = await import('./index-BC0xKxkf.js');
6070
6129
  const { ModelPropertyDataTypes } = schemaMod;
6071
6130
  if (!propertyValue || !isRelation || populatedFromDb) {
6072
6131
  return;
@@ -6406,7 +6465,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
6406
6465
  // to use dynamically imported ModelPropertyDataTypes
6407
6466
  const _hydrateFromDb = async () => {
6408
6467
  // Use dynamic import to break circular dependency
6409
- const schemaMod = await import('./index-CSAVWKeA.js');
6468
+ const schemaMod = await import('./index-BC0xKxkf.js');
6410
6469
  const { ModelPropertyDataTypes } = schemaMod;
6411
6470
  const appDb = BaseDb.getAppDb();
6412
6471
  const whereClauses = [];
@@ -6916,7 +6975,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
6916
6975
  }
6917
6976
  const _analyzeInput = async () => {
6918
6977
  // Use dynamic import to break circular dependency
6919
- const schemaMod = await import('./index-CSAVWKeA.js');
6978
+ const schemaMod = await import('./index-BC0xKxkf.js');
6920
6979
  const { ModelPropertyDataTypes } = schemaMod;
6921
6980
  let propertyName = propertyNameRaw;
6922
6981
  if (!propertyName) {
@@ -7558,7 +7617,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
7558
7617
  }
7559
7618
  const _saveRelation = async () => {
7560
7619
  // Use dynamic import to break circular dependency
7561
- const schemaMod = await import('./index-CSAVWKeA.js');
7620
+ const schemaMod = await import('./index-BC0xKxkf.js');
7562
7621
  const { ModelPropertyDataTypes } = schemaMod;
7563
7622
  if (!propertyNameRaw) {
7564
7623
  throw new Error('propertyName is required');
@@ -8422,7 +8481,7 @@ class ItemProperty {
8422
8481
  return;
8423
8482
  }
8424
8483
  // Use dynamic import to break circular dependency
8425
- const schemaMod = await import('./index-CSAVWKeA.js');
8484
+ const schemaMod = await import('./index-BC0xKxkf.js');
8426
8485
  const { ModelPropertyDataTypes } = schemaMod;
8427
8486
  const { context } = snapshot;
8428
8487
  const { propertyRecordSchema } = context;
@@ -8538,7 +8597,7 @@ class ItemProperty {
8538
8597
  setupState.subscriptionSetUp = true;
8539
8598
  logger(`[ItemProperty._setupLiveQuerySubscription] Setting up liveQuery for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}`);
8540
8599
  try {
8541
- const _mod_5 = await import('./index-ajj6SHkh.js');
8600
+ const _mod_5 = await import('./index-CcXvJ2H7.js');
8542
8601
  const _ns_5 = _mod_5.s;
8543
8602
  const seedSchemaMod = _ns_5;
8544
8603
  const { metadata } = seedSchemaMod;
@@ -9110,7 +9169,7 @@ class ItemProperty {
9110
9169
  }
9111
9170
  async save() {
9112
9171
  const ctx = this._getSnapshotContext();
9113
- const { assertItemOwned } = await import('./ownership-DLNI17NE.js');
9172
+ const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
9114
9173
  await assertItemOwned({
9115
9174
  seedLocalId: ctx?.seedLocalId ?? undefined,
9116
9175
  seedUid: ctx?.seedUid ?? undefined,
@@ -9203,7 +9262,7 @@ class ItemProperty {
9203
9262
  if (!propertyName || (!seedLocalId && !seedUid))
9204
9263
  return;
9205
9264
  if (db) {
9206
- const _mod_6 = await import('./index-ajj6SHkh.js');
9265
+ const _mod_6 = await import('./index-CcXvJ2H7.js');
9207
9266
  const _ns_6 = _mod_6.s;
9208
9267
  const seedSchemaMod = _ns_6;
9209
9268
  const { metadata } = seedSchemaMod;
@@ -9432,7 +9491,7 @@ class Item {
9432
9491
  });
9433
9492
  };
9434
9493
  this.publish = async () => {
9435
- const { assertItemOwned } = await import('./ownership-DLNI17NE.js');
9494
+ const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
9436
9495
  await assertItemOwned(this);
9437
9496
  this._service.send({ type: 'startPublish' });
9438
9497
  return new Promise((resolve, reject) => {
@@ -9468,13 +9527,13 @@ class Item {
9468
9527
  };
9469
9528
  this.getPublishUploads = async () => {
9470
9529
  // Use dynamic import to break circular dependency
9471
- const getPublishUploadsMod = await import('./getPublishUploads-BFM94w5S.js');
9530
+ const getPublishUploadsMod = await import('./getPublishUploads-NITxWWDD.js');
9472
9531
  const { getPublishUploads } = getPublishUploadsMod;
9473
9532
  return await getPublishUploads(this);
9474
9533
  };
9475
9534
  this.getPublishPayload = async (uploadedTransactions) => {
9476
9535
  // Use dynamic import to break circular dependency
9477
- const getPublishPayloadMod = await import('./getPublishPayload-BBI_j9I2.js');
9536
+ const getPublishPayloadMod = await import('./getPublishPayload-CBeCMSeQ.js');
9478
9537
  const { getPublishPayload } = getPublishPayloadMod;
9479
9538
  return await getPublishPayload(this, uploadedTransactions);
9480
9539
  };
@@ -10317,7 +10376,7 @@ class Item {
10317
10376
  setupState.subscriptionSetUp = true;
10318
10377
  logger(`[Item._setupLiveQuerySubscription] Setting up liveQuery for seedLocalId: ${seedLocalId}`);
10319
10378
  try {
10320
- const _mod_7 = await import('./index-ajj6SHkh.js');
10379
+ const _mod_7 = await import('./index-CcXvJ2H7.js');
10321
10380
  const _ns_7 = _mod_7.s;
10322
10381
  const seedSchemaMod = _ns_7;
10323
10382
  const { seeds, versions, metadata } = seedSchemaMod;
@@ -10598,7 +10657,7 @@ class Item {
10598
10657
  * Destroy the item: soft delete in DB, remove from caches, clean up subscriptions, stop service.
10599
10658
  */
10600
10659
  async destroy() {
10601
- const { assertItemOwned } = await import('./ownership-DLNI17NE.js');
10660
+ const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
10602
10661
  await assertItemOwned(this);
10603
10662
  const context = this._getSnapshotContext();
10604
10663
  const cacheKey = context.seedUid || context.seedLocalId;
@@ -11260,20 +11319,20 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
11260
11319
  let PathResolver;
11261
11320
  let EasClient;
11262
11321
  if (isBrowser()) {
11263
- FileManager = (await import('./FileManager-Wthr5yHO.js')).FileManager;
11264
- Db = (await import('./Db-Dz17KxVs.js')).Db;
11265
- QueryClient = (await import('./QueryClient-ndmA8MYL.js')).QueryClient;
11266
- ArweaveClient = (await import('./ArweaveClient-DFqnm5Kj.js')).ArweaveClient;
11267
- PathResolver = (await import('./PathResolver-NEpTSgQK.js')).PathResolver;
11268
- EasClient = (await import('./EasClient-BadfcFDk.js')).EasClient;
11322
+ FileManager = (await import('./FileManager-ClU_rIR0.js')).FileManager;
11323
+ Db = (await import('./Db-mH9nSDfI.js')).Db;
11324
+ QueryClient = (await import('./QueryClient-Dl_P8u5s.js')).QueryClient;
11325
+ ArweaveClient = (await import('./ArweaveClient-DyhvHiIT.js')).ArweaveClient;
11326
+ PathResolver = (await import('./PathResolver-CILJPhz1.js')).PathResolver;
11327
+ EasClient = (await import('./EasClient-aggdMFrc.js')).EasClient;
11269
11328
  }
11270
11329
  else if (isNode()) {
11271
- FileManager = (await import('./FileManager-BHuVNWT3.js')).FileManager;
11272
- Db = (await import('./Db-DIythELU.js')).Db;
11273
- QueryClient = (await import('./QueryClient-C9U8oZUe.js')).QueryClient;
11274
- ArweaveClient = (await import('./ArweaveClient-sN5h2FvY.js')).ArweaveClient;
11275
- PathResolver = (await import('./PathResolver-Cd1PZDLG.js')).PathResolver;
11276
- EasClient = (await import('./EasClient-DosbWaZN.js')).EasClient;
11330
+ FileManager = (await import('./FileManager-Dl2DD4Uc.js')).FileManager;
11331
+ Db = (await import('./Db-Dr6gWq8d.js')).Db;
11332
+ QueryClient = (await import('./QueryClient-BdpWYoxo.js')).QueryClient;
11333
+ ArweaveClient = (await import('./ArweaveClient-CwXE3NCK.js')).ArweaveClient;
11334
+ PathResolver = (await import('./PathResolver-CfA_D3wa.js')).PathResolver;
11335
+ EasClient = (await import('./EasClient-Yh-t7zEA.js')).EasClient;
11277
11336
  }
11278
11337
  else {
11279
11338
  throw new Error(`Unable to determine environment. isBrowser()=${isBrowser()}, isNode()=${isNode()}. Platform-specific implementations could not be loaded.`);
@@ -14535,7 +14594,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
14535
14594
  // Lazy import cache for ModelProperty to avoid circular dependency
14536
14595
  // Eagerly start loading to minimize delay on first access
14537
14596
  let ModelPropertyClass = null;
14538
- const modelPropertyImportPromise = import('./ModelProperty-B9Z2DRxI.js')
14597
+ const modelPropertyImportPromise = import('./ModelProperty-gBmew8gY.js')
14539
14598
  .then(module => {
14540
14599
  ModelPropertyClass = module.ModelProperty;
14541
14600
  return ModelPropertyClass;
@@ -14552,7 +14611,7 @@ function getModelProperty() {
14552
14611
  }
14553
14612
  // Lazy import cache for Schema to avoid circular dependency
14554
14613
  let SchemaClass = null;
14555
- const schemaImportPromise = (async () => { const _mod_8 = await import('./Schema-D1-HjT8z.js'); return _mod_8.b; })()
14614
+ const schemaImportPromise = (async () => { const _mod_8 = await import('./Schema-B-vCLIuU.js'); return _mod_8.b; })()
14556
14615
  .then(module => {
14557
14616
  SchemaClass = module.Schema;
14558
14617
  return SchemaClass;
@@ -16292,5 +16351,5 @@ var Model$1 = /*#__PURE__*/Object.freeze({
16292
16351
  Type.Record(Type.String(), Type.Any());
16293
16352
  Type.Record(Type.String(), TProperty);
16294
16353
 
16295
- export { propertyUids as $, BasePathResolver as A, Boolean$1 as B, BaseFileManager as C, Date$1 as D, appState as E, SEED_CONFIG_FALLBACKS as F, BaseEasClient as G, EAS_ENDPOINT as H, Image as I, Json as J, config as K, List as L, Model as M, Number$1 as N, metadata$1 as O, Property as P, modelRelations as Q, Relation as R, SEED_CONFIG_FILE as S, TPropertyDataType as T, modelSchemas as U, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as V, modelUids as W, modelsRelations as X, propertiesRelations as Y, ZERO_BYTES32 as Z, propertyUidRelations as _, ModelPropertyDataTypes as a, Model$1 as a$, schemas as a0, versions as a1, graphql as a2, saveAppState as a3, addModelsToDb$1 as a4, SCHEMA_NJK as a5, ItemProperty as a6, eventEmitter as a7, ClientManager as a8, INIT_SCRIPT_SUCCESS_MESSAGE as a9, getSeedsFromSchemaUids as aA, getSeedsBySchemaName as aB, SeedModels as aC, DEFAULT_ARWEAVE_HOST as aD, DEFAULT_ARWEAVE_GATEWAYS as aE, getArweaveUrlForTransaction as aF, setUploadExecutor as aG, getUploadExecutor as aH, createSchema as aI, readSchema as aJ, listCompleteSchemaFiles as aK, SEED_PROTOCOL_SCHEMA_NAME as aL, addSchemaToDb as aM, createModelsFromJson as aN, loadModelsFromDbForSchema as aO, getLatestSchemaVersion as aP, isInternalSchema as aQ, createModelFromJson as aR, ConflictError as aS, unloadEntity as aT, clearDestroySubscriptions as aU, setupEntityLiveQuery as aV, ModelSchema as aW, BaseFileManager$1 as aX, db as aY, schema as aZ, SEEDPROTOCOL_Seed_Protocol_v1 as a_, SCHEMA_TS as aa, importJsonSchema as ab, loadSchemaFromFile as ac, readJsonImportFile as ad, transformImportToSchemaFile as ae, writeProcessMachine as af, generateId as ag, waitForEntityIdle as ah, createReactiveProxy as ai, findEntity as aj, forceRemoveFromCaches as ak, runDestroyLifecycle as al, getModelIdByFileId as am, getModelId as an, getClient as ao, ClientManagerState as ap, getVersionData$1 as aq, createNewItem as ar, loadAllSchemasFromDb as as, getSchemaNameFromId as at, setSchemaUidForSchemaDefinition as au, setSchemaUidForModel as av, getModelSchemasFromEas as aw, getItemVersionsFromEas as ax, getItemPropertiesFromEas as ay, getEasSchemaUidBySchemaName as az, TStorageType as b, TProperty as c, TPropertyConstructor as d, PropertyMetadataKey as e, PropertyConstructor as f, Text as g, TValidationRules as h, getOwnedAddressesFromDb as i, BaseDb as j, getEasSchemaUidForModel as k, getCorrectId as l, defaultAttestationData as m, normalizeDataType as n, INTERNAL_DATA_TYPES as o, getEasSchemaUidForSchemaDefinition as p, getEasSchemaForItemProperty as q, modelPropertiesToObject as r, seeds as s, toSnakeCase as t, models$1 as u, properties as v, getItemData as w, Item as x, BaseQueryClient as y, BaseArweaveClient as z };
16296
- //# sourceMappingURL=index-j8WN8W6V.js.map
16354
+ export { propertyUids as $, BasePathResolver as A, Boolean$1 as B, BaseFileManager as C, Date$1 as D, appState as E, SEED_CONFIG_FALLBACKS as F, BaseEasClient as G, EAS_ENDPOINT as H, Image as I, Json as J, config as K, List as L, Model as M, Number$1 as N, metadata$1 as O, Property as P, modelRelations as Q, Relation as R, SEED_CONFIG_FILE as S, TPropertyDataType as T, modelSchemas as U, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as V, modelUids as W, modelsRelations as X, propertiesRelations as Y, ZERO_BYTES32 as Z, propertyUidRelations as _, ModelPropertyDataTypes as a, Model$1 as a$, schemas as a0, versions as a1, graphql as a2, saveAppState as a3, addModelsToDb$1 as a4, SCHEMA_NJK as a5, ItemProperty as a6, eventEmitter as a7, ClientManager as a8, INIT_SCRIPT_SUCCESS_MESSAGE as a9, getSeedsFromSchemaUids as aA, getSeedsBySchemaName as aB, SeedModels as aC, DEFAULT_ARWEAVE_HOST as aD, DEFAULT_ARWEAVE_GATEWAYS as aE, getArweaveUrlForTransaction as aF, setUploadExecutor as aG, getUploadExecutor as aH, createSchema as aI, readSchema as aJ, listCompleteSchemaFiles as aK, SEED_PROTOCOL_SCHEMA_NAME as aL, addSchemaToDb as aM, createModelsFromJson as aN, loadModelsFromDbForSchema as aO, getLatestSchemaVersion as aP, isInternalSchema as aQ, createModelFromJson as aR, ConflictError as aS, unloadEntity as aT, clearDestroySubscriptions as aU, setupEntityLiveQuery as aV, ModelSchema as aW, BaseFileManager$1 as aX, db as aY, schema as aZ, SEEDPROTOCOL_Seed_Protocol_v1 as a_, SCHEMA_TS as aa, importJsonSchema as ab, loadSchemaFromFile as ac, readJsonImportFile as ad, transformImportToSchemaFile as ae, writeProcessMachine as af, getModelIdByFileId as ag, generateId as ah, waitForEntityIdle as ai, createReactiveProxy as aj, findEntity as ak, forceRemoveFromCaches as al, runDestroyLifecycle as am, getModelId as an, getClient as ao, ClientManagerState as ap, getVersionData$1 as aq, createNewItem as ar, loadAllSchemasFromDb as as, getSchemaNameFromId as at, setSchemaUidForSchemaDefinition as au, setSchemaUidForModel as av, getModelSchemasFromEas as aw, getItemVersionsFromEas as ax, getItemPropertiesFromEas as ay, getEasSchemaUidBySchemaName as az, TStorageType as b, TProperty as c, TPropertyConstructor as d, PropertyMetadataKey as e, PropertyConstructor as f, Text as g, TValidationRules as h, getOwnedAddressesFromDb as i, BaseDb as j, getEasSchemaUidForModel as k, getCorrectId as l, defaultAttestationData as m, normalizeDataType as n, INTERNAL_DATA_TYPES as o, getEasSchemaUidForSchemaDefinition as p, getEasSchemaForItemProperty as q, modelPropertiesToObject as r, seeds as s, toSnakeCase as t, models$1 as u, properties as v, getItemData as w, Item as x, BaseQueryClient as y, BaseArweaveClient as z };
16355
+ //# sourceMappingURL=index-B_apqB1Q.js.map