@seedprotocol/sdk 0.4.11 → 0.4.12

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 (94) hide show
  1. package/dist/{ArweaveClient-CwXE3NCK.js → ArweaveClient-Bot35vMf.js} +3 -3
  2. package/dist/{ArweaveClient-CwXE3NCK.js.map → ArweaveClient-Bot35vMf.js.map} +1 -1
  3. package/dist/{ArweaveClient-DyhvHiIT.js → ArweaveClient-C6mBPWwy.js} +3 -3
  4. package/dist/{ArweaveClient-DyhvHiIT.js.map → ArweaveClient-C6mBPWwy.js.map} +1 -1
  5. package/dist/{Db-Dr6gWq8d.js → Db-DP7ELP9S.js} +3 -3
  6. package/dist/{Db-Dr6gWq8d.js.map → Db-DP7ELP9S.js.map} +1 -1
  7. package/dist/{Db-mH9nSDfI.js → Db-rlxROH4S.js} +3 -3
  8. package/dist/{Db-mH9nSDfI.js.map → Db-rlxROH4S.js.map} +1 -1
  9. package/dist/{EasClient-Yh-t7zEA.js → EasClient-CHI9lBP8.js} +2 -2
  10. package/dist/{EasClient-Yh-t7zEA.js.map → EasClient-CHI9lBP8.js.map} +1 -1
  11. package/dist/{EasClient-aggdMFrc.js → EasClient-CszJzwqw.js} +2 -2
  12. package/dist/{EasClient-aggdMFrc.js.map → EasClient-CszJzwqw.js.map} +1 -1
  13. package/dist/{FileManager-ClU_rIR0.js → FileManager-C7yOhPvS.js} +2 -2
  14. package/dist/{FileManager-ClU_rIR0.js.map → FileManager-C7yOhPvS.js.map} +1 -1
  15. package/dist/{FileManager-Dl2DD4Uc.js → FileManager-Dy3BbIxq.js} +2 -2
  16. package/dist/{FileManager-Dl2DD4Uc.js.map → FileManager-Dy3BbIxq.js.map} +1 -1
  17. package/dist/{ModelProperty-gBmew8gY.js → ModelProperty--OQb3Dy0.js} +17 -54
  18. package/dist/ModelProperty--OQb3Dy0.js.map +1 -0
  19. package/dist/{PathResolver-CILJPhz1.js → PathResolver-BtnV9pXS.js} +2 -2
  20. package/dist/{PathResolver-CILJPhz1.js.map → PathResolver-BtnV9pXS.js.map} +1 -1
  21. package/dist/{PathResolver-CfA_D3wa.js → PathResolver-D--w4fFE.js} +2 -2
  22. package/dist/{PathResolver-CfA_D3wa.js.map → PathResolver-D--w4fFE.js.map} +1 -1
  23. package/dist/{QueryClient-BdpWYoxo.js → QueryClient-BdNnK6Es.js} +2 -2
  24. package/dist/{QueryClient-BdpWYoxo.js.map → QueryClient-BdNnK6Es.js.map} +1 -1
  25. package/dist/{QueryClient-Dl_P8u5s.js → QueryClient-Bia5wKCO.js} +2 -2
  26. package/dist/{QueryClient-Dl_P8u5s.js.map → QueryClient-Bia5wKCO.js.map} +1 -1
  27. package/dist/{Schema-B-vCLIuU.js → Schema-DF4mLt86.js} +21 -21
  28. package/dist/{Schema-B-vCLIuU.js.map → Schema-DF4mLt86.js.map} +1 -1
  29. package/dist/{SchemaValidationService-C_iTQIjR.js → SchemaValidationService-D4LwnnIB.js} +2 -2
  30. package/dist/{SchemaValidationService-C_iTQIjR.js.map → SchemaValidationService-D4LwnnIB.js.map} +1 -1
  31. package/dist/cjs/{ModelProperty-DcAM5M8T.js → ModelProperty-C5BRfISV.js} +17 -54
  32. package/dist/cjs/ModelProperty-C5BRfISV.js.map +1 -0
  33. package/dist/cjs/{Schema-B6ifYEhD.js → Schema-DVJG8ISB.js} +20 -20
  34. package/dist/cjs/{Schema-B6ifYEhD.js.map → Schema-DVJG8ISB.js.map} +1 -1
  35. package/dist/cjs/{SchemaValidationService-OFyzZIUX.js → SchemaValidationService-_wef0VX6.js} +2 -2
  36. package/dist/cjs/{SchemaValidationService-OFyzZIUX.js.map → SchemaValidationService-_wef0VX6.js.map} +1 -1
  37. package/dist/cjs/{getItem-CAYQYTpg.js → getItem-CUGoglni.js} +2 -2
  38. package/dist/cjs/{getItem-CAYQYTpg.js.map → getItem-CUGoglni.js.map} +1 -1
  39. package/dist/cjs/{getPublishPayload-CBuGIazw.js → getPublishPayload-CGl97AXX.js} +5 -5
  40. package/dist/cjs/{getPublishPayload-CBuGIazw.js.map → getPublishPayload-CGl97AXX.js.map} +1 -1
  41. package/dist/cjs/{getPublishUploads-B7bB1OGg.js → getPublishUploads-BA5PdoJ3.js} +3 -3
  42. package/dist/cjs/{getPublishUploads-B7bB1OGg.js.map → getPublishUploads-BA5PdoJ3.js.map} +1 -1
  43. package/dist/cjs/{getSegmentedItemProperties-MVZ-0mQG.js → getSegmentedItemProperties-D3iBFPeo.js} +2 -2
  44. package/dist/cjs/{getSegmentedItemProperties-MVZ-0mQG.js.map → getSegmentedItemProperties-D3iBFPeo.js.map} +1 -1
  45. package/dist/cjs/{index-CA4i5TA7.js → index-B3K0jG2t.js} +54 -59
  46. package/dist/cjs/index-B3K0jG2t.js.map +1 -0
  47. package/dist/cjs/{index-6P4MEsbO.js → index-CpBFvNId.js} +2 -2
  48. package/dist/cjs/index-CpBFvNId.js.map +1 -0
  49. package/dist/cjs/{ownership-5TQ-v2CF.js → ownership-CkgGUliG.js} +2 -2
  50. package/dist/cjs/{ownership-5TQ-v2CF.js.map → ownership-CkgGUliG.js.map} +1 -1
  51. package/dist/{getItem-xpxRXqHI.js → getItem-CbGS6wbp.js} +2 -2
  52. package/dist/{getItem-xpxRXqHI.js.map → getItem-CbGS6wbp.js.map} +1 -1
  53. package/dist/{getPublishPayload-CBeCMSeQ.js → getPublishPayload-jUcwhhs1.js} +5 -5
  54. package/dist/{getPublishPayload-CBeCMSeQ.js.map → getPublishPayload-jUcwhhs1.js.map} +1 -1
  55. package/dist/{getPublishUploads-NITxWWDD.js → getPublishUploads-BAsUuLSM.js} +3 -3
  56. package/dist/{getPublishUploads-NITxWWDD.js.map → getPublishUploads-BAsUuLSM.js.map} +1 -1
  57. package/dist/{getSegmentedItemProperties-CYzNtJxH.js → getSegmentedItemProperties-1QklOMkN.js} +2 -2
  58. package/dist/{getSegmentedItemProperties-CYzNtJxH.js.map → getSegmentedItemProperties-1QklOMkN.js.map} +1 -1
  59. package/dist/{index-B_apqB1Q.js → index-BUFvepcD.js} +68 -73
  60. package/dist/index-BUFvepcD.js.map +1 -0
  61. package/dist/{index-BC0xKxkf.js → index-BnBV-CWp.js} +3 -3
  62. package/dist/index-BnBV-CWp.js.map +1 -0
  63. package/dist/{index-CcXvJ2H7.js → index-CjAALVQh.js} +2 -2
  64. package/dist/index-CjAALVQh.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-C7Afj3yr.js → ownership-CeuRaVwP.js} +2 -2
  69. package/dist/{ownership-C7Afj3yr.js.map → ownership-CeuRaVwP.js.map} +1 -1
  70. package/dist/{property-C2gviIFJ.js → property-BiZvboSH.js} +4 -4
  71. package/dist/{property-C2gviIFJ.js.map → property-BiZvboSH.js.map} +1 -1
  72. package/dist/{queries-BFzkFn4Y.js → queries-B2xdenwS.js} +2 -2
  73. package/dist/{queries-BFzkFn4Y.js.map → queries-B2xdenwS.js.map} +1 -1
  74. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  75. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  76. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  77. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  78. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  79. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  80. package/dist/src/helpers/db.d.ts.map +1 -1
  81. package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
  82. package/dist/src/vite/index.d.ts.map +1 -1
  83. package/dist/vite.cjs +10 -1
  84. package/dist/vite.cjs.map +1 -1
  85. package/dist/vite.js +10 -1
  86. package/dist/vite.js.map +1 -1
  87. package/package.json +4 -1
  88. package/dist/ModelProperty-gBmew8gY.js.map +0 -1
  89. package/dist/cjs/ModelProperty-DcAM5M8T.js.map +0 -1
  90. package/dist/cjs/index-6P4MEsbO.js.map +0 -1
  91. package/dist/cjs/index-CA4i5TA7.js.map +0 -1
  92. package/dist/index-BC0xKxkf.js.map +0 -1
  93. package/dist/index-B_apqB1Q.js.map +0 -1
  94. package/dist/index-CcXvJ2H7.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-gBmew8gY.js');
