@seedprotocol/sdk 0.4.5 → 0.4.6
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-CgWK-JgT.js → ArweaveClient-Caio37h1.js} +3 -3
- package/dist/ArweaveClient-Caio37h1.js.map +1 -0
- package/dist/{ArweaveClient-WcG8CZAE.js → ArweaveClient-DLKAaS3K.js} +3 -3
- package/dist/ArweaveClient-DLKAaS3K.js.map +1 -0
- package/dist/{Db-DjFdIdR9.js → Db-C9fppVRl.js} +3 -3
- package/dist/Db-C9fppVRl.js.map +1 -0
- package/dist/{Db-DjofXdeU.js → Db-DJAG-5Di.js} +7 -5
- package/dist/Db-DJAG-5Di.js.map +1 -0
- package/dist/{EasClient-Aojewp6P.js → EasClient-DQGAIj-b.js} +2 -2
- package/dist/EasClient-DQGAIj-b.js.map +1 -0
- package/dist/{EasClient-BVFXp2O6.js → EasClient-T7Nx9185.js} +2 -2
- package/dist/EasClient-T7Nx9185.js.map +1 -0
- package/dist/{FileManager-C9zr4AJe.js → FileManager-BohtoKYo.js} +4 -3
- package/dist/FileManager-BohtoKYo.js.map +1 -0
- package/dist/{FileManager-CxGJLw5C.js → FileManager-d64CkqXy.js} +2 -2
- package/dist/FileManager-d64CkqXy.js.map +1 -0
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
- package/dist/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/Item/service/actors/runPublish.d.ts.map +1 -1
- package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
- package/dist/Model/Model.d.ts.map +1 -1
- package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/{ModelProperty-CGdkocQ8.js → ModelProperty-Cpd9xiIM.js} +52 -18
- package/dist/ModelProperty-Cpd9xiIM.js.map +1 -0
- package/dist/{PathResolver-CX6GHoTS.js → PathResolver-CLZUWoX2.js} +2 -2
- package/dist/PathResolver-CLZUWoX2.js.map +1 -0
- package/dist/{PathResolver-z_WX47_o.js → PathResolver-D6M0rzKV.js} +2 -2
- package/dist/PathResolver-D6M0rzKV.js.map +1 -0
- package/dist/{QueryClient-ByKPdRmE.js → QueryClient-BUoz2Vb0.js} +2 -2
- package/dist/QueryClient-BUoz2Vb0.js.map +1 -0
- package/dist/{QueryClient-Cb1iJO-x.js → QueryClient-COQ_Rs4-.js} +2 -2
- package/dist/QueryClient-COQ_Rs4-.js.map +1 -0
- package/dist/Schema/Schema.d.ts.map +1 -1
- package/dist/Schema/service/actors/createModelInstances.d.ts.map +1 -1
- package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +1 -1
- package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
- package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/{Schema-D1eqDHyt.js → Schema-BZKBy5Tx.js} +63 -24
- package/dist/Schema-BZKBy5Tx.js.map +1 -0
- package/dist/{SchemaValidationService-DyttFaV_.js → SchemaValidationService-F8No7BHp.js} +2 -2
- package/dist/SchemaValidationService-F8No7BHp.js.map +1 -0
- package/dist/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/browser/react/itemProperty.d.ts.map +1 -1
- package/dist/cjs/{ModelProperty-BeJvgKMw.js → ModelProperty-B4pV91tc.js} +32 -18
- package/dist/cjs/ModelProperty-B4pV91tc.js.map +1 -0
- package/dist/cjs/{Schema-CVs9J6eP.js → Schema-TErl3J36.js} +33 -24
- package/dist/cjs/Schema-TErl3J36.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-CDKcVRFQ.js → SchemaValidationService-p5BbJV9T.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CDKcVRFQ.js.map → SchemaValidationService-p5BbJV9T.js.map} +1 -1
- package/dist/cjs/{getItem-B5RYPvrG.js → getItem-BrnLfC12.js} +2 -2
- package/dist/cjs/{getItem-B5RYPvrG.js.map → getItem-BrnLfC12.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-BD1qRob1.js → getPublishPayload-BcjCN_bD.js} +7 -5
- package/dist/cjs/getPublishPayload-BcjCN_bD.js.map +1 -0
- package/dist/cjs/{getPublishUploads-CnC9aYxs.js → getPublishUploads-5_oXzwol.js} +3 -3
- package/dist/cjs/{getPublishUploads-CnC9aYxs.js.map → getPublishUploads-5_oXzwol.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-B_njnntx.js → getSegmentedItemProperties-WFdizUDv.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-B_njnntx.js.map → getSegmentedItemProperties-WFdizUDv.js.map} +1 -1
- package/dist/cjs/{index-Dnywap_P.js → index-BrmvhXsG.js} +2 -2
- package/dist/cjs/index-BrmvhXsG.js.map +1 -0
- package/dist/cjs/{index-BeKPbbk0.js → index-CXI4VF1H.js} +330 -88
- package/dist/cjs/index-CXI4VF1H.js.map +1 -0
- package/dist/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/db/write/createNewItem.d.ts.map +1 -1
- package/dist/eas.d.ts.map +1 -1
- package/dist/events/files/download.d.ts.map +1 -1
- package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/{getItem-BB5HBCbK.js → getItem-DaQVdeae.js} +2 -2
- package/dist/getItem-DaQVdeae.js.map +1 -0
- package/dist/{getPublishPayload-uLm0AqN_.js → getPublishPayload-CWiLI1yd.js} +7 -5
- package/dist/getPublishPayload-CWiLI1yd.js.map +1 -0
- package/dist/{getPublishUploads-Dc-HqhO8.js → getPublishUploads-DhvcKD_9.js} +3 -3
- package/dist/getPublishUploads-DhvcKD_9.js.map +1 -0
- package/dist/{getSegmentedItemProperties-BrIqFNfD.js → getSegmentedItemProperties-Cp4kcWIF.js} +2 -2
- package/dist/getSegmentedItemProperties-Cp4kcWIF.js.map +1 -0
- package/dist/helpers/db.d.ts.map +1 -1
- package/dist/helpers/property.d.ts.map +1 -1
- package/dist/helpers/updateSchema.d.ts.map +1 -1
- package/dist/imports/json.d.ts.map +1 -1
- package/dist/{index-2FcQHgKp.js → index-DBy53qbb.js} +2 -2
- package/dist/index-DBy53qbb.js.map +1 -0
- package/dist/{index-DPll6EAp.js → index-Dk73a7JE.js} +343 -97
- package/dist/index-Dk73a7JE.js.map +1 -0
- package/dist/{index-LEY0Og1p.js → index-LfXKx_PE.js} +3 -3
- package/dist/index-LfXKx_PE.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +11 -8
- package/dist/main.js.map +1 -1
- package/dist/node/db/Db.d.ts.map +1 -1
- package/dist/node.js +10 -10
- package/dist/node.js.map +1 -1
- package/dist/{property-B15X7jLX.js → property-1o2MvYTm.js} +10 -4
- package/dist/property-1o2MvYTm.js.map +1 -0
- package/dist/{queries-BPDSpiEX.js → queries-DA4G0iEN.js} +2 -2
- package/dist/queries-DA4G0iEN.js.map +1 -0
- package/dist/services/publish/actors/preparePublishRequestData.d.ts.map +1 -1
- package/dist/services/publish/actors/upload.d.ts.map +1 -1
- package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
- package/dist/ArweaveClient-CgWK-JgT.js.map +0 -1
- package/dist/ArweaveClient-WcG8CZAE.js.map +0 -1
- package/dist/Db-DjFdIdR9.js.map +0 -1
- package/dist/Db-DjofXdeU.js.map +0 -1
- package/dist/EasClient-Aojewp6P.js.map +0 -1
- package/dist/EasClient-BVFXp2O6.js.map +0 -1
- package/dist/FileManager-C9zr4AJe.js.map +0 -1
- package/dist/FileManager-CxGJLw5C.js.map +0 -1
- package/dist/ModelProperty-CGdkocQ8.js.map +0 -1
- package/dist/PathResolver-CX6GHoTS.js.map +0 -1
- package/dist/PathResolver-z_WX47_o.js.map +0 -1
- package/dist/QueryClient-ByKPdRmE.js.map +0 -1
- package/dist/QueryClient-Cb1iJO-x.js.map +0 -1
- package/dist/Schema-D1eqDHyt.js.map +0 -1
- package/dist/SchemaValidationService-DyttFaV_.js.map +0 -1
- package/dist/cjs/ModelProperty-BeJvgKMw.js.map +0 -1
- package/dist/cjs/Schema-CVs9J6eP.js.map +0 -1
- package/dist/cjs/getPublishPayload-BD1qRob1.js.map +0 -1
- package/dist/cjs/index-BeKPbbk0.js.map +0 -1
- package/dist/cjs/index-Dnywap_P.js.map +0 -1
- package/dist/getItem-BB5HBCbK.js.map +0 -1
- package/dist/getPublishPayload-uLm0AqN_.js.map +0 -1
- package/dist/getPublishUploads-Dc-HqhO8.js.map +0 -1
- package/dist/getSegmentedItemProperties-BrIqFNfD.js.map +0 -1
- package/dist/index-2FcQHgKp.js.map +0 -1
- package/dist/index-DPll6EAp.js.map +0 -1
- package/dist/index-LEY0Og1p.js.map +0 -1
- package/dist/property-B15X7jLX.js.map +0 -1
- package/dist/queries-BPDSpiEX.js.map +0 -1
|
@@ -424,6 +424,30 @@ const generateId = () => {
|
|
|
424
424
|
const toSnakeCase = (str) => {
|
|
425
425
|
return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
426
426
|
};
|
|
427
|
+
const identifyString = (str) => {
|
|
428
|
+
try {
|
|
429
|
+
JSON.parse(str);
|
|
430
|
+
return 'json';
|
|
431
|
+
}
|
|
432
|
+
catch (e) {
|
|
433
|
+
// Not JSON
|
|
434
|
+
}
|
|
435
|
+
if (!str) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (str.trim().startsWith('<') && str.trim().endsWith('>')) {
|
|
439
|
+
return 'html';
|
|
440
|
+
}
|
|
441
|
+
// Simple markdown checks (very naive)
|
|
442
|
+
if (/^#{1,6}\s|^-{3,}|\*{3,}|^-{1,2}\s|\*\s/.test(str)) {
|
|
443
|
+
return 'markdown';
|
|
444
|
+
}
|
|
445
|
+
if (/^data:image\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/.test(str)) {
|
|
446
|
+
return 'base64';
|
|
447
|
+
}
|
|
448
|
+
// Default to plain text if unsure
|
|
449
|
+
return 'text';
|
|
450
|
+
};
|
|
427
451
|
const getMimeType = (base64) => {
|
|
428
452
|
if (!base64) {
|
|
429
453
|
return null;
|
|
@@ -510,6 +534,12 @@ const convertTxIdToImage = async (txId) => {
|
|
|
510
534
|
const getArweaveUrlForTransaction = (storageTransactionId) => {
|
|
511
535
|
return BaseArweaveClient.getRawUrl(storageTransactionId);
|
|
512
536
|
};
|
|
537
|
+
const getExecutionTime = async (task, args) => {
|
|
538
|
+
const start = Date.now();
|
|
539
|
+
await task(...args);
|
|
540
|
+
return Date.now() - start;
|
|
541
|
+
};
|
|
542
|
+
const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
513
543
|
const parseEasRelationPropertyName = (easPropertyName) => {
|
|
514
544
|
// Split the input string on the first underscore
|
|
515
545
|
const [singularProperty, modelName, idSegment] = easPropertyName.split('_');
|
|
@@ -525,6 +555,25 @@ const parseEasRelationPropertyName = (easPropertyName) => {
|
|
|
525
555
|
isList, // True if the property is a list (e.g., 'ids' is present)
|
|
526
556
|
};
|
|
527
557
|
};
|
|
558
|
+
const isBinary = (arrayBuffer) => {
|
|
559
|
+
const view = new Uint8Array(arrayBuffer);
|
|
560
|
+
let nonTextCount = 0;
|
|
561
|
+
const threshold = 0.2; // Adjust as needed (e.g., 20% non-text implies binary)
|
|
562
|
+
for (let i = 0; i < view.length; i++) {
|
|
563
|
+
const byte = view[i];
|
|
564
|
+
// ASCII printable characters (32-126) and common whitespace (9, 10, 13)
|
|
565
|
+
if ((byte >= 32 && byte <= 126) || // Printable ASCII
|
|
566
|
+
byte === 9 || byte === 10 || byte === 13 // Tab, LF, CR
|
|
567
|
+
) {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
nonTextCount++;
|
|
571
|
+
if (nonTextCount / view.length > threshold) {
|
|
572
|
+
return true; // More than threshold are non-text bytes
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return false; // Fewer than threshold are non-text bytes
|
|
576
|
+
};
|
|
528
577
|
|
|
529
578
|
var index = /*#__PURE__*/Object.freeze({
|
|
530
579
|
__proto__: null,
|
|
@@ -532,12 +581,16 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
532
581
|
BaseEasClient: BaseEasClient,
|
|
533
582
|
BaseFileManager: BaseFileManager,
|
|
534
583
|
BaseQueryClient: BaseQueryClient,
|
|
584
|
+
capitalizeFirstLetter: capitalizeFirstLetter,
|
|
535
585
|
convertTxIdToImage: convertTxIdToImage,
|
|
536
586
|
generateId: generateId,
|
|
537
587
|
getArweaveUrlForTransaction: getArweaveUrlForTransaction,
|
|
538
588
|
getCorrectId: getCorrectId,
|
|
539
589
|
getDataTypeFromString: getDataTypeFromString,
|
|
590
|
+
getExecutionTime: getExecutionTime,
|
|
540
591
|
getMimeType: getMimeType,
|
|
592
|
+
identifyString: identifyString,
|
|
593
|
+
isBinary: isBinary,
|
|
541
594
|
parseEasRelationPropertyName: parseEasRelationPropertyName,
|
|
542
595
|
toSnakeCase: toSnakeCase,
|
|
543
596
|
waitForEntityIdle: waitForEntityIdle
|
|
@@ -554,7 +607,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
554
607
|
return;
|
|
555
608
|
}
|
|
556
609
|
try {
|
|
557
|
-
const mod = await import('./ModelProperty-
|
|
610
|
+
const mod = await import('./ModelProperty-Cpd9xiIM.js');
|
|
558
611
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
559
612
|
if (!ModelProperty) {
|
|
560
613
|
logger$s('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -637,7 +690,8 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
637
690
|
// schemaFileId to match the database, both will point to the same cached instance.
|
|
638
691
|
if (dbSchemaFileId) {
|
|
639
692
|
try {
|
|
640
|
-
const
|
|
693
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
694
|
+
const { Model } = modelMod;
|
|
641
695
|
// Access instanceCacheById via type assertion since it's protected
|
|
642
696
|
const cacheById = Model.instanceCacheById;
|
|
643
697
|
if (cacheById.has(dbSchemaFileId)) {
|
|
@@ -742,7 +796,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
742
796
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
743
797
|
// This handles the case where model exists in schema file but not yet in database
|
|
744
798
|
try {
|
|
745
|
-
const
|
|
799
|
+
const _mod_0 = await import('./Schema-BZKBy5Tx.js');
|
|
800
|
+
const _ns_0 = _mod_0.b;
|
|
801
|
+
const schemaMod = _ns_0;
|
|
802
|
+
const { Schema } = schemaMod;
|
|
746
803
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
747
804
|
const schemaSnapshot = schema.getService().getSnapshot();
|
|
748
805
|
// Wait for schema to load if it's still loading
|
|
@@ -813,7 +870,8 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
813
870
|
let finalModelName = modelName;
|
|
814
871
|
if (db) {
|
|
815
872
|
// Check if this is an internal schema (Seed Protocol)
|
|
816
|
-
const
|
|
873
|
+
const constantsMod = await Promise.resolve().then(function () { return constants; });
|
|
874
|
+
const { isInternalSchema } = constantsMod;
|
|
817
875
|
const isInternal = isInternalSchema(schemaName);
|
|
818
876
|
// Only skip duplicate check if:
|
|
819
877
|
// 1. We found a model record to use (modelRecord is set), OR
|
|
@@ -828,7 +886,8 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
828
886
|
const existingNumbers = new Set(existingNumbersFromSchemaContext ?? []);
|
|
829
887
|
// First, check Model cache for models (includes models from imported schemas that may not be in DB yet)
|
|
830
888
|
try {
|
|
831
|
-
const
|
|
889
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
890
|
+
const { Model } = modelMod;
|
|
832
891
|
// Check name-based cache for this schema
|
|
833
892
|
// Skip the current model (context.id): Model.create() adds the new instance to the cache
|
|
834
893
|
// before this callback runs, so we must not count it as a duplicate.
|
|
@@ -887,8 +946,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
887
946
|
}
|
|
888
947
|
// Also check database for models (in case they're persisted but not in Schema context)
|
|
889
948
|
if (db) {
|
|
890
|
-
const
|
|
891
|
-
const {
|
|
949
|
+
const modelSchemaSchemaMod = await Promise.resolve().then(function () { return ModelSchemaSchema; });
|
|
950
|
+
const { modelSchemas } = modelSchemaSchemaMod;
|
|
951
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
952
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
892
953
|
// Query all models for this schema to check for duplicates (case-insensitive)
|
|
893
954
|
logger$s(`Checking database for duplicate model names in schema "${schemaName}"`);
|
|
894
955
|
const allModelsForSchema = await db
|
|
@@ -961,7 +1022,8 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
961
1022
|
}
|
|
962
1023
|
// Runtime creates use a placeholder cache key in Model.create; move it to the final name. Skip when schema model (_idFromSchema).
|
|
963
1024
|
if (!_idFromSchema) {
|
|
964
|
-
const
|
|
1025
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
1026
|
+
const { Model } = modelMod;
|
|
965
1027
|
Model.updateNameIndex('__pending__' + schemaFileId, finalModelName, schemaName, schemaFileId);
|
|
966
1028
|
}
|
|
967
1029
|
// If model name was changed, store it in a temporary internal field so loadOrCreateModelSuccess can apply it
|
|
@@ -980,7 +1042,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
980
1042
|
}
|
|
981
1043
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
982
1044
|
try {
|
|
983
|
-
const
|
|
1045
|
+
const _mod_1 = await import('./Schema-BZKBy5Tx.js');
|
|
1046
|
+
const _ns_1 = _mod_1.b;
|
|
1047
|
+
const schemaMod = _ns_1;
|
|
1048
|
+
const { Schema } = schemaMod;
|
|
984
1049
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
985
1050
|
schema.getService().send({ type: 'markAsDraft', propertyKey: 'schema:models' });
|
|
986
1051
|
}
|
|
@@ -1023,9 +1088,13 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1023
1088
|
const _validateModel = async () => {
|
|
1024
1089
|
try {
|
|
1025
1090
|
// Use dynamic imports to break circular dependencies
|
|
1026
|
-
const
|
|
1091
|
+
const validationServiceMod = await import('./SchemaValidationService-F8No7BHp.js');
|
|
1092
|
+
const { SchemaValidationService } = validationServiceMod;
|
|
1027
1093
|
const validationService = new SchemaValidationService();
|
|
1028
|
-
const
|
|
1094
|
+
const _mod_2 = await import('./Schema-BZKBy5Tx.js');
|
|
1095
|
+
const _ns_2 = _mod_2.b;
|
|
1096
|
+
const schemaMod = _ns_2;
|
|
1097
|
+
const { Schema } = schemaMod;
|
|
1029
1098
|
// Validate model structure
|
|
1030
1099
|
const structureResult = validationService.validateModelStructure(context);
|
|
1031
1100
|
if (!structureResult.isValid) {
|
|
@@ -1136,19 +1205,21 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
|
|
|
1136
1205
|
return;
|
|
1137
1206
|
}
|
|
1138
1207
|
logger$q(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
1139
|
-
const mod = await import('./ModelProperty-
|
|
1208
|
+
const mod = await import('./ModelProperty-Cpd9xiIM.js');
|
|
1140
1209
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1141
1210
|
if (!ModelProperty) {
|
|
1142
1211
|
logger$q('ModelProperty not available from dynamic import');
|
|
1143
1212
|
sendBack({ type: 'createModelPropertiesError', error: new Error('ModelProperty not available') });
|
|
1144
1213
|
return;
|
|
1145
1214
|
}
|
|
1146
|
-
const
|
|
1215
|
+
const drizzleMod = await import('drizzle-orm');
|
|
1216
|
+
const { eq } = drizzleMod;
|
|
1147
1217
|
const db = BaseDb.getAppDb();
|
|
1148
1218
|
for (const [propName, propData] of Object.entries(propertyDefinitions)) {
|
|
1149
1219
|
// Use provided ID or generate a random one
|
|
1150
1220
|
// IDs should be generated in the import process before creating properties
|
|
1151
|
-
const
|
|
1221
|
+
const helpersMod = await Promise.resolve().then(function () { return index; });
|
|
1222
|
+
const { generateId } = helpersMod;
|
|
1152
1223
|
const propertyFileId = propData.id || generateId();
|
|
1153
1224
|
logger$q(`Creating property "${propName}" with fileId "${propertyFileId}"`);
|
|
1154
1225
|
// Query database to get refModelId if the property has ref/refModelName
|
|
@@ -1239,7 +1310,8 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1239
1310
|
logger$p(structureMsg);
|
|
1240
1311
|
console.log(structureMsg); // Always log to console
|
|
1241
1312
|
// Use existing Model validation
|
|
1242
|
-
const
|
|
1313
|
+
const validationServiceMod = await import('./SchemaValidationService-F8No7BHp.js');
|
|
1314
|
+
const { SchemaValidationService } = validationServiceMod;
|
|
1243
1315
|
const validationService = new SchemaValidationService();
|
|
1244
1316
|
// Validate model structure
|
|
1245
1317
|
const structureResult = validationService.validateModelStructure(entityInput.entityData);
|
|
@@ -1257,7 +1329,10 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1257
1329
|
if (entityInput.entityData.schemaName) {
|
|
1258
1330
|
try {
|
|
1259
1331
|
logger$p(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
|
|
1260
|
-
const
|
|
1332
|
+
const _mod_3 = await import('./Schema-BZKBy5Tx.js');
|
|
1333
|
+
const _ns_3 = _mod_3.b;
|
|
1334
|
+
const schemaMod = _ns_3;
|
|
1335
|
+
const { Schema } = schemaMod;
|
|
1261
1336
|
const schema = Schema.create(entityInput.entityData.schemaName, {
|
|
1262
1337
|
waitForReady: false,
|
|
1263
1338
|
});
|
|
@@ -1292,7 +1367,8 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1292
1367
|
}
|
|
1293
1368
|
else if (entityInput.entityType === 'modelProperty') {
|
|
1294
1369
|
// Use existing ModelProperty validation
|
|
1295
|
-
const
|
|
1370
|
+
const validationServiceMod = await import('./SchemaValidationService-F8No7BHp.js');
|
|
1371
|
+
const { SchemaValidationService } = validationServiceMod;
|
|
1296
1372
|
const validationService = new SchemaValidationService();
|
|
1297
1373
|
// Validate property structure
|
|
1298
1374
|
const structureResult = validationService.validatePropertyStructure(entityInput.entityData);
|
|
@@ -1306,7 +1382,10 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1306
1382
|
// If schema name and model name provided, validate against schema
|
|
1307
1383
|
if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
|
|
1308
1384
|
try {
|
|
1309
|
-
const
|
|
1385
|
+
const _mod_4 = await import('./Schema-BZKBy5Tx.js');
|
|
1386
|
+
const _ns_4 = _mod_4.b;
|
|
1387
|
+
const schemaMod = _ns_4;
|
|
1388
|
+
const { Schema } = schemaMod;
|
|
1310
1389
|
const schema = Schema.create(entityInput.entityData._schemaName, {
|
|
1311
1390
|
waitForReady: false,
|
|
1312
1391
|
});
|
|
@@ -1334,7 +1413,8 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1334
1413
|
}
|
|
1335
1414
|
else if (entityInput.entityType === 'schema') {
|
|
1336
1415
|
// Schema validation - use existing validation
|
|
1337
|
-
const
|
|
1416
|
+
const validationServiceMod = await import('./SchemaValidationService-F8No7BHp.js');
|
|
1417
|
+
const { SchemaValidationService } = validationServiceMod;
|
|
1338
1418
|
const validationService = new SchemaValidationService();
|
|
1339
1419
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
1340
1420
|
if (!schemaResult.isValid) {
|
|
@@ -1493,6 +1573,42 @@ const escapeSqliteString = (value) => {
|
|
|
1493
1573
|
}
|
|
1494
1574
|
return value.replace(/'/g, "''");
|
|
1495
1575
|
};
|
|
1576
|
+
const getObjectForRow = (row) => {
|
|
1577
|
+
const obj = {};
|
|
1578
|
+
row.columnNames.forEach((colName, index) => {
|
|
1579
|
+
const value = row.row[index];
|
|
1580
|
+
if (typeof value !== 'string') {
|
|
1581
|
+
obj[colName] = row.row[index];
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
// Try to parse the value as JSON
|
|
1585
|
+
try {
|
|
1586
|
+
obj[colName] = JSON.parse(value);
|
|
1587
|
+
}
|
|
1588
|
+
catch (e) {
|
|
1589
|
+
// If it fails, just set the value as a string
|
|
1590
|
+
obj[colName] = value;
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
return obj;
|
|
1594
|
+
};
|
|
1595
|
+
const getSqlResultObject = (queryResult) => {
|
|
1596
|
+
if (!queryResult || !queryResult.rows || queryResult.rows.length === 0) {
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
let obj;
|
|
1600
|
+
if (queryResult.rows.length === 1) {
|
|
1601
|
+
obj = getObjectForRow(queryResult.rows[0]);
|
|
1602
|
+
}
|
|
1603
|
+
if (queryResult.rows.length > 1) {
|
|
1604
|
+
obj = queryResult.rows.reduce((acc, row) => {
|
|
1605
|
+
const rowObj = getObjectForRow(row);
|
|
1606
|
+
acc.push(rowObj);
|
|
1607
|
+
return acc;
|
|
1608
|
+
}, []);
|
|
1609
|
+
}
|
|
1610
|
+
return obj;
|
|
1611
|
+
};
|
|
1496
1612
|
const createOrUpdate = async (db, table, values) => {
|
|
1497
1613
|
const valueFilters = [];
|
|
1498
1614
|
const propertiesToExcludeFromDb = ['ref'];
|
|
@@ -1828,7 +1944,7 @@ async function checkIfPropertyIsEdited(modelName, propertyName, schemaFileValue)
|
|
|
1828
1944
|
const cacheKey = `${modelName}:${propertyName}`;
|
|
1829
1945
|
// First, check the in-memory cache (for current session edits)
|
|
1830
1946
|
// Robust dynamic import for consumer re-bundling (named or default export)
|
|
1831
|
-
const mod = await import('./ModelProperty-
|
|
1947
|
+
const mod = await import('./ModelProperty-Cpd9xiIM.js');
|
|
1832
1948
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1833
1949
|
if (!ModelProperty) {
|
|
1834
1950
|
logger$o('ModelProperty not available from dynamic import');
|
|
@@ -2071,7 +2187,8 @@ const addModelsToDb$1 = async (models, schema, modelRenames, schemaFileData) =>
|
|
|
2071
2187
|
schema = pendingProperties;
|
|
2072
2188
|
}
|
|
2073
2189
|
else {
|
|
2074
|
-
const
|
|
2190
|
+
const modelHelpersMod = await Promise.resolve().then(function () { return model; });
|
|
2191
|
+
const { modelPropertiesToObject } = modelHelpersMod;
|
|
2075
2192
|
const modelProperties = modelClass.properties || [];
|
|
2076
2193
|
schema = modelPropertiesToObject(modelProperties);
|
|
2077
2194
|
}
|
|
@@ -2091,7 +2208,8 @@ const addModelsToDb$1 = async (models, schema, modelRenames, schemaFileData) =>
|
|
|
2091
2208
|
// If no propertyFileId from map, generate a random ID
|
|
2092
2209
|
// IDs should be generated in the import process before calling addModelsToDb
|
|
2093
2210
|
if (!propertyFileId) {
|
|
2094
|
-
const
|
|
2211
|
+
const helpersIndexMod = await Promise.resolve().then(function () { return index; });
|
|
2212
|
+
const { generateId } = helpersIndexMod;
|
|
2095
2213
|
propertyFileId = generateId();
|
|
2096
2214
|
logger$o(`Generated propertyFileId "${propertyFileId}" for property "${modelName}:${propertyName}" (not found in propertyFileIds map)`);
|
|
2097
2215
|
}
|
|
@@ -2636,7 +2754,8 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
2636
2754
|
throw new Error(`Model with id ${modelId} does not exist in database. Cannot create join record.`);
|
|
2637
2755
|
}
|
|
2638
2756
|
// Verify schemaId exists and get name/fileId for invalidation broadcast
|
|
2639
|
-
const
|
|
2757
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
2758
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
2640
2759
|
const schemaCheck = await db
|
|
2641
2760
|
.select({
|
|
2642
2761
|
id: schemasTable.id,
|
|
@@ -2702,7 +2821,8 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
2702
2821
|
else {
|
|
2703
2822
|
// Generate random propertyFileId
|
|
2704
2823
|
// IDs should be generated in the import process before calling writeModelToDb
|
|
2705
|
-
const
|
|
2824
|
+
const helpersIndexMod = await Promise.resolve().then(function () { return index; });
|
|
2825
|
+
const { generateId } = helpersIndexMod;
|
|
2706
2826
|
propertyFileId = generateId();
|
|
2707
2827
|
logger$o(`Generated propertyFileId "${propertyFileId}" for property "${data.modelName}:${propName}"`);
|
|
2708
2828
|
}
|
|
@@ -2828,6 +2948,68 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
2828
2948
|
}
|
|
2829
2949
|
}
|
|
2830
2950
|
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Get schema database ID from schema name or schemaFileId
|
|
2953
|
+
* @param schemaNameOrFileId - Schema name (string) or schemaFileId (string)
|
|
2954
|
+
* @returns Schema database ID
|
|
2955
|
+
* @throws Error if schema not found
|
|
2956
|
+
*/
|
|
2957
|
+
async function getSchemaId(schemaNameOrFileId) {
|
|
2958
|
+
const db = BaseDb.getAppDb();
|
|
2959
|
+
if (!db) {
|
|
2960
|
+
throw new Error('Database not available');
|
|
2961
|
+
}
|
|
2962
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
2963
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
2964
|
+
const drizzleMod = await import('drizzle-orm');
|
|
2965
|
+
const { eq, desc } = drizzleMod;
|
|
2966
|
+
// Try to find by schemaFileId first (more reliable)
|
|
2967
|
+
let records = await db
|
|
2968
|
+
.select()
|
|
2969
|
+
.from(schemasTable)
|
|
2970
|
+
.where(eq(schemasTable.schemaFileId, schemaNameOrFileId))
|
|
2971
|
+
.orderBy(desc(schemasTable.version))
|
|
2972
|
+
.limit(1);
|
|
2973
|
+
// If not found by schemaFileId, try by name
|
|
2974
|
+
if (records.length === 0) {
|
|
2975
|
+
records = await db
|
|
2976
|
+
.select()
|
|
2977
|
+
.from(schemasTable)
|
|
2978
|
+
.where(eq(schemasTable.name, schemaNameOrFileId))
|
|
2979
|
+
.orderBy(desc(schemasTable.version))
|
|
2980
|
+
.limit(1);
|
|
2981
|
+
}
|
|
2982
|
+
if (records.length === 0) {
|
|
2983
|
+
throw new Error(`Schema "${schemaNameOrFileId}" not found in database`);
|
|
2984
|
+
}
|
|
2985
|
+
return records[0].id;
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Get schema database ID from schemaFileId
|
|
2989
|
+
* @param schemaFileId - The schema file ID
|
|
2990
|
+
* @returns Schema database ID
|
|
2991
|
+
* @throws Error if schema not found
|
|
2992
|
+
*/
|
|
2993
|
+
async function getSchemaIdByFileId(schemaFileId) {
|
|
2994
|
+
const db = BaseDb.getAppDb();
|
|
2995
|
+
if (!db) {
|
|
2996
|
+
throw new Error('Database not available');
|
|
2997
|
+
}
|
|
2998
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
2999
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
3000
|
+
const drizzleMod = await import('drizzle-orm');
|
|
3001
|
+
const { eq, desc } = drizzleMod;
|
|
3002
|
+
const records = await db
|
|
3003
|
+
.select()
|
|
3004
|
+
.from(schemasTable)
|
|
3005
|
+
.where(eq(schemasTable.schemaFileId, schemaFileId))
|
|
3006
|
+
.orderBy(desc(schemasTable.version))
|
|
3007
|
+
.limit(1);
|
|
3008
|
+
if (records.length === 0) {
|
|
3009
|
+
throw new Error(`Schema with file ID "${schemaFileId}" not found in database`);
|
|
3010
|
+
}
|
|
3011
|
+
return records[0].id;
|
|
3012
|
+
}
|
|
2831
3013
|
/**
|
|
2832
3014
|
* Get model database ID from model name or modelFileId
|
|
2833
3015
|
* @param modelNameOrFileId - Model name (string) or modelFileId (string)
|
|
@@ -2840,8 +3022,10 @@ async function getModelId(modelNameOrFileId, schemaNameOrId) {
|
|
|
2840
3022
|
if (!db) {
|
|
2841
3023
|
throw new Error('Database not available');
|
|
2842
3024
|
}
|
|
2843
|
-
const
|
|
2844
|
-
const {
|
|
3025
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return ModelSchema; });
|
|
3026
|
+
const { models: modelsTable } = modelSchemaMod;
|
|
3027
|
+
const drizzleMod = await import('drizzle-orm');
|
|
3028
|
+
const { eq, and, or } = drizzleMod;
|
|
2845
3029
|
// Try to find by modelFileId first (more reliable)
|
|
2846
3030
|
let records = await db
|
|
2847
3031
|
.select()
|
|
@@ -2853,8 +3037,10 @@ async function getModelId(modelNameOrFileId, schemaNameOrId) {
|
|
|
2853
3037
|
[eq(modelsTable.name, modelNameOrFileId)];
|
|
2854
3038
|
// If schema is provided, narrow the search
|
|
2855
3039
|
if (schemaNameOrId !== undefined) {
|
|
2856
|
-
const
|
|
2857
|
-
const {
|
|
3040
|
+
const modelSchemaSchemaMod = await Promise.resolve().then(function () { return ModelSchemaSchema; });
|
|
3041
|
+
const { modelSchemas } = modelSchemaSchemaMod;
|
|
3042
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
3043
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
2858
3044
|
if (typeof schemaNameOrId === 'number') {
|
|
2859
3045
|
// schemaNameOrId is schemaId
|
|
2860
3046
|
records = await db
|
|
@@ -2901,8 +3087,10 @@ async function getModelIdByFileId(modelFileId) {
|
|
|
2901
3087
|
if (!db) {
|
|
2902
3088
|
throw new Error('Database not available');
|
|
2903
3089
|
}
|
|
2904
|
-
const
|
|
2905
|
-
const {
|
|
3090
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return ModelSchema; });
|
|
3091
|
+
const { models: modelsTable } = modelSchemaMod;
|
|
3092
|
+
const drizzleMod = await import('drizzle-orm');
|
|
3093
|
+
const { eq } = drizzleMod;
|
|
2906
3094
|
const records = await db
|
|
2907
3095
|
.select()
|
|
2908
3096
|
.from(modelsTable)
|
|
@@ -2924,7 +3112,11 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
2924
3112
|
getModelId: getModelId,
|
|
2925
3113
|
getModelIdByFileId: getModelIdByFileId,
|
|
2926
3114
|
getModelNameByModelId: getModelNameByModelId,
|
|
3115
|
+
getObjectForRow: getObjectForRow,
|
|
2927
3116
|
getPropertyModelNameAndDataType: getPropertyModelNameAndDataType,
|
|
3117
|
+
getSchemaId: getSchemaId,
|
|
3118
|
+
getSchemaIdByFileId: getSchemaIdByFileId,
|
|
3119
|
+
getSqlResultObject: getSqlResultObject,
|
|
2928
3120
|
loadModelsFromDbForSchema: loadModelsFromDbForSchema,
|
|
2929
3121
|
renameModelInDb: renameModelInDb,
|
|
2930
3122
|
savePropertyToDb: savePropertyToDb,
|
|
@@ -2978,7 +3170,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
|
|
|
2978
3170
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
2979
3171
|
let dataToWrite = input.entityData;
|
|
2980
3172
|
try {
|
|
2981
|
-
const mod = await import('./ModelProperty-
|
|
3173
|
+
const mod = await import('./ModelProperty-Cpd9xiIM.js');
|
|
2982
3174
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2983
3175
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
2984
3176
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -3369,7 +3561,7 @@ const modelMachine = setup({
|
|
|
3369
3561
|
// Create ModelProperty instances for any new property IDs
|
|
3370
3562
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
3371
3563
|
// Import and create instances asynchronously (fire-and-forget)
|
|
3372
|
-
import('./ModelProperty-
|
|
3564
|
+
import('./ModelProperty-Cpd9xiIM.js').then(({ ModelProperty }) => {
|
|
3373
3565
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
3374
3566
|
try {
|
|
3375
3567
|
const property = await ModelProperty.createById(propertyFileId);
|
|
@@ -4215,7 +4407,8 @@ const fetchDataFromEas = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
4215
4407
|
}
|
|
4216
4408
|
else if (modelName) {
|
|
4217
4409
|
// Dynamic import to break circular dependency
|
|
4218
|
-
const
|
|
4410
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
4411
|
+
const { Model } = modelMod;
|
|
4219
4412
|
const model = Model.getByName(modelName);
|
|
4220
4413
|
modelSchema = model?.properties ? modelPropertiesToObject(model.properties) : undefined;
|
|
4221
4414
|
}
|
|
@@ -4346,7 +4539,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid) =
|
|
|
4346
4539
|
return propertyInstances;
|
|
4347
4540
|
}
|
|
4348
4541
|
try {
|
|
4349
|
-
const
|
|
4542
|
+
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
4543
|
+
const { ItemProperty } = itemPropertyMod;
|
|
4350
4544
|
// Create instances for all metadata records in parallel
|
|
4351
4545
|
const createPromises = metadataRows.map(async (metaRow) => {
|
|
4352
4546
|
try {
|
|
@@ -4539,14 +4733,17 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
4539
4733
|
return;
|
|
4540
4734
|
}
|
|
4541
4735
|
try {
|
|
4542
|
-
const
|
|
4736
|
+
const itemMod = await Promise.resolve().then(function () { return Item$1; });
|
|
4737
|
+
const { Item } = itemMod;
|
|
4543
4738
|
const item = await Item.find({ seedLocalId });
|
|
4544
4739
|
if (!item) {
|
|
4545
4740
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
4546
4741
|
return;
|
|
4547
4742
|
}
|
|
4548
|
-
const
|
|
4549
|
-
const {
|
|
4743
|
+
const getPublishUploadsMod = await import('./getPublishUploads-DhvcKD_9.js');
|
|
4744
|
+
const { getPublishUploads } = getPublishUploadsMod;
|
|
4745
|
+
const getPublishPayloadMod = await import('./getPublishPayload-CWiLI1yd.js');
|
|
4746
|
+
const { getPublishPayload } = getPublishPayloadMod;
|
|
4550
4747
|
await getPublishUploads(item);
|
|
4551
4748
|
// For first iteration: no Arweave sign/upload - pass empty uploadedTransactions.
|
|
4552
4749
|
// Real upload/submit can be wired in later.
|
|
@@ -5276,7 +5473,8 @@ const getModelSchemasFromEas = async () => {
|
|
|
5276
5473
|
const queryClient = BaseQueryClient.getQueryClient();
|
|
5277
5474
|
const easClient = BaseEasClient.getEasClient();
|
|
5278
5475
|
// Dynamic import to break circular dependency
|
|
5279
|
-
const
|
|
5476
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
5477
|
+
const { Model } = modelMod;
|
|
5280
5478
|
const allModels = await Model.all();
|
|
5281
5479
|
const modelNames = allModels.map(m => m.modelName).filter((name) => !!name);
|
|
5282
5480
|
// If there are no models, return empty array instead of querying
|
|
@@ -5630,7 +5828,8 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5630
5828
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
5631
5829
|
const _resolveRelatedValue = async () => {
|
|
5632
5830
|
// Use dynamic import to break circular dependency
|
|
5633
|
-
const
|
|
5831
|
+
const schemaMod = await import('./index-LfXKx_PE.js');
|
|
5832
|
+
const { ModelPropertyDataTypes } = schemaMod;
|
|
5634
5833
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
5635
5834
|
return;
|
|
5636
5835
|
}
|
|
@@ -5968,7 +6167,8 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5968
6167
|
// to use dynamically imported ModelPropertyDataTypes
|
|
5969
6168
|
const _hydrateFromDb = async () => {
|
|
5970
6169
|
// Use dynamic import to break circular dependency
|
|
5971
|
-
const
|
|
6170
|
+
const schemaMod = await import('./index-LfXKx_PE.js');
|
|
6171
|
+
const { ModelPropertyDataTypes } = schemaMod;
|
|
5972
6172
|
const appDb = BaseDb.getAppDb();
|
|
5973
6173
|
const whereClauses = [];
|
|
5974
6174
|
// Re-check types with dynamically imported ModelPropertyDataTypes
|
|
@@ -6120,7 +6320,8 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
6120
6320
|
if (propertyRecordSchema &&
|
|
6121
6321
|
propertyRecordSchema.storageType &&
|
|
6122
6322
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
6123
|
-
const
|
|
6323
|
+
const itemMod = await Promise.resolve().then(function () { return Item$1; });
|
|
6324
|
+
const { Item } = itemMod;
|
|
6124
6325
|
const item = await Item.find({
|
|
6125
6326
|
seedLocalId: seedLocalId ?? undefined,
|
|
6126
6327
|
modelName,
|
|
@@ -6440,7 +6641,8 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
6440
6641
|
}
|
|
6441
6642
|
const _analyzeInput = async () => {
|
|
6442
6643
|
// Use dynamic import to break circular dependency
|
|
6443
|
-
const
|
|
6644
|
+
const schemaMod = await import('./index-LfXKx_PE.js');
|
|
6645
|
+
const { ModelPropertyDataTypes } = schemaMod;
|
|
6444
6646
|
let propertyName = propertyNameRaw;
|
|
6445
6647
|
if (!propertyName) {
|
|
6446
6648
|
throw new Error('propertyName is required');
|
|
@@ -6797,7 +6999,8 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
6797
6999
|
}
|
|
6798
7000
|
const _saveRelation = async () => {
|
|
6799
7001
|
// Use dynamic import to break circular dependency
|
|
6800
|
-
const
|
|
7002
|
+
const schemaMod = await import('./index-LfXKx_PE.js');
|
|
7003
|
+
const { ModelPropertyDataTypes } = schemaMod;
|
|
6801
7004
|
if (!propertyNameRaw) {
|
|
6802
7005
|
throw new Error('propertyName is required');
|
|
6803
7006
|
}
|
|
@@ -7595,7 +7798,8 @@ class ItemProperty {
|
|
|
7595
7798
|
return;
|
|
7596
7799
|
}
|
|
7597
7800
|
// Use dynamic import to break circular dependency
|
|
7598
|
-
const
|
|
7801
|
+
const schemaMod = await import('./index-LfXKx_PE.js');
|
|
7802
|
+
const { ModelPropertyDataTypes } = schemaMod;
|
|
7599
7803
|
const { context } = snapshot;
|
|
7600
7804
|
const { propertyRecordSchema } = context;
|
|
7601
7805
|
if (context.seedLocalId && context.propertyName) {
|
|
@@ -7708,9 +7912,14 @@ class ItemProperty {
|
|
|
7708
7912
|
setupState.subscriptionSetUp = true;
|
|
7709
7913
|
logger(`[ItemProperty._setupLiveQuerySubscription] Setting up liveQuery for propertyName: ${propertyName}, seedLocalId: ${seedLocalId}`);
|
|
7710
7914
|
try {
|
|
7711
|
-
const
|
|
7712
|
-
const
|
|
7713
|
-
const
|
|
7915
|
+
const _mod_5 = await import('./index-DBy53qbb.js');
|
|
7916
|
+
const _ns_5 = _mod_5.s;
|
|
7917
|
+
const seedSchemaMod = _ns_5;
|
|
7918
|
+
const { metadata } = seedSchemaMod;
|
|
7919
|
+
const drizzleMod = await import('drizzle-orm');
|
|
7920
|
+
const { eq, and, isNotNull } = drizzleMod;
|
|
7921
|
+
const metadataLatestMod = await Promise.resolve().then(function () { return metadataLatest; });
|
|
7922
|
+
const { getMetadataLatest } = metadataLatestMod;
|
|
7714
7923
|
const db = BaseDb.getAppDb();
|
|
7715
7924
|
if (!db) {
|
|
7716
7925
|
logger('[ItemProperty._setupLiveQuerySubscription] Database not available');
|
|
@@ -8223,8 +8432,12 @@ class ItemProperty {
|
|
|
8223
8432
|
if (!propertyName || (!seedLocalId && !seedUid))
|
|
8224
8433
|
return;
|
|
8225
8434
|
if (db) {
|
|
8226
|
-
const
|
|
8227
|
-
const
|
|
8435
|
+
const _mod_6 = await import('./index-DBy53qbb.js');
|
|
8436
|
+
const _ns_6 = _mod_6.s;
|
|
8437
|
+
const seedSchemaMod = _ns_6;
|
|
8438
|
+
const { metadata } = seedSchemaMod;
|
|
8439
|
+
const drizzleMod = await import('drizzle-orm');
|
|
8440
|
+
const { and, eq, or } = drizzleMod;
|
|
8228
8441
|
const conditions = [eq(metadata.propertyName, propertyName)];
|
|
8229
8442
|
if (seedLocalId && seedUid) {
|
|
8230
8443
|
conditions.push(or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid)));
|
|
@@ -8239,7 +8452,8 @@ class ItemProperty {
|
|
|
8239
8452
|
await db.delete(metadata).where(and(...conditions));
|
|
8240
8453
|
}
|
|
8241
8454
|
}
|
|
8242
|
-
const
|
|
8455
|
+
const itemMod = await Promise.resolve().then(function () { return Item$1; });
|
|
8456
|
+
const { Item } = itemMod;
|
|
8243
8457
|
const item = Item.getById((seedLocalId || seedUid));
|
|
8244
8458
|
if (item) {
|
|
8245
8459
|
item.getService().send({ type: 'removePropertyInstance', propertyName });
|
|
@@ -8265,7 +8479,8 @@ const createNewItem = async ({ modelName, ...propertyData }) => {
|
|
|
8265
8479
|
const newSeedId = await createSeed({ type: seedType });
|
|
8266
8480
|
const newVersionId = await createVersion({ seedLocalId: newSeedId, seedType: toSnakeCase$1(modelName) });
|
|
8267
8481
|
// Dynamic import to break circular dependency
|
|
8268
|
-
const
|
|
8482
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
8483
|
+
const { Model } = modelMod;
|
|
8269
8484
|
const model = await Model.getByNameAsync(modelName);
|
|
8270
8485
|
const propertySchemas = model?.properties ? modelPropertiesToObject(model.properties) : undefined;
|
|
8271
8486
|
for (const [propertyName, propertyValue] of Object.entries(propertyData)) {
|
|
@@ -8473,12 +8688,14 @@ class Item {
|
|
|
8473
8688
|
};
|
|
8474
8689
|
this.getPublishUploads = async () => {
|
|
8475
8690
|
// Use dynamic import to break circular dependency
|
|
8476
|
-
const
|
|
8691
|
+
const getPublishUploadsMod = await import('./getPublishUploads-DhvcKD_9.js');
|
|
8692
|
+
const { getPublishUploads } = getPublishUploadsMod;
|
|
8477
8693
|
return await getPublishUploads(this);
|
|
8478
8694
|
};
|
|
8479
8695
|
this.getPublishPayload = async (uploadedTransactions) => {
|
|
8480
8696
|
// Use dynamic import to break circular dependency
|
|
8481
|
-
const
|
|
8697
|
+
const getPublishPayloadMod = await import('./getPublishPayload-CWiLI1yd.js');
|
|
8698
|
+
const { getPublishPayload } = getPublishPayloadMod;
|
|
8482
8699
|
return await getPublishPayload(this, uploadedTransactions);
|
|
8483
8700
|
};
|
|
8484
8701
|
this.persistSeedUid = async () => {
|
|
@@ -8753,8 +8970,10 @@ class Item {
|
|
|
8753
8970
|
let modelRecords;
|
|
8754
8971
|
// If we have a schema name, join with modelSchemas to filter by schema
|
|
8755
8972
|
if (schemaName) {
|
|
8756
|
-
const
|
|
8757
|
-
const {
|
|
8973
|
+
const modelSchemaSchemaMod = await Promise.resolve().then(function () { return ModelSchemaSchema; });
|
|
8974
|
+
const { modelSchemas } = modelSchemaSchemaMod;
|
|
8975
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
8976
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
8758
8977
|
modelRecords = await db
|
|
8759
8978
|
.select({ id: models$1.id })
|
|
8760
8979
|
.from(models$1)
|
|
@@ -9344,9 +9563,14 @@ class Item {
|
|
|
9344
9563
|
setupState.subscriptionSetUp = true;
|
|
9345
9564
|
logger(`[Item._setupLiveQuerySubscription] Setting up liveQuery for seedLocalId: ${seedLocalId}`);
|
|
9346
9565
|
try {
|
|
9347
|
-
const
|
|
9348
|
-
const
|
|
9349
|
-
const
|
|
9566
|
+
const _mod_7 = await import('./index-DBy53qbb.js');
|
|
9567
|
+
const _ns_7 = _mod_7.s;
|
|
9568
|
+
const seedSchemaMod = _ns_7;
|
|
9569
|
+
const { seeds, versions, metadata } = seedSchemaMod;
|
|
9570
|
+
const drizzleMod = await import('drizzle-orm');
|
|
9571
|
+
const { eq, and } = drizzleMod;
|
|
9572
|
+
const versionDataMod = await Promise.resolve().then(function () { return versionData; });
|
|
9573
|
+
const { getVersionData } = versionDataMod;
|
|
9350
9574
|
const db = BaseDb.getAppDb();
|
|
9351
9575
|
if (!db) {
|
|
9352
9576
|
logger('[Item._setupLiveQuerySubscription] Database not available');
|
|
@@ -9389,7 +9613,8 @@ class Item {
|
|
|
9389
9613
|
// CRITICAL: Create ItemProperty instances BEFORE updating context
|
|
9390
9614
|
if (initialMetadataIds.length > 0) {
|
|
9391
9615
|
try {
|
|
9392
|
-
const
|
|
9616
|
+
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
9617
|
+
const { ItemProperty } = itemPropertyMod;
|
|
9393
9618
|
const itemModelName = this._service.getSnapshot().context.modelName;
|
|
9394
9619
|
const createPromises = initialMetadata.map(async (metaRow) => {
|
|
9395
9620
|
try {
|
|
@@ -9497,7 +9722,8 @@ class Item {
|
|
|
9497
9722
|
// CRITICAL: Create ItemProperty instances BEFORE updating context
|
|
9498
9723
|
if (metadataRows.length > 0) {
|
|
9499
9724
|
try {
|
|
9500
|
-
const
|
|
9725
|
+
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
9726
|
+
const { ItemProperty } = itemPropertyMod;
|
|
9501
9727
|
const itemModelName = this._service.getSnapshot().context.modelName;
|
|
9502
9728
|
const createPromises = metadataRows.map(async (metaRow) => {
|
|
9503
9729
|
try {
|
|
@@ -9695,7 +9921,8 @@ const setupServicesEventHandlers = () => {
|
|
|
9695
9921
|
const schemaStringToModelRecord = new Map();
|
|
9696
9922
|
const getModelSchemas = async () => {
|
|
9697
9923
|
// Dynamic import to break circular dependency
|
|
9698
|
-
const
|
|
9924
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
9925
|
+
const { Model } = modelMod;
|
|
9699
9926
|
const allModels = await Model.all();
|
|
9700
9927
|
const modelRecords = [];
|
|
9701
9928
|
const appDb = BaseDb.getAppDb();
|
|
@@ -9930,7 +10157,8 @@ const saveEasPropertiesToDb = async ({ itemProperties, itemSeeds, }) => {
|
|
|
9930
10157
|
isSavingToDb = true;
|
|
9931
10158
|
const propertyUids = itemProperties.map((property) => property.id);
|
|
9932
10159
|
// Dynamic import to break circular dependency
|
|
9933
|
-
const
|
|
10160
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
10161
|
+
const { Model } = modelMod;
|
|
9934
10162
|
const allModels = await Model.all();
|
|
9935
10163
|
const models = Object.fromEntries(allModels.map(m => [m.modelName, m]));
|
|
9936
10164
|
const appDb = BaseDb.getAppDb();
|
|
@@ -10254,21 +10482,21 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
|
|
|
10254
10482
|
let PathResolver;
|
|
10255
10483
|
let EasClient;
|
|
10256
10484
|
if (isBrowser()) {
|
|
10257
|
-
FileManager = (await import('./FileManager-
|
|
10258
|
-
Db = (await import('./Db-
|
|
10259
|
-
QueryClient = (await import('./QueryClient-
|
|
10260
|
-
ArweaveClient = (await import('./ArweaveClient-
|
|
10261
|
-
PathResolver = (await import('./PathResolver-
|
|
10262
|
-
EasClient = (await import('./EasClient-
|
|
10485
|
+
FileManager = (await import('./FileManager-BohtoKYo.js')).FileManager;
|
|
10486
|
+
Db = (await import('./Db-C9fppVRl.js')).Db;
|
|
10487
|
+
QueryClient = (await import('./QueryClient-BUoz2Vb0.js')).QueryClient;
|
|
10488
|
+
ArweaveClient = (await import('./ArweaveClient-Caio37h1.js')).ArweaveClient;
|
|
10489
|
+
PathResolver = (await import('./PathResolver-CLZUWoX2.js')).PathResolver;
|
|
10490
|
+
EasClient = (await import('./EasClient-DQGAIj-b.js')).EasClient;
|
|
10263
10491
|
}
|
|
10264
10492
|
else if (isNode()) {
|
|
10265
10493
|
console.log('isNode');
|
|
10266
|
-
FileManager = (await import('./FileManager-
|
|
10267
|
-
Db = (await import('./Db-
|
|
10268
|
-
QueryClient = (await import('./QueryClient-
|
|
10269
|
-
ArweaveClient = (await import('./ArweaveClient-
|
|
10270
|
-
PathResolver = (await import('./PathResolver-
|
|
10271
|
-
EasClient = (await import('./EasClient-
|
|
10494
|
+
FileManager = (await import('./FileManager-d64CkqXy.js')).FileManager;
|
|
10495
|
+
Db = (await import('./Db-DJAG-5Di.js')).Db;
|
|
10496
|
+
QueryClient = (await import('./QueryClient-COQ_Rs4-.js')).QueryClient;
|
|
10497
|
+
ArweaveClient = (await import('./ArweaveClient-DLKAaS3K.js')).ArweaveClient;
|
|
10498
|
+
PathResolver = (await import('./PathResolver-D6M0rzKV.js')).PathResolver;
|
|
10499
|
+
EasClient = (await import('./EasClient-T7Nx9185.js')).EasClient;
|
|
10272
10500
|
}
|
|
10273
10501
|
else {
|
|
10274
10502
|
throw new Error(`Unable to determine environment. isBrowser()=${isBrowser()}, isNode()=${isNode()}. Platform-specific implementations could not be loaded.`);
|
|
@@ -10520,7 +10748,8 @@ const downloadAllFilesBinaryRequestHandler = async () => {
|
|
|
10520
10748
|
}
|
|
10521
10749
|
if (!BaseDb.isAppDbReady()) {
|
|
10522
10750
|
// Wait for ClientManager to be ready (DB_INIT state or later)
|
|
10523
|
-
const
|
|
10751
|
+
const clientManagerMod = await Promise.resolve().then(function () { return ClientManager$1; });
|
|
10752
|
+
const { getClient } = clientManagerMod;
|
|
10524
10753
|
const clientManager = getClient();
|
|
10525
10754
|
const clientService = clientManager.getService();
|
|
10526
10755
|
await waitFor(clientService, (snapshot) => {
|
|
@@ -11458,8 +11687,10 @@ const logger$3 = debug('seedSdk:imports:json');
|
|
|
11458
11687
|
* @returns Promise that resolves when properties are found, or rejects if not found after max retries
|
|
11459
11688
|
*/
|
|
11460
11689
|
const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
|
|
11461
|
-
const
|
|
11462
|
-
const {
|
|
11690
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return ModelSchema; });
|
|
11691
|
+
const { properties: propertiesTable } = modelSchemaMod;
|
|
11692
|
+
const drizzleMod = await import('drizzle-orm');
|
|
11693
|
+
const { eq } = drizzleMod;
|
|
11463
11694
|
console.log(`[verifyPropertiesPersisted] Starting verification for model "${modelName}" (modelId: ${modelId})`);
|
|
11464
11695
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
11465
11696
|
const props = await db
|
|
@@ -11775,7 +12006,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
11775
12006
|
schemaFile = transformImportToSchemaFile(importData, version);
|
|
11776
12007
|
}
|
|
11777
12008
|
// Check if this is an internal SDK schema (should not create files in app directory)
|
|
11778
|
-
const
|
|
12009
|
+
const constantsMod = await Promise.resolve().then(function () { return constants; });
|
|
12010
|
+
const { isInternalSchema } = constantsMod;
|
|
11779
12011
|
const isInternal = isInternalSchema(schemaFile.metadata.name, schemaFile.id);
|
|
11780
12012
|
if (isInternal) {
|
|
11781
12013
|
logger$3(`Skipping file creation for internal schema: ${schemaFile.metadata.name}`);
|
|
@@ -11869,7 +12101,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
11869
12101
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
11870
12102
|
};
|
|
11871
12103
|
// Use dynamic import to break circular dependency
|
|
11872
|
-
const
|
|
12104
|
+
const dbMod = await Promise.resolve().then(function () { return db; });
|
|
12105
|
+
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
11873
12106
|
// Try to add schema and models to database if database is available
|
|
11874
12107
|
try {
|
|
11875
12108
|
const db = BaseDb.getAppDb();
|
|
@@ -11890,9 +12123,12 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
11890
12123
|
// CRITICAL: Verify all expected models are linked via join table
|
|
11891
12124
|
// Retry querying until all models are visible (browser environments may have delays)
|
|
11892
12125
|
const expectedModelNames = Object.keys(schemaFile.models || {});
|
|
11893
|
-
const
|
|
11894
|
-
const {
|
|
11895
|
-
const
|
|
12126
|
+
const modelSchemaSchemaMod = await Promise.resolve().then(function () { return ModelSchemaSchema; });
|
|
12127
|
+
const { modelSchemas } = modelSchemaSchemaMod;
|
|
12128
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return ModelSchema; });
|
|
12129
|
+
const { models: modelsTable } = modelSchemaMod;
|
|
12130
|
+
const drizzleMod = await import('drizzle-orm');
|
|
12131
|
+
const { eq, and } = drizzleMod;
|
|
11896
12132
|
let allModelsLinked = false;
|
|
11897
12133
|
for (let attempt = 0; attempt < 10; attempt++) {
|
|
11898
12134
|
const modelLinks = await db
|
|
@@ -12063,10 +12299,11 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12063
12299
|
}
|
|
12064
12300
|
}
|
|
12065
12301
|
}
|
|
12066
|
-
// After properties are created, ensure schemaFile has the correct IDs from database
|
|
12302
|
+
// After properties are created (internal schema path), ensure schemaFile has the correct IDs from database
|
|
12067
12303
|
// Query the database to get the actual schemaFileId values that were used
|
|
12068
12304
|
// This ensures schemaData matches what's actually in the database
|
|
12069
|
-
const
|
|
12305
|
+
const modelSchemaMod1 = await Promise.resolve().then(function () { return ModelSchema; });
|
|
12306
|
+
const { properties: propertiesTable } = modelSchemaMod1;
|
|
12070
12307
|
let schemaFileUpdated = false;
|
|
12071
12308
|
for (const [modelName, modelFileId] of modelFileIds.entries()) {
|
|
12072
12309
|
// Get model record to find modelId
|
|
@@ -12099,7 +12336,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12099
12336
|
// This is important even if nothing changed, to ensure consistency
|
|
12100
12337
|
const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
|
|
12101
12338
|
// Update the schema record in the database with current schemaData
|
|
12102
|
-
const
|
|
12339
|
+
const schemaSchemaMod1 = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
12340
|
+
const { schemas: schemasTable } = schemaSchemaMod1;
|
|
12103
12341
|
await db
|
|
12104
12342
|
.update(schemasTable)
|
|
12105
12343
|
.set({ schemaData: updatedSchemaData })
|
|
@@ -12313,7 +12551,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12313
12551
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
12314
12552
|
};
|
|
12315
12553
|
// Use dynamic import to break circular dependency
|
|
12316
|
-
const
|
|
12554
|
+
const dbMod = await Promise.resolve().then(function () { return db; });
|
|
12555
|
+
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
12317
12556
|
// Try to add schema and models to database if database is available
|
|
12318
12557
|
try {
|
|
12319
12558
|
const db = BaseDb.getAppDb();
|
|
@@ -12335,9 +12574,12 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12335
12574
|
await new Promise(resolve => setTimeout(resolve, 200));
|
|
12336
12575
|
console.log(`[importJsonSchema] Starting property verification for schema "${schemaName}" (schemaRecord.id: ${schemaRecord.id})`);
|
|
12337
12576
|
// Query the database to get model IDs that were just created
|
|
12338
|
-
const
|
|
12339
|
-
const {
|
|
12340
|
-
const
|
|
12577
|
+
const modelSchemaSchemaMod = await Promise.resolve().then(function () { return ModelSchemaSchema; });
|
|
12578
|
+
const { modelSchemas } = modelSchemaSchemaMod;
|
|
12579
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return ModelSchema; });
|
|
12580
|
+
const { models: modelsTable } = modelSchemaMod;
|
|
12581
|
+
const drizzleMod = await import('drizzle-orm');
|
|
12582
|
+
const { eq } = drizzleMod;
|
|
12341
12583
|
// Try to find models directly by schemaFileId first (more reliable than join table)
|
|
12342
12584
|
const seedModelId = modelFileIds.get('Seed');
|
|
12343
12585
|
let seedModel = [];
|
|
@@ -12399,10 +12641,11 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12399
12641
|
}
|
|
12400
12642
|
}
|
|
12401
12643
|
}
|
|
12402
|
-
// After properties are created, ensure schemaFile has the correct IDs from database
|
|
12644
|
+
// After properties are created (file path), ensure schemaFile has the correct IDs from database
|
|
12403
12645
|
// Query the database to get the actual schemaFileId values that were used
|
|
12404
12646
|
// This ensures schemaData matches what's actually in the database
|
|
12405
|
-
const
|
|
12647
|
+
const modelSchemaMod2 = await Promise.resolve().then(function () { return ModelSchema; });
|
|
12648
|
+
const { properties: propertiesTable } = modelSchemaMod2;
|
|
12406
12649
|
let schemaFileUpdated = false;
|
|
12407
12650
|
for (const [modelName, modelFileId] of modelFileIds.entries()) {
|
|
12408
12651
|
// Get model record to find modelId
|
|
@@ -12435,7 +12678,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12435
12678
|
// This is important even if nothing changed, to ensure consistency
|
|
12436
12679
|
const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
|
|
12437
12680
|
// Update the schema record in the database with current schemaData
|
|
12438
|
-
const
|
|
12681
|
+
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
12682
|
+
const { schemas: schemasTable } = schemaSchemaMod;
|
|
12439
12683
|
await db
|
|
12440
12684
|
.update(schemasTable)
|
|
12441
12685
|
.set({ schemaData: updatedSchemaData })
|
|
@@ -12476,7 +12720,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12476
12720
|
*/
|
|
12477
12721
|
const createModelFromJson = async (modelName, modelDef, schemaName, modelFileId, // Optional modelFileId from JSON file
|
|
12478
12722
|
propertyFileIds) => {
|
|
12479
|
-
const
|
|
12723
|
+
const modelMod = await Promise.resolve().then(function () { return Model$1; });
|
|
12724
|
+
const { Model } = modelMod;
|
|
12480
12725
|
// Convert JSON properties to schema format
|
|
12481
12726
|
const convertedProperties = {};
|
|
12482
12727
|
if (modelDef.properties) {
|
|
@@ -13327,7 +13572,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
13327
13572
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
13328
13573
|
// Eagerly start loading to minimize delay on first access
|
|
13329
13574
|
let ModelPropertyClass = null;
|
|
13330
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
13575
|
+
const modelPropertyImportPromise = import('./ModelProperty-Cpd9xiIM.js')
|
|
13331
13576
|
.then(module => {
|
|
13332
13577
|
ModelPropertyClass = module.ModelProperty;
|
|
13333
13578
|
return ModelPropertyClass;
|
|
@@ -13344,7 +13589,7 @@ function getModelProperty() {
|
|
|
13344
13589
|
}
|
|
13345
13590
|
// Lazy import cache for Schema to avoid circular dependency
|
|
13346
13591
|
let SchemaClass = null;
|
|
13347
|
-
const schemaImportPromise = import('./Schema-
|
|
13592
|
+
const schemaImportPromise = (async () => { const _mod_8 = await import('./Schema-BZKBy5Tx.js'); return _mod_8.b; })()
|
|
13348
13593
|
.then(module => {
|
|
13349
13594
|
SchemaClass = module.Schema;
|
|
13350
13595
|
return SchemaClass;
|
|
@@ -14845,7 +15090,8 @@ class Model {
|
|
|
14845
15090
|
doDestroy: async () => {
|
|
14846
15091
|
const db = BaseDb.getAppDb();
|
|
14847
15092
|
if (db && modelFileId) {
|
|
14848
|
-
const
|
|
15093
|
+
const drizzleMod = await import('drizzle-orm');
|
|
15094
|
+
const { eq } = drizzleMod;
|
|
14849
15095
|
const modelRecords = await db
|
|
14850
15096
|
.select()
|
|
14851
15097
|
.from(models$1)
|
|
@@ -15177,4 +15423,4 @@ Type.Record(Type.String(), Type.Any());
|
|
|
15177
15423
|
Type.Record(Type.String(), TProperty);
|
|
15178
15424
|
|
|
15179
15425
|
export { getItemData as $, config as A, Boolean$1 as B, metadata$1 as C, Date$1 as D, EAS_ENDPOINT as E, modelRelations as F, modelSchemas as G, modelUids as H, Image as I, Json as J, modelsRelations as K, List as L, Model as M, Number$1 as N, propertiesRelations as O, Property as P, propertyUidRelations as Q, Relation as R, SEED_CONFIG_FILE as S, TPropertyDataType as T, propertyUids as U, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as V, schemas as W, seeds as X, versions as Y, ZERO_BYTES32 as Z, graphql as _, ModelPropertyDataTypes as a, Item as a0, saveAppState as a1, addModelsToDb$1 as a2, SCHEMA_NJK as a3, ItemProperty as a4, eventEmitter as a5, ClientManager as a6, INIT_SCRIPT_SUCCESS_MESSAGE as a7, SCHEMA_TS as a8, importJsonSchema as a9, SeedModels as aA, getArweaveUrlForTransaction as aB, createSchema as aC, readSchema as aD, listCompleteSchemaFiles as aE, getSchemaNameFromId as aF, getLatestSchemaVersion as aG, createModelsFromJson as aH, SEED_PROTOCOL_SCHEMA_NAME as aI, addSchemaToDb as aJ, loadModelsFromDbForSchema as aK, isInternalSchema as aL, createModelFromJson as aM, ConflictError as aN, unloadEntity as aO, clearDestroySubscriptions as aP, setupEntityLiveQuery as aQ, ModelSchema as aR, BaseFileManager$1 as aS, db as aT, schema as aU, SEEDPROTOCOL_Seed_Protocol_v1 as aV, Model$1 as aW, loadSchemaFromFile as aa, readJsonImportFile as ab, transformImportToSchemaFile as ac, writeProcessMachine as ad, generateId as ae, waitForEntityIdle as af, createReactiveProxy as ag, findEntity as ah, forceRemoveFromCaches as ai, runDestroyLifecycle as aj, getModelIdByFileId as ak, getModelId as al, getClient as am, ClientManagerState as an, getVersionData$1 as ao, createNewItem as ap, loadAllSchemasFromDb as aq, getSeedsBySchemaName as ar, GET_SEEDS as as, getItemVersionsFromEas as at, getItemPropertiesFromEas as au, setSchemaUidForSchemaDefinition as av, parseEasRelationPropertyName as aw, getModelSchemasFromEas as ax, getSchemaUidBySchemaName as ay, getSeedsFromSchemaUids as az, TStorageType as b, TProperty as c, TPropertyConstructor as d, PropertyMetadataKey as e, PropertyConstructor as f, Text as g, TValidationRules as h, getSchemaUidForModel as i, getCorrectId as j, defaultAttestationData as k, INTERNAL_DATA_TYPES as l, getSchemaUidForSchemaDefinition as m, getSchemaForItemProperty as n, modelPropertiesToObject as o, BaseDb as p, models$1 as q, properties as r, BaseQueryClient as s, toSnakeCase as t, BaseArweaveClient as u, BasePathResolver as v, BaseEasClient as w, BaseFileManager as x, appState as y, SEED_CONFIG_FALLBACKS as z };
|
|
15180
|
-
//# sourceMappingURL=index-
|
|
15426
|
+
//# sourceMappingURL=index-Dk73a7JE.js.map
|