@seedprotocol/sdk 0.7.0 → 0.7.2-next.593.gd5bd4ea
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-ndE8XTpw.js → BasePathResolver-BdxCSIzn.js} +2 -2
- package/dist/{BasePathResolver-ndE8XTpw.js.map → BasePathResolver-BdxCSIzn.js.map} +1 -1
- package/dist/{ClientManager-DLleL_2e.js → ClientManager-ClCwwhwo.js} +28 -23
- package/dist/ClientManager-ClCwwhwo.js.map +1 -0
- package/dist/{Item-zBFWQDU9.js → Item-B9Y4VuK1.js} +140 -74
- package/dist/Item-B9Y4VuK1.js.map +1 -0
- package/dist/{ModelProperty-lth9L37R.js → ModelProperty-BMePcicQ.js} +64 -36
- package/dist/ModelProperty-BMePcicQ.js.map +1 -0
- package/dist/{Schema-DOhlrQ-N.js → Schema-COsEXXaR.js} +106 -58
- package/dist/Schema-COsEXXaR.js.map +1 -0
- package/dist/{SchemaValidationService-DDKr5piy.js → SchemaValidationService-DabGMzSE.js} +7 -8
- package/dist/{SchemaValidationService-DDKr5piy.js.map → SchemaValidationService-DabGMzSE.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js → backfillMetadataPropertyIds-Ck6fumnm.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js.map → backfillMetadataPropertyIds-Ck6fumnm.js.map} +1 -1
- package/dist/cjs/{ModelProperty-BEsIHAjk.js → ModelProperty-BT6Un_MB.js} +59 -30
- package/dist/cjs/ModelProperty-BT6Un_MB.js.map +1 -0
- package/dist/cjs/{Schema-qEp5mH1N.js → Schema-BXhXdUsA.js} +93 -44
- package/dist/cjs/Schema-BXhXdUsA.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-CWEnZmOH.js → SchemaValidationService-CC18QDfc.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CWEnZmOH.js.map → SchemaValidationService-CC18QDfc.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js → backfillMetadataPropertyIds-DEHC9ejq.js} +3 -3
- package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js.map → backfillMetadataPropertyIds-DEHC9ejq.js.map} +1 -1
- package/dist/cjs/{eas-CLiV2Hmn.js → eas-C3CL0l7l.js} +3 -3
- package/dist/cjs/{eas-CLiV2Hmn.js.map → eas-C3CL0l7l.js.map} +1 -1
- package/dist/cjs/{getItem-DSRtx_68.js → getItem-CrwWYCkj.js} +2 -2
- package/dist/cjs/{getItem-DSRtx_68.js.map → getItem-CrwWYCkj.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-D5-dYtNq.js → getPublishPayload-DRJh7WR0.js} +171 -209
- package/dist/cjs/getPublishPayload-DRJh7WR0.js.map +1 -0
- package/dist/cjs/{getPublishUploads-B5Lq6q-_.js → getPublishUploads-Bh22D3zJ.js} +49 -10
- package/dist/cjs/getPublishUploads-Bh22D3zJ.js.map +1 -0
- package/dist/cjs/{index-B3UDbm1C.js → index-BA1RIYFG.js} +3 -3
- package/dist/cjs/index-BA1RIYFG.js.map +1 -0
- package/dist/cjs/{index-C66AfYDG.js → index-Dls7aMjr.js} +281 -90
- package/dist/cjs/index-Dls7aMjr.js.map +1 -0
- package/dist/cjs/{property-BVJIP7SX.js → property-ZerTWizX.js} +5 -5
- package/dist/cjs/{property-BVJIP7SX.js.map → property-ZerTWizX.js.map} +1 -1
- package/dist/cjs/publishDraftGraph-CPOAcQFf.js +403 -0
- package/dist/cjs/publishDraftGraph-CPOAcQFf.js.map +1 -0
- package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js → resetAmbiguousLegacyItemData-adDl4LcT.js} +2 -2
- package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js.map → resetAmbiguousLegacyItemData-adDl4LcT.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js → resolveModelForSyncedSeed-DoNThPdL.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js.map → resolveModelForSyncedSeed-DoNThPdL.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-Dk96sAG-.js → syncDbWithEas-CYfPkus9.js} +20 -7
- package/dist/cjs/{syncDbWithEas-Dk96sAG-.js.map → syncDbWithEas-CYfPkus9.js.map} +1 -1
- package/dist/{configurePlatform-BMoPG9vY.js → configurePlatform-xU3Hsno3.js} +4 -4
- package/dist/{configurePlatform-BMoPG9vY.js.map → configurePlatform-xU3Hsno3.js.map} +1 -1
- package/dist/{db-BJZN0a0a.js → db-W1g29qsM.js} +31 -27
- package/dist/{db-BJZN0a0a.js.map → db-W1g29qsM.js.map} +1 -1
- package/dist/{eas-B0hsMLqt.js → eas-CSwV6MvB.js} +6 -6
- package/dist/{eas-B0hsMLqt.js.map → eas-CSwV6MvB.js.map} +1 -1
- package/dist/{getItem-DEh4WfHG.js → getItem-BYQeM3DY.js} +5 -6
- package/dist/{getItem-DEh4WfHG.js.map → getItem-BYQeM3DY.js.map} +1 -1
- package/dist/{getPublishPayload-H032DHC7.js → getPublishPayload-D5CQZd-y.js} +167 -206
- package/dist/getPublishPayload-D5CQZd-y.js.map +1 -0
- package/dist/{getPublishUploads-CR66RlGJ.js → getPublishUploads-BGpDsrBp.js} +52 -14
- package/dist/getPublishUploads-BGpDsrBp.js.map +1 -0
- package/dist/{index-6bJuv5Tt.js → index-Bev-hZF-.js} +9 -10
- package/dist/index-Bev-hZF-.js.map +1 -0
- package/dist/{index-B0LgJblD.js → index-CSOQFAOn.js} +2 -2
- package/dist/index-CSOQFAOn.js.map +1 -0
- package/dist/{index-DtfjeuxC.js → index-DRXC5Mra.js} +167 -75
- package/dist/index-DRXC5Mra.js.map +1 -0
- package/dist/{index.browser-CNrqhvEA.js → index.browser-DO20vYuP.js} +9 -9
- package/dist/{index.browser-CNrqhvEA.js.map → index.browser-DO20vYuP.js.map} +1 -1
- package/dist/{index.node-DrHiTuOr.js → index.node-C4iyOhdo.js} +5 -5
- package/dist/{index.node-DrHiTuOr.js.map → index.node-C4iyOhdo.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +258 -183
- package/dist/main.js.map +1 -1
- package/dist/node.js +14 -15
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +3 -3
- package/dist/{property-D2Nnsmm1.js → property-BT1zDSkd.js} +10 -11
- package/dist/property-BT1zDSkd.js.map +1 -0
- package/dist/publishDraftGraph-Bcfrdj7-.js +405 -0
- package/dist/publishDraftGraph-Bcfrdj7-.js.map +1 -0
- package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js → resetAmbiguousLegacyItemData-Ci6PM_vC.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js.map → resetAmbiguousLegacyItemData-Ci6PM_vC.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js → resolveModelForSyncedSeed-CLlumTBq.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js.map → resolveModelForSyncedSeed-CLlumTBq.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +11 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +10 -0
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +15 -2
- 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/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +9 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +7 -0
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +9 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +5 -0
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/publishDraftGraph.d.ts +57 -0
- package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -0
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/entity/evictionEpoch.d.ts +18 -0
- package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
- package/dist/src/helpers/generateId.d.ts +4 -0
- package/dist/src/helpers/generateId.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +28 -6
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/src/types/item.d.ts +7 -8
- package/dist/src/types/item.d.ts.map +1 -1
- package/dist/{syncDbWithEas-LRKr_NZF.js → syncDbWithEas-BQsXjGhe.js} +15 -16
- package/dist/syncDbWithEas-BQsXjGhe.js.map +1 -0
- package/dist/{tabEvents-DYI2GU7i.js → tabEvents-C9qUKx_z.js} +28 -11
- package/dist/tabEvents-C9qUKx_z.js.map +1 -0
- package/dist/{tolerantWebAccess-CzOBz5M6.js → tolerantWebAccess-B-9bwxbw.js} +6 -6
- package/dist/{tolerantWebAccess-CzOBz5M6.js.map → tolerantWebAccess-B-9bwxbw.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-B58ORbY3.js → updateSeedRevokedAt-D6q0h7pj.js} +3 -3
- package/dist/{updateSeedRevokedAt-B58ORbY3.js.map → updateSeedRevokedAt-D6q0h7pj.js.map} +1 -1
- package/package.json +13 -10
- package/dist/ClientManager-DLleL_2e.js.map +0 -1
- package/dist/Item-zBFWQDU9.js.map +0 -1
- package/dist/ModelProperty-lth9L37R.js.map +0 -1
- package/dist/Schema-DOhlrQ-N.js.map +0 -1
- package/dist/cjs/ModelProperty-BEsIHAjk.js.map +0 -1
- package/dist/cjs/Schema-qEp5mH1N.js.map +0 -1
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js +0 -59
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js.map +0 -1
- package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +0 -1
- package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js +0 -147
- package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +0 -1
- package/dist/cjs/index-B3UDbm1C.js.map +0 -1
- package/dist/cjs/index-C66AfYDG.js.map +0 -1
- package/dist/generateId-BopUwD8F.js +0 -9
- package/dist/generateId-BopUwD8F.js.map +0 -1
- package/dist/getLatestVersionRow-Brrl1AnW.js +0 -46
- package/dist/getLatestVersionRow-Brrl1AnW.js.map +0 -1
- package/dist/getPublishPayload-H032DHC7.js.map +0 -1
- package/dist/getPublishUploads-CR66RlGJ.js.map +0 -1
- package/dist/getSegmentedItemProperties-C2EJ2G0N.js +0 -147
- package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +0 -1
- package/dist/index-6bJuv5Tt.js.map +0 -1
- package/dist/index-B0LgJblD.js.map +0 -1
- package/dist/index-DtfjeuxC.js.map +0 -1
- package/dist/property-D2Nnsmm1.js.map +0 -1
- package/dist/src/browser/helpers/index.d.ts +0 -4
- package/dist/src/browser/helpers/index.d.ts.map +0 -1
- package/dist/syncDbWithEas-LRKr_NZF.js.map +0 -1
- package/dist/tabEvents-DYI2GU7i.js.map +0 -1
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
|
|
2
|
-
import {
|
|
2
|
+
import { a as BaseDb, v as versions, m as metadata, r as seeds, s as schemas, j as models, g as modelSchemas, Z as ZERO_BYTES32, I as INTERNAL_PROPERTY_NAMES, B as BaseFileManager, D as ImageSize, p as properties, x as INTERNAL_DATA_TYPES, i as modelUids, C as INTERNAL_STORAGE_MODEL_FILE_IDS, P as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP } from './BasePathResolver-BdxCSIzn.js';
|
|
3
3
|
import { or, isNull, eq, max, count, and, getTableColumns, sql, desc, inArray, isNotNull, gt } from 'drizzle-orm';
|
|
4
4
|
import pluralize from 'pluralize';
|
|
5
|
-
import { n as normalizeDataType, W as getOwnedAddressesFromDb, E as normalizeAddressList, u as normalizeHexAddress, z as getAddressesForItemsFilter, k as isDataType, s as normalizePublisher, M as ModelPropertyDataTypes,
|
|
5
|
+
import { n as normalizeDataType, W as getOwnedAddressesFromDb, E as normalizeAddressList, u as normalizeHexAddress, z as getAddressesForItemsFilter, k as isDataType, s as normalizePublisher, M as ModelPropertyDataTypes, r as resolveItemModelFileId, X as getPropertyIdForSchemaFileId, o as getPropertyIdForModelAndName, l as normalizePropertyRecordSchema, m as eventEmitter } from './db-W1g29qsM.js';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import { BehaviorSubject } from 'rxjs';
|
|
8
8
|
import { startCase, upperFirst, camelCase, orderBy } from 'lodash-es';
|
|
9
9
|
import { toSnakeCase } from 'drizzle-orm/casing';
|
|
10
10
|
import { isValidEasAttestationUid, isPlaceholderUid, BaseQueryClient, BaseEasClient, GET_SCHEMAS, getEasSchemaUidForSchemaDefinition, getSchemaUidForModelFromCache, cachedSchemaLookup, setSchemaUidForModel, getEasSchemaUidForExactDefinition } from '@seedprotocol/eas';
|
|
11
|
-
import { t as toSnakeCase$1,
|
|
11
|
+
import { t as toSnakeCase$1, H as getStorageTransactionIdForSeedUid, I as convertTxIdToImage, h as ensureImageLocal, J as downloadTransactionIdWithDedupe, b as generateId, K as getDataTypeFromString, M as getMimeType, N as notifyFileSaved, g as getCorrectId, a as isStorageSeedRef } from './tabEvents-C9qUKx_z.js';
|
|
12
12
|
import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
|
|
13
|
-
import { generateId } from './generateId-BopUwD8F.js';
|
|
14
13
|
import { modelPropertiesToObject } from './model-DGMe-TTm.js';
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -709,8 +708,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
709
708
|
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
710
709
|
const { ItemProperty } = itemPropertyMod;
|
|
711
710
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
712
|
-
const _mod_0 = await import('./index-
|
|
713
|
-
const _ns_0 = _mod_0.
|
|
711
|
+
const _mod_0 = await import('./index-DRXC5Mra.js');
|
|
712
|
+
const _ns_0 = _mod_0.f;
|
|
714
713
|
const { Model } = _ns_0;
|
|
715
714
|
// Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
|
|
716
715
|
let propertySchemas = {};
|
|
@@ -727,7 +726,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
727
726
|
const schemaNameToTry = schemaName ?? model?.schemaName;
|
|
728
727
|
if (schemaNameToTry) {
|
|
729
728
|
try {
|
|
730
|
-
const _mod_1 = await import('./Schema-
|
|
729
|
+
const _mod_1 = await import('./Schema-COsEXXaR.js');
|
|
731
730
|
const _ns_1 = _mod_1.b;
|
|
732
731
|
const { Schema } = _ns_1;
|
|
733
732
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
@@ -743,7 +742,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
743
742
|
}
|
|
744
743
|
if (Object.keys(propertySchemas).length === 0) {
|
|
745
744
|
try {
|
|
746
|
-
const _mod_2 = await import('./ClientManager-
|
|
745
|
+
const _mod_2 = await import('./ClientManager-ClCwwhwo.js');
|
|
747
746
|
const _ns_2 = _mod_2.G;
|
|
748
747
|
const { loadAllSchemasFromDb } = _ns_2;
|
|
749
748
|
const allSchemas = await loadAllSchemasFromDb();
|
|
@@ -764,10 +763,10 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
764
763
|
}
|
|
765
764
|
if (Object.keys(propertySchemas).length === 0) {
|
|
766
765
|
try {
|
|
767
|
-
const _mod_3 = await import('./ClientManager-
|
|
766
|
+
const _mod_3 = await import('./ClientManager-ClCwwhwo.js');
|
|
768
767
|
const _ns_3 = _mod_3.G;
|
|
769
768
|
const { listCompleteSchemaFiles } = _ns_3;
|
|
770
|
-
const _mod_4 = await import('./BasePathResolver-
|
|
769
|
+
const _mod_4 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
771
770
|
const _ns_4 = _mod_4.O;
|
|
772
771
|
const { BaseFileManager } = _ns_4;
|
|
773
772
|
const schemaFiles = await listCompleteSchemaFiles();
|
|
@@ -788,7 +787,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
788
787
|
}
|
|
789
788
|
}
|
|
790
789
|
if (Object.keys(propertySchemas).length === 0) {
|
|
791
|
-
const schemaMod = await import('./index-
|
|
790
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
792
791
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
793
792
|
const KNOWN_MODEL_FALLBACKS = {
|
|
794
793
|
Post: {
|
|
@@ -805,7 +804,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
805
804
|
}
|
|
806
805
|
}
|
|
807
806
|
// Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
|
|
808
|
-
const { normalizePropertyRecordSchema } = await import('./property-
|
|
807
|
+
const { normalizePropertyRecordSchema } = await import('./property-BT1zDSkd.js');
|
|
809
808
|
propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
|
|
810
809
|
// Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
|
|
811
810
|
// ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
|
|
@@ -838,7 +837,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
838
837
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
839
838
|
let propSchema = propertySchemas[propertyName];
|
|
840
839
|
if (!propSchema && isRefTypeFromMeta) {
|
|
841
|
-
const schemaMod = await import('./index-
|
|
840
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
842
841
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
843
842
|
propSchema = {
|
|
844
843
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -1105,9 +1104,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1105
1104
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
1106
1105
|
return;
|
|
1107
1106
|
}
|
|
1108
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
1107
|
+
const getPublishUploadsMod = await import('./getPublishUploads-BGpDsrBp.js');
|
|
1109
1108
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
1110
|
-
const _mod_5 = await import('./getPublishPayload-
|
|
1109
|
+
const _mod_5 = await import('./getPublishPayload-D5CQZd-y.js');
|
|
1111
1110
|
const _ns_5 = _mod_5.g;
|
|
1112
1111
|
const getPublishPayloadMod = _ns_5;
|
|
1113
1112
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
@@ -1808,7 +1807,7 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
1808
1807
|
conditions.push(eq(seeds.type, toSnakeCase(modelName)));
|
|
1809
1808
|
}
|
|
1810
1809
|
if (!modelFileId && schemaName && modelName) {
|
|
1811
|
-
const _mod_6 = await import('./db-
|
|
1810
|
+
const _mod_6 = await import('./db-W1g29qsM.js');
|
|
1812
1811
|
const _ns_6 = _mod_6.Y;
|
|
1813
1812
|
const { resolveModelRecord } = _ns_6;
|
|
1814
1813
|
modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
|
|
@@ -1874,6 +1873,29 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
1874
1873
|
});
|
|
1875
1874
|
};
|
|
1876
1875
|
|
|
1876
|
+
/**
|
|
1877
|
+
* The seed's head version row: newest by (created_at DESC, local_id DESC), attested or not, skipping
|
|
1878
|
+
* revoked versions. Null when the seed has no version or every version is revoked (a fully
|
|
1879
|
+
* unpublished item). Same choice as `latestVersionLocalId` in the `getVersionData` subquery.
|
|
1880
|
+
*/
|
|
1881
|
+
async function getLatestVersionRow(seedLocalId) {
|
|
1882
|
+
const appDb = BaseDb.getAppDb();
|
|
1883
|
+
if (!appDb || !seedLocalId)
|
|
1884
|
+
return null;
|
|
1885
|
+
const rows = await appDb
|
|
1886
|
+
.select({
|
|
1887
|
+
localId: versions.localId,
|
|
1888
|
+
uid: versions.uid,
|
|
1889
|
+
createdAt: versions.createdAt,
|
|
1890
|
+
attestationCreatedAt: versions.attestationCreatedAt,
|
|
1891
|
+
})
|
|
1892
|
+
.from(versions)
|
|
1893
|
+
.where(and(eq(versions.seedLocalId, seedLocalId), versionNotRevoked()))
|
|
1894
|
+
.orderBy(desc(versions.createdAt), desc(versions.localId))
|
|
1895
|
+
.limit(1);
|
|
1896
|
+
return rows[0] ?? null;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1877
1899
|
const logger$5 = debug('seedSdk:ItemProperty:service:actors:waitForDb');
|
|
1878
1900
|
const waitForDb = fromCallback(({ sendBack }) => {
|
|
1879
1901
|
// Check immediately first
|
|
@@ -2068,7 +2090,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2068
2090
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
2069
2091
|
const _resolveRelatedValue = async () => {
|
|
2070
2092
|
// Use dynamic import to break circular dependency
|
|
2071
|
-
const schemaMod = await import('./index-
|
|
2093
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
2072
2094
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2073
2095
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
2074
2096
|
return;
|
|
@@ -2503,8 +2525,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
|
|
|
2503
2525
|
/* offline / bad tx id */
|
|
2504
2526
|
}
|
|
2505
2527
|
try {
|
|
2506
|
-
const _mod_7 = await import('./tabEvents-
|
|
2507
|
-
const _ns_7 = _mod_7.
|
|
2528
|
+
const _mod_7 = await import('./tabEvents-C9qUKx_z.js');
|
|
2529
|
+
const _ns_7 = _mod_7.O;
|
|
2508
2530
|
const { downloadTransactionIdWithDedupe } = _ns_7;
|
|
2509
2531
|
await downloadTransactionIdWithDedupe(txId);
|
|
2510
2532
|
const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
|
|
@@ -2564,7 +2586,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2564
2586
|
// to use dynamically imported ModelPropertyDataTypes
|
|
2565
2587
|
const _hydrateFromDb = async () => {
|
|
2566
2588
|
// Use dynamic import to break circular dependency
|
|
2567
|
-
const schemaMod = await import('./index-
|
|
2589
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
2568
2590
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2569
2591
|
const appDb = BaseDb.getAppDb();
|
|
2570
2592
|
const whereClauses = [];
|
|
@@ -2843,11 +2865,11 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2843
2865
|
const modelNameForNew = context.modelName;
|
|
2844
2866
|
if (modelNameForNew) {
|
|
2845
2867
|
try {
|
|
2846
|
-
const _mod_8 = await import('./index-
|
|
2847
|
-
const _ns_8 = _mod_8.
|
|
2868
|
+
const _mod_8 = await import('./index-DRXC5Mra.js');
|
|
2869
|
+
const _ns_8 = _mod_8.f;
|
|
2848
2870
|
const { Model } = _ns_8;
|
|
2849
2871
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
2850
|
-
const _mod_9 = await import('./db-
|
|
2872
|
+
const _mod_9 = await import('./db-W1g29qsM.js');
|
|
2851
2873
|
const _ns_9 = _mod_9.Y;
|
|
2852
2874
|
const { resolveItemModelFileId } = _ns_9;
|
|
2853
2875
|
const normalizedModelName = upperFirst(camelCase(modelNameForNew));
|
|
@@ -2901,7 +2923,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2901
2923
|
// It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
|
|
2902
2924
|
const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
|
|
2903
2925
|
// Model names are only unique per schema: pin lookups to the item's own model row.
|
|
2904
|
-
const _mod_10 = await import('./db-
|
|
2926
|
+
const _mod_10 = await import('./db-W1g29qsM.js');
|
|
2905
2927
|
const _ns_10 = _mod_10.Y;
|
|
2906
2928
|
const { resolveItemModelFileId, resolveModelRecord } = _ns_10;
|
|
2907
2929
|
const modelFileId = await resolveItemModelFileId({
|
|
@@ -2947,16 +2969,16 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2947
2969
|
};
|
|
2948
2970
|
// Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
|
|
2949
2971
|
try {
|
|
2950
|
-
const { getPropertySchema } = await import('./property-
|
|
2972
|
+
const { getPropertySchema } = await import('./property-BT1zDSkd.js');
|
|
2951
2973
|
let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName, {
|
|
2952
2974
|
modelFileId: modelRecord?.schemaFileId ?? modelFileId,
|
|
2953
2975
|
});
|
|
2954
2976
|
if (!schemaFromFile?.validation) {
|
|
2955
2977
|
// Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
|
|
2956
|
-
const _mod_11 = await import('./BasePathResolver-
|
|
2978
|
+
const _mod_11 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
2957
2979
|
const _ns_11 = _mod_11.Q;
|
|
2958
2980
|
const { schemas: schemasTable } = _ns_11;
|
|
2959
|
-
const _mod_12 = await import('./BasePathResolver-
|
|
2981
|
+
const _mod_12 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
2960
2982
|
const _ns_12 = _mod_12.R;
|
|
2961
2983
|
const { modelSchemas } = _ns_12;
|
|
2962
2984
|
const modelSchemaRows = await db
|
|
@@ -2997,8 +3019,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2997
3019
|
}
|
|
2998
3020
|
if (!propertyRecordSchema && modelName) {
|
|
2999
3021
|
try {
|
|
3000
|
-
const _mod_13 = await import('./index-
|
|
3001
|
-
const _ns_13 = _mod_13.
|
|
3022
|
+
const _mod_13 = await import('./index-DRXC5Mra.js');
|
|
3023
|
+
const _ns_13 = _mod_13.f;
|
|
3002
3024
|
const { Model } = _ns_13;
|
|
3003
3025
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
3004
3026
|
const normalizedModelName = upperFirst(camelCase(modelName));
|
|
@@ -3374,9 +3396,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
3374
3396
|
}
|
|
3375
3397
|
const _analyzeInput = async () => {
|
|
3376
3398
|
// Use dynamic import to break circular dependency
|
|
3377
|
-
const schemaMod = await import('./index-
|
|
3399
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
3378
3400
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
3379
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
3401
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DabGMzSE.js');
|
|
3380
3402
|
let propertyName = propertyNameRaw;
|
|
3381
3403
|
if (!propertyName) {
|
|
3382
3404
|
throw new Error('propertyName is required');
|
|
@@ -3666,7 +3688,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
3666
3688
|
propertyRecordSchema?.validation &&
|
|
3667
3689
|
metadataValues.propertyValue != null &&
|
|
3668
3690
|
metadataValues.propertyValue !== '') {
|
|
3669
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
3691
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DabGMzSE.js');
|
|
3670
3692
|
const validationService = new SchemaValidationService();
|
|
3671
3693
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
3672
3694
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -4248,7 +4270,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
4248
4270
|
}
|
|
4249
4271
|
const _saveRelation = async () => {
|
|
4250
4272
|
// Use dynamic import to break circular dependency
|
|
4251
|
-
const schemaMod = await import('./index-
|
|
4273
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
4252
4274
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
4253
4275
|
if (!propertyNameRaw) {
|
|
4254
4276
|
throw new Error('propertyName is required');
|
|
@@ -4812,10 +4834,10 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
|
|
|
4812
4834
|
let names = [...getMetadataPropertyNamesForQuery(propertyName)];
|
|
4813
4835
|
if (modelName) {
|
|
4814
4836
|
try {
|
|
4815
|
-
const _mod_14 = await import('./index-
|
|
4816
|
-
const _ns_14 = _mod_14.
|
|
4837
|
+
const _mod_14 = await import('./index-DRXC5Mra.js');
|
|
4838
|
+
const _ns_14 = _mod_14.f;
|
|
4817
4839
|
const { Model } = _ns_14;
|
|
4818
|
-
const _mod_15 = await import('./db-
|
|
4840
|
+
const _mod_15 = await import('./db-W1g29qsM.js');
|
|
4819
4841
|
const _ns_15 = _mod_15.Y;
|
|
4820
4842
|
const { resolveItemModelFileId } = _ns_15;
|
|
4821
4843
|
// Model names are only unique per schema: use the seed's own model when it is recorded.
|
|
@@ -5006,7 +5028,7 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
|
|
|
5006
5028
|
*/
|
|
5007
5029
|
const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
|
|
5008
5030
|
try {
|
|
5009
|
-
const _mod_16 = await import('./ClientManager-
|
|
5031
|
+
const _mod_16 = await import('./ClientManager-ClCwwhwo.js');
|
|
5010
5032
|
const _ns_16 = _mod_16.G;
|
|
5011
5033
|
const { loadAllSchemasFromDb } = _ns_16;
|
|
5012
5034
|
const allSchemas = await loadAllSchemasFromDb();
|
|
@@ -5060,11 +5082,11 @@ hints = {}) => {
|
|
|
5060
5082
|
return undefined;
|
|
5061
5083
|
}
|
|
5062
5084
|
try {
|
|
5063
|
-
const _mod_17 = await import('./index-
|
|
5064
|
-
const _ns_17 = _mod_17.
|
|
5085
|
+
const _mod_17 = await import('./index-DRXC5Mra.js');
|
|
5086
|
+
const _ns_17 = _mod_17.f;
|
|
5065
5087
|
const { Model } = _ns_17;
|
|
5066
5088
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
5067
|
-
const _mod_18 = await import('./db-
|
|
5089
|
+
const _mod_18 = await import('./db-W1g29qsM.js');
|
|
5068
5090
|
const _ns_18 = _mod_18.Y;
|
|
5069
5091
|
const { resolveItemModelFileId } = _ns_18;
|
|
5070
5092
|
const modelFileId = await resolveItemModelFileId(hints);
|
|
@@ -5224,7 +5246,7 @@ class ItemProperty {
|
|
|
5224
5246
|
return;
|
|
5225
5247
|
}
|
|
5226
5248
|
// Use dynamic import to break circular dependency
|
|
5227
|
-
const schemaMod = await import('./index-
|
|
5249
|
+
const schemaMod = await import('./index-Bev-hZF-.js');
|
|
5228
5250
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
5229
5251
|
const { context } = snapshot;
|
|
5230
5252
|
const { propertyRecordSchema } = context;
|
|
@@ -5395,7 +5417,7 @@ class ItemProperty {
|
|
|
5395
5417
|
const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
|
|
5396
5418
|
const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
|
|
5397
5419
|
const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
|
|
5398
|
-
const _mod_19 = await import('./index-
|
|
5420
|
+
const _mod_19 = await import('./index-CSOQFAOn.js');
|
|
5399
5421
|
const _ns_19 = _mod_19.s;
|
|
5400
5422
|
const seedSchemaMod = _ns_19;
|
|
5401
5423
|
const { metadata } = seedSchemaMod;
|
|
@@ -5611,7 +5633,7 @@ class ItemProperty {
|
|
|
5611
5633
|
const ctx = this._service.getSnapshot().context;
|
|
5612
5634
|
let modelFileId;
|
|
5613
5635
|
try {
|
|
5614
|
-
const _mod_20 = await import('./db-
|
|
5636
|
+
const _mod_20 = await import('./db-W1g29qsM.js');
|
|
5615
5637
|
const _ns_20 = _mod_20.Y;
|
|
5616
5638
|
const { resolveItemModelFileId } = _ns_20;
|
|
5617
5639
|
modelFileId = await resolveItemModelFileId({
|
|
@@ -5889,6 +5911,29 @@ class ItemProperty {
|
|
|
5889
5911
|
return result;
|
|
5890
5912
|
return waitForEntityIdle(result, { timeout: readyTimeout }).then(() => result);
|
|
5891
5913
|
}
|
|
5914
|
+
/**
|
|
5915
|
+
* The cached ItemProperty when it can be read right now (idle, not saving), the state
|
|
5916
|
+
* `ItemProperty.find()` waits for. Otherwise undefined. Unlike `find`, it takes no cache hold, so
|
|
5917
|
+
* React hooks can call it during render.
|
|
5918
|
+
*/
|
|
5919
|
+
static peekReady({ propertyName, seedLocalId, seedUid, }) {
|
|
5920
|
+
if (!propertyName)
|
|
5921
|
+
return undefined;
|
|
5922
|
+
// Same key order as find(), then the other id: instances are cached under both when both are known.
|
|
5923
|
+
const keys = [seedUid, seedLocalId]
|
|
5924
|
+
.filter((id) => typeof id === 'string' && id.length > 0)
|
|
5925
|
+
.map((id) => this.cacheKey(id, propertyName));
|
|
5926
|
+
for (const key of keys) {
|
|
5927
|
+
const instance = this.instanceCache.get(key)?.instance;
|
|
5928
|
+
if (!instance)
|
|
5929
|
+
continue;
|
|
5930
|
+
const snap = instance.getService().getSnapshot();
|
|
5931
|
+
if (snap.status !== 'active' || snap.value !== 'idle' || snap.context?.isSaving)
|
|
5932
|
+
return undefined;
|
|
5933
|
+
return instance;
|
|
5934
|
+
}
|
|
5935
|
+
return undefined;
|
|
5936
|
+
}
|
|
5892
5937
|
static async find({ propertyName, seedLocalId, seedUid, modelName: modelNameOption, waitForReady = true, readyTimeout = 5000, }) {
|
|
5893
5938
|
if ((!seedLocalId && !seedUid) || !propertyName) {
|
|
5894
5939
|
return undefined;
|
|
@@ -5951,7 +5996,7 @@ class ItemProperty {
|
|
|
5951
5996
|
const propertiesData = await getItemProperties({ seedLocalId, seedUid });
|
|
5952
5997
|
const instances = [];
|
|
5953
5998
|
const seenNormalized = new Set();
|
|
5954
|
-
const _mod_21 = await import('./db-
|
|
5999
|
+
const _mod_21 = await import('./db-W1g29qsM.js');
|
|
5955
6000
|
const _ns_21 = _mod_21.Y;
|
|
5956
6001
|
const { resolveItemModelFileId } = _ns_21;
|
|
5957
6002
|
const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
|
|
@@ -5969,8 +6014,8 @@ class ItemProperty {
|
|
|
5969
6014
|
}
|
|
5970
6015
|
else if (baseName) {
|
|
5971
6016
|
try {
|
|
5972
|
-
const _mod_22 = await import('./index-
|
|
5973
|
-
const _ns_22 = _mod_22.
|
|
6017
|
+
const _mod_22 = await import('./index-DRXC5Mra.js');
|
|
6018
|
+
const _ns_22 = _mod_22.f;
|
|
5974
6019
|
const { Model } = _ns_22;
|
|
5975
6020
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
5976
6021
|
const model = await Model.resolveAsync(modelName, { modelFileId });
|
|
@@ -5986,8 +6031,8 @@ class ItemProperty {
|
|
|
5986
6031
|
}
|
|
5987
6032
|
if (modelName && propertyName) {
|
|
5988
6033
|
try {
|
|
5989
|
-
const _mod_23 = await import('./index-
|
|
5990
|
-
const _ns_23 = _mod_23.
|
|
6034
|
+
const _mod_23 = await import('./index-DRXC5Mra.js');
|
|
6035
|
+
const _ns_23 = _mod_23.f;
|
|
5991
6036
|
const { Model } = _ns_23;
|
|
5992
6037
|
const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
|
|
5993
6038
|
const model = await Model.resolveAsync(modelName, { modelFileId });
|
|
@@ -6308,7 +6353,7 @@ class ItemProperty {
|
|
|
6308
6353
|
if (!propertyName || (!seedLocalId && !seedUid))
|
|
6309
6354
|
return;
|
|
6310
6355
|
if (db) {
|
|
6311
|
-
const _mod_24 = await import('./index-
|
|
6356
|
+
const _mod_24 = await import('./index-CSOQFAOn.js');
|
|
6312
6357
|
const _ns_24 = _mod_24.s;
|
|
6313
6358
|
const seedSchemaMod = _ns_24;
|
|
6314
6359
|
const { metadata } = seedSchemaMod;
|
|
@@ -6354,8 +6399,8 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
6354
6399
|
}
|
|
6355
6400
|
const seedType = toSnakeCase(modelName);
|
|
6356
6401
|
// Dynamic import to break circular dependency
|
|
6357
|
-
const _mod_25 = await import('./index-
|
|
6358
|
-
const _ns_25 = _mod_25.
|
|
6402
|
+
const _mod_25 = await import('./index-DRXC5Mra.js');
|
|
6403
|
+
const _ns_25 = _mod_25.f;
|
|
6359
6404
|
const modelMod = _ns_25;
|
|
6360
6405
|
const { Model } = modelMod;
|
|
6361
6406
|
const model = await Model.resolveAsync(modelName, { modelFileId });
|
|
@@ -6512,8 +6557,8 @@ const getModel = () => {
|
|
|
6512
6557
|
// the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
|
|
6513
6558
|
if (!modelImportPromise) {
|
|
6514
6559
|
modelImportPromise = (async () => {
|
|
6515
|
-
const _mod_26 = await import('./index-
|
|
6516
|
-
const _ns_26 = _mod_26.
|
|
6560
|
+
const _mod_26 = await import('./index-DRXC5Mra.js');
|
|
6561
|
+
const _ns_26 = _mod_26.f;
|
|
6517
6562
|
const mod = _ns_26;
|
|
6518
6563
|
ModelClass = mod.Model;
|
|
6519
6564
|
return mod;
|
|
@@ -6616,7 +6661,6 @@ class Item {
|
|
|
6616
6661
|
const revokedAt = Math.floor(Date.now() / 1000);
|
|
6617
6662
|
// The executor stamps the revoked version rows; the latest version is now the newest one left
|
|
6618
6663
|
// (a local draft) or none, never a revoked one.
|
|
6619
|
-
const { getLatestVersionRow } = await import('./getLatestVersionRow-Brrl1AnW.js');
|
|
6620
6664
|
const head = await getLatestVersionRow(this.seedLocalId);
|
|
6621
6665
|
this._service.send({
|
|
6622
6666
|
type: 'updateContext',
|
|
@@ -6662,12 +6706,12 @@ class Item {
|
|
|
6662
6706
|
};
|
|
6663
6707
|
this.getPublishUploads = async (options) => {
|
|
6664
6708
|
// Use dynamic import to break circular dependency
|
|
6665
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
6709
|
+
const getPublishUploadsMod = await import('./getPublishUploads-BGpDsrBp.js');
|
|
6666
6710
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
6667
6711
|
return await getPublishUploads(this, [], undefined, options);
|
|
6668
6712
|
};
|
|
6669
6713
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
6670
|
-
const _mod_27 = await import('./getPublishPayload-
|
|
6714
|
+
const _mod_27 = await import('./getPublishPayload-D5CQZd-y.js');
|
|
6671
6715
|
const _ns_27 = _mod_27.g;
|
|
6672
6716
|
const getPublishPayloadMod = _ns_27;
|
|
6673
6717
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
@@ -6686,7 +6730,6 @@ class Item {
|
|
|
6686
6730
|
});
|
|
6687
6731
|
// Publish has recorded the version it attested (updateVersionUid): reflect it here too, as
|
|
6688
6732
|
// the versions liveQuery does in the browser. After a republish this is the new version.
|
|
6689
|
-
const { getLatestVersionRow } = await import('./getLatestVersionRow-Brrl1AnW.js');
|
|
6690
6733
|
const head = await getLatestVersionRow(seedLocalId);
|
|
6691
6734
|
if (head?.localId) {
|
|
6692
6735
|
this._service.send({
|
|
@@ -6942,6 +6985,38 @@ class Item {
|
|
|
6942
6985
|
}
|
|
6943
6986
|
}
|
|
6944
6987
|
}
|
|
6988
|
+
/**
|
|
6989
|
+
* Idle, and not the shell the item machine can be in when it reaches `idle` before
|
|
6990
|
+
* `propertyInstances` is merged (an item with a version but no property instances yet).
|
|
6991
|
+
*/
|
|
6992
|
+
static isItemSnapshotReadyForRead(snap) {
|
|
6993
|
+
if (!snap || !('value' in snap) || snap.value !== 'idle') {
|
|
6994
|
+
return false;
|
|
6995
|
+
}
|
|
6996
|
+
const ctx = snap.context || {};
|
|
6997
|
+
const versionsCount = ctx.versionsCount ?? 0;
|
|
6998
|
+
const hasHeadVersion = !!ctx.latestVersionLocalId;
|
|
6999
|
+
if (versionsCount === 0 && !hasHeadVersion) {
|
|
7000
|
+
return true;
|
|
7001
|
+
}
|
|
7002
|
+
return (ctx.propertyInstances?.size ?? 0) > 0;
|
|
7003
|
+
}
|
|
7004
|
+
/**
|
|
7005
|
+
* The cached Item for a seedLocalId or seedUid when it can be read right now: idle and hydrated,
|
|
7006
|
+
* so at least what `Item.find()` would wait for. Otherwise undefined. Unlike `getById`, it takes
|
|
7007
|
+
* no cache hold, so React hooks can call it during render.
|
|
7008
|
+
*/
|
|
7009
|
+
static peekReady(id) {
|
|
7010
|
+
if (!id)
|
|
7011
|
+
return undefined;
|
|
7012
|
+
const instance = this.findItemInstanceCacheEntryById(id)?.instance;
|
|
7013
|
+
if (!instance)
|
|
7014
|
+
return undefined;
|
|
7015
|
+
const snap = instance.getService().getSnapshot();
|
|
7016
|
+
if (snap.status !== 'active')
|
|
7017
|
+
return undefined;
|
|
7018
|
+
return this.isItemSnapshotReadyForRead(snap) ? instance : undefined;
|
|
7019
|
+
}
|
|
6945
7020
|
/**
|
|
6946
7021
|
* Item machine can reach `idle` before `propertyInstances` is merged (race) or while
|
|
6947
7022
|
* child ItemProperty actors are still hydrating. useItems / Item.all must not return that shell.
|
|
@@ -6954,16 +7029,7 @@ class Item {
|
|
|
6954
7029
|
if ('value' in snap && snap.value === 'error') {
|
|
6955
7030
|
throw new Error('Entity failed to load');
|
|
6956
7031
|
}
|
|
6957
|
-
|
|
6958
|
-
return false;
|
|
6959
|
-
}
|
|
6960
|
-
const ctx = snap.context || {};
|
|
6961
|
-
const versionsCount = ctx.versionsCount ?? 0;
|
|
6962
|
-
const hasHeadVersion = !!ctx.latestVersionLocalId;
|
|
6963
|
-
if (versionsCount === 0 && !hasHeadVersion) {
|
|
6964
|
-
return true;
|
|
6965
|
-
}
|
|
6966
|
-
return (ctx.propertyInstances?.size ?? 0) > 0;
|
|
7032
|
+
return Item.isItemSnapshotReadyForRead(snap);
|
|
6967
7033
|
}, { timeout: readyTimeout });
|
|
6968
7034
|
}
|
|
6969
7035
|
catch (e) {
|
|
@@ -7180,7 +7246,7 @@ class Item {
|
|
|
7180
7246
|
const db = BaseDb.getAppDb();
|
|
7181
7247
|
if (db && props.modelName) {
|
|
7182
7248
|
// Model names are only unique per schema: resolve the exact models row from the most specific scope.
|
|
7183
|
-
const _mod_28 = await import('./db-
|
|
7249
|
+
const _mod_28 = await import('./db-W1g29qsM.js');
|
|
7184
7250
|
const _ns_28 = _mod_28.Y;
|
|
7185
7251
|
const { resolveModelRecord } = _ns_28;
|
|
7186
7252
|
const modelRecord = await resolveModelRecord(props.modelName, {
|
|
@@ -7194,10 +7260,10 @@ class Item {
|
|
|
7194
7260
|
// Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
|
|
7195
7261
|
// so a same-named model cached from another schema can't supply the property set.
|
|
7196
7262
|
if (modelRecord && !props.schemaName) {
|
|
7197
|
-
const _mod_29 = await import('./BasePathResolver-
|
|
7263
|
+
const _mod_29 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
7198
7264
|
const _ns_29 = _mod_29.R;
|
|
7199
7265
|
const { modelSchemas } = _ns_29;
|
|
7200
|
-
const _mod_30 = await import('./BasePathResolver-
|
|
7266
|
+
const _mod_30 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
7201
7267
|
const _ns_30 = _mod_30.Q;
|
|
7202
7268
|
const { schemas: schemasTable } = _ns_30;
|
|
7203
7269
|
const schemaRows = await db
|
|
@@ -7543,7 +7609,7 @@ class Item {
|
|
|
7543
7609
|
if (!appDb || Item.instanceCache.size === 0) {
|
|
7544
7610
|
return;
|
|
7545
7611
|
}
|
|
7546
|
-
const _mod_31 = await import('./index-
|
|
7612
|
+
const _mod_31 = await import('./index-CSOQFAOn.js');
|
|
7547
7613
|
const _ns_31 = _mod_31.s;
|
|
7548
7614
|
const { metadata } = _ns_31;
|
|
7549
7615
|
const { eq, and } = await import('drizzle-orm');
|
|
@@ -8002,7 +8068,7 @@ class Item {
|
|
|
8002
8068
|
itemActor.send(event);
|
|
8003
8069
|
};
|
|
8004
8070
|
try {
|
|
8005
|
-
const _mod_32 = await import('./index-
|
|
8071
|
+
const _mod_32 = await import('./index-CSOQFAOn.js');
|
|
8006
8072
|
const _ns_32 = _mod_32.s;
|
|
8007
8073
|
const seedSchemaMod = _ns_32;
|
|
8008
8074
|
const { seeds, versions, metadata } = seedSchemaMod;
|
|
@@ -8355,5 +8421,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
|
|
|
8355
8421
|
Item: Item
|
|
8356
8422
|
});
|
|
8357
8423
|
|
|
8358
|
-
export {
|
|
8359
|
-
//# sourceMappingURL=Item-
|
|
8424
|
+
export { getRevokeExecutor as A, getUploadExecutor as B, ClientManagerState as C, getVersionData$1 as D, isItemOwned as E, isLocalUnsealedDraft as F, isSeedRowOwned as G, ownedPublisherSql as H, Item as I, pickLatestMetadataRowPerProperty as J, propertyMachine as K, publisherInAddressListSql as L, METADATA_LATEST_FIRST_ORDER_SQL as M, publisherIsInOwnedSet as N, setAdditionalSyncAddresses as O, setGetPublisherForNewSeeds as P, setRevokeExecutor as Q, setUploadExecutor as R, getInvariantSafePropertyDescriptor as S, clearDestroySubscriptions as T, unloadEntity as U, ClientManagerEvents as V, resolvePublisherFromSeedRow as W, getPropertyData$1 as X, Item$1 as Y, getEasSchemaUidForModel as a, getLatestPublishedVersionRow as b, chunkValues as c, rowsPerInsert as d, getGetAdditionalSyncAddresses as e, ItemProperty as f, getItemData as g, ItemPropertySaveValidationError as h, isVersionRevoked as i, waitForEntityIdle as j, createReactiveProxy as k, listRelationEasPropertyName as l, findEntity as m, forceRemoveFromCaches as n, runDestroyLifecycle as o, parseListPropertyValueFromStorage as p, compareMetadataRowsLatestFirst as q, resolveStorageNameToSchemaName as r, selectInBatches as s, isPublishedMetadataRow as t, MachineIds as u, createNewItem as v, writeInBatches as w, getEasSchemaForItemProperty as x, getGetPublisherForNewSeeds as y, getMetadataLatest as z };
|
|
8425
|
+
//# sourceMappingURL=Item-B9Y4VuK1.js.map
|