@seedprotocol/sdk 0.7.5-next.850.g9ab585b → 0.7.5
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/{BasePathResolver-CsZHPrk9.js → BasePathResolver-CBTXCMFL.js} +20 -6
- package/dist/BasePathResolver-CBTXCMFL.js.map +1 -0
- package/dist/{ClientManager-DETTj0_z.js → ClientManager-DRf4uuei.js} +348 -222
- package/dist/ClientManager-DRf4uuei.js.map +1 -0
- package/dist/{Item-TMrVEPeX.js → Item-DTJPMjFk.js} +241 -157
- package/dist/Item-DTJPMjFk.js.map +1 -0
- package/dist/{ModelProperty-Bw6N8OMK.js → ModelProperty-Dto5C0om.js} +66 -31
- package/dist/ModelProperty-Dto5C0om.js.map +1 -0
- package/dist/{Schema-VLenyJDy.js → Schema-8DxGcORY.js} +39 -37
- package/dist/{Schema-VLenyJDy.js.map → Schema-8DxGcORY.js.map} +1 -1
- package/dist/{SchemaValidationService-CLGadxgf.js → SchemaValidationService-CE92y1TT.js} +6 -6
- package/dist/{SchemaValidationService-CLGadxgf.js.map → SchemaValidationService-CE92y1TT.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-C8fSvzy2.js → backfillMetadataPropertyIds-CRqp-BqX.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-C8fSvzy2.js.map → backfillMetadataPropertyIds-CRqp-BqX.js.map} +1 -1
- package/dist/{configurePlatform-C3E0BS3u.js → configurePlatform-D4aGjKNk.js} +2 -2
- package/dist/{configurePlatform-C3E0BS3u.js.map → configurePlatform-D4aGjKNk.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-D1gTseFW.js → detachRowsBeforeDelete-BVetHtn2.js} +2 -2
- package/dist/{detachRowsBeforeDelete-D1gTseFW.js.map → detachRowsBeforeDelete-BVetHtn2.js.map} +1 -1
- package/dist/discardNewDraft-CEOouygG.js +78 -0
- package/dist/discardNewDraft-CEOouygG.js.map +1 -0
- package/dist/{eas-A82zVNQ9.js → eas-D7jvWMnI.js} +3 -3
- package/dist/{eas-A82zVNQ9.js.map → eas-D7jvWMnI.js.map} +1 -1
- package/dist/{errors-CWKup8tw.js → errors-CIrbsN_i.js} +46 -39
- package/dist/errors-CIrbsN_i.js.map +1 -0
- package/dist/{getItem-ChieGxJV.js → getItem-CxU_kT5W.js} +4 -4
- package/dist/{getItem-ChieGxJV.js.map → getItem-CxU_kT5W.js.map} +1 -1
- package/dist/{getPublishPayload-CWfjl8PM.js → getPublishPayload-DTjOKd3y.js} +13 -13
- package/dist/{getPublishPayload-CWfjl8PM.js.map → getPublishPayload-DTjOKd3y.js.map} +1 -1
- package/dist/{getPublishUploads-cLbSEXLk.js → getPublishUploads-CVTBo_OV.js} +506 -45
- package/dist/getPublishUploads-CVTBo_OV.js.map +1 -0
- package/dist/{index-CXkcz4hT.js → index-CMxEil8T.js} +8 -8
- package/dist/index-CMxEil8T.js.map +1 -0
- package/dist/{index-CURf9L4d.js → index-DWK-LOUY.js} +2 -2
- package/dist/index-DWK-LOUY.js.map +1 -0
- package/dist/{index.browser-47W0fJPw.js → index.browser-shRXMeB3.js} +11 -11
- package/dist/{index.browser-47W0fJPw.js.map → index.browser-shRXMeB3.js.map} +1 -1
- package/dist/{index.node-BiQhZQvH.js → index.node-DAKJNYp5.js} +20 -6
- package/dist/index.node-DAKJNYp5.js.map +1 -0
- package/dist/main.js +89 -504
- package/dist/main.js.map +1 -1
- package/dist/{mimeTypes-DHAHC4eZ.js → mimeTypes-C9r76DCH.js} +7 -2
- package/dist/{mimeTypes-DHAHC4eZ.js.map → mimeTypes-C9r76DCH.js.map} +1 -1
- package/dist/node.js +10 -10
- package/dist/platform.browser.js +6 -6
- package/dist/platform.node.js +4 -4
- package/dist/{property-tgPI5hMu.js → property-lz9yIpyA.js} +6 -6
- package/dist/{property-tgPI5hMu.js.map → property-lz9yIpyA.js.map} +1 -1
- package/dist/{propertyValidationRules-BLVxTejW.js → propertyValidationRules-LuIwoQoJ.js} +6 -6
- package/dist/{propertyValidationRules-BLVxTejW.js.map → propertyValidationRules-LuIwoQoJ.js.map} +1 -1
- package/dist/{publishDraftGraph-FAfecR_4.js → publishDraftGraph-CgSLPKvQ.js} +6 -6
- package/dist/{publishDraftGraph-FAfecR_4.js.map → publishDraftGraph-CgSLPKvQ.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-kz2PYdZi.js → resetAmbiguousLegacyItemData-CuamkAAh.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-kz2PYdZi.js.map → resetAmbiguousLegacyItemData-CuamkAAh.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-Dm1E4ebt.js → resolveModelForSyncedSeed-BbSctSvz.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-Dm1E4ebt.js.map → resolveModelForSyncedSeed-BbSctSvz.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +9 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/errors.d.ts +3 -1
- package/dist/src/Item/errors.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +17 -0
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +2 -2
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/db/alignRowPublishers.d.ts +25 -0
- package/dist/src/db/alignRowPublishers.d.ts.map +1 -0
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getSchemaUidForModel.d.ts.map +1 -1
- package/dist/src/db/read/getSeedPublisher.d.ts +7 -0
- package/dist/src/db/read/getSeedPublisher.d.ts.map +1 -0
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts +5 -3
- package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +1 -1
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts +4 -2
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/db/write/createSeed.d.ts.map +1 -1
- package/dist/src/db/write/createVersion.d.ts.map +1 -1
- package/dist/src/db/write/discardNewDraft.d.ts +8 -0
- package/dist/src/db/write/discardNewDraft.d.ts.map +1 -0
- package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts +18 -0
- package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts.map +1 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +13 -2
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/helpers/ownership.d.ts +9 -12
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/publishConfig.d.ts +9 -4
- package/dist/src/helpers/publishConfig.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CMCAihFh.js → syncDbWithEas-CrAY9Rl2.js} +13 -13
- package/dist/{syncDbWithEas-CMCAihFh.js.map → syncDbWithEas-CrAY9Rl2.js.map} +1 -1
- package/dist/{tabEvents-BEAmMncP.js → tabEvents-BGBYV65P.js} +4 -4
- package/dist/{tabEvents-BEAmMncP.js.map → tabEvents-BGBYV65P.js.map} +1 -1
- package/dist/{tolerantWebAccess-CqiDGEyR.js → tolerantWebAccess-DVHCEulL.js} +7 -7
- package/dist/{tolerantWebAccess-CqiDGEyR.js.map → tolerantWebAccess-DVHCEulL.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-Bw3uEStt.js → updateSeedRevokedAt-Dy5J8CfQ.js} +3 -3
- package/dist/{updateSeedRevokedAt-Bw3uEStt.js.map → updateSeedRevokedAt-Dy5J8CfQ.js.map} +1 -1
- package/package.json +5 -5
- package/dist/BasePathResolver-CsZHPrk9.js.map +0 -1
- package/dist/ClientManager-DETTj0_z.js.map +0 -1
- package/dist/Item-TMrVEPeX.js.map +0 -1
- package/dist/ModelProperty-Bw6N8OMK.js.map +0 -1
- package/dist/errors-CWKup8tw.js.map +0 -1
- package/dist/getPublishUploads-cLbSEXLk.js.map +0 -1
- package/dist/index-CURf9L4d.js.map +0 -1
- package/dist/index-CXkcz4hT.js.map +0 -1
- package/dist/index.node-BiQhZQvH.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { fromCallback, fromPromise, setup, assign, createActor } from 'xstate';
|
|
2
|
-
import {
|
|
2
|
+
import { B as BaseDb, t as models, v as properties, al as generateId, aK as isInternalSchema, aL as writeModelToDb, aM as writePropertyToDb, aN as addSchemaToDb, r as modelSchemas, A as schemas, H as AmbiguousModelError, aO as renameModelInDb, aP as currentNameMatchLevels, a as TProperty } from './BasePathResolver-CBTXCMFL.js';
|
|
3
3
|
import { eq, and, isNull, or } from 'drizzle-orm';
|
|
4
4
|
import debug from 'debug';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { d as waitForEntityIdle, D as DEFAULT_READY_TIMEOUT_MS, Z as getInvariantSafePropertyDescriptor, n as findEntity, C as ClientManagerState, I as Item, _ as clearDestroySubscriptions, o as forceRemoveFromCaches, $ as unloadEntity, q as runDestroyLifecycle } from './Item-DTJPMjFk.js';
|
|
6
|
+
import { m as getClient } from './ClientManager-DRf4uuei.js';
|
|
7
7
|
import { modelPropertiesToObject } from './model-oHA3YhOd.js';
|
|
8
8
|
import { localNamesInBestMatchTier } from '@seedprotocol/eas';
|
|
9
9
|
import { Type } from '@sinclair/typebox';
|
|
@@ -35,7 +35,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
try {
|
|
38
|
-
const mod = await import('./ModelProperty-
|
|
38
|
+
const mod = await import('./ModelProperty-Dto5C0om.js');
|
|
39
39
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
40
40
|
if (!ModelProperty) {
|
|
41
41
|
logger$7('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -101,10 +101,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
|
|
|
101
101
|
if (!modelRecord) {
|
|
102
102
|
// Model names are only unique per schema: prefer this schema's row, and otherwise only
|
|
103
103
|
// consider same-name rows that no schema claims yet (never another schema's model).
|
|
104
|
-
const _mod_0 = await import('./BasePathResolver-
|
|
104
|
+
const _mod_0 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
105
105
|
const _ns_0 = _mod_0.be;
|
|
106
106
|
const { modelSchemas } = _ns_0;
|
|
107
|
-
const _mod_1 = await import('./BasePathResolver-
|
|
107
|
+
const _mod_1 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
108
108
|
const _ns_1 = _mod_1.bd;
|
|
109
109
|
const { schemas: schemasTable } = _ns_1;
|
|
110
110
|
let dbModels = await db
|
|
@@ -252,7 +252,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
|
|
|
252
252
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
253
253
|
// This handles the case where model exists in schema file but not yet in database
|
|
254
254
|
try {
|
|
255
|
-
const _mod_2 = await import('./Schema-
|
|
255
|
+
const _mod_2 = await import('./Schema-8DxGcORY.js');
|
|
256
256
|
const _ns_2 = _mod_2.b;
|
|
257
257
|
const schemaMod = _ns_2;
|
|
258
258
|
const { Schema } = schemaMod;
|
|
@@ -403,11 +403,11 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
|
|
|
403
403
|
}
|
|
404
404
|
// Also check database for models (in case they're persisted but not in Schema context)
|
|
405
405
|
if (db) {
|
|
406
|
-
const _mod_3 = await import('./BasePathResolver-
|
|
406
|
+
const _mod_3 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
407
407
|
const _ns_3 = _mod_3.be;
|
|
408
408
|
const modelSchemaSchemaMod = _ns_3;
|
|
409
409
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
410
|
-
const _mod_4 = await import('./BasePathResolver-
|
|
410
|
+
const _mod_4 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
411
411
|
const _ns_4 = _mod_4.bd;
|
|
412
412
|
const schemaSchemaMod = _ns_4;
|
|
413
413
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -503,7 +503,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
|
|
|
503
503
|
}
|
|
504
504
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
505
505
|
try {
|
|
506
|
-
const _mod_5 = await import('./Schema-
|
|
506
|
+
const _mod_5 = await import('./Schema-8DxGcORY.js');
|
|
507
507
|
const _ns_5 = _mod_5.b;
|
|
508
508
|
const schemaMod = _ns_5;
|
|
509
509
|
const { Schema } = schemaMod;
|
|
@@ -551,10 +551,10 @@ const validateModel = fromCallback(({ sendBack, input: { context }, self }) => {
|
|
|
551
551
|
const _validateModel = async () => {
|
|
552
552
|
try {
|
|
553
553
|
// Use dynamic imports to break circular dependencies
|
|
554
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
554
|
+
const validationServiceMod = await import('./SchemaValidationService-CE92y1TT.js');
|
|
555
555
|
const { SchemaValidationService } = validationServiceMod;
|
|
556
556
|
const validationService = new SchemaValidationService();
|
|
557
|
-
const _mod_6 = await import('./Schema-
|
|
557
|
+
const _mod_6 = await import('./Schema-8DxGcORY.js');
|
|
558
558
|
const _ns_6 = _mod_6.b;
|
|
559
559
|
const schemaMod = _ns_6;
|
|
560
560
|
const { Schema } = schemaMod;
|
|
@@ -673,7 +673,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
|
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
logger$5(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
676
|
-
const mod = await import('./ModelProperty-
|
|
676
|
+
const mod = await import('./ModelProperty-Dto5C0om.js');
|
|
677
677
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
678
678
|
if (!ModelProperty) {
|
|
679
679
|
logger$5('ModelProperty not available from dynamic import');
|
|
@@ -698,7 +698,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
|
|
|
698
698
|
: undefined;
|
|
699
699
|
// Otherwise use provided ID or generate a random one
|
|
700
700
|
// IDs should be generated in the import process before creating properties
|
|
701
|
-
const _mod_7 = await import('./BasePathResolver-
|
|
701
|
+
const _mod_7 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
702
702
|
const _ns_7 = _mod_7.bi;
|
|
703
703
|
const { generateId } = _ns_7;
|
|
704
704
|
const propertyFileId = propData.id || propertyRecord?.schemaFileId || generateId();
|
|
@@ -716,7 +716,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
|
|
|
716
716
|
}
|
|
717
717
|
else if (refModelName) {
|
|
718
718
|
// Fallback: resolve the ref by name within this model's schema
|
|
719
|
-
const _mod_8 = await import('./BasePathResolver-
|
|
719
|
+
const _mod_8 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
720
720
|
const _ns_8 = _mod_8.bf;
|
|
721
721
|
const { resolveModelRecord } = _ns_8;
|
|
722
722
|
const refModelRecord = await resolveModelRecord(refModelName, { schemaName }, db);
|
|
@@ -740,7 +740,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
|
|
|
740
740
|
// The property should already be in DB from writeModelToDb
|
|
741
741
|
// Note: propertyFileId is the schemaFileId (string), not the database ID (number)
|
|
742
742
|
// We pass it as _propertyFileId so getById() can find the instance
|
|
743
|
-
await ModelProperty.create({
|
|
743
|
+
const property = await ModelProperty.create({
|
|
744
744
|
name: propName,
|
|
745
745
|
modelName,
|
|
746
746
|
modelId: _dbId,
|
|
@@ -761,6 +761,8 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
|
|
|
761
761
|
_propertyFileId: propertyFileId, // Store schemaFileId for getById() lookups
|
|
762
762
|
_dbId: propertyRecord?.schemaFileId === propertyFileId ? propertyRecord.id : undefined, // Already persisted: skip the write
|
|
763
763
|
}, { schemaName }); // Use 'as any' because _propertyFileId is not in TProperty type
|
|
764
|
+
// The model keeps its properties; an app's unload of the same instance doesn't stop them.
|
|
765
|
+
ModelProperty.adoptForModel(property);
|
|
764
766
|
}
|
|
765
767
|
logger$5(`Successfully created all properties for model "${modelName}"`);
|
|
766
768
|
sendBack({ type: 'createModelPropertiesSuccess' });
|
|
@@ -885,7 +887,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
885
887
|
const evictionEpoch = currentEvictionEpoch();
|
|
886
888
|
/** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
|
|
887
889
|
const schemaForValidation = async (schemaName) => {
|
|
888
|
-
const _mod_9 = await import('./Schema-
|
|
890
|
+
const _mod_9 = await import('./Schema-8DxGcORY.js');
|
|
889
891
|
const _ns_9 = _mod_9.b;
|
|
890
892
|
const { Schema } = _ns_9;
|
|
891
893
|
if (schemaEvictedSince(schemaName, evictionEpoch)) {
|
|
@@ -903,7 +905,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
903
905
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
904
906
|
logger$4(structureMsg);
|
|
905
907
|
// Use existing Model validation
|
|
906
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
908
|
+
const validationServiceMod = await import('./SchemaValidationService-CE92y1TT.js');
|
|
907
909
|
const { SchemaValidationService } = validationServiceMod;
|
|
908
910
|
const validationService = new SchemaValidationService();
|
|
909
911
|
// Validate model structure
|
|
@@ -953,7 +955,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
953
955
|
}
|
|
954
956
|
else if (entityInput.entityType === 'modelProperty') {
|
|
955
957
|
// Use existing ModelProperty validation
|
|
956
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
958
|
+
const validationServiceMod = await import('./SchemaValidationService-CE92y1TT.js');
|
|
957
959
|
const { SchemaValidationService } = validationServiceMod;
|
|
958
960
|
const validationService = new SchemaValidationService();
|
|
959
961
|
// Validate property structure
|
|
@@ -993,7 +995,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
993
995
|
}
|
|
994
996
|
else if (entityInput.entityType === 'schema') {
|
|
995
997
|
// Schema validation - use existing validation
|
|
996
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
998
|
+
const validationServiceMod = await import('./SchemaValidationService-CE92y1TT.js');
|
|
997
999
|
const { SchemaValidationService } = validationServiceMod;
|
|
998
1000
|
const validationService = new SchemaValidationService();
|
|
999
1001
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -1082,7 +1084,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
|
|
|
1082
1084
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
1083
1085
|
let dataToWrite = input.entityData;
|
|
1084
1086
|
try {
|
|
1085
|
-
const mod = await import('./ModelProperty-
|
|
1087
|
+
const mod = await import('./ModelProperty-Dto5C0om.js');
|
|
1086
1088
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1087
1089
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
1088
1090
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -1476,7 +1478,7 @@ const modelMachine = setup({
|
|
|
1476
1478
|
// Create ModelProperty instances for any new property IDs
|
|
1477
1479
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
1478
1480
|
// Import and create instances asynchronously (fire-and-forget)
|
|
1479
|
-
import('./ModelProperty-
|
|
1481
|
+
import('./ModelProperty-Dto5C0om.js').then(({ ModelProperty }) => {
|
|
1480
1482
|
if (self.getSnapshot().status === 'stopped')
|
|
1481
1483
|
return;
|
|
1482
1484
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
@@ -2002,7 +2004,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
2002
2004
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
2003
2005
|
// Eagerly start loading to minimize delay on first access
|
|
2004
2006
|
let ModelPropertyClass = null;
|
|
2005
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
2007
|
+
const modelPropertyImportPromise = import('./ModelProperty-Dto5C0om.js')
|
|
2006
2008
|
.then(module => {
|
|
2007
2009
|
ModelPropertyClass = module.ModelProperty;
|
|
2008
2010
|
return ModelPropertyClass;
|
|
@@ -2555,18 +2557,19 @@ class Model {
|
|
|
2555
2557
|
try {
|
|
2556
2558
|
// Wait for model to reach idle state (validation complete)
|
|
2557
2559
|
await new Promise((resolve) => {
|
|
2560
|
+
// Cleared once the model settles: a pending timer kept Node scripts alive for 10 s.
|
|
2561
|
+
const timer = setTimeout(() => {
|
|
2562
|
+
subscription.unsubscribe();
|
|
2563
|
+
resolve();
|
|
2564
|
+
}, 10000);
|
|
2558
2565
|
const subscription = proxiedInstance._service.subscribe((snapshot) => {
|
|
2559
2566
|
// Wait for idle state (validation complete) or error state
|
|
2560
2567
|
if (snapshot.value === 'idle' || snapshot.value === 'error') {
|
|
2568
|
+
clearTimeout(timer);
|
|
2561
2569
|
subscription.unsubscribe();
|
|
2562
2570
|
resolve();
|
|
2563
2571
|
}
|
|
2564
2572
|
});
|
|
2565
|
-
// Timeout after 10 seconds
|
|
2566
|
-
setTimeout(() => {
|
|
2567
|
-
subscription.unsubscribe();
|
|
2568
|
-
resolve();
|
|
2569
|
-
}, 10000);
|
|
2570
2573
|
});
|
|
2571
2574
|
// Unloaded or evicted (e.g. Schema.destroy) while it loaded: a stopped model never writes
|
|
2572
2575
|
if (isActorStopped(proxiedInstance._service)) {
|
|
@@ -2999,7 +3002,7 @@ class Model {
|
|
|
2999
3002
|
const evictionEpoch = options?.evictionEpoch ?? currentEvictionEpoch();
|
|
3000
3003
|
try {
|
|
3001
3004
|
// Query model by name (throws AmbiguousModelError when several schemas define it)
|
|
3002
|
-
const _mod_10 = await import('./BasePathResolver-
|
|
3005
|
+
const _mod_10 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
3003
3006
|
const _ns_10 = _mod_10.bf;
|
|
3004
3007
|
const { resolveModelRecord } = _ns_10;
|
|
3005
3008
|
const resolved = await resolveModelRecord(modelName, {}, db);
|
|
@@ -3615,21 +3618,23 @@ class Model {
|
|
|
3615
3618
|
this._service.send({ type: 'reloadFromDb' });
|
|
3616
3619
|
// Wait for reload to complete
|
|
3617
3620
|
return new Promise((resolve, reject) => {
|
|
3621
|
+
// Cleared once the reload settles: a pending timer kept Node scripts alive for 10 s.
|
|
3622
|
+
const timer = setTimeout(() => {
|
|
3623
|
+
subscription.unsubscribe();
|
|
3624
|
+
reject(new Error('Timeout waiting for model reload'));
|
|
3625
|
+
}, 10000);
|
|
3618
3626
|
const subscription = this._service.subscribe((snapshot) => {
|
|
3619
3627
|
if (snapshot.value === 'idle') {
|
|
3628
|
+
clearTimeout(timer);
|
|
3620
3629
|
subscription.unsubscribe();
|
|
3621
3630
|
resolve();
|
|
3622
3631
|
}
|
|
3623
3632
|
else if (snapshot.value === 'error') {
|
|
3633
|
+
clearTimeout(timer);
|
|
3624
3634
|
subscription.unsubscribe();
|
|
3625
3635
|
reject(new Error('Failed to reload model from database'));
|
|
3626
3636
|
}
|
|
3627
3637
|
});
|
|
3628
|
-
// Timeout after 10 seconds
|
|
3629
|
-
setTimeout(() => {
|
|
3630
|
-
subscription.unsubscribe();
|
|
3631
|
-
reject(new Error('Timeout waiting for model reload'));
|
|
3632
|
-
}, 10000);
|
|
3633
3638
|
});
|
|
3634
3639
|
}
|
|
3635
3640
|
/**
|
|
@@ -3751,7 +3756,7 @@ class Model {
|
|
|
3751
3756
|
.limit(1);
|
|
3752
3757
|
if (modelRecords.length > 0) {
|
|
3753
3758
|
const modelId = modelRecords[0].id;
|
|
3754
|
-
const { detachModelRows } = await import('./detachRowsBeforeDelete-
|
|
3759
|
+
const { detachModelRows } = await import('./detachRowsBeforeDelete-BVetHtn2.js');
|
|
3755
3760
|
await detachModelRows(db, [typeof modelId === 'string' ? parseInt(modelId, 10) : modelId]);
|
|
3756
3761
|
await db.delete(modelSchemas).where(eq(modelSchemas.modelId, modelId));
|
|
3757
3762
|
await db
|
|
@@ -3762,7 +3767,7 @@ class Model {
|
|
|
3762
3767
|
}
|
|
3763
3768
|
if (schemaName && modelName) {
|
|
3764
3769
|
// Imported here, not at module load: Model and Schema import each other.
|
|
3765
|
-
const _mod_11 = await import('./Schema-
|
|
3770
|
+
const _mod_11 = await import('./Schema-8DxGcORY.js');
|
|
3766
3771
|
const _ns_11 = _mod_11.b;
|
|
3767
3772
|
const { Schema } = _ns_11;
|
|
3768
3773
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
@@ -3806,7 +3811,7 @@ class Model {
|
|
|
3806
3811
|
return undefined;
|
|
3807
3812
|
}
|
|
3808
3813
|
// Model names are only unique per schema: find this model's row by its id (schemaFileId).
|
|
3809
|
-
const _mod_12 = await import('./BasePathResolver-
|
|
3814
|
+
const _mod_12 = await import('./BasePathResolver-CBTXCMFL.js');
|
|
3810
3815
|
const _ns_12 = _mod_12.bf;
|
|
3811
3816
|
const { resolveModelRecord } = _ns_12;
|
|
3812
3817
|
const modelRecord = await resolveModelRecord(modelName, { modelFileId: context.id, schemaName: context.schemaName }, db);
|
|
@@ -4013,7 +4018,9 @@ const TModelSchema = Type.Record(Type.String(), TProperty);
|
|
|
4013
4018
|
|
|
4014
4019
|
/**
|
|
4015
4020
|
* Thrown by Item.create when values don't fit the model: unknown keys, wrong types, or values
|
|
4016
|
-
* that break the property's validation rules. Nothing is written
|
|
4021
|
+
* that break the property's validation rules. Nothing is left written: most values are checked
|
|
4022
|
+
* before anything is written, and File/Image/Html/ItemStorage values, checked as they're saved,
|
|
4023
|
+
* have their draft removed.
|
|
4017
4024
|
*/
|
|
4018
4025
|
class ItemCreateValidationError extends Error {
|
|
4019
4026
|
constructor(modelName, problems) {
|
|
@@ -4042,4 +4049,4 @@ var errors = /*#__PURE__*/Object.freeze({
|
|
|
4042
4049
|
});
|
|
4043
4050
|
|
|
4044
4051
|
export { ConflictError as C, ItemCreateValidationError as I, Model as M, TModelSchema as T, UnknownModelError as U, TModelValues as a, anyEvictionSince as b, currentEvictionEpoch as c, setupEntityLiveQuery as d, writeToDatabase$1 as e, finishSchemaDestroy as f, getDraftSaveError as g, Model$1 as h, isActorStopped as i, errors as j, recordSchemaDestroy as r, schemaEvictedSince as s, trackDraftSave as t, writeProcessMachine as w };
|
|
4045
|
-
//# sourceMappingURL=errors-
|
|
4052
|
+
//# sourceMappingURL=errors-CIrbsN_i.js.map
|