773
+ const mod = await import('./ModelProperty--OQb3Dy0.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-B-vCLIuU.js');
957
+ const _mod_0 = await import('./Schema-DF4mLt86.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-B-vCLIuU.js');
1203
+ const _mod_1 = await import('./Schema-DF4mLt86.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-C_iTQIjR.js');
1249
+ const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.js');
1250
1250
  const { SchemaValidationService } = validationServiceMod;
1251
1251
  const validationService = new SchemaValidationService();
1252
- const _mod_2 = await import('./Schema-B-vCLIuU.js');
1252
+ const _mod_2 = await import('./Schema-DF4mLt86.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-gBmew8gY.js');
1364
+ const mod = await import('./ModelProperty--OQb3Dy0.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-C_iTQIjR.js');
1467
+ const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.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-B-vCLIuU.js');
1485
+ const _mod_3 = await import('./Schema-DF4mLt86.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-C_iTQIjR.js');
1523
+ const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.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-B-vCLIuU.js');
1538
+ const _mod_4 = await import('./Schema-DF4mLt86.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-C_iTQIjR.js');
1569
+ const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.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-gBmew8gY.js');
2187
+ const mod = await import('./ModelProperty--OQb3Dy0.js');
2188
2188
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
2189
2189
  if (!ModelProperty) {
2190
2190
  logger$o('ModelProperty not available from dynamic import');
@@ -2551,7 +2551,18 @@ const addModelsToDb$1 = async (models, schema, modelRenames, schemaFileData) =>
2551
2551
  isEdited: false,
2552
2552
  };
