@seedprotocol/sdk 0.4.10 → 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.
- package/dist/{ArweaveClient-sN5h2FvY.js → ArweaveClient-Bot35vMf.js} +3 -3
- package/dist/{ArweaveClient-sN5h2FvY.js.map → ArweaveClient-Bot35vMf.js.map} +1 -1
- package/dist/{ArweaveClient-DFqnm5Kj.js → ArweaveClient-C6mBPWwy.js} +3 -3
- package/dist/{ArweaveClient-DFqnm5Kj.js.map → ArweaveClient-C6mBPWwy.js.map} +1 -1
- package/dist/{Db-DIythELU.js → Db-DP7ELP9S.js} +3 -3
- package/dist/{Db-DIythELU.js.map → Db-DP7ELP9S.js.map} +1 -1
- package/dist/{Db-Dz17KxVs.js → Db-rlxROH4S.js} +3 -3
- package/dist/{Db-Dz17KxVs.js.map → Db-rlxROH4S.js.map} +1 -1
- package/dist/{EasClient-BadfcFDk.js → EasClient-CHI9lBP8.js} +2 -2
- package/dist/{EasClient-DosbWaZN.js.map → EasClient-CHI9lBP8.js.map} +1 -1
- package/dist/{EasClient-DosbWaZN.js → EasClient-CszJzwqw.js} +2 -2
- package/dist/{EasClient-BadfcFDk.js.map → EasClient-CszJzwqw.js.map} +1 -1
- package/dist/{FileManager-Wthr5yHO.js → FileManager-C7yOhPvS.js} +2 -2
- package/dist/{FileManager-Wthr5yHO.js.map → FileManager-C7yOhPvS.js.map} +1 -1
- package/dist/{FileManager-BHuVNWT3.js → FileManager-Dy3BbIxq.js} +2 -2
- package/dist/{FileManager-BHuVNWT3.js.map → FileManager-Dy3BbIxq.js.map} +1 -1
- package/dist/{ModelProperty-B9Z2DRxI.js → ModelProperty--OQb3Dy0.js} +57 -18
- package/dist/ModelProperty--OQb3Dy0.js.map +1 -0
- package/dist/{PathResolver-NEpTSgQK.js → PathResolver-BtnV9pXS.js} +2 -2
- package/dist/{PathResolver-NEpTSgQK.js.map → PathResolver-BtnV9pXS.js.map} +1 -1
- package/dist/{PathResolver-Cd1PZDLG.js → PathResolver-D--w4fFE.js} +2 -2
- package/dist/{PathResolver-Cd1PZDLG.js.map → PathResolver-D--w4fFE.js.map} +1 -1
- package/dist/{QueryClient-C9U8oZUe.js → QueryClient-BdNnK6Es.js} +2 -2
- package/dist/{QueryClient-C9U8oZUe.js.map → QueryClient-BdNnK6Es.js.map} +1 -1
- package/dist/{QueryClient-ndmA8MYL.js → QueryClient-Bia5wKCO.js} +2 -2
- package/dist/{QueryClient-ndmA8MYL.js.map → QueryClient-Bia5wKCO.js.map} +1 -1
- package/dist/{Schema-D1-HjT8z.js → Schema-DF4mLt86.js} +21 -21
- package/dist/{Schema-D1-HjT8z.js.map → Schema-DF4mLt86.js.map} +1 -1
- package/dist/{SchemaValidationService-CIXKzSpb.js → SchemaValidationService-D4LwnnIB.js} +2 -2
- package/dist/{SchemaValidationService-CIXKzSpb.js.map → SchemaValidationService-D4LwnnIB.js.map} +1 -1
- package/dist/cjs/{ModelProperty-09hNvSBl.js → ModelProperty-C5BRfISV.js} +57 -18
- package/dist/cjs/ModelProperty-C5BRfISV.js.map +1 -0
- package/dist/cjs/{Schema-BcwvUABB.js → Schema-DVJG8ISB.js} +20 -20
- package/dist/cjs/{Schema-BcwvUABB.js.map → Schema-DVJG8ISB.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-zty4nfCu.js → SchemaValidationService-_wef0VX6.js} +2 -2
- package/dist/cjs/{SchemaValidationService-zty4nfCu.js.map → SchemaValidationService-_wef0VX6.js.map} +1 -1
- package/dist/cjs/{getItem-Dlb5YSQn.js → getItem-CUGoglni.js} +2 -2
- package/dist/cjs/{getItem-Dlb5YSQn.js.map → getItem-CUGoglni.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-BqL06sEI.js → getPublishPayload-CGl97AXX.js} +5 -5
- package/dist/cjs/{getPublishPayload-BqL06sEI.js.map → getPublishPayload-CGl97AXX.js.map} +1 -1
- package/dist/cjs/{getPublishUploads-oukGI2N6.js → getPublishUploads-BA5PdoJ3.js} +3 -3
- package/dist/cjs/{getPublishUploads-oukGI2N6.js.map → getPublishUploads-BA5PdoJ3.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js → getSegmentedItemProperties-D3iBFPeo.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js.map → getSegmentedItemProperties-D3iBFPeo.js.map} +1 -1
- package/dist/cjs/{index-BLETlVgA.js → index-B3K0jG2t.js} +109 -55
- package/dist/cjs/index-B3K0jG2t.js.map +1 -0
- package/dist/cjs/{index-jubgGeM2.js → index-CpBFvNId.js} +2 -2
- package/dist/cjs/index-CpBFvNId.js.map +1 -0
- package/dist/cjs/{ownership-vfvyz3KJ.js → ownership-CkgGUliG.js} +2 -2
- package/dist/cjs/{ownership-vfvyz3KJ.js.map → ownership-CkgGUliG.js.map} +1 -1
- package/dist/{getItem-f9rNUz7I.js → getItem-CbGS6wbp.js} +2 -2
- package/dist/{getItem-f9rNUz7I.js.map → getItem-CbGS6wbp.js.map} +1 -1
- package/dist/{getPublishPayload-BBI_j9I2.js → getPublishPayload-jUcwhhs1.js} +5 -5
- package/dist/{getPublishPayload-BBI_j9I2.js.map → getPublishPayload-jUcwhhs1.js.map} +1 -1
- package/dist/{getPublishUploads-BFM94w5S.js → getPublishUploads-BAsUuLSM.js} +3 -3
- package/dist/{getPublishUploads-BFM94w5S.js.map → getPublishUploads-BAsUuLSM.js.map} +1 -1
- package/dist/{getSegmentedItemProperties-Di9vevKz.js → getSegmentedItemProperties-1QklOMkN.js} +2 -2
- package/dist/{getSegmentedItemProperties-Di9vevKz.js.map → getSegmentedItemProperties-1QklOMkN.js.map} +1 -1
- package/dist/{index-j8WN8W6V.js → index-BUFvepcD.js} +124 -70
- package/dist/index-BUFvepcD.js.map +1 -0
- package/dist/{index-CSAVWKeA.js → index-BnBV-CWp.js} +3 -3
- package/dist/index-BnBV-CWp.js.map +1 -0
- package/dist/{index-ajj6SHkh.js → index-CjAALVQh.js} +2 -2
- package/dist/index-CjAALVQh.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +11 -11
- package/dist/node.js +10 -10
- package/dist/{ownership-DLNI17NE.js → ownership-CeuRaVwP.js} +2 -2
- package/dist/{ownership-DLNI17NE.js.map → ownership-CeuRaVwP.js.map} +1 -1
- package/dist/{property-C6qoOzLG.js → property-BiZvboSH.js} +4 -4
- package/dist/{property-C6qoOzLG.js.map → property-BiZvboSH.js.map} +1 -1
- package/dist/{queries-jMaUn86w.js → queries-B2xdenwS.js} +2 -2
- package/dist/{queries-jMaUn86w.js.map → queries-B2xdenwS.js.map} +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +5 -0
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/src/vite/index.d.ts.map +1 -1
- package/dist/vite.cjs +10 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +10 -1
- package/dist/vite.js.map +1 -1
- package/package.json +4 -1
- package/dist/ModelProperty-B9Z2DRxI.js.map +0 -1
- package/dist/cjs/ModelProperty-09hNvSBl.js.map +0 -1
- package/dist/cjs/index-BLETlVgA.js.map +0 -1
- package/dist/cjs/index-jubgGeM2.js.map +0 -1
- package/dist/index-CSAVWKeA.js.map +0 -1
- package/dist/index-ajj6SHkh.js.map +0 -1
- package/dist/index-j8WN8W6V.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSegmentedItemProperties-
|
|
1
|
+
{"version":3,"file":"getSegmentedItemProperties-D3iBFPeo.js","sources":["../../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes } from '@/Schema'\n\nexport const getSegmentedItemProperties = (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n if (!itemProperty.propertyDef) {\n continue\n }\n\n const isItemStorage =\n itemProperty.propertyDef.storageType &&\n itemProperty.propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId'\n\n const isStorageSeedType =\n itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Image ||\n itemProperty.propertyDef.dataType === ModelPropertyDataTypes.File ||\n itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Html\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.List) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n if (itemProperty.propertyDef.ref) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":["ModelPropertyDataTypes"],"mappings":";;;;;;;AAIO,MAAM,0BAA0B,GAAG,CAAC,IAAgB,KAAI;IAC7D,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,sBAAsB,GAAG,EAAE;IACjC,MAAM,kBAAkB,GAAG,EAAE;IAC7B,MAAM,oBAAoB,GAAqB,EAAE;IACjD,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,qBAAqB,GAAG,EAAE;AAChC,IAAA,IAAI,8BAA0D;AAE9D,IAAA,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,UAAU,EAAE;AAC1C,QAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;YAC7B;QACF;AAEA,QAAA,MAAM,aAAa,GACjB,YAAY,CAAC,WAAW,CAAC,WAAW;AACpC,YAAA,YAAY,CAAC,WAAW,CAAC,WAAW,KAAK,aAAa;AAGxD,QAAA,MAAM,oBAAoB,GACxB,YAAY,CAAC,YAAY,KAAK,sBAAsB;QAEtD,MAAM,iBAAiB,GACrB,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,KAAK;AAClE,YAAA,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,IAAI;YACjE,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,IAAI;QAEnE,IAAI,iBAAiB,EAAE;AACrB,YAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACtC;QACF;QAEA,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,QAAQ,EAAE;AACzE,YAAA,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC;QACF;QAEA,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,IAAI,EAAE;;;AAGrE,YAAA,IAAI,YAAY,CAAC,WAAW,CAAC,GAAG,EAAE;AAChC,gBAAA,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC;iBAAO;AACL,gBAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;YACA;QACF;QAEA,IAAI,aAAa,EAAE;AACjB,YAAA,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;QACF;QAEA,IAAI,oBAAoB,EAAE;YACxB,8BAA8B,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;YACtE;QACF;AAEA,QAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;;;"}
|
|
@@ -807,7 +807,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
809
|
try {
|
|
810
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
810
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); });
|
|
811
811
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
812
812
|
if (!ModelProperty) {
|
|
813
813
|
logger$x('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -991,7 +991,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context } })
|
|
|
991
991
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
992
992
|
// This handles the case where model exists in schema file but not yet in database
|
|
993
993
|
try {
|
|
994
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
994
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); });
|
|
995
995
|
const { Schema } = schemaMod;
|
|
996
996
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
997
997
|
const schemaSnapshot = schema.getService().getSnapshot();
|
|
@@ -1235,7 +1235,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context } })
|
|
|
1235
1235
|
}
|
|
1236
1236
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
1237
1237
|
try {
|
|
1238
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
1238
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); });
|
|
1239
1239
|
const { Schema } = schemaMod;
|
|
1240
1240
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
1241
1241
|
schema.getService().send({ type: 'markAsDraft', propertyKey: 'schema:models' });
|
|
@@ -1279,10 +1279,10 @@ const validateModel = xstate.fromCallback(({ sendBack, input: { context } }) =>
|
|
|
1279
1279
|
const _validateModel = async () => {
|
|
1280
1280
|
try {
|
|
1281
1281
|
// Use dynamic imports to break circular dependencies
|
|
1282
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
1282
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-_wef0VX6.js'); });
|
|
1283
1283
|
const { SchemaValidationService } = validationServiceMod;
|
|
1284
1284
|
const validationService = new SchemaValidationService();
|
|
1285
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
1285
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); });
|
|
1286
1286
|
const { Schema } = schemaMod;
|
|
1287
1287
|
// Validate model structure
|
|
1288
1288
|
const structureResult = validationService.validateModelStructure(context);
|
|
@@ -1392,7 +1392,7 @@ const createModelProperties = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
1392
1392
|
return;
|
|
1393
1393
|
}
|
|
1394
1394
|
logger$v(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
1395
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
1395
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); });
|
|
1396
1396
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1397
1397
|
if (!ModelProperty) {
|
|
1398
1398
|
logger$v('ModelProperty not available from dynamic import');
|
|
@@ -1495,7 +1495,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
1495
1495
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
1496
1496
|
logger$u(structureMsg);
|
|
1497
1497
|
// Use existing Model validation
|
|
1498
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
1498
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-_wef0VX6.js'); });
|
|
1499
1499
|
const { SchemaValidationService } = validationServiceMod;
|
|
1500
1500
|
const validationService = new SchemaValidationService();
|
|
1501
1501
|
// Validate model structure
|
|
@@ -1513,7 +1513,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
1513
1513
|
if (entityInput.entityData.schemaName) {
|
|
1514
1514
|
try {
|
|
1515
1515
|
logger$u(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
|
|
1516
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
1516
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); });
|
|
1517
1517
|
const { Schema } = schemaMod;
|
|
1518
1518
|
const schema = Schema.create(entityInput.entityData.schemaName, {
|
|
1519
1519
|
waitForReady: false,
|
|
@@ -1549,7 +1549,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
else if (entityInput.entityType === 'modelProperty') {
|
|
1551
1551
|
// Use existing ModelProperty validation
|
|
1552
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
1552
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-_wef0VX6.js'); });
|
|
1553
1553
|
const { SchemaValidationService } = validationServiceMod;
|
|
1554
1554
|
const validationService = new SchemaValidationService();
|
|
1555
1555
|
// Validate property structure
|
|
@@ -1564,7 +1564,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
1564
1564
|
// If schema name and model name provided, validate against schema
|
|
1565
1565
|
if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
|
|
1566
1566
|
try {
|
|
1567
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
1567
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); });
|
|
1568
1568
|
const { Schema } = schemaMod;
|
|
1569
1569
|
const schema = Schema.create(entityInput.entityData._schemaName, {
|
|
1570
1570
|
waitForReady: false,
|
|
@@ -1593,7 +1593,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
else if (entityInput.entityType === 'schema') {
|
|
1595
1595
|
// Schema validation - use existing validation
|
|
1596
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
1596
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-_wef0VX6.js'); });
|
|
1597
1597
|
const { SchemaValidationService } = validationServiceMod;
|
|
1598
1598
|
const validationService = new SchemaValidationService();
|
|
1599
1599
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -2230,7 +2230,7 @@ async function checkIfPropertyIsEdited(modelName, propertyName, schemaFileValue)
|
|
|
2230
2230
|
const cacheKey = `${modelName}:${propertyName}`;
|
|
2231
2231
|
// First, check the in-memory cache (for current session edits)
|
|
2232
2232
|
// Robust dynamic import for consumer re-bundling (named or default export)
|
|
2233
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
2233
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); });
|
|
2234
2234
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2235
2235
|
if (!ModelProperty) {
|
|
2236
2236
|
logger$t('ModelProperty not available from dynamic import');
|
|
@@ -2597,7 +2597,18 @@ const addModelsToDb$1 = async (models, schema, modelRenames, schemaFileData) =>
|
|
|
2597
2597
|
isEdited: false,
|
|
2598
2598
|
};
|
|
2599
2599
|
logger$t(`Creating new property ${modelName}:${propertyName} with schemaFileId: ${propertyData.schemaFileId}`);
|
|
2600
|
-
|
|
2600
|
+
try {
|
|
2601
|
+
await db.insert(properties).values(propertyDataWithIsEdited);
|
|
2602
|
+
}
|
|
2603
|
+
catch (insertError) {
|
|
2604
|
+
// Treat UNIQUE constraint as success - property already exists (e.g. from concurrent addModelsToDb call)
|
|
2605
|
+
if (insertError?.code === 'SQLITE_CONSTRAINT_UNIQUE' || insertError?.message?.includes('UNIQUE constraint')) {
|
|
2606
|
+
logger$t(`Property ${modelName}:${propertyName} already exists (UNIQUE constraint), treating as success`);
|
|
2607
|
+
}
|
|
2608
|
+
else {
|
|
2609
|
+
throw insertError;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2601
2612
|
}
|
|
2602
2613
|
}
|
|
2603
2614
|
}
|
|
@@ -2793,23 +2804,58 @@ const savePropertyToDb = async (property) => {
|
|
|
2793
2804
|
if (!db) {
|
|
2794
2805
|
throw new Error('Database not found');
|
|
2795
2806
|
}
|
|
2796
|
-
if (!property.
|
|
2797
|
-
throw new Error('
|
|
2807
|
+
if (!property.name) {
|
|
2808
|
+
throw new Error('Property name is required');
|
|
2798
2809
|
}
|
|
2799
|
-
// Find the model
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2810
|
+
// Find the model: prefer modelId (reliable), then modelName as name, then modelName as schemaFileId
|
|
2811
|
+
// (context.modelName can be a model schemaFileId when schema uses that as identifier)
|
|
2812
|
+
let modelRecord;
|
|
2813
|
+
if (property.modelId != null && typeof property.modelId === 'number') {
|
|
2814
|
+
const byId = await db
|
|
2815
|
+
.select()
|
|
2816
|
+
.from(models$1)
|
|
2817
|
+
.where(drizzleOrm.eq(models$1.id, property.modelId))
|
|
2818
|
+
.limit(1);
|
|
2819
|
+
modelRecord = byId[0];
|
|
2820
|
+
}
|
|
2821
|
+
if (!modelRecord && property.modelName) {
|
|
2822
|
+
const byName = await db
|
|
2823
|
+
.select()
|
|
2824
|
+
.from(models$1)
|
|
2825
|
+
.where(drizzleOrm.eq(models$1.name, property.modelName))
|
|
2826
|
+
.limit(1);
|
|
2827
|
+
modelRecord = byName[0];
|
|
2828
|
+
}
|
|
2829
|
+
if (!modelRecord && property.modelName) {
|
|
2830
|
+
const bySchemaFileId = await db
|
|
2831
|
+
.select()
|
|
2832
|
+
.from(models$1)
|
|
2833
|
+
.where(drizzleOrm.eq(models$1.schemaFileId, property.modelName))
|
|
2834
|
+
.limit(1);
|
|
2835
|
+
modelRecord = bySchemaFileId[0];
|
|
2836
|
+
}
|
|
2837
|
+
// Fallback: resolve model from existing property row (by schemaFileId) when modelName is wrong
|
|
2838
|
+
const schemaFileId = property._propertyFileId || (typeof property.id === 'string' ? property.id : undefined);
|
|
2839
|
+
if (!modelRecord && schemaFileId) {
|
|
2840
|
+
const propRows = await db
|
|
2841
|
+
.select({ modelId: properties.modelId })
|
|
2842
|
+
.from(properties)
|
|
2843
|
+
.where(drizzleOrm.eq(properties.schemaFileId, schemaFileId))
|
|
2844
|
+
.limit(1);
|
|
2845
|
+
if (propRows.length > 0 && propRows[0].modelId) {
|
|
2846
|
+
const byPropModelId = await db
|
|
2847
|
+
.select()
|
|
2848
|
+
.from(models$1)
|
|
2849
|
+
.where(drizzleOrm.eq(models$1.id, propRows[0].modelId))
|
|
2850
|
+
.limit(1);
|
|
2851
|
+
modelRecord = byPropModelId[0];
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
if (!modelRecord) {
|
|
2855
|
+
throw new Error(`Model not found in database (modelId=${property.modelId}, modelName=${property.modelName})`);
|
|
2807
2856
|
}
|
|
2808
|
-
const modelRecord = modelRecords[0];
|
|
2809
2857
|
// Find existing property - try multiple strategies to handle name changes
|
|
2810
2858
|
// 1. First try by schemaFileId (most reliable - doesn't change when name changes)
|
|
2811
|
-
// Use _propertyFileId first (from getPropertySchema), then id if it's a string (schemaFileId)
|
|
2812
|
-
const schemaFileId = property._propertyFileId || (typeof property.id === 'string' ? property.id : undefined);
|
|
2813
2859
|
let existingProperties = [];
|
|
2814
2860
|
logger$t(`[savePropertyToDb] Looking for property ${property.modelName}:${property.name} (schemaFileId: ${schemaFileId}, originalName: ${property._originalValues?.name})`);
|
|
2815
2861
|
if (schemaFileId) {
|
|
@@ -3210,11 +3256,14 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
3210
3256
|
// Note: Additional property fields like storageType, localStorageDir, filenameSuffix
|
|
3211
3257
|
// are not stored in the properties table but may be in the schema JSON
|
|
3212
3258
|
if (existingProperties.length > 0) {
|
|
3213
|
-
// Property exists, update it with new values
|
|
3259
|
+
// Property exists, update it with new values.
|
|
3260
|
+
// Use existing row id for WHERE (not name+modelId) so renames work: the row
|
|
3261
|
+
// may have the old name but we're updating to the new one.
|
|
3262
|
+
const existing = existingProperties[0];
|
|
3214
3263
|
await db
|
|
3215
3264
|
.update(properties)
|
|
3216
3265
|
.set(propertyData)
|
|
3217
|
-
.where(drizzleOrm.
|
|
3266
|
+
.where(drizzleOrm.eq(properties.id, existing.id));
|
|
3218
3267
|
logger$t(`Updated property ${data.name} (${propertyFileId}) in database`);
|
|
3219
3268
|
}
|
|
3220
3269
|
else {
|
|
@@ -3489,15 +3538,16 @@ const writeToDatabase = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
3489
3538
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
3490
3539
|
let dataToWrite = input.entityData;
|
|
3491
3540
|
try {
|
|
3492
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
3541
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); });
|
|
3493
3542
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
3494
3543
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
3495
3544
|
const instance = ModelProperty.getById(input.entityId);
|
|
3496
3545
|
if (instance && typeof instance._getSnapshotContext === 'function') {
|
|
3497
3546
|
const ctx = instance._getSnapshotContext();
|
|
3547
|
+
const ctxName = ctx.name ?? input.entityData.name;
|
|
3498
3548
|
dataToWrite = {
|
|
3499
3549
|
...input.entityData,
|
|
3500
|
-
name:
|
|
3550
|
+
name: ctxName,
|
|
3501
3551
|
dataType: ctx.dataType ?? input.entityData.dataType,
|
|
3502
3552
|
refModelId: ctx.refModelId ?? input.entityData.refModelId,
|
|
3503
3553
|
refValueType: ctx.refValueType ?? input.entityData.refValueType,
|
|
@@ -3868,7 +3918,7 @@ const modelMachine = xstate.setup({
|
|
|
3868
3918
|
// Create ModelProperty instances for any new property IDs
|
|
3869
3919
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
3870
3920
|
// Import and create instances asynchronously (fire-and-forget)
|
|
3871
|
-
Promise.resolve().then(function () { return require('./ModelProperty-
|
|
3921
|
+
Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); }).then(({ ModelProperty }) => {
|
|
3872
3922
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
3873
3923
|
try {
|
|
3874
3924
|
const property = await ModelProperty.createById(propertyFileId);
|
|
@@ -4069,11 +4119,12 @@ const modelMachine = xstate.setup({
|
|
|
4069
4119
|
target: 'creatingProperties',
|
|
4070
4120
|
actions: xstate.assign(({ context, event }) => {
|
|
4071
4121
|
logger$q(`[writeSuccess] Transitioning to creatingProperties for model "${context.modelName}"`);
|
|
4072
|
-
// Update _dbId from write output if available
|
|
4122
|
+
// Update _dbId from write output if available (writeToDatabase returns _dbId, not id)
|
|
4073
4123
|
const newContext = { ...context };
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4124
|
+
const dbId = event.output?._dbId ?? event.output?.id;
|
|
4125
|
+
if (dbId != null) {
|
|
4126
|
+
newContext._dbId = dbId;
|
|
4127
|
+
logger$q(`[writeSuccess] Updated _dbId to ${dbId}`);
|
|
4077
4128
|
}
|
|
4078
4129
|
return newContext;
|
|
4079
4130
|
}),
|
|
@@ -4081,10 +4132,11 @@ const modelMachine = xstate.setup({
|
|
|
4081
4132
|
{
|
|
4082
4133
|
target: 'idle',
|
|
4083
4134
|
actions: xstate.assign(({ context, event }) => {
|
|
4084
|
-
// Update _dbId from write output if available
|
|
4135
|
+
// Update _dbId from write output if available (writeToDatabase returns _dbId, not id)
|
|
4085
4136
|
const newContext = { ...context };
|
|
4086
|
-
|
|
4087
|
-
|
|
4137
|
+
const dbId = event.output?._dbId ?? event.output?.id;
|
|
4138
|
+
if (dbId != null) {
|
|
4139
|
+
newContext._dbId = dbId;
|
|
4088
4140
|
}
|
|
4089
4141
|
return newContext;
|
|
4090
4142
|
}),
|
|
@@ -5326,9 +5378,9 @@ const runPublish = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5326
5378
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
5327
5379
|
return;
|
|
5328
5380
|
}
|
|
5329
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
5381
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-BA5PdoJ3.js'); });
|
|
5330
5382
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
5331
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
5383
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-CGl97AXX.js'); });
|
|
5332
5384
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
5333
5385
|
const uploads = await getPublishUploads(item);
|
|
5334
5386
|
let uploadedTransactions = [];
|
|
@@ -6087,7 +6139,7 @@ const resolveRelatedValue = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
6087
6139
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
6088
6140
|
const _resolveRelatedValue = async () => {
|
|
6089
6141
|
// Use dynamic import to break circular dependency
|
|
6090
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6142
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-CpBFvNId.js'); });
|
|
6091
6143
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6092
6144
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
6093
6145
|
return;
|
|
@@ -6427,7 +6479,7 @@ const hydrateFromDb = xstate.fromCallback(({ sendBack, input: { context } }) =>
|
|
|
6427
6479
|
// to use dynamically imported ModelPropertyDataTypes
|
|
6428
6480
|
const _hydrateFromDb = async () => {
|
|
6429
6481
|
// Use dynamic import to break circular dependency
|
|
6430
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6482
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-CpBFvNId.js'); });
|
|
6431
6483
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6432
6484
|
const appDb = BaseDb.getAppDb();
|
|
6433
6485
|
const whereClauses = [];
|
|
@@ -6937,7 +6989,7 @@ const analyzeInput = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
6937
6989
|
}
|
|
6938
6990
|
const _analyzeInput = async () => {
|
|
6939
6991
|
// Use dynamic import to break circular dependency
|
|
6940
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6992
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-CpBFvNId.js'); });
|
|
6941
6993
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6942
6994
|
let propertyName = propertyNameRaw;
|
|
6943
6995
|
if (!propertyName) {
|
|
@@ -7019,8 +7071,10 @@ const analyzeInput = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
7019
7071
|
modelName,
|
|
7020
7072
|
schemaUid,
|
|
7021
7073
|
}); // Type assertion needed because newValue is not in MetadataType but is accepted by the function
|
|
7074
|
+
const stringValueForContext = typeof newValue === 'string' ? newValue : (newValue !== null && newValue !== undefined ? String(newValue) : undefined);
|
|
7022
7075
|
let updatedContext = {
|
|
7023
|
-
propertyValue:
|
|
7076
|
+
propertyValue: stringValueForContext,
|
|
7077
|
+
renderValue: stringValueForContext,
|
|
7024
7078
|
};
|
|
7025
7079
|
if (localId) {
|
|
7026
7080
|
updatedContext.localId = localId;
|
|
@@ -7579,7 +7633,7 @@ const saveRelation = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
7579
7633
|
}
|
|
7580
7634
|
const _saveRelation = async () => {
|
|
7581
7635
|
// Use dynamic import to break circular dependency
|
|
7582
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
7636
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-CpBFvNId.js'); });
|
|
7583
7637
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
7584
7638
|
if (!propertyNameRaw) {
|
|
7585
7639
|
throw new Error('propertyName is required');
|
|
@@ -8443,7 +8497,7 @@ class ItemProperty {
|
|
|
8443
8497
|
return;
|
|
8444
8498
|
}
|
|
8445
8499
|
// Use dynamic import to break circular dependency
|
|
8446
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
8500
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-CpBFvNId.js'); });
|
|
8447
8501
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
8448
8502
|
const { context } = snapshot;
|
|
8449
8503
|
const { propertyRecordSchema } = context;
|
|
@@ -9129,7 +9183,7 @@ class ItemProperty {
|
|
|
9129
9183
|
}
|
|
9130
9184
|
async save() {
|
|
9131
9185
|
const ctx = this._getSnapshotContext();
|
|
9132
|
-
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-
|
|
9186
|
+
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-CkgGUliG.js'); });
|
|
9133
9187
|
await assertItemOwned({
|
|
9134
9188
|
seedLocalId: ctx?.seedLocalId ?? undefined,
|
|
9135
9189
|
seedUid: ctx?.seedUid ?? undefined,
|
|
@@ -9449,7 +9503,7 @@ class Item {
|
|
|
9449
9503
|
});
|
|
9450
9504
|
};
|
|
9451
9505
|
this.publish = async () => {
|
|
9452
|
-
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-
|
|
9506
|
+
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-CkgGUliG.js'); });
|
|
9453
9507
|
await assertItemOwned(this);
|
|
9454
9508
|
this._service.send({ type: 'startPublish' });
|
|
9455
9509
|
return new Promise((resolve, reject) => {
|
|
@@ -9485,13 +9539,13 @@ class Item {
|
|
|
9485
9539
|
};
|
|
9486
9540
|
this.getPublishUploads = async () => {
|
|
9487
9541
|
// Use dynamic import to break circular dependency
|
|
9488
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
9542
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-BA5PdoJ3.js'); });
|
|
9489
9543
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
9490
9544
|
return await getPublishUploads(this);
|
|
9491
9545
|
};
|
|
9492
9546
|
this.getPublishPayload = async (uploadedTransactions) => {
|
|
9493
9547
|
// Use dynamic import to break circular dependency
|
|
9494
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
9548
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-CGl97AXX.js'); });
|
|
9495
9549
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
9496
9550
|
return await getPublishPayload(this, uploadedTransactions);
|
|
9497
9551
|
};
|
|
@@ -10613,7 +10667,7 @@ class Item {
|
|
|
10613
10667
|
* Destroy the item: soft delete in DB, remove from caches, clean up subscriptions, stop service.
|
|
10614
10668
|
*/
|
|
10615
10669
|
async destroy() {
|
|
10616
|
-
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-
|
|
10670
|
+
const { assertItemOwned } = await Promise.resolve().then(function () { return require('./ownership-CkgGUliG.js'); });
|
|
10617
10671
|
await assertItemOwned(this);
|
|
10618
10672
|
const context = this._getSnapshotContext();
|
|
10619
10673
|
const cacheKey = context.seedUid || context.seedLocalId;
|
|
@@ -14442,7 +14496,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
14442
14496
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
14443
14497
|
// Eagerly start loading to minimize delay on first access
|
|
14444
14498
|
let ModelPropertyClass = null;
|
|
14445
|
-
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-
|
|
14499
|
+
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-C5BRfISV.js'); })
|
|
14446
14500
|
.then(module => {
|
|
14447
14501
|
ModelPropertyClass = module.ModelProperty;
|
|
14448
14502
|
return ModelPropertyClass;
|
|
@@ -14459,7 +14513,7 @@ function getModelProperty() {
|
|
|
14459
14513
|
}
|
|
14460
14514
|
// Lazy import cache for Schema to avoid circular dependency
|
|
14461
14515
|
let SchemaClass = null;
|
|
14462
|
-
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-
|
|
14516
|
+
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-DVJG8ISB.js'); })
|
|
14463
14517
|
.then(module => {
|
|
14464
14518
|
SchemaClass = module.Schema;
|
|
14465
14519
|
return SchemaClass;
|
|
@@ -17055,7 +17109,7 @@ const getTsImport = async (filePath) => {
|
|
|
17055
17109
|
|
|
17056
17110
|
// Get the directory of this file to resolve relative paths
|
|
17057
17111
|
// @ts-ignore - rollup plugin-typescript doesn't recognize import.meta with module: "preserve"
|
|
17058
|
-
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-
|
|
17112
|
+
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-B3K0jG2t.js', document.baseURI).href)));
|
|
17059
17113
|
path.dirname(__filename$1);
|
|
17060
17114
|
const commandExists = (command) => {
|
|
17061
17115
|
try {
|
|
@@ -17611,4 +17665,4 @@ exports.versions = versions;
|
|
|
17611
17665
|
exports.waitForEntityIdle = waitForEntityIdle;
|
|
17612
17666
|
exports.withSeed = withSeed;
|
|
17613
17667
|
exports.writeProcessMachine = writeProcessMachine;
|
|
17614
|
-
//# sourceMappingURL=index-
|
|
17668
|
+
//# sourceMappingURL=index-B3K0jG2t.js.map
|