@seedprotocol/sdk 0.6.0 → 0.6.2
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-DWY_hb8w.js → BasePathResolver-0IHnXxtL.js} +5 -1
- package/dist/BasePathResolver-0IHnXxtL.js.map +1 -0
- package/dist/{ModelProperty-DGJf78CS.js → ModelProperty-DMjKVphl.js} +39 -29
- package/dist/ModelProperty-DMjKVphl.js.map +1 -0
- package/dist/{Schema-Drmce3q-.js → Schema-cK2z7wet.js} +42 -38
- package/dist/{Schema-Drmce3q-.js.map → Schema-cK2z7wet.js.map} +1 -1
- package/dist/{SchemaValidationService-a_sfnpDV.js → SchemaValidationService-B3pQ_q-9.js} +5 -5
- package/dist/{SchemaValidationService-a_sfnpDV.js.map → SchemaValidationService-B3pQ_q-9.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-CZcOi-cK.js → backfillMetadataPropertyIds-C-YLFeI2.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-CZcOi-cK.js.map → backfillMetadataPropertyIds-C-YLFeI2.js.map} +1 -1
- package/dist/cjs/{ModelProperty-BA26rMV8.js → ModelProperty-CCwtTuvi.js} +17 -17
- package/dist/cjs/{ModelProperty-BA26rMV8.js.map → ModelProperty-CCwtTuvi.js.map} +1 -1
- package/dist/cjs/{Schema-Hgwq3L34.js → Schema-DU28JWKv.js} +20 -20
- package/dist/cjs/{Schema-Hgwq3L34.js.map → Schema-DU28JWKv.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-DVmOGZao.js → SchemaValidationService-BOYI1syg.js} +2 -2
- package/dist/cjs/{SchemaValidationService-DVmOGZao.js.map → SchemaValidationService-BOYI1syg.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-BWJI4eCj.js → backfillMetadataPropertyIds-CrvyL7Xq.js} +2 -2
- package/dist/cjs/{backfillMetadataPropertyIds-BWJI4eCj.js.map → backfillMetadataPropertyIds-CrvyL7Xq.js.map} +1 -1
- package/dist/cjs/{eas-BJ8FtbU9.js → eas-D-Casv2P.js} +3 -3
- package/dist/cjs/{eas-BJ8FtbU9.js.map → eas-D-Casv2P.js.map} +1 -1
- package/dist/cjs/{getItem-DdBKeEEU.js → getItem-BPAs0Jxp.js} +2 -2
- package/dist/cjs/{getItem-DdBKeEEU.js.map → getItem-BPAs0Jxp.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DSBLjMKl.js → getPublishPayload-BeoNRCLY.js} +13 -11
- package/dist/cjs/getPublishPayload-BeoNRCLY.js.map +1 -0
- package/dist/cjs/{getPublishUploads-DMKnK2_R.js → getPublishUploads-C75vy7nb.js} +4 -4
- package/dist/cjs/{getPublishUploads-DMKnK2_R.js.map → getPublishUploads-C75vy7nb.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-D0ZzTmvi.js → getSegmentedItemProperties-CDmkM9Yc.js} +3 -3
- package/dist/cjs/{getSegmentedItemProperties-D0ZzTmvi.js.map → getSegmentedItemProperties-CDmkM9Yc.js.map} +1 -1
- package/dist/cjs/{index-BD1b6zAi.js → index-BbfxH7OY.js} +321 -189
- package/dist/cjs/index-BbfxH7OY.js.map +1 -0
- package/dist/cjs/{index-DQggpLqI.js → index-CA6kGjZH.js} +3 -3
- package/dist/cjs/index-CA6kGjZH.js.map +1 -0
- package/dist/cjs/{property-D4IB0zBz.js → property-aeBSv5CF.js} +4 -4
- package/dist/cjs/{property-D4IB0zBz.js.map → property-aeBSv5CF.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-BYvFJc7N.js → syncDbWithEas-ChvunkwQ.js} +17 -10
- package/dist/cjs/syncDbWithEas-ChvunkwQ.js.map +1 -0
- package/dist/{configurePlatform-CXQCT7N8.js → configurePlatform-Df4BlXwQ.js} +3 -3
- package/dist/{configurePlatform-CXQCT7N8.js.map → configurePlatform-Df4BlXwQ.js.map} +1 -1
- package/dist/{constants-B7aNfB_1.js → constants-CROrIRd-.js} +2 -2
- package/dist/{constants-B7aNfB_1.js.map → constants-CROrIRd-.js.map} +1 -1
- package/dist/{db-Bad8QKfZ.js → db-BwVuO1tO.js} +121 -56
- package/dist/db-BwVuO1tO.js.map +1 -0
- package/dist/{eas-BB9hVW68.js → eas-C0H0EbDo.js} +5 -5
- package/dist/{eas-BB9hVW68.js.map → eas-C0H0EbDo.js.map} +1 -1
- package/dist/{getItem-Cina46nb.js → getItem-Cxa-rKqh.js} +5 -5
- package/dist/{getItem-Cina46nb.js.map → getItem-Cxa-rKqh.js.map} +1 -1
- package/dist/{getPublishPayload-BEO52UOv.js → getPublishPayload-DmOu0I29.js} +18 -16
- package/dist/getPublishPayload-DmOu0I29.js.map +1 -0
- package/dist/{getPublishUploads-CJjfqJi9.js → getPublishUploads-gWv4tDyT.js} +7 -7
- package/dist/{getPublishUploads-CJjfqJi9.js.map → getPublishUploads-gWv4tDyT.js.map} +1 -1
- package/dist/{getSegmentedItemProperties-CbzFDgFr.js → getSegmentedItemProperties-BfIBZbR7.js} +5 -5
- package/dist/{getSegmentedItemProperties-CbzFDgFr.js.map → getSegmentedItemProperties-BfIBZbR7.js.map} +1 -1
- package/dist/{index-B4In0GEO.js → index-C1pktvdj.js} +293 -214
- package/dist/index-C1pktvdj.js.map +1 -0
- package/dist/{index-DNOCl06b.js → index-DAwvrNga.js} +7 -7
- package/dist/index-DAwvrNga.js.map +1 -0
- package/dist/{index-DrEkRiuK.js → index-xNWgPtlN.js} +2 -2
- package/dist/index-xNWgPtlN.js.map +1 -0
- package/dist/{index.node-CnP9s4cV.js → index.node-DqC_o5EN.js} +13 -4
- package/dist/index.node-DqC_o5EN.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +315 -31
- package/dist/main.js.map +1 -1
- package/dist/node.js +10 -10
- package/dist/platform.browser.js +14 -4
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +3 -3
- package/dist/{property-DIN1zQ_c.js → property-eMrSbAWU.js} +8 -8
- package/dist/{property-DIN1zQ_c.js.map → property-eMrSbAWU.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +1 -0
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +12 -0
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/db/read/getItems.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts +24 -0
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -0
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +4 -2
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts +11 -0
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -0
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/createSeed.d.ts.map +1 -1
- package/dist/src/db/write/createSeeds.d.ts.map +1 -1
- package/dist/src/db/write/createVersion.d.ts.map +1 -1
- package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
- package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -0
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +2 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/addresses.d.ts +14 -0
- package/dist/src/helpers/addresses.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +2 -2
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/ownership.d.ts +36 -8
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/publishConfig.d.ts +4 -3
- package/dist/src/helpers/publishConfig.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/helpers/FileManager.d.ts +1 -0
- package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +6 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-ceVUuWSZ.js → syncDbWithEas-c9Xe17zq.js} +24 -17
- package/dist/syncDbWithEas-c9Xe17zq.js.map +1 -0
- package/dist/{updateSeedRevokedAt-CtRjZiyh.js → updateSeedRevokedAt-F0ZDvwOO.js} +2 -2
- package/dist/{updateSeedRevokedAt-CtRjZiyh.js.map → updateSeedRevokedAt-F0ZDvwOO.js.map} +1 -1
- package/package.json +5 -5
- package/dist/BasePathResolver-DWY_hb8w.js.map +0 -1
- package/dist/ModelProperty-DGJf78CS.js.map +0 -1
- package/dist/cjs/getPublishPayload-DSBLjMKl.js.map +0 -1
- package/dist/cjs/index-BD1b6zAi.js.map +0 -1
- package/dist/cjs/index-DQggpLqI.js.map +0 -1
- package/dist/cjs/syncDbWithEas-BYvFJc7N.js.map +0 -1
- package/dist/db-Bad8QKfZ.js.map +0 -1
- package/dist/getPublishPayload-BEO52UOv.js.map +0 -1
- package/dist/index-B4In0GEO.js.map +0 -1
- package/dist/index-DNOCl06b.js.map +0 -1
- package/dist/index-DrEkRiuK.js.map +0 -1
- package/dist/index.node-CnP9s4cV.js.map +0 -1
- package/dist/syncDbWithEas-ceVUuWSZ.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { waitFor, fromCallback, fromPromise, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
|
|
2
|
-
import { a as BaseDb, m as models$1, p as properties, r as seeds, j as modelUids, v as versions, b as metadata$1, s as schemas, i as modelSchemas, B as BaseFileManager, c as appState, f as easSyncProcesses, t as BasePathResolver, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses } from './BasePathResolver-
|
|
2
|
+
import { a as BaseDb, m as models$1, p as properties, r as seeds, j as modelUids, v as versions, b as metadata$1, s as schemas, i as modelSchemas, B as BaseFileManager, c as appState, f as easSyncProcesses, t as BasePathResolver, h as htmlEmbeddedImageCoPublish, d as arweaveL1FinalizeJobs, q as publishProcesses } from './BasePathResolver-0IHnXxtL.js';
|
|
3
3
|
import { eq, and, isNotNull, not, or, max, count, getTableColumns, sql, isNull, desc, inArray, gt } from 'drizzle-orm';
|
|
4
|
-
import { n as normalizeDataType, t as toSnakeCase, o as MachineIds, v as getStorageTransactionIdForSeedUid, w as convertTxIdToImage, M as ModelPropertyDataTypes, x as getDataTypeFromString, y as getMimeType, l as getCorrectId, z as ClientManagerEvents, C as ClientManagerState, d as TProperty } from './constants-
|
|
4
|
+
import { n as normalizeDataType, t as toSnakeCase, o as MachineIds, v as getStorageTransactionIdForSeedUid, w as convertTxIdToImage, M as ModelPropertyDataTypes, x as getDataTypeFromString, y as getMimeType, l as getCorrectId, z as ClientManagerEvents, C as ClientManagerState, d as TProperty } from './constants-CROrIRd-.js';
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
import { customAlphabet } from 'nanoid';
|
|
7
7
|
import { alphanumeric } from 'nanoid-dictionary';
|
|
8
|
-
import { writeModelToDb, writePropertyToDb, addSchemaToDb, getAddressesForItemsFilter, getAllAddressesFromDb, escapeSqliteString, getPropertyIdForModelAndName,
|
|
8
|
+
import { w as writeModelToDb, m as writePropertyToDb, k as addSchemaToDb, n as normalizePublisher, o as getOwnedAddressesFromDb, j as normalizeAddressList, b as normalizeHexAddress, h as getAddressesForItemsFilter, a as getAllAddressesFromDb, e as escapeSqliteString, g as getPropertyIdForModelAndName, i as normalizeAddressConfig, l as loadModelsFromDbForSchema, p as getWatchedAddressesFromDb, r as renameModelInDb } from './db-BwVuO1tO.js';
|
|
9
9
|
import pluralize from 'pluralize';
|
|
10
|
-
import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition, GET_FILES_METADATA, GET_SCHEMA_BY_NAME } from '@seedprotocol/eas';
|
|
10
|
+
import { BaseQueryClient, BaseEasClient, GET_SCHEMAS, getSchemaUidForModelFromCache, setSchemaUidForModel, GET_PROPERTIES, pickLatestPropertyAttestationsByRefAndSchema, isValidEasAttestationUid, isPlaceholderUid, getEasSchemaUidForSchemaDefinition, GET_FILES_METADATA, GET_SCHEMA_BY_NAME } from '@seedprotocol/eas';
|
|
11
11
|
import { ZERO_BYTES32, INTERNAL_PROPERTY_NAMES, INTERNAL_DATA_TYPES, ImageSize, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, isInternalSchema, INTERNAL_SCHEMA_IDS, SEED_PROTOCOL_SCHEMA_NAME, CLIENT_NOT_INITIALIZED } from './constants-DMHTYMgJ.js';
|
|
12
12
|
import { BehaviorSubject } from 'rxjs';
|
|
13
13
|
import { startCase, throttle, upperFirst, camelCase, orderBy } from 'lodash-es';
|
|
@@ -283,7 +283,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
try {
|
|
286
|
-
const mod = await import('./ModelProperty-
|
|
286
|
+
const mod = await import('./ModelProperty-DMjKVphl.js');
|
|
287
287
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
288
288
|
if (!ModelProperty) {
|
|
289
289
|
logger$s('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -467,7 +467,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
467
467
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
468
468
|
// This handles the case where model exists in schema file but not yet in database
|
|
469
469
|
try {
|
|
470
|
-
const _mod_0 = await import('./Schema-
|
|
470
|
+
const _mod_0 = await import('./Schema-cK2z7wet.js');
|
|
471
471
|
const _ns_0 = _mod_0.b;
|
|
472
472
|
const schemaMod = _ns_0;
|
|
473
473
|
const { Schema } = schemaMod;
|
|
@@ -617,11 +617,11 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
617
617
|
}
|
|
618
618
|
// Also check database for models (in case they're persisted but not in Schema context)
|
|
619
619
|
if (db) {
|
|
620
|
-
const _mod_1 = await import('./BasePathResolver-
|
|
620
|
+
const _mod_1 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
621
621
|
const _ns_1 = _mod_1.x;
|
|
622
622
|
const modelSchemaSchemaMod = _ns_1;
|
|
623
623
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
624
|
-
const _mod_2 = await import('./BasePathResolver-
|
|
624
|
+
const _mod_2 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
625
625
|
const _ns_2 = _mod_2.S;
|
|
626
626
|
const schemaSchemaMod = _ns_2;
|
|
627
627
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -717,7 +717,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
717
717
|
}
|
|
718
718
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
719
719
|
try {
|
|
720
|
-
const _mod_3 = await import('./Schema-
|
|
720
|
+
const _mod_3 = await import('./Schema-cK2z7wet.js');
|
|
721
721
|
const _ns_3 = _mod_3.b;
|
|
722
722
|
const schemaMod = _ns_3;
|
|
723
723
|
const { Schema } = schemaMod;
|
|
@@ -763,10 +763,10 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
763
763
|
const _validateModel = async () => {
|
|
764
764
|
try {
|
|
765
765
|
// Use dynamic imports to break circular dependencies
|
|
766
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
766
|
+
const validationServiceMod = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
767
767
|
const { SchemaValidationService } = validationServiceMod;
|
|
768
768
|
const validationService = new SchemaValidationService();
|
|
769
|
-
const _mod_4 = await import('./Schema-
|
|
769
|
+
const _mod_4 = await import('./Schema-cK2z7wet.js');
|
|
770
770
|
const _ns_4 = _mod_4.b;
|
|
771
771
|
const schemaMod = _ns_4;
|
|
772
772
|
const { Schema } = schemaMod;
|
|
@@ -878,7 +878,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
|
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
880
|
logger$q(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
881
|
-
const mod = await import('./ModelProperty-
|
|
881
|
+
const mod = await import('./ModelProperty-DMjKVphl.js');
|
|
882
882
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
883
883
|
if (!ModelProperty) {
|
|
884
884
|
logger$q('ModelProperty not available from dynamic import');
|
|
@@ -981,7 +981,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
981
981
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
982
982
|
logger$p(structureMsg);
|
|
983
983
|
// Use existing Model validation
|
|
984
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
984
|
+
const validationServiceMod = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
985
985
|
const { SchemaValidationService } = validationServiceMod;
|
|
986
986
|
const validationService = new SchemaValidationService();
|
|
987
987
|
// Validate model structure
|
|
@@ -999,7 +999,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
999
999
|
if (entityInput.entityData.schemaName) {
|
|
1000
1000
|
try {
|
|
1001
1001
|
logger$p(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
|
|
1002
|
-
const _mod_5 = await import('./Schema-
|
|
1002
|
+
const _mod_5 = await import('./Schema-cK2z7wet.js');
|
|
1003
1003
|
const _ns_5 = _mod_5.b;
|
|
1004
1004
|
const schemaMod = _ns_5;
|
|
1005
1005
|
const { Schema } = schemaMod;
|
|
@@ -1037,7 +1037,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
else if (entityInput.entityType === 'modelProperty') {
|
|
1039
1039
|
// Use existing ModelProperty validation
|
|
1040
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
1040
|
+
const validationServiceMod = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
1041
1041
|
const { SchemaValidationService } = validationServiceMod;
|
|
1042
1042
|
const validationService = new SchemaValidationService();
|
|
1043
1043
|
// Validate property structure
|
|
@@ -1052,7 +1052,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1052
1052
|
// If schema name and model name provided, validate against schema
|
|
1053
1053
|
if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
|
|
1054
1054
|
try {
|
|
1055
|
-
const _mod_6 = await import('./Schema-
|
|
1055
|
+
const _mod_6 = await import('./Schema-cK2z7wet.js');
|
|
1056
1056
|
const _ns_6 = _mod_6.b;
|
|
1057
1057
|
const schemaMod = _ns_6;
|
|
1058
1058
|
const { Schema } = schemaMod;
|
|
@@ -1083,7 +1083,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
else if (entityInput.entityType === 'schema') {
|
|
1085
1085
|
// Schema validation - use existing validation
|
|
1086
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
1086
|
+
const validationServiceMod = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
1087
1087
|
const { SchemaValidationService } = validationServiceMod;
|
|
1088
1088
|
const validationService = new SchemaValidationService();
|
|
1089
1089
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -1156,7 +1156,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
|
|
|
1156
1156
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
1157
1157
|
let dataToWrite = input.entityData;
|
|
1158
1158
|
try {
|
|
1159
|
-
const mod = await import('./ModelProperty-
|
|
1159
|
+
const mod = await import('./ModelProperty-DMjKVphl.js');
|
|
1160
1160
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
1161
1161
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
1162
1162
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -1536,7 +1536,7 @@ const modelMachine = setup({
|
|
|
1536
1536
|
// Create ModelProperty instances for any new property IDs
|
|
1537
1537
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
1538
1538
|
// Import and create instances asynchronously (fire-and-forget)
|
|
1539
|
-
import('./ModelProperty-
|
|
1539
|
+
import('./ModelProperty-DMjKVphl.js').then(({ ModelProperty }) => {
|
|
1540
1540
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
1541
1541
|
try {
|
|
1542
1542
|
const property = await ModelProperty.createById(propertyFileId);
|
|
@@ -2068,14 +2068,14 @@ const createSeed = async ({ type, seedUid }) => {
|
|
|
2068
2068
|
// if the EAS schema hasn't been published yet
|
|
2069
2069
|
const appDb = BaseDb.getAppDb();
|
|
2070
2070
|
const newSeedLocalId = generateId();
|
|
2071
|
-
const publisher = await getPublisherForNewSeedsWithTimeout();
|
|
2071
|
+
const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
|
|
2072
2072
|
await appDb.insert(seeds).values({
|
|
2073
2073
|
localId: newSeedLocalId,
|
|
2074
2074
|
type,
|
|
2075
2075
|
uid: seedUid,
|
|
2076
2076
|
createdAt: Date.now(),
|
|
2077
2077
|
schemaUid: schemaUid || null,
|
|
2078
|
-
...(publisher
|
|
2078
|
+
...(publisher && { publisher }),
|
|
2079
2079
|
});
|
|
2080
2080
|
return newSeedLocalId;
|
|
2081
2081
|
};
|
|
@@ -2083,7 +2083,7 @@ const createSeed = async ({ type, seedUid }) => {
|
|
|
2083
2083
|
const createVersion = async ({ seedLocalId, seedUid, seedType, uid, }) => {
|
|
2084
2084
|
const appDb = BaseDb.getAppDb();
|
|
2085
2085
|
const newVersionLocalId = generateId();
|
|
2086
|
-
const publisher = await getPublisherForNewSeedsWithTimeout();
|
|
2086
|
+
const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
|
|
2087
2087
|
await appDb.insert(versions).values({
|
|
2088
2088
|
localId: newVersionLocalId,
|
|
2089
2089
|
createdAt: Date.now(),
|
|
@@ -2091,7 +2091,7 @@ const createVersion = async ({ seedLocalId, seedUid, seedType, uid, }) => {
|
|
|
2091
2091
|
seedUid: seedUid ?? null,
|
|
2092
2092
|
seedType,
|
|
2093
2093
|
uid: uid ?? null,
|
|
2094
|
-
...(publisher
|
|
2094
|
+
...(publisher && { publisher }),
|
|
2095
2095
|
});
|
|
2096
2096
|
return newVersionLocalId;
|
|
2097
2097
|
};
|
|
@@ -2434,7 +2434,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
2434
2434
|
const schemaNameToTry = model$1?.schemaName;
|
|
2435
2435
|
if (schemaNameToTry) {
|
|
2436
2436
|
try {
|
|
2437
|
-
const _mod_7 = await import('./Schema-
|
|
2437
|
+
const _mod_7 = await import('./Schema-cK2z7wet.js');
|
|
2438
2438
|
const _ns_7 = _mod_7.b;
|
|
2439
2439
|
const { Schema } = _ns_7;
|
|
2440
2440
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
@@ -2468,7 +2468,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
2468
2468
|
if (Object.keys(propertySchemas).length === 0) {
|
|
2469
2469
|
try {
|
|
2470
2470
|
const { listCompleteSchemaFiles } = await Promise.resolve().then(function () { return schema; });
|
|
2471
|
-
const _mod_8 = await import('./BasePathResolver-
|
|
2471
|
+
const _mod_8 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
2472
2472
|
const _ns_8 = _mod_8.w;
|
|
2473
2473
|
const { BaseFileManager } = _ns_8;
|
|
2474
2474
|
const schemaFiles = await listCompleteSchemaFiles();
|
|
@@ -2487,7 +2487,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
2487
2487
|
}
|
|
2488
2488
|
}
|
|
2489
2489
|
if (Object.keys(propertySchemas).length === 0) {
|
|
2490
|
-
const schemaMod = await import('./index-
|
|
2490
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
2491
2491
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2492
2492
|
const KNOWN_MODEL_FALLBACKS = {
|
|
2493
2493
|
Post: {
|
|
@@ -2534,7 +2534,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
2534
2534
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
2535
2535
|
let propSchema = propertySchemas[propertyName];
|
|
2536
2536
|
if (!propSchema && isRefTypeFromMeta) {
|
|
2537
|
-
const schemaMod = await import('./index-
|
|
2537
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
2538
2538
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2539
2539
|
propSchema = {
|
|
2540
2540
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -2791,9 +2791,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2791
2791
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
2792
2792
|
return;
|
|
2793
2793
|
}
|
|
2794
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
2794
|
+
const getPublishUploadsMod = await import('./getPublishUploads-gWv4tDyT.js');
|
|
2795
2795
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
2796
|
-
const getPublishPayloadMod = await import('./getPublishPayload-
|
|
2796
|
+
const getPublishPayloadMod = await import('./getPublishPayload-DmOu0I29.js');
|
|
2797
2797
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
2798
2798
|
const uploads = await getPublishUploads(item);
|
|
2799
2799
|
let uploadedTransactions = [];
|
|
@@ -3370,6 +3370,135 @@ async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
|
|
|
3370
3370
|
return out;
|
|
3371
3371
|
}
|
|
3372
3372
|
|
|
3373
|
+
const READ_ONLY_ERROR = 'Item is read-only: you do not own this item';
|
|
3374
|
+
async function getSeedRowForItem(item) {
|
|
3375
|
+
const appDb = BaseDb.getAppDb();
|
|
3376
|
+
if (!appDb)
|
|
3377
|
+
return null;
|
|
3378
|
+
const conditions = [];
|
|
3379
|
+
if (item.seedLocalId)
|
|
3380
|
+
conditions.push(eq(seeds.localId, item.seedLocalId));
|
|
3381
|
+
if (item.seedUid)
|
|
3382
|
+
conditions.push(eq(seeds.uid, item.seedUid));
|
|
3383
|
+
if (conditions.length === 0)
|
|
3384
|
+
return null;
|
|
3385
|
+
const seedRows = await appDb
|
|
3386
|
+
.select({
|
|
3387
|
+
publisher: seeds.publisher,
|
|
3388
|
+
attestationRaw: seeds.attestationRaw,
|
|
3389
|
+
uid: seeds.uid,
|
|
3390
|
+
})
|
|
3391
|
+
.from(seeds)
|
|
3392
|
+
.where(conditions.length === 1 ? conditions[0] : or(...conditions))
|
|
3393
|
+
.limit(1);
|
|
3394
|
+
if (!seedRows || seedRows.length === 0)
|
|
3395
|
+
return null;
|
|
3396
|
+
return seedRows[0];
|
|
3397
|
+
}
|
|
3398
|
+
/** Resolve publisher from seed row: `publisher` column, else `attestationRaw.attester`. */
|
|
3399
|
+
function resolvePublisherFromSeedRow(row) {
|
|
3400
|
+
if (row.publisher)
|
|
3401
|
+
return row.publisher;
|
|
3402
|
+
if (row.attestationRaw) {
|
|
3403
|
+
try {
|
|
3404
|
+
const parsed = JSON.parse(row.attestationRaw);
|
|
3405
|
+
return parsed.attester ?? null;
|
|
3406
|
+
}
|
|
3407
|
+
catch {
|
|
3408
|
+
return null;
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
return null;
|
|
3412
|
+
}
|
|
3413
|
+
/**
|
|
3414
|
+
* Local draft that has never been attested: no publisher, no real uid, no attestationRaw.
|
|
3415
|
+
*/
|
|
3416
|
+
function isLocalUnsealedDraft(row) {
|
|
3417
|
+
const publisher = row.publisher;
|
|
3418
|
+
if (publisher != null && publisher !== '')
|
|
3419
|
+
return false;
|
|
3420
|
+
if (!isPlaceholderUid(row.uid))
|
|
3421
|
+
return false;
|
|
3422
|
+
if (row.attestationRaw != null && row.attestationRaw !== '')
|
|
3423
|
+
return false;
|
|
3424
|
+
return true;
|
|
3425
|
+
}
|
|
3426
|
+
/** Case-insensitive membership in the persisted owned set. */
|
|
3427
|
+
function publisherIsInOwnedSet(publisher, ownedAddresses) {
|
|
3428
|
+
if (publisher == null || publisher === '')
|
|
3429
|
+
return false;
|
|
3430
|
+
const ownedSet = new Set(normalizeAddressList(ownedAddresses));
|
|
3431
|
+
return ownedSet.has(normalizeHexAddress(publisher));
|
|
3432
|
+
}
|
|
3433
|
+
/**
|
|
3434
|
+
* Shared ownership predicate.
|
|
3435
|
+
* - Session has owned addresses: only a publisher in that set is owned (null is never owned).
|
|
3436
|
+
* - Session has no owned addresses: local unsealed drafts are owned so pre-connect authoring works.
|
|
3437
|
+
*/
|
|
3438
|
+
function isSeedRowOwned(row, ownedAddresses) {
|
|
3439
|
+
const publisher = resolvePublisherFromSeedRow(row);
|
|
3440
|
+
if (ownedAddresses.length === 0) {
|
|
3441
|
+
return isLocalUnsealedDraft({ ...row, publisher: publisher ?? row.publisher });
|
|
3442
|
+
}
|
|
3443
|
+
return publisherIsInOwnedSet(publisher, ownedAddresses);
|
|
3444
|
+
}
|
|
3445
|
+
/**
|
|
3446
|
+
* SQL for `addressFilter: 'owned' | 'watched'`. Empty list → no rows (`1=0`).
|
|
3447
|
+
* Compares `lower(publisher)` so checksummed rows match persisted lowercase owned.
|
|
3448
|
+
*/
|
|
3449
|
+
function publisherInAddressListSql(column, addresses) {
|
|
3450
|
+
const normalized = normalizeAddressList(addresses);
|
|
3451
|
+
if (normalized.length === 0) {
|
|
3452
|
+
return sql `1=0`;
|
|
3453
|
+
}
|
|
3454
|
+
return inArray(sql `lower(${column})`, normalized);
|
|
3455
|
+
}
|
|
3456
|
+
/** Owned-list SQL on `seeds.publisher`. */
|
|
3457
|
+
function ownedPublisherSql(ownedAddresses) {
|
|
3458
|
+
return publisherInAddressListSql(seeds.publisher, ownedAddresses);
|
|
3459
|
+
}
|
|
3460
|
+
/**
|
|
3461
|
+
* Checks if the current user owns the item (publisher is in persisted owned addresses).
|
|
3462
|
+
*
|
|
3463
|
+
* When the session has owned addresses, only a matching publisher is owned —
|
|
3464
|
+
* `publisher IS NULL` is not treated as owned. Call `claimUnpublishedDrafts`
|
|
3465
|
+
* after connect to stamp local drafts.
|
|
3466
|
+
*
|
|
3467
|
+
* When owned is empty, local unsealed drafts (no publisher, no real uid, no
|
|
3468
|
+
* attestationRaw) are still owned so create/edit works before a wallet is connected.
|
|
3469
|
+
*
|
|
3470
|
+
* Does not include `getAdditionalSyncAddresses` (those are extra EAS indexers,
|
|
3471
|
+
* not wallets the user controls).
|
|
3472
|
+
*/
|
|
3473
|
+
async function isItemOwned(item) {
|
|
3474
|
+
const row = await getSeedRowForItem(item);
|
|
3475
|
+
if (!row)
|
|
3476
|
+
return false;
|
|
3477
|
+
const ownedAddresses = await getOwnedAddressesFromDb();
|
|
3478
|
+
return isSeedRowOwned(row, ownedAddresses);
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* Throws if the item is not owned. Use before write operations (publish, save, destroy).
|
|
3482
|
+
*/
|
|
3483
|
+
async function assertItemOwned(item) {
|
|
3484
|
+
const owned = await isItemOwned(item);
|
|
3485
|
+
if (!owned) {
|
|
3486
|
+
throw new Error(READ_ONLY_ERROR);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
var ownership = /*#__PURE__*/Object.freeze({
|
|
3491
|
+
__proto__: null,
|
|
3492
|
+
assertItemOwned: assertItemOwned,
|
|
3493
|
+
isItemOwned: isItemOwned,
|
|
3494
|
+
isLocalUnsealedDraft: isLocalUnsealedDraft,
|
|
3495
|
+
isSeedRowOwned: isSeedRowOwned,
|
|
3496
|
+
ownedPublisherSql: ownedPublisherSql,
|
|
3497
|
+
publisherInAddressListSql: publisherInAddressListSql,
|
|
3498
|
+
publisherIsInOwnedSet: publisherIsInOwnedSet,
|
|
3499
|
+
resolvePublisherFromSeedRow: resolvePublisherFromSeedRow
|
|
3500
|
+
});
|
|
3501
|
+
|
|
3373
3502
|
/**
|
|
3374
3503
|
* List item rows for list UIs. Only includes seeds that have at least one version.
|
|
3375
3504
|
*
|
|
@@ -3390,16 +3519,11 @@ const getItemsData = async ({ modelName, deleted, includeEas = false, addressFil
|
|
|
3390
3519
|
}
|
|
3391
3520
|
if (addressFilter === 'owned') {
|
|
3392
3521
|
const ownedAddresses = await getAddressesForItemsFilter('owned');
|
|
3393
|
-
|
|
3394
|
-
conditions.push(or(inArray(seeds.publisher, ownedAddresses), isNull(seeds.publisher)));
|
|
3395
|
-
}
|
|
3522
|
+
conditions.push(publisherInAddressListSql(seeds.publisher, ownedAddresses));
|
|
3396
3523
|
}
|
|
3397
3524
|
else if (addressFilter === 'watched') {
|
|
3398
3525
|
const watchedAddresses = await getAddressesForItemsFilter('watched');
|
|
3399
|
-
|
|
3400
|
-
return [];
|
|
3401
|
-
}
|
|
3402
|
-
conditions.push(inArray(seeds.publisher, watchedAddresses));
|
|
3526
|
+
conditions.push(publisherInAddressListSql(seeds.publisher, watchedAddresses));
|
|
3403
3527
|
}
|
|
3404
3528
|
if (deleted) {
|
|
3405
3529
|
conditions.push(or(isNotNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 1)));
|
|
@@ -3641,7 +3765,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3641
3765
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
3642
3766
|
const _resolveRelatedValue = async () => {
|
|
3643
3767
|
// Use dynamic import to break circular dependency
|
|
3644
|
-
const schemaMod = await import('./index-
|
|
3768
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
3645
3769
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
3646
3770
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
3647
3771
|
return;
|
|
@@ -3960,6 +4084,7 @@ const updateMetadata = async (metadataValues, propertyRecordSchema) => {
|
|
|
3960
4084
|
}
|
|
3961
4085
|
// Publisher is immutable once set: do not overwrite existing publisher
|
|
3962
4086
|
if (rest.publisher != null && rest.publisher !== '') {
|
|
4087
|
+
rest.publisher = normalizePublisher(rest.publisher) ?? rest.publisher;
|
|
3963
4088
|
const [row] = await appDb
|
|
3964
4089
|
.select({ publisher: metadata$1.publisher })
|
|
3965
4090
|
.from(metadata$1)
|
|
@@ -4644,7 +4769,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
4644
4769
|
// to use dynamically imported ModelPropertyDataTypes
|
|
4645
4770
|
const _hydrateFromDb = async () => {
|
|
4646
4771
|
// Use dynamic import to break circular dependency
|
|
4647
|
-
const schemaMod = await import('./index-
|
|
4772
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
4648
4773
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
4649
4774
|
const appDb = BaseDb.getAppDb();
|
|
4650
4775
|
const whereClauses = [];
|
|
@@ -5007,14 +5132,14 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
5007
5132
|
};
|
|
5008
5133
|
// Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
|
|
5009
5134
|
try {
|
|
5010
|
-
const { getPropertySchema } = await import('./property-
|
|
5135
|
+
const { getPropertySchema } = await import('./property-eMrSbAWU.js');
|
|
5011
5136
|
let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName);
|
|
5012
5137
|
if (!schemaFromFile?.validation) {
|
|
5013
5138
|
// Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
|
|
5014
|
-
const _mod_9 = await import('./BasePathResolver-
|
|
5139
|
+
const _mod_9 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
5015
5140
|
const _ns_9 = _mod_9.S;
|
|
5016
5141
|
const { schemas: schemasTable } = _ns_9;
|
|
5017
|
-
const _mod_10 = await import('./BasePathResolver-
|
|
5142
|
+
const _mod_10 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
5018
5143
|
const _ns_10 = _mod_10.x;
|
|
5019
5144
|
const { modelSchemas } = _ns_10;
|
|
5020
5145
|
const modelSchemaRows = await db
|
|
@@ -5476,9 +5601,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
5476
5601
|
}
|
|
5477
5602
|
const _analyzeInput = async () => {
|
|
5478
5603
|
// Use dynamic import to break circular dependency
|
|
5479
|
-
const schemaMod = await import('./index-
|
|
5604
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
5480
5605
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
5481
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
5606
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
5482
5607
|
let propertyName = propertyNameRaw;
|
|
5483
5608
|
if (!propertyName) {
|
|
5484
5609
|
throw new Error('propertyName is required');
|
|
@@ -5646,8 +5771,8 @@ class MetadataValidationError extends Error {
|
|
|
5646
5771
|
const createMetadata = async (metadataValues, propertyRecordSchema, options) => {
|
|
5647
5772
|
const appDb = BaseDb.getAppDb();
|
|
5648
5773
|
metadataValues.localId = generateId();
|
|
5649
|
-
const publisher = await getPublisherForNewSeedsWithTimeout();
|
|
5650
|
-
if (publisher
|
|
5774
|
+
const publisher = normalizePublisher(await getPublisherForNewSeedsWithTimeout());
|
|
5775
|
+
if (publisher) {
|
|
5651
5776
|
metadataValues.publisher = publisher;
|
|
5652
5777
|
}
|
|
5653
5778
|
if (!metadataValues.modelType && metadataValues.modelName) {
|
|
@@ -5676,7 +5801,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
5676
5801
|
propertyRecordSchema?.validation &&
|
|
5677
5802
|
metadataValues.propertyValue != null &&
|
|
5678
5803
|
metadataValues.propertyValue !== '') {
|
|
5679
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
5804
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-B3pQ_q-9.js');
|
|
5680
5805
|
const validationService = new SchemaValidationService();
|
|
5681
5806
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
5682
5807
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -6269,7 +6394,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
6269
6394
|
}
|
|
6270
6395
|
const _saveRelation = async () => {
|
|
6271
6396
|
// Use dynamic import to break circular dependency
|
|
6272
|
-
const schemaMod = await import('./index-
|
|
6397
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
6273
6398
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6274
6399
|
if (!propertyNameRaw) {
|
|
6275
6400
|
throw new Error('propertyName is required');
|
|
@@ -7313,7 +7438,7 @@ class ItemProperty {
|
|
|
7313
7438
|
return;
|
|
7314
7439
|
}
|
|
7315
7440
|
// Use dynamic import to break circular dependency
|
|
7316
|
-
const schemaMod = await import('./index-
|
|
7441
|
+
const schemaMod = await import('./index-DAwvrNga.js');
|
|
7317
7442
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
7318
7443
|
const { context } = snapshot;
|
|
7319
7444
|
const { propertyRecordSchema } = context;
|
|
@@ -7484,7 +7609,7 @@ class ItemProperty {
|
|
|
7484
7609
|
const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
|
|
7485
7610
|
const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
|
|
7486
7611
|
const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
|
|
7487
|
-
const _mod_11 = await import('./index-
|
|
7612
|
+
const _mod_11 = await import('./index-xNWgPtlN.js');
|
|
7488
7613
|
const _ns_11 = _mod_11.s;
|
|
7489
7614
|
const seedSchemaMod = _ns_11;
|
|
7490
7615
|
const { metadata } = seedSchemaMod;
|
|
@@ -8317,7 +8442,7 @@ class ItemProperty {
|
|
|
8317
8442
|
if (!propertyName || (!seedLocalId && !seedUid))
|
|
8318
8443
|
return;
|
|
8319
8444
|
if (db) {
|
|
8320
|
-
const _mod_12 = await import('./index-
|
|
8445
|
+
const _mod_12 = await import('./index-xNWgPtlN.js');
|
|
8321
8446
|
const _ns_12 = _mod_12.s;
|
|
8322
8447
|
const seedSchemaMod = _ns_12;
|
|
8323
8448
|
const { metadata } = seedSchemaMod;
|
|
@@ -8468,7 +8593,8 @@ const updateSeedUid = async ({ seedLocalId, seedUid, publisher, attestationCreat
|
|
|
8468
8593
|
return;
|
|
8469
8594
|
}
|
|
8470
8595
|
const appDb = BaseDb.getAppDb();
|
|
8471
|
-
|
|
8596
|
+
const normalizedPublisher = normalizePublisher(publisher);
|
|
8597
|
+
let shouldSetPublisher = normalizedPublisher != null;
|
|
8472
8598
|
if (shouldSetPublisher) {
|
|
8473
8599
|
const [row] = await appDb
|
|
8474
8600
|
.select({ publisher: seeds.publisher })
|
|
@@ -8483,7 +8609,7 @@ const updateSeedUid = async ({ seedLocalId, seedUid, publisher, attestationCreat
|
|
|
8483
8609
|
.update(seeds)
|
|
8484
8610
|
.set({
|
|
8485
8611
|
uid: seedUid,
|
|
8486
|
-
...(shouldSetPublisher && { publisher }),
|
|
8612
|
+
...(shouldSetPublisher && { publisher: normalizedPublisher }),
|
|
8487
8613
|
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
8488
8614
|
updatedAt: Date.now(),
|
|
8489
8615
|
})
|
|
@@ -8625,12 +8751,12 @@ class Item {
|
|
|
8625
8751
|
};
|
|
8626
8752
|
this.getPublishUploads = async (options) => {
|
|
8627
8753
|
// Use dynamic import to break circular dependency
|
|
8628
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
8754
|
+
const getPublishUploadsMod = await import('./getPublishUploads-gWv4tDyT.js');
|
|
8629
8755
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
8630
8756
|
return await getPublishUploads(this, [], undefined, options);
|
|
8631
8757
|
};
|
|
8632
8758
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
8633
|
-
const getPublishPayloadMod = await import('./getPublishPayload-
|
|
8759
|
+
const getPublishPayloadMod = await import('./getPublishPayload-DmOu0I29.js');
|
|
8634
8760
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
8635
8761
|
return await getPublishPayload(this, uploadedTransactions, options);
|
|
8636
8762
|
};
|
|
@@ -9102,11 +9228,11 @@ class Item {
|
|
|
9102
9228
|
let modelRecords;
|
|
9103
9229
|
// If we have a schema name, join with modelSchemas to filter by schema
|
|
9104
9230
|
if (schemaName) {
|
|
9105
|
-
const _mod_13 = await import('./BasePathResolver-
|
|
9231
|
+
const _mod_13 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
9106
9232
|
const _ns_13 = _mod_13.x;
|
|
9107
9233
|
const modelSchemaSchemaMod = _ns_13;
|
|
9108
9234
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
9109
|
-
const _mod_14 = await import('./BasePathResolver-
|
|
9235
|
+
const _mod_14 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
9110
9236
|
const _ns_14 = _mod_14.S;
|
|
9111
9237
|
const schemaSchemaMod = _ns_14;
|
|
9112
9238
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -9408,7 +9534,7 @@ class Item {
|
|
|
9408
9534
|
if (!appDb || Item.instanceCache.size === 0) {
|
|
9409
9535
|
return;
|
|
9410
9536
|
}
|
|
9411
|
-
const _mod_15 = await import('./index-
|
|
9537
|
+
const _mod_15 = await import('./index-xNWgPtlN.js');
|
|
9412
9538
|
const _ns_15 = _mod_15.s;
|
|
9413
9539
|
const { metadata } = _ns_15;
|
|
9414
9540
|
const { eq, and } = await import('drizzle-orm');
|
|
@@ -9859,7 +9985,7 @@ class Item {
|
|
|
9859
9985
|
itemActor.send(event);
|
|
9860
9986
|
};
|
|
9861
9987
|
try {
|
|
9862
|
-
const _mod_16 = await import('./index-
|
|
9988
|
+
const _mod_16 = await import('./index-xNWgPtlN.js');
|
|
9863
9989
|
const _ns_16 = _mod_16.s;
|
|
9864
9990
|
const seedSchemaMod = _ns_16;
|
|
9865
9991
|
const { seeds, versions, metadata } = seedSchemaMod;
|
|
@@ -10207,24 +10333,6 @@ class ConflictError extends Error {
|
|
|
10207
10333
|
}
|
|
10208
10334
|
}
|
|
10209
10335
|
|
|
10210
|
-
/**
|
|
10211
|
-
* Normalizes AddressConfiguration to { owned, watched }.
|
|
10212
|
-
* - string[] -> { owned: addresses, watched: [] }
|
|
10213
|
-
* - { owned, watched? } -> { owned, watched: watched ?? [] }
|
|
10214
|
-
*/
|
|
10215
|
-
function normalizeAddressConfig(addresses) {
|
|
10216
|
-
if (!addresses) {
|
|
10217
|
-
return { owned: [], watched: [] };
|
|
10218
|
-
}
|
|
10219
|
-
if (Array.isArray(addresses)) {
|
|
10220
|
-
return { owned: addresses, watched: [] };
|
|
10221
|
-
}
|
|
10222
|
-
return {
|
|
10223
|
-
owned: addresses.owned ?? [],
|
|
10224
|
-
watched: addresses.watched ?? [],
|
|
10225
|
-
};
|
|
10226
|
-
}
|
|
10227
|
-
|
|
10228
10336
|
let writeTail = Promise.resolve();
|
|
10229
10337
|
function enqueueEasSyncDbWrite(fn) {
|
|
10230
10338
|
const next = writeTail.then(fn);
|
|
@@ -10321,7 +10429,7 @@ const runEasSync = fromPromise(async ({ input, }) => {
|
|
|
10321
10429
|
requestPayload: input.requestPayload,
|
|
10322
10430
|
persistedSnapshot: input.runningSnapshot,
|
|
10323
10431
|
});
|
|
10324
|
-
const { runSyncFromEas } = await import('./syncDbWithEas-
|
|
10432
|
+
const { runSyncFromEas } = await import('./syncDbWithEas-c9Xe17zq.js');
|
|
10325
10433
|
try {
|
|
10326
10434
|
await runSyncFromEas(toRunSyncArg(input.options));
|
|
10327
10435
|
await finalizeEasSyncProcessRow(rowId, {
|
|
@@ -10600,7 +10708,7 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
|
|
|
10600
10708
|
}
|
|
10601
10709
|
// Prefer the condition-resolved factory when available; fall back to explicit
|
|
10602
10710
|
// platform imports so source/vitest resolution stays reliable.
|
|
10603
|
-
const { configurePlatform } = await import('./configurePlatform-
|
|
10711
|
+
const { configurePlatform } = await import('./configurePlatform-Df4BlXwQ.js');
|
|
10604
10712
|
if (isBrowser()) {
|
|
10605
10713
|
const { createPlatformServices } = await import('./platform.browser.js');
|
|
10606
10714
|
configurePlatform(createPlatformServices());
|
|
@@ -11047,8 +11155,8 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
11047
11155
|
throw new Error('App DB not found');
|
|
11048
11156
|
}
|
|
11049
11157
|
const endpointsValueString = JSON.stringify(endpoints);
|
|
11050
|
-
const owned = ownedAddresses ?? addresses ?? [];
|
|
11051
|
-
const watched = watchedAddresses ?? [];
|
|
11158
|
+
const owned = normalizeAddressList(ownedAddresses ?? addresses ?? []);
|
|
11159
|
+
const watched = normalizeAddressList(watchedAddresses ?? []);
|
|
11052
11160
|
const addressesValueString = JSON.stringify({ owned, watched });
|
|
11053
11161
|
// TODO: Figure out how to define on conflict with multiple rows added
|
|
11054
11162
|
await appDb
|
|
@@ -11063,20 +11171,18 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
11063
11171
|
value: endpointsValueString,
|
|
11064
11172
|
},
|
|
11065
11173
|
});
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11174
|
+
await appDb
|
|
11175
|
+
.insert(appState)
|
|
11176
|
+
.values({
|
|
11177
|
+
key: 'addresses',
|
|
11178
|
+
value: addressesValueString,
|
|
11179
|
+
})
|
|
11180
|
+
.onConflictDoUpdate({
|
|
11181
|
+
target: appState.key,
|
|
11182
|
+
set: {
|
|
11071
11183
|
value: addressesValueString,
|
|
11072
|
-
}
|
|
11073
|
-
|
|
11074
|
-
target: appState.key,
|
|
11075
|
-
set: {
|
|
11076
|
-
value: addressesValueString,
|
|
11077
|
-
},
|
|
11078
|
-
});
|
|
11079
|
-
}
|
|
11184
|
+
},
|
|
11185
|
+
});
|
|
11080
11186
|
await appDb
|
|
11081
11187
|
.insert(appState)
|
|
11082
11188
|
.values({
|
|
@@ -11827,7 +11933,7 @@ function getRefValueType(prop) {
|
|
|
11827
11933
|
* @returns Promise that resolves when properties are found, or rejects if not found after max retries
|
|
11828
11934
|
*/
|
|
11829
11935
|
const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
|
|
11830
|
-
const _mod_17 = await import('./BasePathResolver-
|
|
11936
|
+
const _mod_17 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
11831
11937
|
const _ns_17 = _mod_17.M;
|
|
11832
11938
|
const modelSchemaMod = _ns_17;
|
|
11833
11939
|
const { properties: propertiesTable } = modelSchemaMod;
|
|
@@ -12175,7 +12281,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12175
12281
|
// Check DB for existing schema by name+version (same as minimal path)
|
|
12176
12282
|
const db = BaseDb.getAppDb();
|
|
12177
12283
|
if (db) {
|
|
12178
|
-
const _mod_18 = await import('./BasePathResolver-
|
|
12284
|
+
const _mod_18 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12179
12285
|
const _ns_18 = _mod_18.S;
|
|
12180
12286
|
const schemaSchemaMod = _ns_18;
|
|
12181
12287
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -12259,7 +12365,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12259
12365
|
// For minimal imports: check DB for existing schema before creating new file
|
|
12260
12366
|
const db = BaseDb.getAppDb();
|
|
12261
12367
|
if (db) {
|
|
12262
|
-
const _mod_19 = await import('./BasePathResolver-
|
|
12368
|
+
const _mod_19 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12263
12369
|
const _ns_19 = _mod_19.S;
|
|
12264
12370
|
const schemaSchemaMod = _ns_19;
|
|
12265
12371
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -12440,7 +12546,9 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12440
12546
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
12441
12547
|
};
|
|
12442
12548
|
// Use dynamic import to break circular dependency
|
|
12443
|
-
const
|
|
12549
|
+
const _mod_20 = await import('./db-BwVuO1tO.js');
|
|
12550
|
+
const _ns_20 = _mod_20.q;
|
|
12551
|
+
const dbMod = _ns_20;
|
|
12444
12552
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
12445
12553
|
// Try to add schema and models to database if database is available
|
|
12446
12554
|
try {
|
|
@@ -12460,13 +12568,13 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
12460
12568
|
});
|
|
12461
12569
|
// Verify expected models are linked (single attempt - addModelsToDb already confirmed)
|
|
12462
12570
|
const expectedModelNames = Object.keys(schemaFile.models || {});
|
|
12463
|
-
const
|
|
12464
|
-
const
|
|
12465
|
-
const modelSchemaSchemaMod =
|
|
12571
|
+
const _mod_21 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12572
|
+
const _ns_21 = _mod_21.x;
|
|
12573
|
+
const modelSchemaSchemaMod = _ns_21;
|
|
12466
12574
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
12467
|
-
const
|
|
12468
|
-
const
|
|
12469
|
-
const modelSchemaMod =
|
|
12575
|
+
const _mod_22 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12576
|
+
const _ns_22 = _mod_22.M;
|
|
12577
|
+
const modelSchemaMod = _ns_22;
|
|
12470
12578
|
const { models: modelsTable } = modelSchemaMod;
|
|
12471
12579
|
const drizzleMod = await import('drizzle-orm');
|
|
12472
12580
|
const { eq, and } = drizzleMod;
|
|
@@ -12667,7 +12775,9 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
|
|
|
12667
12775
|
createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
|
|
12668
12776
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
12669
12777
|
};
|
|
12670
|
-
const
|
|
12778
|
+
const _mod_23 = await import('./db-BwVuO1tO.js');
|
|
12779
|
+
const _ns_23 = _mod_23.q;
|
|
12780
|
+
const dbMod = _ns_23;
|
|
12671
12781
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
12672
12782
|
const db = BaseDb.getAppDb();
|
|
12673
12783
|
if (!db) {
|
|
@@ -12825,13 +12935,13 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12825
12935
|
if (db) {
|
|
12826
12936
|
const { schemaRecord } = await applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, propertyFileIds);
|
|
12827
12937
|
// Query the database to get model IDs that were just created
|
|
12828
|
-
const
|
|
12829
|
-
const
|
|
12830
|
-
const modelSchemaSchemaMod =
|
|
12938
|
+
const _mod_24 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12939
|
+
const _ns_24 = _mod_24.x;
|
|
12940
|
+
const modelSchemaSchemaMod = _ns_24;
|
|
12831
12941
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
12832
|
-
const
|
|
12833
|
-
const
|
|
12834
|
-
const modelSchemaMod =
|
|
12942
|
+
const _mod_25 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
12943
|
+
const _ns_25 = _mod_25.M;
|
|
12944
|
+
const modelSchemaMod = _ns_25;
|
|
12835
12945
|
const { models: modelsTable } = modelSchemaMod;
|
|
12836
12946
|
const drizzleMod = await import('drizzle-orm');
|
|
12837
12947
|
const { eq } = drizzleMod;
|
|
@@ -12895,9 +13005,9 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12895
13005
|
// After properties are created (file path), ensure schemaFile has the correct IDs from database
|
|
12896
13006
|
// Query the database to get the actual schemaFileId values that were used
|
|
12897
13007
|
// This ensures schemaData matches what's actually in the database
|
|
12898
|
-
const
|
|
12899
|
-
const
|
|
12900
|
-
const modelSchemaMod2 =
|
|
13008
|
+
const _mod_26 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
13009
|
+
const _ns_26 = _mod_26.M;
|
|
13010
|
+
const modelSchemaMod2 = _ns_26;
|
|
12901
13011
|
const { properties: propertiesTable } = modelSchemaMod2;
|
|
12902
13012
|
let schemaFileUpdated = false;
|
|
12903
13013
|
for (const [modelName, modelFileId] of modelFileIds.entries()) {
|
|
@@ -12931,9 +13041,9 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
12931
13041
|
// This is important even if nothing changed, to ensure consistency
|
|
12932
13042
|
const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
|
|
12933
13043
|
// Update the schema record in the database with current schemaData
|
|
12934
|
-
const
|
|
12935
|
-
const
|
|
12936
|
-
const schemaSchemaMod =
|
|
13044
|
+
const _mod_27 = await import('./BasePathResolver-0IHnXxtL.js');
|
|
13045
|
+
const _ns_27 = _mod_27.S;
|
|
13046
|
+
const schemaSchemaMod = _ns_27;
|
|
12937
13047
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
12938
13048
|
await db
|
|
12939
13049
|
.update(schemasTable)
|
|
@@ -14292,98 +14402,7 @@ async function getPublishedSeedRecord(seedUid, options) {
|
|
|
14292
14402
|
return getSeed(seedUid, { ...options, source });
|
|
14293
14403
|
}
|
|
14294
14404
|
|
|
14295
|
-
const
|
|
14296
|
-
async function getSeedRowForItem(item) {
|
|
14297
|
-
const appDb = BaseDb.getAppDb();
|
|
14298
|
-
if (!appDb)
|
|
14299
|
-
return null;
|
|
14300
|
-
const conditions = [];
|
|
14301
|
-
if (item.seedLocalId)
|
|
14302
|
-
conditions.push(eq(seeds.localId, item.seedLocalId));
|
|
14303
|
-
if (item.seedUid)
|
|
14304
|
-
conditions.push(eq(seeds.uid, item.seedUid));
|
|
14305
|
-
if (conditions.length === 0)
|
|
14306
|
-
return null;
|
|
14307
|
-
const seedRows = await appDb
|
|
14308
|
-
.select({
|
|
14309
|
-
publisher: seeds.publisher,
|
|
14310
|
-
attestationRaw: seeds.attestationRaw,
|
|
14311
|
-
uid: seeds.uid,
|
|
14312
|
-
})
|
|
14313
|
-
.from(seeds)
|
|
14314
|
-
.where(conditions.length === 1 ? conditions[0] : or(...conditions))
|
|
14315
|
-
.limit(1);
|
|
14316
|
-
if (!seedRows || seedRows.length === 0)
|
|
14317
|
-
return null;
|
|
14318
|
-
return seedRows[0];
|
|
14319
|
-
}
|
|
14320
|
-
/** Resolve publisher from seed row: `publisher` column, else `attestationRaw.attester`. */
|
|
14321
|
-
function resolvePublisherFromSeedRow(row) {
|
|
14322
|
-
if (row.publisher)
|
|
14323
|
-
return row.publisher;
|
|
14324
|
-
if (row.attestationRaw) {
|
|
14325
|
-
try {
|
|
14326
|
-
const parsed = JSON.parse(row.attestationRaw);
|
|
14327
|
-
return parsed.attester ?? null;
|
|
14328
|
-
}
|
|
14329
|
-
catch {
|
|
14330
|
-
return null;
|
|
14331
|
-
}
|
|
14332
|
-
}
|
|
14333
|
-
return null;
|
|
14334
|
-
}
|
|
14335
|
-
/**
|
|
14336
|
-
* Checks if the current user owns the item (publisher is in owned addresses).
|
|
14337
|
-
* Locally created items (no publisher, no attestationRaw) are considered owned.
|
|
14338
|
-
* Includes getAdditionalSyncAddresses (e.g. `modularAccountModuleContract` when configured)
|
|
14339
|
-
* so ownership aligns with EAS sync when the publisher/attester matches those addresses.
|
|
14340
|
-
*/
|
|
14341
|
-
async function isItemOwned(item) {
|
|
14342
|
-
const row = await getSeedRowForItem(item);
|
|
14343
|
-
if (!row)
|
|
14344
|
-
return false;
|
|
14345
|
-
const publisher = resolvePublisherFromSeedRow(row);
|
|
14346
|
-
if (!publisher) {
|
|
14347
|
-
if (!row.uid && !row.attestationRaw) {
|
|
14348
|
-
return true;
|
|
14349
|
-
}
|
|
14350
|
-
return false;
|
|
14351
|
-
}
|
|
14352
|
-
let addressesToCheck = await getOwnedAddressesFromDb();
|
|
14353
|
-
const additionalGetter = getGetAdditionalSyncAddresses();
|
|
14354
|
-
if (additionalGetter) {
|
|
14355
|
-
const additional = await additionalGetter();
|
|
14356
|
-
if (additional?.length) {
|
|
14357
|
-
const seen = new Set(addressesToCheck.map((a) => a.toLowerCase()));
|
|
14358
|
-
for (const addr of additional) {
|
|
14359
|
-
if (addr && !seen.has(addr.toLowerCase())) {
|
|
14360
|
-
seen.add(addr.toLowerCase());
|
|
14361
|
-
addressesToCheck = [...addressesToCheck, addr];
|
|
14362
|
-
}
|
|
14363
|
-
}
|
|
14364
|
-
}
|
|
14365
|
-
}
|
|
14366
|
-
const ownedSet = new Set(addressesToCheck.map((a) => a.toLowerCase()));
|
|
14367
|
-
return ownedSet.has(publisher.toLowerCase());
|
|
14368
|
-
}
|
|
14369
|
-
/**
|
|
14370
|
-
* Throws if the item is not owned. Use before write operations (publish, save, destroy).
|
|
14371
|
-
*/
|
|
14372
|
-
async function assertItemOwned(item) {
|
|
14373
|
-
const owned = await isItemOwned(item);
|
|
14374
|
-
if (!owned) {
|
|
14375
|
-
throw new Error(READ_ONLY_ERROR);
|
|
14376
|
-
}
|
|
14377
|
-
}
|
|
14378
|
-
|
|
14379
|
-
var ownership = /*#__PURE__*/Object.freeze({
|
|
14380
|
-
__proto__: null,
|
|
14381
|
-
assertItemOwned: assertItemOwned,
|
|
14382
|
-
isItemOwned: isItemOwned,
|
|
14383
|
-
resolvePublisherFromSeedRow: resolvePublisherFromSeedRow
|
|
14384
|
-
});
|
|
14385
|
-
|
|
14386
|
-
const emptyResult = () => ({
|
|
14405
|
+
const emptyResult$1 = () => ({
|
|
14387
14406
|
removedSeedLocalIds: [],
|
|
14388
14407
|
removedSeedUids: [],
|
|
14389
14408
|
});
|
|
@@ -14401,11 +14420,11 @@ function normalizeAddresses(addresses) {
|
|
|
14401
14420
|
async function findLocalOnchainCopiesForAddresses(addresses) {
|
|
14402
14421
|
const normalized = normalizeAddresses(addresses);
|
|
14403
14422
|
if (normalized.length === 0) {
|
|
14404
|
-
return emptyResult();
|
|
14423
|
+
return emptyResult$1();
|
|
14405
14424
|
}
|
|
14406
14425
|
const appDb = BaseDb.getAppDb();
|
|
14407
14426
|
if (!appDb) {
|
|
14408
|
-
return emptyResult();
|
|
14427
|
+
return emptyResult$1();
|
|
14409
14428
|
}
|
|
14410
14429
|
const addressSet = new Set(normalized);
|
|
14411
14430
|
const candidateRows = (await appDb
|
|
@@ -14454,6 +14473,57 @@ async function hardDeleteLocalSeedsByLocalIds(seedLocalIds) {
|
|
|
14454
14473
|
await appDb.delete(seeds).where(inArray(seeds.localId, seedLocalIds));
|
|
14455
14474
|
}
|
|
14456
14475
|
|
|
14476
|
+
const emptyResult = () => ({
|
|
14477
|
+
seeds: 0,
|
|
14478
|
+
versions: 0,
|
|
14479
|
+
metadata: 0,
|
|
14480
|
+
});
|
|
14481
|
+
/**
|
|
14482
|
+
* Stamp local seeds/versions/metadata that have no publisher and no real uid.
|
|
14483
|
+
* Does not touch sealed rows (real EAS uid or attestationRaw).
|
|
14484
|
+
*/
|
|
14485
|
+
async function claimUnpublishedDrafts(publisher) {
|
|
14486
|
+
const normalized = normalizePublisher(publisher);
|
|
14487
|
+
if (!normalized)
|
|
14488
|
+
return emptyResult();
|
|
14489
|
+
const appDb = BaseDb.getAppDb();
|
|
14490
|
+
if (!appDb)
|
|
14491
|
+
return emptyResult();
|
|
14492
|
+
const now = Date.now();
|
|
14493
|
+
const claimTable = async (table) => {
|
|
14494
|
+
const rows = (await appDb
|
|
14495
|
+
.select({
|
|
14496
|
+
localId: table.localId,
|
|
14497
|
+
uid: table.uid,
|
|
14498
|
+
publisher: table.publisher,
|
|
14499
|
+
attestationRaw: table.attestationRaw,
|
|
14500
|
+
})
|
|
14501
|
+
.from(table));
|
|
14502
|
+
const ids = rows
|
|
14503
|
+
.filter((row) => typeof row.localId === 'string' &&
|
|
14504
|
+
row.localId !== '' &&
|
|
14505
|
+
isLocalUnsealedDraft(row))
|
|
14506
|
+
.map((row) => row.localId);
|
|
14507
|
+
if (ids.length === 0)
|
|
14508
|
+
return 0;
|
|
14509
|
+
await appDb
|
|
14510
|
+
.update(table)
|
|
14511
|
+
.set({ publisher: normalized, updatedAt: now })
|
|
14512
|
+
.where(inArray(table.localId, ids));
|
|
14513
|
+
return ids.length;
|
|
14514
|
+
};
|
|
14515
|
+
const [seedCount, versionCount, metadataCount] = await Promise.all([
|
|
14516
|
+
claimTable(seeds),
|
|
14517
|
+
claimTable(versions),
|
|
14518
|
+
claimTable(metadata$1),
|
|
14519
|
+
]);
|
|
14520
|
+
return {
|
|
14521
|
+
seeds: seedCount,
|
|
14522
|
+
versions: versionCount,
|
|
14523
|
+
metadata: metadataCount,
|
|
14524
|
+
};
|
|
14525
|
+
}
|
|
14526
|
+
|
|
14457
14527
|
const logger$1 = debug('seedSdk:client');
|
|
14458
14528
|
const clientManager = createActor(clientManagerMachine, {
|
|
14459
14529
|
input: {
|
|
@@ -14582,6 +14652,15 @@ const clientInstance = {
|
|
|
14582
14652
|
ensureInitialized();
|
|
14583
14653
|
return getWatchedAddressesFromDb();
|
|
14584
14654
|
},
|
|
14655
|
+
/**
|
|
14656
|
+
* Stamp local seeds/versions/metadata that have no publisher and no real uid.
|
|
14657
|
+
* Sealed rows (real EAS uid or attestationRaw) are left unchanged.
|
|
14658
|
+
* Use after `setAddresses` on connect; `setPublishWallet` does this automatically.
|
|
14659
|
+
*/
|
|
14660
|
+
claimUnpublishedDrafts: async (publisher) => {
|
|
14661
|
+
ensureInitialized();
|
|
14662
|
+
return claimUnpublishedDrafts(publisher);
|
|
14663
|
+
},
|
|
14585
14664
|
/**
|
|
14586
14665
|
* Hard-delete local on-chain seed copies for the given publisher addresses.
|
|
14587
14666
|
* Drafts (no uid / attestationRaw) are kept. Chain is untouched; reconnect can rehydrate via syncFromEas.
|
|
@@ -14832,7 +14911,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
14832
14911
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
14833
14912
|
// Eagerly start loading to minimize delay on first access
|
|
14834
14913
|
let ModelPropertyClass = null;
|
|
14835
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
14914
|
+
const modelPropertyImportPromise = import('./ModelProperty-DMjKVphl.js')
|
|
14836
14915
|
.then(module => {
|
|
14837
14916
|
ModelPropertyClass = module.ModelProperty;
|
|
14838
14917
|
return ModelPropertyClass;
|
|
@@ -14849,7 +14928,7 @@ function getModelProperty() {
|
|
|
14849
14928
|
}
|
|
14850
14929
|
// Lazy import cache for Schema to avoid circular dependency
|
|
14851
14930
|
let SchemaClass = null;
|
|
14852
|
-
const schemaImportPromise = (async () => { const
|
|
14931
|
+
const schemaImportPromise = (async () => { const _mod_28 = await import('./Schema-cK2z7wet.js'); return _mod_28.b; })()
|
|
14853
14932
|
.then(module => {
|
|
14854
14933
|
SchemaClass = module.Schema;
|
|
14855
14934
|
return SchemaClass;
|
|
@@ -16589,5 +16668,5 @@ var Model$1 = /*#__PURE__*/Object.freeze({
|
|
|
16589
16668
|
const TModelValues = Type.Record(Type.String(), Type.Any());
|
|
16590
16669
|
const TModelSchema = Type.Record(Type.String(), TProperty);
|
|
16591
16670
|
|
|
16592
|
-
export {
|
|
16593
|
-
//# sourceMappingURL=index-
|
|
16671
|
+
export { ownedPublisherSql as $, compareMetadataRowsLatestFirst as A, ADDRESSES_PERSISTED_EVENT as B, ClientManager as C, claimUnpublishedDrafts as D, createLocalQueryDataSource as E, createNewItem as F, createSchema as G, easSyncActor as H, Item as I, getClient as J, getGetPublisherForNewSeeds as K, LOCAL_COPIES_REMOVED_EVENT as L, Model as M, getMetadataLatest as N, getPublishedSeedRecord as O, getRevokeExecutor as P, getSchemaNameFromId as Q, getUploadExecutor as R, getVersionData$1 as S, TModelSchema as T, isItemOwned as U, isLocalUnsealedDraft as V, isSeedQueryLocalSourceRegistered as W, isSeedRowOwned as X, listCompleteSchemaFiles as Y, loadAllSchemasFromDb as Z, mergeEasSyncRequestIntents as _, TModelValues as a, parseAddressesPersistedPayload as a0, propertyMachine as a1, publisherInAddressListSql as a2, publisherIsInOwnedSet as a3, readSchema as a4, registerSeedQueryLocalSource as a5, requestEasSyncFromAddressChange as a6, requestEasSyncFromEventBus as a7, requestEasSyncFromModelsInit as a8, sendEasSyncClientRequest as a9, setAdditionalSyncAddresses as aa, setGetPublisherForNewSeeds as ab, setRevokeExecutor as ac, setUploadExecutor as ad, startEasSyncActor as ae, unregisterSeedQueryLocalSource as af, createModelsFromJson as ag, getLatestSchemaVersion as ah, createModelFromJson as ai, ConflictError as aj, unloadEntity as ak, clearDestroySubscriptions as al, setupEntityLiveQuery as am, generateId$1 as an, model as ao, getPropertyData$1 as ap, Item$1 as aq, schema as ar, SEEDPROTOCOL_Seed_Protocol_v1 as as, Model$1 as at, getItemData as b, getEasSchemaUidForModel as c, getLatestPublishedVersionRow as d, getEasSchemaForItemProperty as e, eventEmitter as f, getContentHash as g, generateId as h, getGetAdditionalSyncAddresses as i, ItemProperty as j, getRefValueType as k, importJsonSchema as l, modelPropertiesToObject as m, loadSchemaFromFile as n, readJsonImportFile as o, parseListPropertyValueFromStorage as p, syncSchemaFromSource as q, resolveStorageNameToSchemaName as r, scheduleBulkFilesDownloadFromEasSync as s, transformImportToSchemaFile as t, waitForEntityIdle as u, createReactiveProxy as v, writeProcessMachine as w, findEntity as x, forceRemoveFromCaches as y, runDestroyLifecycle as z };
|
|
16672
|
+
//# sourceMappingURL=index-C1pktvdj.js.map
|