2553
2553
  logger$o(`Creating new property ${modelName}:${propertyName} with schemaFileId: ${propertyData.schemaFileId}`);
2554
- const result = await db.insert(properties).values(propertyDataWithIsEdited);
2554
+ try {
2555
+ await db.insert(properties).values(propertyDataWithIsEdited);
2556
+ }
2557
+ catch (insertError) {
2558
+ // Treat UNIQUE constraint as success - property already exists (e.g. from concurrent addModelsToDb call)
2559
+ if (insertError?.code === 'SQLITE_CONSTRAINT_UNIQUE' || insertError?.message?.includes('UNIQUE constraint')) {
2560
+ logger$o(`Property ${modelName}:${propertyName} already exists (UNIQUE constraint), treating as success`);
2561
+ }
2562
+ else {
2563
+ throw insertError;
2564
+ }
2565
+ }
2555
2566
  }
2556
2567
  }
2557
2568
  }
@@ -2872,11 +2883,6 @@ const savePropertyToDb = async (property) => {
2872
2883
  })
2873
2884
  .where(eq(properties.id, existingProperty.id));
2874
2885
  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
2880
2886
  }
2881
2887
  else {
2882
2888
  // Property doesn't exist, create it
@@ -2886,11 +2892,6 @@ const savePropertyToDb = async (property) => {
2886
2892
  isEdited: true, // Runtime-created properties are edited
2887
2893
  });
