@seedprotocol/sdk 0.7.5 → 0.7.6-next.957.g6bb7768
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/README.md +2 -2
- package/dist/{ClientManager-DRf4uuei.js → ClientManager-D6YA20jP.js} +207 -149
- package/dist/ClientManager-D6YA20jP.js.map +1 -0
- package/dist/{Item-DTJPMjFk.js → Item-B1MH0tXx.js} +126 -86
- package/dist/Item-B1MH0tXx.js.map +1 -0
- package/dist/{ModelProperty-Dto5C0om.js → ModelProperty-Dw6dHdu_.js} +37 -37
- package/dist/{ModelProperty-Dto5C0om.js.map → ModelProperty-Dw6dHdu_.js.map} +1 -1
- package/dist/{Schema-8DxGcORY.js → Schema-DppObO6h.js} +62 -212
- package/dist/Schema-DppObO6h.js.map +1 -0
- package/dist/{SchemaValidationService-CE92y1TT.js → SchemaValidationService-DXQ-D531.js} +6 -6
- package/dist/{SchemaValidationService-CE92y1TT.js.map → SchemaValidationService-DXQ-D531.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js → backfillMetadataPropertyIds-Uhzlwg9X.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js.map → backfillMetadataPropertyIds-Uhzlwg9X.js.map} +1 -1
- package/dist/configurePlatform-CVoh3JeR.js +81 -0
- package/dist/configurePlatform-CVoh3JeR.js.map +1 -0
- package/dist/{detachRowsBeforeDelete-BVetHtn2.js → detachRowsBeforeDelete-CtmIFpgV.js} +2 -2
- package/dist/{detachRowsBeforeDelete-BVetHtn2.js.map → detachRowsBeforeDelete-CtmIFpgV.js.map} +1 -1
- package/dist/{discardNewDraft-CEOouygG.js → discardNewDraft-oGYdB5vS.js} +5 -5
- package/dist/{discardNewDraft-CEOouygG.js.map → discardNewDraft-oGYdB5vS.js.map} +1 -1
- package/dist/dist/ClientManager-D6YA20jP.d.ts +933 -0
- package/dist/dist/ClientManager-D6YA20jP.d.ts.map +1 -0
- package/dist/dist/Item-B1MH0tXx.d.ts +898 -0
- package/dist/dist/Item-B1MH0tXx.d.ts.map +1 -0
- package/dist/dist/ModelProperty-Dw6dHdu_.d.ts +315 -0
- package/dist/dist/ModelProperty-Dw6dHdu_.d.ts.map +1 -0
- package/dist/dist/Schema-DppObO6h.d.ts +601 -0
- package/dist/dist/Schema-DppObO6h.d.ts.map +1 -0
- package/dist/dist/SchemaValidationService-DXQ-D531.d.ts +118 -0
- package/dist/dist/SchemaValidationService-DXQ-D531.d.ts.map +1 -0
- package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts +7 -0
- package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts.map +1 -0
- package/dist/dist/configurePlatform-CVoh3JeR.d.ts +30 -0
- package/dist/dist/configurePlatform-CVoh3JeR.d.ts.map +1 -0
- package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts +13 -0
- package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts.map +1 -0
- package/dist/dist/discardNewDraft-oGYdB5vS.d.ts +8 -0
- package/dist/dist/discardNewDraft-oGYdB5vS.d.ts.map +1 -0
- package/dist/dist/eas-CSm5wmry.d.ts +12 -0
- package/dist/dist/eas-CSm5wmry.d.ts.map +1 -0
- package/dist/dist/errors-3tc6XkCB.d.ts +487 -0
- package/dist/dist/errors-3tc6XkCB.d.ts.map +1 -0
- package/dist/dist/errors-Do7v6RKu.d.ts +22 -0
- package/dist/dist/errors-Do7v6RKu.d.ts.map +1 -0
- package/dist/dist/getItem-DM3a-7XE.d.ts +6 -0
- package/dist/dist/getItem-DM3a-7XE.d.ts.map +1 -0
- package/dist/dist/getPublishPayload-CJF0k5d8.d.ts +47 -0
- package/dist/dist/getPublishPayload-CJF0k5d8.d.ts.map +1 -0
- package/dist/dist/getPublishUploads-C7-fYIgX.d.ts +89 -0
- package/dist/dist/getPublishUploads-C7-fYIgX.d.ts.map +1 -0
- package/dist/dist/index--mmQ3LQu.d.ts +6 -0
- package/dist/dist/index--mmQ3LQu.d.ts.map +1 -0
- package/dist/dist/index-B7yAoYli.d.ts +2752 -0
- package/dist/dist/index-B7yAoYli.d.ts.map +1 -0
- package/dist/dist/index-CrvIcVFJ.d.ts +4475 -0
- package/dist/dist/index-CrvIcVFJ.d.ts.map +1 -0
- package/dist/dist/index.browser-BmVS-c2C.d.ts +8445 -0
- package/dist/dist/index.browser-BmVS-c2C.d.ts.map +1 -0
- package/dist/dist/index.node-BKpbCAWt.d.ts +11123 -0
- package/dist/dist/index.node-BKpbCAWt.d.ts.map +1 -0
- package/dist/dist/mimeTypes-C9r76DCH.d.ts +30 -0
- package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +1 -0
- package/dist/dist/model-oHA3YhOd.d.ts +6 -0
- package/dist/dist/model-oHA3YhOd.d.ts.map +1 -0
- package/dist/dist/platform.browser.d.ts +3 -0
- package/dist/dist/platform.browser.d.ts.map +1 -0
- package/dist/dist/platform.node.d.ts +3 -0
- package/dist/dist/platform.node.d.ts.map +1 -0
- package/dist/dist/property-DQ-Owzki.d.ts +37 -0
- package/dist/dist/property-DQ-Owzki.d.ts.map +1 -0
- package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts +8 -0
- package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts.map +1 -0
- package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts +76 -0
- package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts.map +1 -0
- package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts +17 -0
- package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts.map +1 -0
- package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts +21 -0
- package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts.map +1 -0
- package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts +22 -0
- package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts.map +1 -0
- package/dist/dist/tabEvents-D9x26vf2.d.ts +81 -0
- package/dist/dist/tabEvents-D9x26vf2.d.ts.map +1 -0
- package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts +113 -0
- package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts.map +1 -0
- package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts +11 -0
- package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts.map +1 -0
- package/dist/drizzle.js +2 -0
- package/dist/drizzle.js.map +1 -0
- package/dist/{eas-D7jvWMnI.js → eas-CSm5wmry.js} +3 -3
- package/dist/{eas-D7jvWMnI.js.map → eas-CSm5wmry.js.map} +1 -1
- package/dist/{errors-CIrbsN_i.js → errors-3tc6XkCB.js} +81 -36
- package/dist/errors-3tc6XkCB.js.map +1 -0
- package/dist/errors-Do7v6RKu.js +34 -0
- package/dist/errors-Do7v6RKu.js.map +1 -0
- package/dist/{getItem-CxU_kT5W.js → getItem-DM3a-7XE.js} +4 -4
- package/dist/{getItem-CxU_kT5W.js.map → getItem-DM3a-7XE.js.map} +1 -1
- package/dist/{getPublishPayload-DTjOKd3y.js → getPublishPayload-CJF0k5d8.js} +31 -25
- package/dist/getPublishPayload-CJF0k5d8.js.map +1 -0
- package/dist/{getPublishUploads-CVTBo_OV.js → getPublishUploads-C7-fYIgX.js} +6 -6
- package/dist/{getPublishUploads-CVTBo_OV.js.map → getPublishUploads-C7-fYIgX.js.map} +1 -1
- package/dist/{index-CMxEil8T.js → index--mmQ3LQu.js} +8 -8
- package/dist/index--mmQ3LQu.js.map +1 -0
- package/dist/{index-DWK-LOUY.js → index-B7yAoYli.js} +2 -2
- package/dist/index-B7yAoYli.js.map +1 -0
- package/dist/{BasePathResolver-CBTXCMFL.js → index-CrvIcVFJ.js} +304 -285
- package/dist/index-CrvIcVFJ.js.map +1 -0
- package/dist/{index.browser-shRXMeB3.js → index.browser-BmVS-c2C.js} +34 -44
- package/dist/index.browser-BmVS-c2C.js.map +1 -0
- package/dist/{index.node-DAKJNYp5.js → index.node-BKpbCAWt.js} +43 -7
- package/dist/index.node-BKpbCAWt.js.map +1 -0
- package/dist/main.js +23 -24
- package/dist/main.js.map +1 -1
- package/dist/node.js +13 -10
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +7 -7
- package/dist/platform.node.js +4 -4
- package/dist/{property-lz9yIpyA.js → property-DQ-Owzki.js} +7 -7
- package/dist/{property-lz9yIpyA.js.map → property-DQ-Owzki.js.map} +1 -1
- package/dist/{propertyValidationRules-LuIwoQoJ.js → propertyValidationRules-BDhFjlwP.js} +10 -10
- package/dist/{propertyValidationRules-LuIwoQoJ.js.map → propertyValidationRules-BDhFjlwP.js.map} +1 -1
- package/dist/{publishDraftGraph-CgSLPKvQ.js → publishDraftGraph-CzPd9oe9.js} +41 -8
- package/dist/publishDraftGraph-CzPd9oe9.js.map +1 -0
- package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js → resetAmbiguousLegacyItemData-cXZm4NuG.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js.map → resetAmbiguousLegacyItemData-cXZm4NuG.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-BbSctSvz.js → resolveModelForSyncedSeed-BgxtVCHI.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-BbSctSvz.js.map → resolveModelForSyncedSeed-BgxtVCHI.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts +10 -0
- package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +1 -0
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +20 -20
- package/dist/src/Model/Model.d.ts +8 -0
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -3
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
- package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +1 -7
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/saveAppState.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/seedConfigDefaults.d.ts +10 -0
- package/dist/src/client/seedConfigDefaults.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/write/updateItemPropertyValue.d.ts +6 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/drizzle/index.d.ts +7 -0
- package/dist/src/drizzle/index.d.ts.map +1 -0
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/errors.d.ts +11 -0
- package/dist/src/helpers/FileManager/errors.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +14 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/dotSeedPath.d.ts +7 -0
- package/dist/src/helpers/dotSeedPath.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/environment.d.ts +5 -0
- package/dist/src/helpers/environment.d.ts.map +1 -1
- package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
- package/dist/src/helpers/metadataPropertyNames.d.ts +10 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +9 -0
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +1 -0
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/imports/index.d.ts +1 -1
- package/dist/src/imports/index.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +18 -5
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/helpers/resolveFilesDir.d.ts +8 -0
- package/dist/src/node/helpers/resolveFilesDir.d.ts.map +1 -0
- package/dist/src/node/webpack/index.d.ts +2 -0
- package/dist/src/node/webpack/index.d.ts.map +1 -1
- package/dist/src/platform/index.browser.d.ts +5 -0
- package/dist/src/platform/index.browser.d.ts.map +1 -1
- package/dist/src/platform/index.node.d.ts +1 -0
- package/dist/src/platform/index.node.d.ts.map +1 -1
- package/dist/src/stores/eas.d.ts +1 -1
- package/dist/src/stores/eas.d.ts.map +1 -1
- package/dist/src/types/import.d.ts +15 -0
- package/dist/src/types/import.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +8 -4
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CrAY9Rl2.js → syncDbWithEas-Y5GysSCm.js} +17 -13
- package/dist/syncDbWithEas-Y5GysSCm.js.map +1 -0
- package/dist/{tabEvents-BGBYV65P.js → tabEvents-D9x26vf2.js} +4 -4
- package/dist/{tabEvents-BGBYV65P.js.map → tabEvents-D9x26vf2.js.map} +1 -1
- package/dist/{tolerantWebAccess-DVHCEulL.js → tolerantWebAccess-BFU2t-SC.js} +8 -8
- package/dist/{tolerantWebAccess-DVHCEulL.js.map → tolerantWebAccess-BFU2t-SC.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js → updateSeedRevokedAt-CCF8WWYS.js} +3 -3
- package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js.map → updateSeedRevokedAt-CCF8WWYS.js.map} +1 -1
- package/package.json +31 -31
- package/dist/BasePathResolver-CBTXCMFL.js.map +0 -1
- package/dist/ClientManager-DRf4uuei.js.map +0 -1
- package/dist/Item-DTJPMjFk.js.map +0 -1
- package/dist/Schema-8DxGcORY.js.map +0 -1
- package/dist/configurePlatform-D4aGjKNk.js +0 -31
- package/dist/configurePlatform-D4aGjKNk.js.map +0 -1
- package/dist/errors-CIrbsN_i.js.map +0 -1
- package/dist/errors-CrBxGWah.js +0 -17
- package/dist/errors-CrBxGWah.js.map +0 -1
- package/dist/getPublishPayload-DTjOKd3y.js.map +0 -1
- package/dist/index-CMxEil8T.js.map +0 -1
- package/dist/index-DWK-LOUY.js.map +0 -1
- package/dist/index.browser-shRXMeB3.js.map +0 -1
- package/dist/index.node-DAKJNYp5.js.map +0 -1
- package/dist/publishDraftGraph-CgSLPKvQ.js.map +0 -1
- package/dist/src/client/nodeEndpointDefaults.d.ts +0 -8
- package/dist/src/client/nodeEndpointDefaults.d.ts.map +0 -1
- package/dist/syncDbWithEas-CrAY9Rl2.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { fromCallback, fromPromise, setup, assign, createActor } from 'xstate';
|
|
2
|
-
import { B as BaseDb, t as models, v as properties,
|
|
2
|
+
import { B as BaseDb, t as models, v as properties, ai as generateId, aJ as isInternalSchema, aK as writeModelToDb, aL as writePropertyToDb, aM as addSchemaToDb, r as modelSchemas, A as schemas, H as AmbiguousModelError, aN as renameModelInDb, aO as currentNameMatchLevels, a as TProperty } from './index-CrvIcVFJ.js';
|
|
3
3
|
import { eq, and, isNull, or } from 'drizzle-orm';
|
|
4
4
|
import debug from 'debug';
|
|
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-
|
|
6
|
-
import { m as getClient } from './ClientManager-
|
|
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-B1MH0tXx.js';
|
|
6
|
+
import { m as getClient } from './ClientManager-D6YA20jP.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-Dw6dHdu_.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,11 +101,11 @@ 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('./
|
|
105
|
-
const _ns_0 = _mod_0.
|
|
104
|
+
const _mod_0 = await import('./index-CrvIcVFJ.js');
|
|
105
|
+
const _ns_0 = _mod_0.bg;
|
|
106
106
|
const { modelSchemas } = _ns_0;
|
|
107
|
-
const _mod_1 = await import('./
|
|
108
|
-
const _ns_1 = _mod_1.
|
|
107
|
+
const _mod_1 = await import('./index-CrvIcVFJ.js');
|
|
108
|
+
const _ns_1 = _mod_1.bf;
|
|
109
109
|
const { schemas: schemasTable } = _ns_1;
|
|
110
110
|
let dbModels = await db
|
|
111
111
|
.select({
|
|
@@ -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-DppObO6h.js');
|
|
256
256
|
const _ns_2 = _mod_2.b;
|
|
257
257
|
const schemaMod = _ns_2;
|
|
258
258
|
const { Schema } = schemaMod;
|
|
@@ -403,12 +403,12 @@ 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('./
|
|
407
|
-
const _ns_3 = _mod_3.
|
|
406
|
+
const _mod_3 = await import('./index-CrvIcVFJ.js');
|
|
407
|
+
const _ns_3 = _mod_3.bg;
|
|
408
408
|
const modelSchemaSchemaMod = _ns_3;
|
|
409
409
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
410
|
-
const _mod_4 = await import('./
|
|
411
|
-
const _ns_4 = _mod_4.
|
|
410
|
+
const _mod_4 = await import('./index-CrvIcVFJ.js');
|
|
411
|
+
const _ns_4 = _mod_4.bf;
|
|
412
412
|
const schemaSchemaMod = _ns_4;
|
|
413
413
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
414
414
|
// Query all models for this schema to check for duplicates (case-insensitive)
|
|
@@ -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-DppObO6h.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-DXQ-D531.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-DppObO6h.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-Dw6dHdu_.js');
|
|
677
677
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
678
678
|
if (!ModelProperty) {
|
|
679
679
|
logger$5('ModelProperty not available from dynamic import');
|
|
@@ -698,8 +698,8 @@ 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('./
|
|
702
|
-
const _ns_7 = _mod_7.
|
|
701
|
+
const _mod_7 = await import('./index-CrvIcVFJ.js');
|
|
702
|
+
const _ns_7 = _mod_7.bk;
|
|
703
703
|
const { generateId } = _ns_7;
|
|
704
704
|
const propertyFileId = propData.id || propertyRecord?.schemaFileId || generateId();
|
|
705
705
|
logger$5(`Creating property "${propName}" with fileId "${propertyFileId}"`);
|
|
@@ -716,8 +716,8 @@ 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('./
|
|
720
|
-
const _ns_8 = _mod_8.
|
|
719
|
+
const _mod_8 = await import('./index-CrvIcVFJ.js');
|
|
720
|
+
const _ns_8 = _mod_8.bh;
|
|
721
721
|
const { resolveModelRecord } = _ns_8;
|
|
722
722
|
const refModelRecord = await resolveModelRecord(refModelName, { schemaName }, db);
|
|
723
723
|
if (refModelRecord?.id) {
|
|
@@ -887,7 +887,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
887
887
|
const evictionEpoch = currentEvictionEpoch();
|
|
888
888
|
/** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
|
|
889
889
|
const schemaForValidation = async (schemaName) => {
|
|
890
|
-
const _mod_9 = await import('./Schema-
|
|
890
|
+
const _mod_9 = await import('./Schema-DppObO6h.js');
|
|
891
891
|
const _ns_9 = _mod_9.b;
|
|
892
892
|
const { Schema } = _ns_9;
|
|
893
893
|
if (schemaEvictedSince(schemaName, evictionEpoch)) {
|
|
@@ -905,7 +905,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
905
905
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
906
906
|
logger$4(structureMsg);
|
|
907
907
|
// Use existing Model validation
|
|
908
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
908
|
+
const validationServiceMod = await import('./SchemaValidationService-DXQ-D531.js');
|
|
909
909
|
const { SchemaValidationService } = validationServiceMod;
|
|
910
910
|
const validationService = new SchemaValidationService();
|
|
911
911
|
// Validate model structure
|
|
@@ -955,7 +955,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
955
955
|
}
|
|
956
956
|
else if (entityInput.entityType === 'modelProperty') {
|
|
957
957
|
// Use existing ModelProperty validation
|
|
958
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
958
|
+
const validationServiceMod = await import('./SchemaValidationService-DXQ-D531.js');
|
|
959
959
|
const { SchemaValidationService } = validationServiceMod;
|
|
960
960
|
const validationService = new SchemaValidationService();
|
|
961
961
|
// Validate property structure
|
|
@@ -995,7 +995,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
995
995
|
}
|
|
996
996
|
else if (entityInput.entityType === 'schema') {
|
|
997
997
|
// Schema validation - use existing validation
|
|
998
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
998
|
+
const validationServiceMod = await import('./SchemaValidationService-DXQ-D531.js');
|
|
999
999
|
const { SchemaValidationService } = validationServiceMod;
|
|
1000
1000
|
const validationService = new SchemaValidationService();
|
|
1001
1001
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -1084,7 +1084,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
|
|
|
1084
1084
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
1085
1085
|
let dataToWrite = input.entityData;
|
|
1086
1086
|
try {
|
|
1087
|
-
const mod = await import('./ModelProperty-
|
|
1087
|
+
const mod = await import('./ModelProperty-Dw6dHdu_.js');
|
|
1088
1088
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1089
1089
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
1090
1090
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -1478,7 +1478,7 @@ const modelMachine = setup({
|
|
|
1478
1478
|
// Create ModelProperty instances for any new property IDs
|
|
1479
1479
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
1480
1480
|
// Import and create instances asynchronously (fire-and-forget)
|
|
1481
|
-
import('./ModelProperty-
|
|
1481
|
+
import('./ModelProperty-Dw6dHdu_.js').then(({ ModelProperty }) => {
|
|
1482
1482
|
if (self.getSnapshot().status === 'stopped')
|
|
1483
1483
|
return;
|
|
1484
1484
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
@@ -1844,7 +1844,15 @@ function setupEntityLiveQuery(instance, config) {
|
|
|
1844
1844
|
if (isActorStopped(instance.getService()))
|
|
1845
1845
|
return;
|
|
1846
1846
|
if (config.createChildInstances && ids.length > 0) {
|
|
1847
|
-
|
|
1847
|
+
// Nothing awaits this handler, so a child that fails to load (its row deleted while it
|
|
1848
|
+
// loads, say) would be an unhandled rejection. Skip this result; a later one tries again.
|
|
1849
|
+
try {
|
|
1850
|
+
await config.createChildInstances(ids);
|
|
1851
|
+
}
|
|
1852
|
+
catch (error) {
|
|
1853
|
+
logger(`createChildInstances failed: ${error}`);
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1848
1856
|
}
|
|
1849
1857
|
// Update context with new IDs
|
|
1850
1858
|
if (isActorStopped(instance.getService()))
|
|
@@ -2004,7 +2012,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
2004
2012
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
2005
2013
|
// Eagerly start loading to minimize delay on first access
|
|
2006
2014
|
let ModelPropertyClass = null;
|
|
2007
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
2015
|
+
const modelPropertyImportPromise = import('./ModelProperty-Dw6dHdu_.js')
|
|
2008
2016
|
.then(module => {
|
|
2009
2017
|
ModelPropertyClass = module.ModelProperty;
|
|
2010
2018
|
return ModelPropertyClass;
|
|
@@ -2112,6 +2120,30 @@ class Model {
|
|
|
2112
2120
|
}
|
|
2113
2121
|
return instance;
|
|
2114
2122
|
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Gives an idle, valid model the row someone else wrote for its id, the way its own write would
|
|
2125
|
+
* (writeSuccess with the row's id, which goes on to create its properties from their rows).
|
|
2126
|
+
* Returns false when there is no such row, so the model writes it.
|
|
2127
|
+
*/
|
|
2128
|
+
static async adoptPersistedRow(instance) {
|
|
2129
|
+
const snapshot = instance.getService().getSnapshot();
|
|
2130
|
+
if (snapshot.value !== 'idle' || snapshot.context._validationErrors?.length || !snapshot.context.id) {
|
|
2131
|
+
return false;
|
|
2132
|
+
}
|
|
2133
|
+
const db = BaseDb.getAppDb();
|
|
2134
|
+
if (!db)
|
|
2135
|
+
return false;
|
|
2136
|
+
const [row] = await db
|
|
2137
|
+
.select({ id: models.id })
|
|
2138
|
+
.from(models)
|
|
2139
|
+
.where(eq(models.schemaFileId, snapshot.context.id))
|
|
2140
|
+
.limit(1);
|
|
2141
|
+
if (!row || isActorStopped(instance.getService()))
|
|
2142
|
+
return false;
|
|
2143
|
+
logger(`Model "${snapshot.context.modelName}" adopts model row ${row.id} written by its schema import`);
|
|
2144
|
+
instance.getService().send({ type: 'writeSuccess', output: { _dbId: row.id } });
|
|
2145
|
+
return true;
|
|
2146
|
+
}
|
|
2115
2147
|
/**
|
|
2116
2148
|
* True when a name-cached instance belongs to a different model than the requested modelFileId.
|
|
2117
2149
|
* A schema re-imported under the same name can give its models new ids while the previous
|
|
@@ -2571,11 +2603,18 @@ class Model {
|
|
|
2571
2603
|
}
|
|
2572
2604
|
});
|
|
2573
2605
|
});
|
|
2606
|
+
// The caller writes this model's rows; wait for that so two writers don't write them at once
|
|
2607
|
+
if (options?.persistedBy) {
|
|
2608
|
+
await options.persistedBy.catch(() => { });
|
|
2609
|
+
}
|
|
2574
2610
|
// Unloaded or evicted (e.g. Schema.destroy) while it loaded: a stopped model never writes
|
|
2575
2611
|
if (isActorStopped(proxiedInstance._service)) {
|
|
2576
2612
|
failPropertyCreation('the model was unloaded');
|
|
2577
2613
|
return;
|
|
2578
2614
|
}
|
|
2615
|
+
if (options?.persistedBy && (await Model.adoptPersistedRow(proxiedInstance))) {
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2579
2618
|
// Only write if validation passed (model is in idle state, not error)
|
|
2580
2619
|
const finalSnapshot = proxiedInstance._service.getSnapshot();
|
|
2581
2620
|
if (finalSnapshot.value === 'idle' && (!finalSnapshot.context._validationErrors || finalSnapshot.context._validationErrors.length === 0)) {
|
|
@@ -3002,8 +3041,8 @@ class Model {
|
|
|
3002
3041
|
const evictionEpoch = options?.evictionEpoch ?? currentEvictionEpoch();
|
|
3003
3042
|
try {
|
|
3004
3043
|
// Query model by name (throws AmbiguousModelError when several schemas define it)
|
|
3005
|
-
const _mod_10 = await import('./
|
|
3006
|
-
const _ns_10 = _mod_10.
|
|
3044
|
+
const _mod_10 = await import('./index-CrvIcVFJ.js');
|
|
3045
|
+
const _ns_10 = _mod_10.bh;
|
|
3007
3046
|
const { resolveModelRecord } = _ns_10;
|
|
3008
3047
|
const resolved = await resolveModelRecord(modelName, {}, db);
|
|
3009
3048
|
if (!resolved?.schemaFileId) {
|
|
@@ -3756,7 +3795,7 @@ class Model {
|
|
|
3756
3795
|
.limit(1);
|
|
3757
3796
|
if (modelRecords.length > 0) {
|
|
3758
3797
|
const modelId = modelRecords[0].id;
|
|
3759
|
-
const { detachModelRows } = await import('./detachRowsBeforeDelete-
|
|
3798
|
+
const { detachModelRows } = await import('./detachRowsBeforeDelete-CtmIFpgV.js');
|
|
3760
3799
|
await detachModelRows(db, [typeof modelId === 'string' ? parseInt(modelId, 10) : modelId]);
|
|
3761
3800
|
await db.delete(modelSchemas).where(eq(modelSchemas.modelId, modelId));
|
|
3762
3801
|
await db
|
|
@@ -3767,7 +3806,7 @@ class Model {
|
|
|
3767
3806
|
}
|
|
3768
3807
|
if (schemaName && modelName) {
|
|
3769
3808
|
// Imported here, not at module load: Model and Schema import each other.
|
|
3770
|
-
const _mod_11 = await import('./Schema-
|
|
3809
|
+
const _mod_11 = await import('./Schema-DppObO6h.js');
|
|
3771
3810
|
const _ns_11 = _mod_11.b;
|
|
3772
3811
|
const { Schema } = _ns_11;
|
|
3773
3812
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
@@ -3811,13 +3850,19 @@ class Model {
|
|
|
3811
3850
|
return undefined;
|
|
3812
3851
|
}
|
|
3813
3852
|
// Model names are only unique per schema: find this model's row by its id (schemaFileId).
|
|
3814
|
-
const _mod_12 = await import('./
|
|
3815
|
-
const _ns_12 = _mod_12.
|
|
3853
|
+
const _mod_12 = await import('./index-CrvIcVFJ.js');
|
|
3854
|
+
const _ns_12 = _mod_12.bh;
|
|
3816
3855
|
const { resolveModelRecord } = _ns_12;
|
|
3817
3856
|
const modelRecord = await resolveModelRecord(modelName, { modelFileId: context.id, schemaName: context.schemaName }, db);
|
|
3818
3857
|
if (!modelRecord?.id) {
|
|
3819
3858
|
return undefined;
|
|
3820
3859
|
}
|
|
3860
|
+
// Until this model's own row is written, the lookup falls back to the name and can find a
|
|
3861
|
+
// same-named model in another schema. Taking that row would load its properties into this
|
|
3862
|
+
// model; wait for the row with this model's id instead (the caller retries).
|
|
3863
|
+
if (context.id && modelRecord.schemaFileId !== context.id) {
|
|
3864
|
+
return undefined;
|
|
3865
|
+
}
|
|
3821
3866
|
dbId = modelRecord.id;
|
|
3822
3867
|
// Update context with _dbId (unless the model was stopped while the lookup ran)
|
|
3823
3868
|
if (isActorStopped(model._service))
|
|
@@ -4049,4 +4094,4 @@ var errors = /*#__PURE__*/Object.freeze({
|
|
|
4049
4094
|
});
|
|
4050
4095
|
|
|
4051
4096
|
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 };
|
|
4052
|
-
//# sourceMappingURL=errors-
|
|
4097
|
+
//# sourceMappingURL=errors-3tc6XkCB.js.map
|