@seedprotocol/sdk 0.6.7 → 0.6.9
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-qV0apdVY.js → BasePathResolver-B6CKqoKw.js} +16 -5
- package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
- package/dist/{ClientManager-Y5EWQuJj.js → ClientManager-ChcmUL47.js} +619 -264
- package/dist/ClientManager-ChcmUL47.js.map +1 -0
- package/dist/{ModelProperty-DuB5nk6A.js → ModelProperty-D79uV42p.js} +33 -30
- package/dist/ModelProperty-D79uV42p.js.map +1 -0
- package/dist/{Schema-BYM-GNdE.js → Schema-a8uO-hIZ.js} +43 -43
- package/dist/Schema-a8uO-hIZ.js.map +1 -0
- package/dist/{SchemaValidationService-Dr6nmwPm.js → SchemaValidationService-Y49vqast.js} +13 -12
- package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js → backfillMetadataPropertyIds-CBsf7LnU.js} +5 -3
- package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
- package/dist/cjs/{ModelProperty-CDTOx5zi.js → ModelProperty-D9FGaGuE.js} +21 -17
- package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
- package/dist/cjs/{Schema-XXcwj3hV.js → Schema-BiJIPLEL.js} +25 -24
- package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-Z7OhtGn5.js → SchemaValidationService-DtYs_CNY.js} +5 -3
- package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
- package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js → backfillMetadataPropertyIds-2XaN3b9S.js} +3 -2
- package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
- package/dist/cjs/{eas-DdI-4vwl.js → eas-CMNppmGE.js} +4 -3
- package/dist/cjs/{eas-DdI-4vwl.js.map → eas-CMNppmGE.js.map} +1 -1
- package/dist/cjs/{getItem-B_2GeTQf.js → getItem-B6jEINjW.js} +3 -2
- package/dist/cjs/{getItem-B_2GeTQf.js.map → getItem-B6jEINjW.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-Jmgi1RUj.js → getPublishPayload-D5DhLGvN.js} +64 -59
- package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
- package/dist/cjs/{getPublishUploads-DNULcrN5.js → getPublishUploads-DMhCCKYF.js} +17 -10
- package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-DK82kjri.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
- package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
- package/dist/cjs/{index-DM1WR83P.js → index-CSNtEnbF.js} +879 -467
- package/dist/cjs/index-CSNtEnbF.js.map +1 -0
- package/dist/cjs/{index-tpO1Nj4v.js → index-DPp9rdRL.js} +6 -3
- package/dist/cjs/index-DPp9rdRL.js.map +1 -0
- package/dist/cjs/{property-DmvgA8FD.js → property-DlKiAWt4.js} +7 -4
- package/dist/cjs/{property-DmvgA8FD.js.map → property-DlKiAWt4.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-3hOoPdu1.js → syncDbWithEas-C6n34o_Q.js} +11 -6
- package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
- package/dist/{configurePlatform-CCYQruij.js → configurePlatform-CE0Vew17.js} +5 -5
- package/dist/{configurePlatform-CCYQruij.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
- package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
- package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
- package/dist/db/drizzle/meta/_journal.json +7 -0
- package/dist/{db-CceyWksv.js → db-WbrzEf7c.js} +254 -35
- package/dist/db-WbrzEf7c.js.map +1 -0
- package/dist/{eas-CH8iFIST.js → eas-CfYCu4IX.js} +6 -6
- package/dist/{eas-CH8iFIST.js.map → eas-CfYCu4IX.js.map} +1 -1
- package/dist/{getItem-C7Mtfz6O.js → getItem-Br-bGNFO.js} +6 -6
- package/dist/{getItem-C7Mtfz6O.js.map → getItem-Br-bGNFO.js.map} +1 -1
- package/dist/{getPublishPayload-2gnnDdMh.js → getPublishPayload-BIrTVUxb.js} +66 -62
- package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
- package/dist/{getPublishUploads-AKISt3JA.js → getPublishUploads-C6cDeZdz.js} +19 -13
- package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
- package/dist/{getSegmentedItemProperties-eIjvhCP_.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
- package/dist/{getSegmentedItemProperties-eIjvhCP_.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
- package/dist/{constants-DSqHBPNe.js → index-280bL-n4.js} +32 -257
- package/dist/index-280bL-n4.js.map +1 -0
- package/dist/{index-CHi212ST.js → index-ClSv5pTA.js} +13 -13
- package/dist/index-ClSv5pTA.js.map +1 -0
- package/dist/{index-CsmiM0RI.js → index-Djd3667v.js} +2 -2
- package/dist/index-Djd3667v.js.map +1 -0
- package/dist/{index-BFpbtEsg.js → index-HRHkbVQd.js} +24 -24
- package/dist/{index-BFpbtEsg.js.map → index-HRHkbVQd.js.map} +1 -1
- package/dist/{index.node-CbWB4MDz.js → index.node-DBtQkEfz.js} +8 -6
- package/dist/index.node-DBtQkEfz.js.map +1 -0
- package/dist/main.cjs +6 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +36 -38
- package/dist/main.js.map +1 -1
- package/dist/node.js +15 -14
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +108 -46
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +4 -3
- package/dist/platform.node.js.map +1 -1
- package/dist/{property-CWKcZ5YZ.js → property-CQjuZ4JW.js} +14 -13
- package/dist/property-CQjuZ4JW.js.map +1 -0
- package/dist/seedSchema/PublishProcessSchema.ts +1 -0
- package/dist/src/Item/Item.d.ts +6 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
- package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/EasClient.d.ts +2 -1
- package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +4 -0
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
- package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +8 -0
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +6 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
- package/dist/src/helpers/localDbChain.d.ts +22 -0
- package/dist/src/helpers/localDbChain.d.ts.map +1 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/property/index.d.ts +12 -0
- package/dist/src/helpers/property/index.d.ts.map +1 -1
- package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
- package/dist/src/helpers/relationSeedRef.d.ts +8 -0
- package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
- package/dist/src/index.d.ts +9 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/easLodashHook.d.ts +2 -0
- package/dist/src/node/easLodashHook.d.ts.map +1 -0
- package/dist/src/node/easLodashRegister.d.ts +2 -0
- package/dist/src/node/easLodashRegister.d.ts.map +1 -0
- package/dist/src/node/helpers/FileManager.d.ts +2 -1
- package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +2 -1
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
- package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +4 -0
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +15 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-5kZneTEL.js → syncDbWithEas-CuARXfyN.js} +16 -12
- package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
- package/dist/{updateSeedRevokedAt-CgfOBtqJ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
- package/dist/{updateSeedRevokedAt-CgfOBtqJ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
- package/package.json +11 -7
- package/src/node/easLodashHook.js +22 -0
- package/src/node/easLodashRegister.js +13 -0
- package/dist/BasePathResolver-qV0apdVY.js.map +0 -1
- package/dist/ClientManager-Y5EWQuJj.js.map +0 -1
- package/dist/ModelProperty-DuB5nk6A.js.map +0 -1
- package/dist/Schema-BYM-GNdE.js.map +0 -1
- package/dist/SchemaValidationService-Dr6nmwPm.js.map +0 -1
- package/dist/cjs/ModelProperty-CDTOx5zi.js.map +0 -1
- package/dist/cjs/Schema-XXcwj3hV.js.map +0 -1
- package/dist/cjs/SchemaValidationService-Z7OhtGn5.js.map +0 -1
- package/dist/cjs/getPublishPayload-Jmgi1RUj.js.map +0 -1
- package/dist/cjs/getPublishUploads-DNULcrN5.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-DK82kjri.js.map +0 -1
- package/dist/cjs/index-DM1WR83P.js.map +0 -1
- package/dist/cjs/index-tpO1Nj4v.js.map +0 -1
- package/dist/cjs/syncDbWithEas-3hOoPdu1.js.map +0 -1
- package/dist/constants-DSqHBPNe.js.map +0 -1
- package/dist/db-CceyWksv.js.map +0 -1
- package/dist/getPublishPayload-2gnnDdMh.js.map +0 -1
- package/dist/getPublishUploads-AKISt3JA.js.map +0 -1
- package/dist/index-CHi212ST.js.map +0 -1
- package/dist/index-CsmiM0RI.js.map +0 -1
- package/dist/index.node-CbWB4MDz.js.map +0 -1
- package/dist/property-CWKcZ5YZ.js.map +0 -1
- package/dist/seedSchema/AppStateSchema.d.ts +0 -82
- package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
- package/dist/seedSchema/ConfigSchema.d.ts +0 -101
- package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
- package/dist/seedSchema/MetadataSchema.d.ts +0 -422
- package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchema.d.ts +0 -243
- package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
- package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
- package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
- package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/SchemaSchema.d.ts +0 -169
- package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/SeedSchema.d.ts +0 -192
- package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
- package/dist/seedSchema/VersionSchema.d.ts +0 -194
- package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
- package/dist/seedSchema/index.d.ts +0 -14
- package/dist/seedSchema/index.d.ts.map +0 -1
- package/dist/syncDbWithEas-5kZneTEL.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { getItemVersionsFromEas, BaseQueryClient, BaseEasClient, GET_SCHEMAS } from '@seedprotocol/eas';
|
|
2
2
|
export { PUBLISHED_BY_SCHEMA_DEF, PUBLISHED_BY_SCHEMA_NAME, decodePublishedByData, getCanonicalItemPropertiesFromEas, getEasSchemaUidBySchemaName, getItemPropertiesFromEas, getItemVersionsFromEas, getPublishedByFromEas, getSeedUidsBySchemaName, getSeedsBySchemaName, getSeedsFromSchemaUids, hashPublishedByBatch, verifyPublishedByBatch } from '@seedprotocol/eas';
|
|
3
|
-
import { t as toSnakeCase } from './
|
|
3
|
+
import { t as toSnakeCase } from './index-280bL-n4.js';
|
|
4
4
|
import 'debug';
|
|
5
|
-
import './BasePathResolver-
|
|
5
|
+
import './BasePathResolver-B6CKqoKw.js';
|
|
6
6
|
import 'drizzle-orm/sqlite-core';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import '@seedprotocol/arweave';
|
|
9
9
|
import 'xstate';
|
|
10
10
|
import 'pluralize';
|
|
11
|
-
import '
|
|
12
|
-
import './db-CceyWksv.js';
|
|
11
|
+
import './db-WbrzEf7c.js';
|
|
13
12
|
import 'drizzle-orm/casing';
|
|
14
13
|
import 'lodash-es';
|
|
14
|
+
import '@sinclair/typebox';
|
|
15
15
|
import 'nanoid';
|
|
16
16
|
import 'nanoid-dictionary';
|
|
17
17
|
import '@seedprotocol/query';
|
|
@@ -20,7 +20,7 @@ import '@seedprotocol/query';
|
|
|
20
20
|
const getModelSchemasFromEas = async () => {
|
|
21
21
|
const queryClient = BaseQueryClient.getQueryClient();
|
|
22
22
|
const easClient = BaseEasClient.getEasClient();
|
|
23
|
-
const _mod_0 = await import('./index-
|
|
23
|
+
const _mod_0 = await import('./index-HRHkbVQd.js');
|
|
24
24
|
const _ns_0 = _mod_0.b;
|
|
25
25
|
const modelMod = _ns_0;
|
|
26
26
|
const { Model } = modelMod;
|
|
@@ -69,4 +69,4 @@ const getModelSchemasFromEas = async () => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export { getModelSchemasFromEas };
|
|
72
|
-
//# sourceMappingURL=eas-
|
|
72
|
+
//# sourceMappingURL=eas-CfYCu4IX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eas-
|
|
1
|
+
{"version":3,"file":"eas-CfYCu4IX.js","sources":["../../src/eas.ts"],"sourcesContent":["export {\n getItemVersionsFromEas,\n getItemPropertiesFromEas,\n getCanonicalItemPropertiesFromEas,\n getEasSchemaUidBySchemaName,\n getSeedsFromSchemaUids,\n getSeedsBySchemaName,\n getSeedUidsBySchemaName,\n getPublishedByFromEas,\n decodePublishedByData,\n hashPublishedByBatch,\n verifyPublishedByBatch,\n PUBLISHED_BY_SCHEMA_DEF,\n PUBLISHED_BY_SCHEMA_NAME,\n} from '@seedprotocol/eas'\nexport type {\n Attestation,\n EASSchema,\n PublishedByDecoded,\n GetPublishedByFromEasParams,\n} from '@seedprotocol/eas'\n\nimport { toSnakeCase } from '@/helpers'\nimport { withExcludeRevokedFilter } from '@seedprotocol/eas'\nimport { BaseEasClient } from '@seedprotocol/eas'\nimport { BaseQueryClient } from '@seedprotocol/eas'\nimport { GET_SCHEMAS } from '@seedprotocol/eas'\nimport type { EASSchema } from '@seedprotocol/eas'\n\ntype GetModelSchemasFromEas = () => Promise<EASSchema[]>\n\n/** Stays in SDK: depends on local Model registry. */\nexport const getModelSchemasFromEas: GetModelSchemasFromEas = async () => {\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const modelMod = await import('./Model/Model')\n const { Model } = modelMod\n const allModels = await Model.all()\n const modelNames = allModels.map((m) => m.modelName).filter((name): name is string => !!name)\n\n if (modelNames.length === 0) {\n return []\n }\n\n const OR: Record<string, unknown>[] = []\n const hasImageModel = modelNames.includes('Image')\n\n for (const modelName of modelNames) {\n const snake = toSnakeCase(modelName)\n OR.push({\n schema: {\n equals: `bytes32 ${snake}`,\n },\n })\n const altSchema = `bytes32 ${modelName}`\n if (altSchema !== `bytes32 ${snake}`) {\n OR.push({\n schema: {\n equals: altSchema,\n },\n })\n }\n }\n\n if (hasImageModel) {\n OR.push({\n schema: {\n equals: `bytes32 image`,\n },\n })\n }\n\n const modelSchemas = await queryClient.fetchQuery({\n queryKey: [`getSchemasAllModels`],\n queryFn: async () =>\n easClient.request(GET_SCHEMAS, {\n where: {\n OR,\n },\n }),\n })\n\n if (!modelSchemas?.schemas?.length) {\n return []\n }\n\n return modelSchemas.schemas as EASSchema[]\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,GAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW;AACvE,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,cAAc,CAAA,CAAE;AACpD,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,YAAY,CAAA,CAAE;AAE9C;AAAA;A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Y,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB;AAC5C,CAAA;;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as getItemData, I as Item } from './ClientManager-
|
|
1
|
+
import { a as getItemData, I as Item } from './ClientManager-ChcmUL47.js';
|
|
2
2
|
import { startCase } from 'lodash-es';
|
|
3
3
|
import 'debug';
|
|
4
4
|
import 'xstate';
|
|
5
|
-
import './db-
|
|
6
|
-
import './BasePathResolver-
|
|
5
|
+
import './db-WbrzEf7c.js';
|
|
6
|
+
import './BasePathResolver-B6CKqoKw.js';
|
|
7
7
|
import 'drizzle-orm/sqlite-core';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import '@seedprotocol/arweave';
|
|
10
10
|
import 'drizzle-orm/casing';
|
|
11
|
-
import './constants-DSqHBPNe.js';
|
|
12
|
-
import '@seedprotocol/eas';
|
|
13
11
|
import 'pluralize';
|
|
14
12
|
import '@sinclair/typebox';
|
|
13
|
+
import './index-280bL-n4.js';
|
|
14
|
+
import '@seedprotocol/eas';
|
|
15
15
|
import 'nanoid';
|
|
16
16
|
import 'nanoid-dictionary';
|
|
17
17
|
import '@seedprotocol/query';
|
|
@@ -44,4 +44,4 @@ const getItem = async ({ modelName, seedLocalId, seedUid }) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export { getItem };
|
|
47
|
-
//# sourceMappingURL=getItem-
|
|
47
|
+
//# sourceMappingURL=getItem-Br-bGNFO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getItem-
|
|
1
|
+
{"version":3,"file":"getItem-Br-bGNFO.js","sources":["../../src/db/read/getItem.ts"],"sourcesContent":["import { getItemData } from './getItemData'\nimport { GetItem } from '@/types'\nimport { Item } from '@/Item/Item'\nimport { startCase } from 'lodash-es'\n\nexport const getItem: GetItem = async ({ modelName, seedLocalId, seedUid }) => {\n const itemInitObj = await getItemData({\n modelName,\n seedLocalId,\n seedUid,\n })\n\n if (!itemInitObj) {\n console.error(\n `[db/queries] [getItem] no itemInitObj modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.seedLocalId) {\n console.error(\n `[db/queries] [getItem] no itemInitObj.seedLocalId modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.modelName && itemInitObj.type) {\n itemInitObj.modelName = startCase(itemInitObj.type)\n }\n\n // DB + loadOrCreateItem + concurrent property saves (e.g. during publish) can exceed the default 5s idle wait.\n const getItemReadyTimeoutMs = 120_000\n return Item.create(itemInitObj, { readyTimeout: getItemReadyTimeoutMs })\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,OAAO,GAAY,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,KAAI;AAC5E,IAAA,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC;QACpC,SAAS;QACT,WAAW;QACX,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,CAAC,KAAK,CACX,CAAA,iDAAA,EAAoD,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAChH;QACD;IACF;AAEA,IAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;QAC5B,OAAO,CAAC,KAAK,CACX,CAAA,6DAAA,EAAgE,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAC5H;QACD;IACF;IAEA,IAAI,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,IAAI,EAAE;QAC9C,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD;;IAGA,MAAM,qBAAqB,GAAG,MAAO;AACrC,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAC1E;;"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Z as ZERO_BYTES32, a as BaseDb, m as models, p as properties, V as
|
|
1
|
+
import { Z as ZERO_BYTES32, a as BaseDb, m as models, p as properties, V as VERSION_SCHEMA_UID, h as htmlEmbeddedImageCoPublish, I as INTERNAL_PROPERTY_NAMES, w as defaultAttestationData, x as INTERNAL_DATA_TYPES } from './BasePathResolver-B6CKqoKw.js';
|
|
2
2
|
import { SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
3
|
-
import {
|
|
4
|
-
import { M as ModelPropertyDataTypes, r as resolveSeedIdsFromRefString, k as normalizeRelationPropertyValue, l as getCorrectId, n as normalizeDataType, t as toSnakeCase$1 } from './constants-DSqHBPNe.js';
|
|
3
|
+
import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef, g as getCorrectId, a as isStorageSeedRef, t as toSnakeCase$1 } from './index-280bL-n4.js';
|
|
5
4
|
import { toSnakeCase } from 'drizzle-orm/casing';
|
|
6
|
-
import
|
|
5
|
+
import { b as getEasSchemaUidForModel, c as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, l as listRelationEasPropertyName } from './ClientManager-ChcmUL47.js';
|
|
7
6
|
import { isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
|
|
8
|
-
import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-
|
|
9
|
-
import { getPropertySchema } from './property-
|
|
7
|
+
import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-BmKE71vU.js';
|
|
8
|
+
import { getPropertySchema } from './property-CQjuZ4JW.js';
|
|
10
9
|
import { modelPropertiesToObject } from './model-DGMe-TTm.js';
|
|
11
10
|
import { upperFirst, camelCase } from 'lodash-es';
|
|
12
|
-
import { eq, and } from 'drizzle-orm';
|
|
11
|
+
import { eq, and, sql } from 'drizzle-orm';
|
|
13
12
|
import debug from 'debug';
|
|
14
13
|
import '@noble/hashes/sha3';
|
|
15
14
|
import '@noble/hashes/utils';
|
|
16
15
|
import 'reflect-metadata';
|
|
17
|
-
import './index-
|
|
16
|
+
import './index-HRHkbVQd.js';
|
|
17
|
+
import { M as ModelPropertyDataTypes, n as normalizeDataType } from './db-WbrzEf7c.js';
|
|
18
18
|
import 'drizzle-orm/sqlite-core';
|
|
19
19
|
import '@seedprotocol/arweave';
|
|
20
20
|
import 'xstate';
|
|
21
|
-
import '
|
|
22
|
-
import './generateId-BopUwD8F.js';
|
|
21
|
+
import 'pluralize';
|
|
23
22
|
import 'nanoid';
|
|
24
23
|
import 'nanoid-dictionary';
|
|
25
24
|
import '@seedprotocol/query';
|
|
25
|
+
import './generateId-BopUwD8F.js';
|
|
26
26
|
import 'rxjs';
|
|
27
27
|
import '@sinclair/typebox';
|
|
28
28
|
|
|
@@ -44,8 +44,17 @@ debug('seedSdk:db:getPublishPayload');
|
|
|
44
44
|
/** Case-insensitive dataType match (schema JSON may use "text" vs "Text"). */
|
|
45
45
|
const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
|
|
46
46
|
function addValidationError(ctx, message, field, code = 'publish_validation') {
|
|
47
|
+
// A property can be validated on more than one path (List of Relation: list + basic); report once.
|
|
48
|
+
if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
|
|
49
|
+
return;
|
|
47
50
|
ctx.errors.push({ field: field ?? '', message, code });
|
|
48
51
|
}
|
|
52
|
+
/** File/Image/Html value is raw content instead of a storage seed id, so it was never saved/uploaded. */
|
|
53
|
+
function addStorageValueNotSavedError(ctx, propertyName, dataType, value) {
|
|
54
|
+
addValidationError(ctx, `Invalid value for property: ${propertyName}. Expected a storage seed id ` +
|
|
55
|
+
`(${normalizeDataType(dataType)} content must be saved through the property before publishing), ` +
|
|
56
|
+
`got ${value.length > 40 ? `${value.slice(0, 40)}…` : value}.`, propertyName, 'publish_storage_value_not_saved');
|
|
57
|
+
}
|
|
49
58
|
function isStorageTransactionPropertyName(name) {
|
|
50
59
|
return name === 'storageTransactionId' || name === 'storage_transaction_id';
|
|
51
60
|
}
|
|
@@ -115,7 +124,7 @@ async function resolveVersionUid(seedLocalId, seedUid) {
|
|
|
115
124
|
if (published?.uid)
|
|
116
125
|
return published.uid;
|
|
117
126
|
try {
|
|
118
|
-
const { getItemVersionsFromEas } = await import('./eas-
|
|
127
|
+
const { getItemVersionsFromEas } = await import('./eas-CfYCu4IX.js');
|
|
119
128
|
const attestations = await getItemVersionsFromEas({ seedUids: [seedUid] });
|
|
120
129
|
const latest = attestations?.[0];
|
|
121
130
|
if (latest?.id)
|
|
@@ -139,35 +148,25 @@ const getPropertyData = async (itemProperty, ctx) => {
|
|
|
139
148
|
}
|
|
140
149
|
return null;
|
|
141
150
|
}
|
|
142
|
-
let schemaUid = itemProperty.schemaUid;
|
|
143
151
|
const ip = itemProperty;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
!(ip.storagePropertyName && ip.storagePropertyName.length > 0)) {
|
|
152
|
-
const ref = propertyDefForName?.ref ?? propertyDefForName?.refModelName;
|
|
153
|
-
if (ref) {
|
|
154
|
-
const singular = pluralize.singular(itemProperty.propertyName);
|
|
155
|
-
nameForEas = `${singular}${ref}Ids`;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
152
|
+
// List of Relation: the EAS name always comes from the property definition (authors → authorIdentityIds),
|
|
153
|
+
// never from whatever name the ItemProperty was constructed with or a cached schemaUid.
|
|
154
|
+
const listRelationName = listRelationEasPropertyName(itemProperty.propertyName, itemProperty.propertyDef);
|
|
155
|
+
const nameForEas = listRelationName ??
|
|
156
|
+
(ip.storagePropertyName && ip.storagePropertyName.length > 0
|
|
157
|
+
? ip.storagePropertyName
|
|
158
|
+
: itemProperty.propertyName);
|
|
158
159
|
const propertyNameForSchema = toSnakeCase$1(nameForEas);
|
|
159
160
|
const schemaDef = `${easDataType} ${propertyNameForSchema}`;
|
|
161
|
+
let schemaUid = listRelationName ? undefined : itemProperty.schemaUid;
|
|
160
162
|
if (!schemaUid) {
|
|
161
163
|
schemaUid = await getEasSchemaUidForSchemaDefinition({ schemaText: schemaDef });
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
});
|
|
167
|
-
if (schema) {
|
|
168
|
-
schemaUid = schema.id;
|
|
169
|
-
}
|
|
164
|
+
}
|
|
165
|
+
if (!schemaUid) {
|
|
166
|
+
if (ctx) {
|
|
167
|
+
addValidationError(ctx, `EAS schema not found for "${schemaDef}" (property: ${itemProperty.propertyName}). Register it before publishing (ensureEasSchemasForItem).`, itemProperty.propertyName, 'publish_schema_not_found');
|
|
170
168
|
}
|
|
169
|
+
return null;
|
|
171
170
|
}
|
|
172
171
|
return {
|
|
173
172
|
schemaUid,
|
|
@@ -190,7 +189,7 @@ const ensurePropertyDefs = async (targetItem) => {
|
|
|
190
189
|
schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName);
|
|
191
190
|
if (!schema) {
|
|
192
191
|
try {
|
|
193
|
-
const _mod_0 = await import('./index-
|
|
192
|
+
const _mod_0 = await import('./index-HRHkbVQd.js');
|
|
194
193
|
const _ns_0 = _mod_0.b;
|
|
195
194
|
const { Model } = _ns_0;
|
|
196
195
|
const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
|
|
@@ -318,6 +317,14 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
318
317
|
continue;
|
|
319
318
|
}
|
|
320
319
|
}
|
|
320
|
+
// File/Image/Html values must be a storage seed id by now. Raw content means the property's
|
|
321
|
+
// save pipeline never ran or failed (e.g. createNewItem with raw html), so it was never uploaded.
|
|
322
|
+
// Relation/image properties are appended to the basic list after processRelationOrImageProperty,
|
|
323
|
+
// so this one check covers both paths.
|
|
324
|
+
if (isFileImageHtml && typeof value === 'string' && !isStorageSeedRef(value)) {
|
|
325
|
+
addStorageValueNotSavedError(ctx, basicProperty.propertyName, propertyDef?.dataType, value);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
321
328
|
const propertyData = await getPropertyData(basicProperty, ctx);
|
|
322
329
|
if (!propertyData)
|
|
323
330
|
continue;
|
|
@@ -349,7 +356,7 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
349
356
|
}
|
|
350
357
|
// Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
|
|
351
358
|
if (propertyDef?.validation) {
|
|
352
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
359
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-Y49vqast.js');
|
|
353
360
|
const validationService = new SchemaValidationService();
|
|
354
361
|
const validationResult = validationService.validatePropertyValue(value, normalizeDataType(propertyDef.dataType), propertyDef.validation, propertyDef.refValueType
|
|
355
362
|
? normalizeDataType(propertyDef.refValueType)
|
|
@@ -489,8 +496,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
489
496
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Html) ||
|
|
490
497
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Json)));
|
|
491
498
|
if (isStorageSeed && (context.seedLocalId || context.seedUid)) {
|
|
492
|
-
const _mod_1 = await import('./ClientManager-
|
|
493
|
-
const _ns_1 = _mod_1.
|
|
499
|
+
const _mod_1 = await import('./ClientManager-ChcmUL47.js');
|
|
500
|
+
const _ns_1 = _mod_1.al;
|
|
494
501
|
const { getPropertyData: getPropertyDataFromDb } = _ns_1;
|
|
495
502
|
const metaRow = await getPropertyDataFromDb({
|
|
496
503
|
propertyName: relationOrImageProperty.propertyName,
|
|
@@ -577,7 +584,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
577
584
|
return multiPublishPayload;
|
|
578
585
|
}
|
|
579
586
|
// Use dynamic import to break circular dependency
|
|
580
|
-
const getItemMod = await import('./getItem-
|
|
587
|
+
const getItemMod = await import('./getItem-Br-bGNFO.js');
|
|
581
588
|
const { getItem } = getItemMod;
|
|
582
589
|
const relatedItem = await getItem({
|
|
583
590
|
seedLocalId,
|
|
@@ -585,7 +592,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
585
592
|
});
|
|
586
593
|
// When related item not found (e.g. different DB, not yet created)
|
|
587
594
|
if (!relatedItem) {
|
|
588
|
-
|
|
595
|
+
// An attested uid with no local copy is already published; the parent attests the uid as-is.
|
|
596
|
+
if (isRequired && !isPublishedSeedRef(normalizedRef)) {
|
|
589
597
|
addValidationError(ctx, `No related item found for required relation: ${relationOrImageProperty.propertyName}. ` +
|
|
590
598
|
`Value: ${JSON.stringify(value)} (seedLocalId/seedUid). ` +
|
|
591
599
|
`The related item may be missing, in a different database, or the reference may be broken.`, relationOrImageProperty.propertyName);
|
|
@@ -626,7 +634,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
626
634
|
let publishPayload = {
|
|
627
635
|
localId: relatedItem.seedLocalId,
|
|
628
636
|
seedIsRevocable: true,
|
|
629
|
-
versionSchemaUid:
|
|
637
|
+
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
630
638
|
seedUid: seedUid || ZERO_BYTES32,
|
|
631
639
|
seedSchemaUid,
|
|
632
640
|
versionUid,
|
|
@@ -703,7 +711,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
703
711
|
if (rows.length === 0)
|
|
704
712
|
return multiPublishPayload;
|
|
705
713
|
const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
|
|
706
|
-
const getItemMod = await import('./getItem-
|
|
714
|
+
const getItemMod = await import('./getItem-Br-bGNFO.js');
|
|
707
715
|
const { getItem } = getItemMod;
|
|
708
716
|
const doneImages = new Set();
|
|
709
717
|
for (const row of rows) {
|
|
@@ -733,7 +741,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
733
741
|
let publishPayload = {
|
|
734
742
|
localId: relatedItem.seedLocalId,
|
|
735
743
|
seedIsRevocable: true,
|
|
736
|
-
versionSchemaUid:
|
|
744
|
+
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
737
745
|
seedUid: relatedItem.seedUid || ZERO_BYTES32,
|
|
738
746
|
seedSchemaUid,
|
|
739
747
|
versionUid,
|
|
@@ -785,17 +793,6 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
785
793
|
addValidationError(ctx, `processListProperty requires ref (list of relations). List property "${listProperty.propertyName}" has no ref. List-of-primitives should be in itemBasicProperties.`, listProperty.propertyName);
|
|
786
794
|
return multiPublishPayload;
|
|
787
795
|
}
|
|
788
|
-
let listPropertySchemaUid = listProperty.schemaUid;
|
|
789
|
-
if (!listPropertySchemaUid && listProperty.propertyDef) {
|
|
790
|
-
const propertyData = await getPropertyData(listProperty, ctx);
|
|
791
|
-
if (!propertyData)
|
|
792
|
-
return multiPublishPayload;
|
|
793
|
-
listPropertySchemaUid = propertyData.schemaUid;
|
|
794
|
-
}
|
|
795
|
-
if (!listPropertySchemaUid) {
|
|
796
|
-
addValidationError(ctx, `Schema uid not found for list property: ${listProperty.propertyName}`, listProperty.propertyName);
|
|
797
|
-
return multiPublishPayload;
|
|
798
|
-
}
|
|
799
796
|
const snapshot = listProperty.getService().getSnapshot();
|
|
800
797
|
const context = 'context' in snapshot ? snapshot.context : null;
|
|
801
798
|
if (!context) {
|
|
@@ -808,8 +805,12 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
808
805
|
if (listProperty.uid && !forceFullSnapshot) {
|
|
809
806
|
return multiPublishPayload;
|
|
810
807
|
}
|
|
811
|
-
|
|
812
|
-
|
|
808
|
+
// Always resolve from the property definition; a cached schemaUid may point at a schema
|
|
809
|
+
// registered under the schema key (bytes32[] authors) instead of authorIdentityIds.
|
|
810
|
+
const propertyData = await getPropertyData(listProperty, ctx);
|
|
811
|
+
if (!propertyData)
|
|
812
|
+
return multiPublishPayload;
|
|
813
|
+
const listPropertySchemaUid = propertyData.schemaUid;
|
|
813
814
|
if (typeof value === 'string') {
|
|
814
815
|
value = parseListPropertyValueFromStorage(value);
|
|
815
816
|
}
|
|
@@ -830,14 +831,17 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
830
831
|
if (!seedLocalId && !seedUid)
|
|
831
832
|
continue;
|
|
832
833
|
// Use dynamic import to break circular dependency
|
|
833
|
-
const getItemMod = await import('./getItem-
|
|
834
|
+
const getItemMod = await import('./getItem-Br-bGNFO.js');
|
|
834
835
|
const { getItem } = getItemMod;
|
|
835
836
|
const relatedItem = await getItem({
|
|
836
837
|
seedLocalId,
|
|
837
838
|
seedUid,
|
|
838
839
|
});
|
|
839
840
|
if (!relatedItem) {
|
|
840
|
-
|
|
841
|
+
// An attested uid with no local copy is already published; the list attests the uid as-is.
|
|
842
|
+
if (!isPublishedSeedRef(idStr)) {
|
|
843
|
+
console.error(`No related item found for list property: ${listProperty.propertyName}`);
|
|
844
|
+
}
|
|
841
845
|
continue;
|
|
842
846
|
}
|
|
843
847
|
if (relatedItem.seedUid && relatedItem.seedUid !== ZERO_BYTES32) {
|
|
@@ -873,7 +877,7 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
873
877
|
let publishPayload = {
|
|
874
878
|
localId: relatedItem.seedLocalId,
|
|
875
879
|
seedIsRevocable: true,
|
|
876
|
-
versionSchemaUid:
|
|
880
|
+
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
877
881
|
seedUid: seedUid || ZERO_BYTES32,
|
|
878
882
|
seedSchemaUid,
|
|
879
883
|
versionUid,
|
|
@@ -1065,7 +1069,7 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1065
1069
|
seedUid: item.seedUid || ZERO_BYTES32,
|
|
1066
1070
|
seedIsRevocable: true,
|
|
1067
1071
|
seedSchemaUid: itemSchemaUid,
|
|
1068
|
-
versionSchemaUid:
|
|
1072
|
+
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
1069
1073
|
versionUid,
|
|
1070
1074
|
listOfAttestations: [],
|
|
1071
1075
|
propertiesToUpdate: [],
|
|
@@ -1093,7 +1097,7 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1093
1097
|
const propRows = await BaseDb.getAppDb()
|
|
1094
1098
|
.select({ required: properties.required, refModelId: properties.refModelId })
|
|
1095
1099
|
.from(properties)
|
|
1096
|
-
.where(and(eq(properties.modelId, modelRows[0].id), eq(properties.name, relProp.propertyName),
|
|
1100
|
+
.where(and(eq(properties.modelId, modelRows[0].id), eq(properties.name, relProp.propertyName), sql `lower(${properties.dataType}) = 'relation'`))
|
|
1097
1101
|
.limit(1);
|
|
1098
1102
|
if (propRows.length > 0 && (propRows[0].required === true || propRows[0].required === 1)) {
|
|
1099
1103
|
isRequired = true;
|
|
@@ -1437,4 +1441,4 @@ const resolvePublishPayloadValues = async (multiPayload, resolvedUids) => {
|
|
|
1437
1441
|
};
|
|
1438
1442
|
|
|
1439
1443
|
export { PublishValidationFailedError, getPublishPayload, resolvePublishPayloadValues, validateItemForPublish };
|
|
1440
|
-
//# sourceMappingURL=getPublishPayload-
|
|
1444
|
+
//# sourceMappingURL=getPublishPayload-BIrTVUxb.js.map
|