2888
2894
  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
2894
2895
  }
2895
2896
  };
2896
2897
  function parseAddressConfig(value) {
@@ -3491,18 +3492,13 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
3491
3492
  // initial write completes is not overwritten by the stale requestWrite payload.
3492
3493
  let dataToWrite = input.entityData;
3493
3494
  try {
3494
- const mod = await import('./ModelProperty-gBmew8gY.js');
3495
+ const mod = await import('./ModelProperty--OQb3Dy0.js');
3495
3496
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
3496
3497
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
3497
3498
  const instance = ModelProperty.getById(input.entityId);
3498
3499
  if (instance && typeof instance._getSnapshotContext === 'function') {
3499
3500
  const ctx = instance._getSnapshotContext();
3500
3501
  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
3506
3502
  dataToWrite = {
3507
3503
  ...input.entityData,
3508
3504
  name: ctxName,
@@ -3521,11 +3517,6 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
3521
3517
  // Fall back to input.entityData if instance not available
3522
3518
  }
3523
3519
  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
3529
3520
  output = input.entityData;
3530
3521
  }
3531
3522
  else if (input.entityType === 'schema') {
@@ -3881,7 +3872,7 @@ const modelMachine = setup({
3881
3872
  // Create ModelProperty instances for any new property IDs
3882
3873
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
3883
3874
  // Import and create instances asynchronously (fire-and-forget)
3884
- import('./ModelProperty-gBmew8gY.js').then(({ ModelProperty }) => {
3875
+ import('./ModelProperty--OQb3Dy0.js').then(({ ModelProperty }) => {
3885
3876
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
3886
3877
  try {
3887
3878
  const property = await ModelProperty.createById(propertyFileId);
@@ -4082,11 +4073,12 @@ const modelMachine = setup({
4082
4073
  target: 'creatingProperties',
4083
4074
  actions: assign(({ context, event }) => {
4084
4075
  logger$l(`[writeSuccess] Transitioning to creatingProperties for model "${context.modelName}"`);
4085
- // Update _dbId from write output if available
4076
+ // Update _dbId from write output if available (writeToDatabase returns _dbId, not id)
4086
4077
  const newContext = { ...context };
4087
- if (event.output?.id) {
4088
- newContext._dbId = event.output.id;
4089
- logger$l(`[writeSuccess] Updated _dbId to ${event.output.id}`);
4078
+ const dbId = event.output?._dbId ?? event.output?.id;
4079
+ if (dbId != null) {
4080
+ newContext._dbId = dbId;
4081
+ logger$l(`[writeSuccess] Updated _dbId to ${dbId}`);
4090
4082
  }
4091
4083
  return newContext;
4092
4084
  }),
@@ -4094,10 +4086,11 @@ const modelMachine = setup({
4094
4086
  {
4095
4087
  target: 'idle',
4096
4088
  actions: assign(({ context, event }) => {
4097
- // Update _dbId from write output if available
4089
+ // Update _dbId from write output if available (writeToDatabase returns _dbId, not id)
4098
4090
  const newContext = { ...context };
4099
- if (event.output?.id) {
4100
- newContext._dbId = event.output.id;
4091
+ const dbId = event.output?._dbId ?? event.output?.id;
4092
+ if (dbId != null) {
4093
+ newContext._dbId = dbId;
4101
4094
  }
4102
4095
  return newContext;
4103
4096
  }),
@@ -5364,9 +5357,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
5364
5357
  sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
5365
5358
  return;
5366
5359
  }
5367
- const getPublishUploadsMod = await import('./getPublishUploads-NITxWWDD.js');
5360
+ const getPublishUploadsMod = await import('./getPublishUploads-BAsUuLSM.js');
5368
5361
  const { getPublishUploads } = getPublishUploadsMod;
5369
- const getPublishPayloadMod = await import('./getPublishPayload-CBeCMSeQ.js');
5362
+ const getPublishPayloadMod = await import('./getPublishPayload-jUcwhhs1.js');
5370
5363
  const { getPublishPayload } = getPublishPayloadMod;
5371
5364
  const uploads = await getPublishUploads(item);
5372
5365
  let uploadedTransactions = [];
@@ -6125,7 +6118,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
6125
6118
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
6126
6119
  const _resolveRelatedValue = async () => {
6127
6120
  // Use dynamic import to break circular dependency
6128
- const schemaMod = await import('./index-BC0xKxkf.js');
6121
+ const schemaMod = await import('./index-BnBV-CWp.js');
6129
6122
  const { ModelPropertyDataTypes } = schemaMod;
6130
6123
  if (!propertyValue || !isRelation || populatedFromDb) {
6131
6124
  return;
@@ -6465,7 +6458,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
6465
6458
  // to use dynamically imported ModelPropertyDataTypes
6466
6459
  const _hydrateFromDb = async () => {
6467
6460
  // Use dynamic import to break circular dependency
6468
- const schemaMod = await import('./index-BC0xKxkf.js');
6461
+ const schemaMod = await import('./index-BnBV-CWp.js');
6469
6462
  const { ModelPropertyDataTypes } = schemaMod;
6470
6463
  const appDb = BaseDb.getAppDb();
6471
6464
  const whereClauses = [];
@@ -6975,7 +6968,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
6975
6968
  }
6976
6969
  const _analyzeInput = async () => {
6977
6970
  // Use dynamic import to break circular dependency
6978
- const schemaMod = await import('./index-BC0xKxkf.js');
6971
+ const schemaMod = await import('./index-BnBV-CWp.js');
6979
6972
  const { ModelPropertyDataTypes } = schemaMod;
6980
6973
  let propertyName = propertyNameRaw;
6981
6974
  if (!propertyName) {
@@ -7057,8 +7050,10 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
7057
7050
  modelName,
7058
7051
  schemaUid,
7059
7052
  }); // Type assertion needed because newValue is not in MetadataType but is accepted by the function
7053
+ const stringValueForContext = typeof newValue === 'string' ? newValue : (newValue !== null && newValue !== undefined ? String(newValue) : undefined);
7060
7054
  let updatedContext = {
7061
- propertyValue: typeof newValue === 'string' ? newValue : (newValue !== null && newValue !== undefined ? String(newValue) : undefined),
7055
+ propertyValue: stringValueForContext,
7056
+ renderValue: stringValueForContext,
7062
7057
  };
7063
7058
  if (localId) {
7064
7059
  updatedContext.localId = localId;
@@ -7617,7 +7612,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
7617
7612
  }
7618
7613
  const _saveRelation = async () => {
7619
7614
  // Use dynamic import to break circular dependency
7620
- const schemaMod = await import('./index-BC0xKxkf.js');
7615
+ const schemaMod = await import('./index-BnBV-CWp.js');
7621
7616
  const { ModelPropertyDataTypes } = schemaMod;
7622
7617
  if (!propertyNameRaw) {
7623
7618
  throw new Error('propertyName is required');
@@ -8481,7 +8476,7 @@ class ItemProperty {
8481
8476
  return;
8482
8477
  }
8483
8478
  // Use dynamic import to break circular dependency
8484
- const schemaMod = await import('./index-BC0xKxkf.js');
8479
+ const schemaMod = await import('./index-BnBV-CWp.js');
8485
8480
  const { ModelPropertyDataTypes } = schemaMod;
8486
8481
  const { context } = snapshot;
8487
8482
  const { propertyRecordSchema } = context;
@@ -8597,7 +8592,7 @@ class ItemProperty {
8597
8592
  setupState.subscriptionSetUp = true;
8598
8593
  logger(`[ItemProperty._setupLiveQuerySubscription] Setting up liveQuery for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}`);
8599
8594
  try {
8600
- const _mod_5 = await import('./index-CcXvJ2H7.js');
8595
+ const _mod_5 = await import('./index-CjAALVQh.js');
8601
8596
  const _ns_5 = _mod_5.s;
8602
8597
  const seedSchemaMod = _ns_5;
8603
8598
  const { metadata } = seedSchemaMod;
@@ -9169,7 +9164,7 @@ class ItemProperty {
9169
9164
  }
9170
9165
  async save() {
9171
9166
  const ctx = this._getSnapshotContext();
9172
- const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
9167
+ const { assertItemOwned } = await import('./ownership-CeuRaVwP.js');
9173
9168
  await assertItemOwned({
9174
9169
  seedLocalId: ctx?.seedLocalId ?? undefined,
9175
9170
  seedUid: ctx?.seedUid ?? undefined,
@@ -9262,7 +9257,7 @@ class ItemProperty {
9262
9257
  if (!propertyName || (!seedLocalId && !seedUid))
9263
9258
  return;
9264
9259
  if (db) {
9265
- const _mod_6 = await import('./index-CcXvJ2H7.js');
9260
+ const _mod_6 = await import('./index-CjAALVQh.js');
9266
9261
  const _ns_6 = _mod_6.s;
9267
9262
  const seedSchemaMod = _ns_6;
9268
9263
  const { metadata } = seedSchemaMod;
@@ -9491,7 +9486,7 @@ class Item {
9491
9486
  });
9492
9487
  };
9493
9488
  this.publish = async () => {
9494
- const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
9489
+ const { assertItemOwned } = await import('./ownership-CeuRaVwP.js');
9495
9490
  await assertItemOwned(this);
9496
9491
  this._service.send({ type: 'startPublish' });
9497
9492
  return new Promise((resolve, reject) => {
@@ -9527,13 +9522,13 @@ class Item {
9527
9522
  };
9528
9523
  this.getPublishUploads = async () => {
9529
9524
  // Use dynamic import to break circular dependency
9530
- const getPublishUploadsMod = await import('./getPublishUploads-NITxWWDD.js');
9525
+ const getPublishUploadsMod = await import('./getPublishUploads-BAsUuLSM.js');
9531
9526
  const { getPublishUploads } = getPublishUploadsMod;
9532
9527
  return await getPublishUploads(this);
9533
9528
  };
9534
9529
  this.getPublishPayload = async (uploadedTransactions) => {
9535
9530
  // Use dynamic import to break circular dependency
9536
- const getPublishPayloadMod = await import('./getPublishPayload-CBeCMSeQ.js');
9531
+ const getPublishPayloadMod = await import('./getPublishPayload-jUcwhhs1.js');
9537
9532
  const { getPublishPayload } = getPublishPayloadMod;
9538
9533
  return await getPublishPayload(this, uploadedTransactions);
9539
9534
  };
@@ -10376,7 +10371,7 @@ class Item {
10376
10371
  setupState.subscriptionSetUp = true;
10377
10372
  logger(`[Item._setupLiveQuerySubscription] Setting up liveQuery for seedLocalId: ${seedLocalId}`);
10378
10373
  try {
10379
- const _mod_7 = await import('./index-CcXvJ2H7.js');
10374
+ const _mod_7 = await import('./index-CjAALVQh.js');
10380
10375
  const _ns_7 = _mod_7.s;
10381
10376
  const seedSchemaMod = _ns_7;
10382
10377
  const { seeds, versions, metadata } = seedSchemaMod;
@@ -10657,7 +10652,7 @@ class Item {
10657
10652
  * Destroy the item: soft delete in DB, remove from caches, clean up subscriptions, stop service.
10658
10653
  */
10659
10654
  async destroy() {
10660
- const { assertItemOwned } = await import('./ownership-C7Afj3yr.js');
10655
+ const { assertItemOwned } = await import('./ownership-CeuRaVwP.js');
10661
10656
  await assertItemOwned(this);
10662
10657
  const context = this._getSnapshotContext();
10663
10658
  const cacheKey = context.seedUid || context.seedLocalId;
@@ -11319,20 +11314,20 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
11319
11314
  let PathResolver;
11320
11315
  let EasClient;
11321
11316
  if (isBrowser()) {
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;
11317
+ FileManager = (await import('./FileManager-C7yOhPvS.js')).FileManager;
11318
+ Db = (await import('./Db-rlxROH4S.js')).Db;
11319
+ QueryClient = (await import('./QueryClient-Bia5wKCO.js')).QueryClient;
11320
+ ArweaveClient = (await import('./ArweaveClient-C6mBPWwy.js')).ArweaveClient;
11321
+ PathResolver = (await import('./PathResolver-BtnV9pXS.js')).PathResolver;
11322
+ EasClient = (await import('./EasClient-CszJzwqw.js')).EasClient;
11328
11323
  }
11329
11324
  else if (isNode()) {
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;
11325
+ FileManager = (await import('./FileManager-Dy3BbIxq.js')).FileManager;
11326
+ Db = (await import('./Db-DP7ELP9S.js')).Db;
11327
+ QueryClient = (await import('./QueryClient-BdNnK6Es.js')).QueryClient;
11328
+ ArweaveClient = (await import('./ArweaveClient-Bot35vMf.js')).ArweaveClient;
11329
+ PathResolver = (await import('./PathResolver-D--w4fFE.js')).PathResolver;
11330
+ EasClient = (await import('./EasClient-CHI9lBP8.js')).EasClient;
11336
11331
  }
11337
11332
  else {
11338
11333
  throw new Error(`Unable to determine environment. isBrowser()=${isBrowser()}, isNode()=${isNode()}. Platform-specific implementations could not be loaded.`);
@@ -14594,7 +14589,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
14594
14589
  // Lazy import cache for ModelProperty to avoid circular dependency
14595
14590
  // Eagerly start loading to minimize delay on first access
14596
14591
  let ModelPropertyClass = null;
14597
- const modelPropertyImportPromise = import('./ModelProperty-gBmew8gY.js')
14592
+ const modelPropertyImportPromise = import('./ModelProperty--OQb3Dy0.js')
14598
14593
  .then(module => {
14599
14594
  ModelPropertyClass = module.ModelProperty;
14600
14595
  return ModelPropertyClass;
@@ -14611,7 +14606,7 @@ function getModelProperty() {
14611
14606
  }
14612
14607
  // Lazy import cache for Schema to avoid circular dependency
14613
14608
  let SchemaClass = null;
14614
- const schemaImportPromise = (async () => { const _mod_8 = await import('./Schema-B-vCLIuU.js'); return _mod_8.b; })()
14609
+ const schemaImportPromise = (async () => { const _mod_8 = await import('./Schema-DF4mLt86.js'); return _mod_8.b; })()
14615
14610
  .then(module => {
14616
14611
  SchemaClass = module.Schema;
14617
14612
  return SchemaClass;
@@ -16352,4 +16347,4 @@ Type.Record(Type.String(), Type.Any());
16352
16347
  Type.Record(Type.String(), TProperty);
16353
16348
 
16354
16349
  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
16350
+ //# sourceMappingURL=index-BUFvepcD.js.map