@webiny/api-headless-cms 6.4.12-beta.5 → 6.5.0-beta.1
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/crud/contentEntry/entryDataValidation.d.ts +1 -1
- package/crud/contentEntry/entryDataValidation.js +33 -18
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry.crud.js +12 -39
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/defaultFields.js +3 -2
- package/crud/contentModel/defaultFields.js.map +1 -1
- package/crud/contentModel/validate/endingAllowed.js +1 -1
- package/crud/contentModel/validate/endingAllowed.js.map +1 -1
- package/crud/contentModel/validate/pluralApiName.js +1 -1
- package/crud/contentModel/validate/pluralApiName.js.map +1 -1
- package/crud/contentModel/validate/singularApiName.js +1 -1
- package/crud/contentModel/validate/singularApiName.js.map +1 -1
- package/crud/contentModel/validation.js +2 -2
- package/crud/contentModel/validation.js.map +1 -1
- package/domain/contentModel/schemas.d.ts +4 -0
- package/domain/contentModel/schemas.js +5 -2
- package/domain/contentModel/schemas.js.map +1 -1
- package/domain/contentModel/validation/endingAllowed.js +1 -1
- package/domain/contentModel/validation/endingAllowed.js.map +1 -1
- package/domain/contentModel/validation/pluralApiName.js +1 -1
- package/domain/contentModel/validation/pluralApiName.js.map +1 -1
- package/domain/contentModel/validation/singularApiName.js +1 -1
- package/domain/contentModel/validation/singularApiName.js.map +1 -1
- package/export/crud/exporting.js +2 -2
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/imports/importGroups.js +2 -1
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/validateModels.js +1 -1
- package/export/crud/imports/validateModels.js.map +1 -1
- package/exports/api/cms/model.d.ts +4 -1
- package/exports/api/cms/model.js +2 -0
- package/extension.d.ts +3 -0
- package/extension.js +19 -0
- package/extension.js.map +1 -0
- package/features/contentEntry/ContentEntriesFeature.js +2 -0
- package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +1 -2
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +1 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +4 -12
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +1 -0
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
- package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js +1 -3
- package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +1 -3
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +4 -10
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +3 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +3 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +3 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.d.ts +14 -0
- package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.js +34 -0
- package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.js.map +1 -0
- package/features/contentEntry/UpdateRevision/abstractions.d.ts +10 -0
- package/features/contentEntry/UpdateRevision/abstractions.js +5 -0
- package/features/contentEntry/UpdateRevision/abstractions.js.map +1 -0
- package/features/contentEntry/UpdateRevision/feature.d.ts +4 -0
- package/features/contentEntry/UpdateRevision/feature.js +11 -0
- package/features/contentEntry/UpdateRevision/feature.js.map +1 -0
- package/features/contentEntry/UpdateRevision/index.d.ts +1 -0
- package/features/contentEntry/UpdateRevision/index.js +1 -0
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
- package/features/contentEntry/ensureItemIds.d.ts +13 -0
- package/features/contentEntry/ensureItemIds.js +22 -0
- package/features/contentEntry/ensureItemIds.js.map +1 -0
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +9 -3
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +7 -5
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +48 -18
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +22 -16
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +17 -13
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +6 -6
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +17 -18
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +7 -3
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +73 -30
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/expiresAt.js +2 -2
- package/features/contentEntry/entryDataFactories/expiresAt.js.map +1 -1
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
- package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
- package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
- package/features/contentModel/ComponentMapGenerator/index.js +2 -0
- package/features/contentModel/ContentModelFeature.js +6 -0
- package/features/contentModel/ContentModelFeature.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.js +2 -1
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +2 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
- package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
- package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
- package/features/contentModel/RefModelsGenerator/feature.js +11 -0
- package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
- package/features/contentModel/RefModelsGenerator/index.js +2 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.d.ts +16 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +54 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.d.ts +8 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.js +5 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.d.ts +4 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.js +11 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/index.d.ts +1 -0
- package/features/contentModel/ValuesSelectionGenerator/index.js +1 -0
- package/features/graphql/feature.js +2 -0
- package/features/graphql/feature.js.map +1 -1
- package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/AssetToGraphQL.js +153 -0
- package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js +12 -2
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/ObjectToGraphQL.js +8 -5
- package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
- package/features/modelBuilder/abstractions.d.ts +9 -0
- package/features/modelBuilder/abstractions.js.map +1 -1
- package/features/modelBuilder/feature.js +2 -0
- package/features/modelBuilder/feature.js.map +1 -1
- package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
- package/features/modelBuilder/fields/AssetFieldType.js +46 -0
- package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
- package/features/modelBuilder/fields/DataFieldBuilder.d.ts +62 -18
- package/features/modelBuilder/fields/DataFieldBuilder.js +8 -0
- package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
- package/features/modelBuilder/fields/DynamicZoneFieldType.js +2 -6
- package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
- package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
- package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
- package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
- package/features/modelBuilder/index.d.ts +1 -1
- package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
- package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
- package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/PrivateModelBuilder.js +2 -1
- package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
- package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
- package/features/sortMapper/SortMapper.js +2 -5
- package/features/sortMapper/SortMapper.js.map +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js.map +1 -1
- package/features/storage/fields/DateStorageTransform.js +4 -3
- package/features/storage/fields/DateStorageTransform.js.map +1 -1
- package/features/storage/fields/DynamicZoneStorageTransform.js +2 -2
- package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -1
- package/features/storage/fields/JsonStorageTransform.js +1 -1
- package/features/storage/fields/JsonStorageTransform.js.map +1 -1
- package/features/storage/fields/LongTextStorageTransform.js +1 -1
- package/features/storage/fields/LongTextStorageTransform.js.map +1 -1
- package/features/storage/fields/ObjectStorageTransform.js +27 -7
- package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
- package/features/storage/fields/RichTextStorageTransform.js +1 -1
- package/features/storage/fields/RichTextStorageTransform.js.map +1 -1
- package/features/validation/validators/DateGteValidator.js +1 -1
- package/features/validation/validators/DateGteValidator.js.map +1 -1
- package/features/validation/validators/DateLteValidator.js +1 -1
- package/features/validation/validators/DateLteValidator.js.map +1 -1
- package/features/validation/validators/PatternValidator.js +1 -1
- package/features/validation/validators/PatternValidator.js.map +1 -1
- package/features/whereMapper/WhereMapper.js +10 -7
- package/features/whereMapper/WhereMapper.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +8 -2
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/index.d.ts +1 -1
- package/graphql/getSchema/generateCacheKey.js +1 -1
- package/graphql/getSchema/generateCacheKey.js.map +1 -1
- package/graphql/scalars/RevisionId.js +1 -1
- package/graphql/scalars/RevisionId.js.map +1 -1
- package/graphql/schema/baseSchema.js +5 -25
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/cms/getEntryResolver.js +3 -2
- package/graphql/schema/cms/getEntryResolver.js.map +1 -1
- package/graphql/schema/cms/getModelResolver.d.ts +35 -0
- package/graphql/schema/cms/getModelResolver.js +49 -0
- package/graphql/schema/cms/getModelResolver.js.map +1 -0
- package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
- package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
- package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
- package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
- package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
- package/graphql/schema/cms/helpers/index.d.ts +1 -0
- package/graphql/schema/cms/helpers/index.js +1 -0
- package/graphql/schema/cms/helpers.d.ts +1 -0
- package/graphql/schema/cms/helpers.js +1 -0
- package/graphql/schema/cms/index.js +2 -1
- package/graphql/schema/cms/index.js.map +1 -1
- package/graphql/schema/cms/listEntriesResolver.js +3 -2
- package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
- package/graphql/schema/cms/resolvers/getModel.d.ts +8 -0
- package/graphql/schema/cms/resolvers/getModel.js +18 -0
- package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
- package/graphql/schema/cms/resolvers/index.d.ts +1 -0
- package/graphql/schema/cms/resolvers/index.js +1 -0
- package/graphql/schema/cms/typeDefs/query.js +1 -0
- package/graphql/schema/cms/typeDefs/query.js.map +1 -1
- package/graphql/schema/cms/typeDefs/responses.js +5 -0
- package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
- package/graphql/schema/contentModels.js +40 -1
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.js +1 -1
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/index.d.ts +2 -5
- package/index.js +1 -21
- package/package.json +27 -30
- package/plugins/CmsModelPlugin.js +12 -10
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/types/fields/dynamicZoneField.d.ts +1 -0
- package/types/model.d.ts +6 -0
- package/types/modelField.d.ts +13 -0
- package/types/types.d.ts +8 -4
- package/types/types.js.map +1 -1
- package/utils/caching/Cache.js +1 -1
- package/utils/caching/Cache.js.map +1 -1
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.d.ts +28 -0
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js +324 -0
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js.map +1 -0
- package/utils/contentModelToJsonSchema/index.d.ts +2 -0
- package/utils/contentModelToJsonSchema/index.js +1 -0
- package/utils/contentModelToJsonSchema/types.d.ts +24 -0
- package/utils/contentModelToJsonSchema/types.js +0 -0
- package/utils/createModelField.js +2 -1
- package/utils/createModelField.js.map +1 -1
- package/utils/date.js +1 -1
- package/utils/date.js.map +1 -1
- package/utils/entryStorage.js +1 -1
- package/utils/entryStorage.js.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/renderFields.js +1 -1
- package/utils/renderFields.js.map +1 -1
- package/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/baseSchema.js","sources":["../../../src/graphql/schema/baseSchema.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { ContextPlugin } from \"@webiny/api\";\
|
|
1
|
+
{"version":3,"file":"graphql/schema/baseSchema.js","sources":["../../../src/graphql/schema/baseSchema.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { ContextPlugin } from \"@webiny/api\";\n\nconst createSchema = (): IGraphQLSchemaPlugin<CmsContext>[] => {\n const cmsPlugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsIdentity {\n id: String\n displayName: String\n type: String\n }\n\n type CmsError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type CmsCursors {\n next: String\n previous: String\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n input CmsDeleteEntryOptions {\n # force delete an entry that might have some records left behind in the database\n # see CmsDeleteEntryOptions in types.ts\n force: Boolean\n # permanently delete an entry without moving it to the bin\n permanently: Boolean\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n\n type CmsDeleteMultipleDataResponse {\n id: ID!\n }\n\n type CmsDeleteMultipleResponse {\n data: [CmsDeleteMultipleDataResponse!]\n error: CmsError\n }\n\n type CmsBooleanResponse {\n data: Boolean\n error: CmsError\n }\n\n # Advanced Content Organization\n type WbyAcoLocation {\n folderId: ID\n }\n\n input WbyAcoLocationInput {\n folderId: ID!\n }\n\n input WbyAcoLocationWhereInput {\n folderId: ID\n folderId_in: [ID!]\n folderId_not: ID\n folderId_not_in: [ID!]\n }\n\n input CreateCmsEntryOptionsInput {\n skipValidation: Boolean\n }\n\n input CreateRevisionCmsEntryOptionsInput {\n skipValidation: Boolean\n }\n\n input UpdateCmsEntryOptionsInput {\n skipValidation: Boolean\n }\n\n input CmsIdentityInput {\n id: String!\n displayName: String!\n type: String!\n }\n\n type CmsEntryValidationResponseData {\n error: String!\n id: String!\n fieldId: String!\n parents: [String!]!\n }\n\n type CmsEntryValidationResponse {\n data: [CmsEntryValidationResponseData!]\n error: CmsError\n }\n\n type CmsEntrySystem {\n _empty: String\n }\n\n type CmsEntryLive {\n version: Int!\n }\n\n input CmsEntryLiveWhereInput {\n version: Int\n version_gt: Int\n version_gte: Int\n version_lt: Int\n version_lte: Int\n version_not: Int\n version_in: [Int!]\n version_not_in: [Int!]\n }\n\n input ListWhereInputCmsEntrySystem {\n _empty: String\n }\n `,\n resolvers: {}\n });\n cmsPlugin.name = \"headless-cms.graphql.schema.base\";\n const corePlugin = new GraphQLSchemaPlugin<CmsContext>({\n typeDefs: cmsPlugin.schema.typeDefs,\n resolvers: cmsPlugin.schema.resolvers\n });\n corePlugin.name = \"headless-cms.graphql.core.schema.base\";\n /**\n * Due to splitting of CMS and Core schema plugins, we must have both defined for CMS to work.\n */\n return [cmsPlugin, corePlugin];\n};\n\nexport const createBaseSchema = () => {\n const plugin = new ContextPlugin<CmsContext>(async context => {\n context.plugins.register(...createSchema());\n });\n\n plugin.name = \"headless-cms.graphql.createBaseSchema\";\n\n return plugin;\n};\n"],"names":["createSchema","cmsPlugin","createCmsGraphQLSchemaPlugin","corePlugin","GraphQLSchemaPlugin","createBaseSchema","plugin","ContextPlugin","context"],"mappings":";;;AAMA,MAAMA,eAAe;IACjB,MAAMC,YAAYC,6BAA6B;QAC3C,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwHzB,CAAC;QACD,WAAW,CAAC;IAChB;IACAD,UAAU,IAAI,GAAG;IACjB,MAAME,aAAa,IAAIC,oBAAgC;QACnD,UAAUH,UAAU,MAAM,CAAC,QAAQ;QACnC,WAAWA,UAAU,MAAM,CAAC,SAAS;IACzC;IACAE,WAAW,IAAI,GAAG;IAIlB,OAAO;QAACF;QAAWE;KAAW;AAClC;AAEO,MAAME,mBAAmB;IAC5B,MAAMC,SAAS,IAAIC,cAA0B,OAAMC;QAC/CA,QAAQ,OAAO,CAAC,QAAQ,IAAIR;IAChC;IAEAM,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { buildFieldsSelection, getErrorMessage, getModel } from "./helpers.js";
|
|
1
|
+
import { buildFieldsSelection, expandFieldWildcards, getErrorMessage, getModel } from "./helpers.js";
|
|
2
2
|
const createGetEntryResolver = ()=>async ({ args, context })=>{
|
|
3
3
|
const { modelId, where, fields, preview = false } = args;
|
|
4
4
|
try {
|
|
5
5
|
const model = await getModel(context, modelId);
|
|
6
6
|
const apiType = preview ? "preview" : "read";
|
|
7
7
|
const executeSchema = await context.cms.getExecutableSchema(apiType);
|
|
8
|
-
const
|
|
8
|
+
const expandedFields = expandFieldWildcards(fields, model, context);
|
|
9
|
+
const fieldsSelection = buildFieldsSelection(expandedFields);
|
|
9
10
|
const query = `
|
|
10
11
|
query Get${model.singularApiName}($where: ${model.singularApiName}GetWhereInput!) {
|
|
11
12
|
get${model.singularApiName}(where: $where) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/getEntryResolver.js","sources":["../../../../src/graphql/schema/cms/getEntryResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/getEntryResolver.js","sources":["../../../../src/graphql/schema/cms/getEntryResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {\n getModel,\n getErrorMessage,\n buildFieldsSelection,\n expandFieldWildcards\n} from \"./helpers.js\";\n\nexport interface GetEntryArgs {\n modelId: string;\n where: Record<string, unknown>;\n fields: string[];\n preview?: boolean;\n}\n\nexport const createGetEntryResolver = () => {\n return async ({ args, context }: { args: GetEntryArgs; context: CmsContext }) => {\n const { modelId, where, fields, preview = false } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Determine which API to use based on the preview flag.\n // preview=true -> preview API, preview=false -> read API\n const apiType: ApiEndpoint = preview ? \"preview\" : \"read\";\n const executeSchema = await context.cms.getExecutableSchema(apiType);\n\n const expandedFields = expandFieldWildcards(fields, model, context);\n const fieldsSelection = buildFieldsSelection(expandedFields);\n\n const query = /* GraphQL */ `\n query Get${model.singularApiName}($where: ${model.singularApiName}GetWhereInput!) {\n get${model.singularApiName}(where: $where) {\n data {\n ${fieldsSelection}\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n\n const result = (await executeSchema({\n query,\n variables: { where }\n })) as ExecutionResult;\n\n if (result.errors && result.errors.length > 0) {\n return {\n data: null,\n error: {\n message: result.errors.map(e => e.message).join(\"; \"),\n code: \"GET_ENTRY_ERROR\"\n }\n };\n }\n\n const operationName = `get${model.singularApiName}`;\n return result.data?.[operationName] || { data: null, error: null };\n } catch (error) {\n return {\n data: null,\n error: {\n message: getErrorMessage(error, \"Failed to get entry\"),\n code: \"GET_ENTRY_ERROR\"\n }\n };\n }\n };\n};\n"],"names":["createGetEntryResolver","args","context","modelId","where","fields","preview","model","getModel","apiType","executeSchema","expandedFields","expandFieldWildcards","fieldsSelection","buildFieldsSelection","query","result","e","operationName","error","getErrorMessage"],"mappings":";AAiBO,MAAMA,yBAAyB,IAC3B,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAA+C;QACxE,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,UAAU,KAAK,EAAE,GAAGL;QAEpD,IAAI;YACA,MAAMM,QAAQ,MAAMC,SAASN,SAASC;YAItC,MAAMM,UAAuBH,UAAU,YAAY;YACnD,MAAMI,gBAAgB,MAAMR,QAAQ,GAAG,CAAC,mBAAmB,CAACO;YAE5D,MAAME,iBAAiBC,qBAAqBP,QAAQE,OAAOL;YAC3D,MAAMW,kBAAkBC,qBAAqBH;YAE7C,MAAMI,QAAsB,CAAC;yBAChB,EAAER,MAAM,eAAe,CAAC,SAAS,EAAEA,MAAM,eAAe,CAAC;uBAC3D,EAAEA,MAAM,eAAe,CAAC;;4BAEnB,EAAEM,gBAAgB;;;;;;;;;YASlC,CAAC;YAED,MAAMG,SAAU,MAAMN,cAAc;gBAChCK;gBACA,WAAW;oBAAEX;gBAAM;YACvB;YAEA,IAAIY,OAAO,MAAM,IAAIA,OAAO,MAAM,CAAC,MAAM,GAAG,GACxC,OAAO;gBACH,MAAM;gBACN,OAAO;oBACH,SAASA,OAAO,MAAM,CAAC,GAAG,CAACC,CAAAA,IAAKA,EAAE,OAAO,EAAE,IAAI,CAAC;oBAChD,MAAM;gBACV;YACJ;YAGJ,MAAMC,gBAAgB,CAAC,GAAG,EAAEX,MAAM,eAAe,EAAE;YACnD,OAAOS,OAAO,IAAI,EAAE,CAACE,cAAc,IAAI;gBAAE,MAAM;gBAAM,OAAO;YAAK;QACrE,EAAE,OAAOC,OAAO;YACZ,OAAO;gBACH,MAAM;gBACN,OAAO;oBACH,SAASC,gBAAgBD,OAAO;oBAChC,MAAM;gBACV;YACJ;QACJ;IACJ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CmsContext } from "../../../types/index.js";
|
|
2
|
+
export interface GetModelArgs {
|
|
3
|
+
modelId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const createGetModelResolver: () => ({ args, context }: {
|
|
6
|
+
args: GetModelArgs;
|
|
7
|
+
context: CmsContext;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
data: {
|
|
10
|
+
name: string;
|
|
11
|
+
modelId: string;
|
|
12
|
+
singularApiName: string;
|
|
13
|
+
pluralApiName: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
titleFieldId: string;
|
|
16
|
+
descriptionFieldId: string | null | undefined;
|
|
17
|
+
imageFieldId: string | null | undefined;
|
|
18
|
+
fields: import("~/types/index.js").CmsModelField[];
|
|
19
|
+
layout: import("~/types/index.js").CmsModelLayout;
|
|
20
|
+
tags: string[] | undefined;
|
|
21
|
+
settings: import("../../../features/modelBuilder/abstractions.js").IModelSettings | null | undefined;
|
|
22
|
+
metadata: {
|
|
23
|
+
valuesSelection: string;
|
|
24
|
+
componentMap: Record<string, string>;
|
|
25
|
+
refModels: Record<string, import("~/features/contentModel/RefModelsGenerator/abstractions.js").RefModelMetadata>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
error: null;
|
|
29
|
+
} | {
|
|
30
|
+
data: null;
|
|
31
|
+
error: {
|
|
32
|
+
message: string;
|
|
33
|
+
code: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getErrorMessage, getModel } from "./helpers.js";
|
|
2
|
+
import { ComponentMapGenerator } from "../../../features/contentModel/ComponentMapGenerator/abstractions.js";
|
|
3
|
+
import { ValuesSelectionGenerator } from "../../../features/contentModel/ValuesSelectionGenerator/abstractions.js";
|
|
4
|
+
import { RefModelsGenerator } from "../../../features/contentModel/RefModelsGenerator/abstractions.js";
|
|
5
|
+
const createGetModelResolver = ()=>async ({ args, context })=>{
|
|
6
|
+
const { modelId } = args;
|
|
7
|
+
try {
|
|
8
|
+
const model = await getModel(context, modelId);
|
|
9
|
+
const componentMapGenerator = context.container.resolve(ComponentMapGenerator);
|
|
10
|
+
const valuesSelectionGenerator = context.container.resolve(ValuesSelectionGenerator);
|
|
11
|
+
const refModelsGenerator = context.container.resolve(RefModelsGenerator);
|
|
12
|
+
const componentMap = componentMapGenerator.generate(model);
|
|
13
|
+
const valuesSelection = valuesSelectionGenerator.generate(model);
|
|
14
|
+
const refModels = await refModelsGenerator.generate(model);
|
|
15
|
+
return {
|
|
16
|
+
data: {
|
|
17
|
+
name: model.name,
|
|
18
|
+
modelId: model.modelId,
|
|
19
|
+
singularApiName: model.singularApiName,
|
|
20
|
+
pluralApiName: model.pluralApiName,
|
|
21
|
+
description: model.description,
|
|
22
|
+
titleFieldId: model.titleFieldId,
|
|
23
|
+
descriptionFieldId: model.descriptionFieldId,
|
|
24
|
+
imageFieldId: model.imageFieldId,
|
|
25
|
+
fields: model.fields,
|
|
26
|
+
layout: model.layout,
|
|
27
|
+
tags: model.tags,
|
|
28
|
+
settings: model.settings,
|
|
29
|
+
metadata: {
|
|
30
|
+
valuesSelection,
|
|
31
|
+
componentMap,
|
|
32
|
+
refModels
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
error: null
|
|
36
|
+
};
|
|
37
|
+
} catch (error) {
|
|
38
|
+
return {
|
|
39
|
+
data: null,
|
|
40
|
+
error: {
|
|
41
|
+
message: getErrorMessage(error, "Failed to get model"),
|
|
42
|
+
code: "GET_MODEL_ERROR"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export { createGetModelResolver };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=getModelResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/getModelResolver.js","sources":["../../../../src/graphql/schema/cms/getModelResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport { getModel, getErrorMessage } from \"./helpers.js\";\nimport { ComponentMapGenerator } from \"~/features/contentModel/ComponentMapGenerator/abstractions.js\";\nimport { ValuesSelectionGenerator } from \"~/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\nimport { RefModelsGenerator } from \"~/features/contentModel/RefModelsGenerator/abstractions.js\";\n\nexport interface GetModelArgs {\n modelId: string;\n}\n\nexport const createGetModelResolver = () => {\n return async ({ args, context }: { args: GetModelArgs; context: CmsContext }) => {\n const { modelId } = args;\n\n try {\n const model = await getModel(context, modelId);\n const componentMapGenerator = context.container.resolve(ComponentMapGenerator);\n const valuesSelectionGenerator = context.container.resolve(ValuesSelectionGenerator);\n const refModelsGenerator = context.container.resolve(RefModelsGenerator);\n\n const componentMap = componentMapGenerator.generate(model);\n const valuesSelection = valuesSelectionGenerator.generate(model);\n const refModels = await refModelsGenerator.generate(model);\n\n return {\n data: {\n name: model.name,\n modelId: model.modelId,\n singularApiName: model.singularApiName,\n pluralApiName: model.pluralApiName,\n description: model.description,\n titleFieldId: model.titleFieldId,\n descriptionFieldId: model.descriptionFieldId,\n imageFieldId: model.imageFieldId,\n fields: model.fields,\n layout: model.layout,\n tags: model.tags,\n settings: model.settings,\n metadata: {\n valuesSelection,\n componentMap,\n refModels\n }\n },\n error: null\n };\n } catch (error) {\n return {\n data: null,\n error: {\n message: getErrorMessage(error, \"Failed to get model\"),\n code: \"GET_MODEL_ERROR\"\n }\n };\n }\n };\n};\n"],"names":["createGetModelResolver","args","context","modelId","model","getModel","componentMapGenerator","ComponentMapGenerator","valuesSelectionGenerator","ValuesSelectionGenerator","refModelsGenerator","RefModelsGenerator","componentMap","valuesSelection","refModels","error","getErrorMessage"],"mappings":";;;;AAUO,MAAMA,yBAAyB,IAC3B,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAA+C;QACxE,MAAM,EAAEC,OAAO,EAAE,GAAGF;QAEpB,IAAI;YACA,MAAMG,QAAQ,MAAMC,SAASH,SAASC;YACtC,MAAMG,wBAAwBJ,QAAQ,SAAS,CAAC,OAAO,CAACK;YACxD,MAAMC,2BAA2BN,QAAQ,SAAS,CAAC,OAAO,CAACO;YAC3D,MAAMC,qBAAqBR,QAAQ,SAAS,CAAC,OAAO,CAACS;YAErD,MAAMC,eAAeN,sBAAsB,QAAQ,CAACF;YACpD,MAAMS,kBAAkBL,yBAAyB,QAAQ,CAACJ;YAC1D,MAAMU,YAAY,MAAMJ,mBAAmB,QAAQ,CAACN;YAEpD,OAAO;gBACH,MAAM;oBACF,MAAMA,MAAM,IAAI;oBAChB,SAASA,MAAM,OAAO;oBACtB,iBAAiBA,MAAM,eAAe;oBACtC,eAAeA,MAAM,aAAa;oBAClC,aAAaA,MAAM,WAAW;oBAC9B,cAAcA,MAAM,YAAY;oBAChC,oBAAoBA,MAAM,kBAAkB;oBAC5C,cAAcA,MAAM,YAAY;oBAChC,QAAQA,MAAM,MAAM;oBACpB,QAAQA,MAAM,MAAM;oBACpB,MAAMA,MAAM,IAAI;oBAChB,UAAUA,MAAM,QAAQ;oBACxB,UAAU;wBACNS;wBACAD;wBACAE;oBACJ;gBACJ;gBACA,OAAO;YACX;QACJ,EAAE,OAAOC,OAAO;YACZ,OAAO;gBACH,MAAM;gBACN,OAAO;oBACH,SAASC,gBAAgBD,OAAO;oBAChC,MAAM;gBACV;YACJ;QACJ;IACJ"}
|
|
@@ -4,8 +4,12 @@ const buildFieldsSelection = (fields)=>{
|
|
|
4
4
|
entryId
|
|
5
5
|
values
|
|
6
6
|
`;
|
|
7
|
+
const rawSelections = [];
|
|
8
|
+
const dotFields = [];
|
|
9
|
+
for (const field of fields)if (field.includes("{")) rawSelections.push(field);
|
|
10
|
+
else dotFields.push(field);
|
|
7
11
|
const fieldTree = {};
|
|
8
|
-
|
|
12
|
+
dotFields.forEach((field)=>{
|
|
9
13
|
const parts = field.split(".");
|
|
10
14
|
let current = fieldTree;
|
|
11
15
|
parts.forEach((part, index)=>{
|
|
@@ -27,7 +31,10 @@ const buildFieldsSelection = (fields)=>{
|
|
|
27
31
|
});
|
|
28
32
|
return lines.join("\n");
|
|
29
33
|
};
|
|
30
|
-
|
|
34
|
+
const parts = [];
|
|
35
|
+
if (dotFields.length > 0) parts.push(buildSelection(fieldTree));
|
|
36
|
+
for (const raw of rawSelections)parts.push(` ${raw}`);
|
|
37
|
+
return parts.join("\n");
|
|
31
38
|
};
|
|
32
39
|
export { buildFieldsSelection };
|
|
33
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/helpers/buildFieldsSelection.js","sources":["../../../../../src/graphql/schema/cms/helpers/buildFieldsSelection.ts"],"sourcesContent":["/**\n * Helper to build GraphQL fields selection from fields array.\n * Supports both top-level fields (e.g., \"createdOn\", \"id\") and values fields (e.g., \"values.author.name\").\n * Properly merges nested fields that share common parent paths.\n *\n * @param fields - Optional array of field paths in dot notation\n * @returns GraphQL selection string with proper field nesting\n *\n * @example\n * buildFieldsSelection([\"id\", \"entryId\", \"createdOn\", \"values.name\", \"values.author.name\", \"values.author.email\"])\n * // Returns:\n * // id\n * // entryId\n * // createdOn\n * // values {\n * // name\n * // author {\n * // name\n * // email\n * // }\n * // }\n */\nexport const buildFieldsSelection = (fields?: string[]): string => {\n if (!fields || fields.length === 0) {\n return `\n id\n entryId\n values\n `;\n }\n\n interface FieldNode {\n [key: string]: FieldNode | null;\n }\n\n const fieldTree: FieldNode = {};\n\n
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/helpers/buildFieldsSelection.js","sources":["../../../../../src/graphql/schema/cms/helpers/buildFieldsSelection.ts"],"sourcesContent":["/**\n * Helper to build GraphQL fields selection from fields array.\n * Supports both top-level fields (e.g., \"createdOn\", \"id\") and values fields (e.g., \"values.author.name\").\n * Properly merges nested fields that share common parent paths.\n *\n * @param fields - Optional array of field paths in dot notation\n * @returns GraphQL selection string with proper field nesting\n *\n * @example\n * buildFieldsSelection([\"id\", \"entryId\", \"createdOn\", \"values.name\", \"values.author.name\", \"values.author.email\"])\n * // Returns:\n * // id\n * // entryId\n * // createdOn\n * // values {\n * // name\n * // author {\n * // name\n * // email\n * // }\n * // }\n */\nexport const buildFieldsSelection = (fields?: string[]): string => {\n if (!fields || fields.length === 0) {\n return `\n id\n entryId\n values\n `;\n }\n\n const rawSelections: string[] = [];\n const dotFields: string[] = [];\n\n for (const field of fields) {\n if (field.includes(\"{\")) {\n rawSelections.push(field);\n } else {\n dotFields.push(field);\n }\n }\n\n interface FieldNode {\n [key: string]: FieldNode | null;\n }\n\n const fieldTree: FieldNode = {};\n\n dotFields.forEach(field => {\n const parts = field.split(\".\");\n let current = fieldTree;\n\n parts.forEach((part, index) => {\n if (current[part] === undefined) {\n current[part] = index === parts.length - 1 ? null : {};\n } else if (current[part] === null && index < parts.length - 1) {\n current[part] = {};\n }\n if (current[part] !== null) {\n current = current[part] as FieldNode;\n }\n });\n });\n\n const buildSelection = (node: FieldNode, indent: string = \" \"): string => {\n const lines: string[] = [];\n\n Object.keys(node)\n .sort()\n .forEach(key => {\n const value = node[key];\n if (value === null) {\n lines.push(`${indent}${key}`);\n } else {\n lines.push(`${indent}${key} {`);\n lines.push(buildSelection(value, indent + \" \"));\n lines.push(`${indent}}`);\n }\n });\n\n return lines.join(\"\\n\");\n };\n\n const parts: string[] = [];\n\n if (dotFields.length > 0) {\n parts.push(buildSelection(fieldTree));\n }\n\n for (const raw of rawSelections) {\n parts.push(` ${raw}`);\n }\n\n return parts.join(\"\\n\");\n};\n"],"names":["buildFieldsSelection","fields","rawSelections","dotFields","field","fieldTree","parts","current","part","index","undefined","buildSelection","node","indent","lines","Object","key","value","raw"],"mappings":"AAsBO,MAAMA,uBAAuB,CAACC;IACjC,IAAI,CAACA,UAAUA,AAAkB,MAAlBA,OAAO,MAAM,EACxB,OAAO,CAAC;;;;QAIR,CAAC;IAGL,MAAMC,gBAA0B,EAAE;IAClC,MAAMC,YAAsB,EAAE;IAE9B,KAAK,MAAMC,SAASH,OAChB,IAAIG,MAAM,QAAQ,CAAC,MACfF,cAAc,IAAI,CAACE;SAEnBD,UAAU,IAAI,CAACC;IAQvB,MAAMC,YAAuB,CAAC;IAE9BF,UAAU,OAAO,CAACC,CAAAA;QACd,MAAME,QAAQF,MAAM,KAAK,CAAC;QAC1B,IAAIG,UAAUF;QAEdC,MAAM,OAAO,CAAC,CAACE,MAAMC;YACjB,IAAIF,AAAkBG,WAAlBH,OAAO,CAACC,KAAK,EACbD,OAAO,CAACC,KAAK,GAAGC,UAAUH,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC;iBAClD,IAAIC,AAAkB,SAAlBA,OAAO,CAACC,KAAK,IAAaC,QAAQH,MAAM,MAAM,GAAG,GACxDC,OAAO,CAACC,KAAK,GAAG,CAAC;YAErB,IAAID,AAAkB,SAAlBA,OAAO,CAACC,KAAK,EACbD,UAAUA,OAAO,CAACC,KAAK;QAE/B;IACJ;IAEA,MAAMG,iBAAiB,CAACC,MAAiBC,SAAiB,UAAU;QAChE,MAAMC,QAAkB,EAAE;QAE1BC,OAAO,IAAI,CAACH,MACP,IAAI,GACJ,OAAO,CAACI,CAAAA;YACL,MAAMC,QAAQL,IAAI,CAACI,IAAI;YACvB,IAAIC,AAAU,SAAVA,OACAH,MAAM,IAAI,CAAC,GAAGD,SAASG,KAAK;iBACzB;gBACHF,MAAM,IAAI,CAAC,GAAGD,SAASG,IAAI,EAAE,CAAC;gBAC9BF,MAAM,IAAI,CAACH,eAAeM,OAAOJ,SAAS;gBAC1CC,MAAM,IAAI,CAAC,GAAGD,OAAO,CAAC,CAAC;YAC3B;QACJ;QAEJ,OAAOC,MAAM,IAAI,CAAC;IACtB;IAEA,MAAMR,QAAkB,EAAE;IAE1B,IAAIH,UAAU,MAAM,GAAG,GACnBG,MAAM,IAAI,CAACK,eAAeN;IAG9B,KAAK,MAAMa,OAAOhB,cACdI,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAEY,KAAK;IAG/B,OAAOZ,MAAM,IAAI,CAAC;AACtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ValuesSelectionGenerator } from "../../../../features/contentModel/ValuesSelectionGenerator/abstractions.js";
|
|
2
|
+
const expandFieldWildcards = (fields, model, context)=>{
|
|
3
|
+
if (!fields.includes("values.*")) return fields;
|
|
4
|
+
const generator = context.container.resolve(ValuesSelectionGenerator);
|
|
5
|
+
const valuesSelection = generator.generate(model);
|
|
6
|
+
if (!valuesSelection || "_empty" === valuesSelection) return fields.filter((f)=>"values.*" !== f);
|
|
7
|
+
const expanded = fields.filter((f)=>"values.*" !== f);
|
|
8
|
+
expanded.push(`values { ${valuesSelection} }`);
|
|
9
|
+
return expanded;
|
|
10
|
+
};
|
|
11
|
+
export { expandFieldWildcards };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=expandFieldWildcards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/helpers/expandFieldWildcards.js","sources":["../../../../../src/graphql/schema/cms/helpers/expandFieldWildcards.ts"],"sourcesContent":["import type { CmsContext, CmsModel } from \"~/types/index.js\";\nimport { ValuesSelectionGenerator } from \"~/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\n\nexport const expandFieldWildcards = (\n fields: string[],\n model: CmsModel,\n context: CmsContext\n): string[] => {\n if (!fields.includes(\"values.*\")) {\n return fields;\n }\n\n const generator = context.container.resolve(ValuesSelectionGenerator);\n const valuesSelection = generator.generate(model);\n\n if (!valuesSelection || valuesSelection === \"_empty\") {\n return fields.filter(f => f !== \"values.*\");\n }\n\n const expanded = fields.filter(f => f !== \"values.*\");\n expanded.push(`values { ${valuesSelection} }`);\n return expanded;\n};\n"],"names":["expandFieldWildcards","fields","model","context","generator","ValuesSelectionGenerator","valuesSelection","f","expanded"],"mappings":";AAGO,MAAMA,uBAAuB,CAChCC,QACAC,OACAC;IAEA,IAAI,CAACF,OAAO,QAAQ,CAAC,aACjB,OAAOA;IAGX,MAAMG,YAAYD,QAAQ,SAAS,CAAC,OAAO,CAACE;IAC5C,MAAMC,kBAAkBF,UAAU,QAAQ,CAACF;IAE3C,IAAI,CAACI,mBAAmBA,AAAoB,aAApBA,iBACpB,OAAOL,OAAO,MAAM,CAACM,CAAAA,IAAKA,AAAM,eAANA;IAG9B,MAAMC,WAAWP,OAAO,MAAM,CAACM,CAAAA,IAAKA,AAAM,eAANA;IACpCC,SAAS,IAAI,CAAC,CAAC,SAAS,EAAEF,gBAAgB,EAAE,CAAC;IAC7C,OAAOE;AACX"}
|
|
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./getErrorMessage.js";
|
|
|
2
2
|
export { getModel } from "./getModel.js";
|
|
3
3
|
export { transformSortToArray } from "./transformSortToArray.js";
|
|
4
4
|
export { buildFieldsSelection } from "./buildFieldsSelection.js";
|
|
5
|
+
export { expandFieldWildcards } from "./expandFieldWildcards.js";
|
|
5
6
|
export { transformWhereToNested } from "./transformWhereToNested.js";
|
|
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./getErrorMessage.js";
|
|
|
2
2
|
export { getModel } from "./getModel.js";
|
|
3
3
|
export { transformSortToArray } from "./transformSortToArray.js";
|
|
4
4
|
export { buildFieldsSelection } from "./buildFieldsSelection.js";
|
|
5
|
+
export { expandFieldWildcards } from "./expandFieldWildcards.js";
|
|
5
6
|
export { transformWhereToNested } from "./transformWhereToNested.js";
|
|
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./helpers/getErrorMessage.js";
|
|
|
2
2
|
export { getModel } from "./helpers/getModel.js";
|
|
3
3
|
export { transformSortToArray } from "./helpers/transformSortToArray.js";
|
|
4
4
|
export { buildFieldsSelection } from "./helpers/buildFieldsSelection.js";
|
|
5
|
+
export { expandFieldWildcards } from "./helpers/expandFieldWildcards.js";
|
|
5
6
|
export { transformWhereToNested } from "./helpers/transformWhereToNested.js";
|
|
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./helpers/getErrorMessage.js";
|
|
|
2
2
|
export { getModel } from "./helpers/getModel.js";
|
|
3
3
|
export { transformSortToArray } from "./helpers/transformSortToArray.js";
|
|
4
4
|
export { buildFieldsSelection } from "./helpers/buildFieldsSelection.js";
|
|
5
|
+
export { expandFieldWildcards } from "./helpers/expandFieldWildcards.js";
|
|
5
6
|
export { transformWhereToNested } from "./helpers/transformWhereToNested.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import { CmsMutationTypeDefsImpl, CmsQueryTypeDefsImpl, CmsResponseTypeDefsImpl } from "./typeDefs/index.js";
|
|
3
|
-
import { CreateEntryResolverImpl, DeleteEntryRevisionResolverImpl, GetEntryResolverImpl, ListEntriesResolverImpl, MutationCmsResolverImpl, PublishEntryRevisionResolverImpl, QueryCmsResolverImpl, UnpublishEntryRevisionResolverImpl, UpdateEntryRevisionResolverImpl } from "./resolvers/index.js";
|
|
3
|
+
import { CreateEntryResolverImpl, DeleteEntryRevisionResolverImpl, GetEntryResolverImpl, GetModelResolverImpl, ListEntriesResolverImpl, MutationCmsResolverImpl, PublishEntryRevisionResolverImpl, QueryCmsResolverImpl, UnpublishEntryRevisionResolverImpl, UpdateEntryRevisionResolverImpl } from "./resolvers/index.js";
|
|
4
4
|
const createCmsSchema = ()=>{
|
|
5
5
|
const plugin = new ContextPlugin(async (context)=>{
|
|
6
6
|
context.container.register(CmsResponseTypeDefsImpl);
|
|
@@ -15,6 +15,7 @@ const createCmsSchema = ()=>{
|
|
|
15
15
|
context.container.register(DeleteEntryRevisionResolverImpl);
|
|
16
16
|
context.container.register(PublishEntryRevisionResolverImpl);
|
|
17
17
|
context.container.register(UnpublishEntryRevisionResolverImpl);
|
|
18
|
+
context.container.register(GetModelResolverImpl);
|
|
18
19
|
});
|
|
19
20
|
plugin.name = "headless-cms.graphql.createCmsSchema";
|
|
20
21
|
return plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/index.js","sources":["../../../../src/graphql/schema/cms/index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport {\n CmsResponseTypeDefsImpl,\n CmsQueryTypeDefsImpl,\n CmsMutationTypeDefsImpl\n} from \"./typeDefs/index.js\";\nimport {\n QueryCmsResolverImpl,\n MutationCmsResolverImpl,\n GetEntryResolverImpl,\n ListEntriesResolverImpl,\n CreateEntryResolverImpl,\n UpdateEntryRevisionResolverImpl,\n DeleteEntryRevisionResolverImpl,\n PublishEntryRevisionResolverImpl,\n UnpublishEntryRevisionResolverImpl\n} from \"./resolvers/index.js\";\n\nexport const createCmsSchema = () => {\n const plugin = new ContextPlugin(async context => {\n // Register type definitions.\n context.container.register(CmsResponseTypeDefsImpl);\n context.container.register(CmsQueryTypeDefsImpl);\n context.container.register(CmsMutationTypeDefsImpl);\n\n // Register resolvers.\n context.container.register(QueryCmsResolverImpl);\n context.container.register(MutationCmsResolverImpl);\n context.container.register(GetEntryResolverImpl);\n context.container.register(ListEntriesResolverImpl);\n context.container.register(CreateEntryResolverImpl);\n context.container.register(UpdateEntryRevisionResolverImpl);\n context.container.register(DeleteEntryRevisionResolverImpl);\n context.container.register(PublishEntryRevisionResolverImpl);\n context.container.register(UnpublishEntryRevisionResolverImpl);\n });\n\n plugin.name = \"headless-cms.graphql.createCmsSchema\";\n\n return plugin;\n};\n"],"names":["createCmsSchema","plugin","ContextPlugin","context","CmsResponseTypeDefsImpl","CmsQueryTypeDefsImpl","CmsMutationTypeDefsImpl","QueryCmsResolverImpl","MutationCmsResolverImpl","GetEntryResolverImpl","ListEntriesResolverImpl","CreateEntryResolverImpl","UpdateEntryRevisionResolverImpl","DeleteEntryRevisionResolverImpl","PublishEntryRevisionResolverImpl","UnpublishEntryRevisionResolverImpl"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/index.js","sources":["../../../../src/graphql/schema/cms/index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport {\n CmsResponseTypeDefsImpl,\n CmsQueryTypeDefsImpl,\n CmsMutationTypeDefsImpl\n} from \"./typeDefs/index.js\";\nimport {\n QueryCmsResolverImpl,\n MutationCmsResolverImpl,\n GetEntryResolverImpl,\n ListEntriesResolverImpl,\n CreateEntryResolverImpl,\n UpdateEntryRevisionResolverImpl,\n DeleteEntryRevisionResolverImpl,\n PublishEntryRevisionResolverImpl,\n UnpublishEntryRevisionResolverImpl,\n GetModelResolverImpl\n} from \"./resolvers/index.js\";\n\nexport const createCmsSchema = () => {\n const plugin = new ContextPlugin(async context => {\n // Register type definitions.\n context.container.register(CmsResponseTypeDefsImpl);\n context.container.register(CmsQueryTypeDefsImpl);\n context.container.register(CmsMutationTypeDefsImpl);\n\n // Register resolvers.\n context.container.register(QueryCmsResolverImpl);\n context.container.register(MutationCmsResolverImpl);\n context.container.register(GetEntryResolverImpl);\n context.container.register(ListEntriesResolverImpl);\n context.container.register(CreateEntryResolverImpl);\n context.container.register(UpdateEntryRevisionResolverImpl);\n context.container.register(DeleteEntryRevisionResolverImpl);\n context.container.register(PublishEntryRevisionResolverImpl);\n context.container.register(UnpublishEntryRevisionResolverImpl);\n context.container.register(GetModelResolverImpl);\n });\n\n plugin.name = \"headless-cms.graphql.createCmsSchema\";\n\n return plugin;\n};\n"],"names":["createCmsSchema","plugin","ContextPlugin","context","CmsResponseTypeDefsImpl","CmsQueryTypeDefsImpl","CmsMutationTypeDefsImpl","QueryCmsResolverImpl","MutationCmsResolverImpl","GetEntryResolverImpl","ListEntriesResolverImpl","CreateEntryResolverImpl","UpdateEntryRevisionResolverImpl","DeleteEntryRevisionResolverImpl","PublishEntryRevisionResolverImpl","UnpublishEntryRevisionResolverImpl","GetModelResolverImpl"],"mappings":";;;AAmBO,MAAMA,kBAAkB;IAC3B,MAAMC,SAAS,IAAIC,cAAc,OAAMC;QAEnCA,QAAQ,SAAS,CAAC,QAAQ,CAACC;QAC3BD,QAAQ,SAAS,CAAC,QAAQ,CAACE;QAC3BF,QAAQ,SAAS,CAAC,QAAQ,CAACG;QAG3BH,QAAQ,SAAS,CAAC,QAAQ,CAACI;QAC3BJ,QAAQ,SAAS,CAAC,QAAQ,CAACK;QAC3BL,QAAQ,SAAS,CAAC,QAAQ,CAACM;QAC3BN,QAAQ,SAAS,CAAC,QAAQ,CAACO;QAC3BP,QAAQ,SAAS,CAAC,QAAQ,CAACQ;QAC3BR,QAAQ,SAAS,CAAC,QAAQ,CAACS;QAC3BT,QAAQ,SAAS,CAAC,QAAQ,CAACU;QAC3BV,QAAQ,SAAS,CAAC,QAAQ,CAACW;QAC3BX,QAAQ,SAAS,CAAC,QAAQ,CAACY;QAC3BZ,QAAQ,SAAS,CAAC,QAAQ,CAACa;IAC/B;IAEAf,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { buildFieldsSelection, getErrorMessage, getModel, transformSortToArray, transformWhereToNested } from "./helpers.js";
|
|
1
|
+
import { buildFieldsSelection, expandFieldWildcards, getErrorMessage, getModel, transformSortToArray, transformWhereToNested } from "./helpers.js";
|
|
2
2
|
const createListEntriesResolver = ()=>async ({ args, context })=>{
|
|
3
3
|
const { modelId, where, sort, limit, after, search, fields, preview = false } = args;
|
|
4
4
|
try {
|
|
5
5
|
const model = await getModel(context, modelId);
|
|
6
6
|
const apiType = preview ? "preview" : "read";
|
|
7
7
|
const executeSchema = await context.cms.getExecutableSchema(apiType);
|
|
8
|
-
const
|
|
8
|
+
const expandedFields = expandFieldWildcards(fields, model, context);
|
|
9
|
+
const fieldsSelection = buildFieldsSelection(expandedFields);
|
|
9
10
|
const transformedSort = transformSortToArray(sort);
|
|
10
11
|
const transformedWhere = transformWhereToNested(where);
|
|
11
12
|
const query = `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/listEntriesResolver.js","sources":["../../../../src/graphql/schema/cms/listEntriesResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {\n getModel,\n getErrorMessage,\n buildFieldsSelection,\n transformSortToArray,\n transformWhereToNested\n} from \"./helpers.js\";\n\nexport interface ListEntriesArgs {\n modelId: string;\n where?: Record<string, unknown>;\n sort?: Record<string, unknown> | string[];\n limit?: number;\n after?: string;\n search?: string;\n fields: string[];\n preview?: boolean;\n}\n\nexport const createListEntriesResolver = () => {\n return async ({ args, context }: { args: ListEntriesArgs; context: CmsContext }) => {\n const { modelId, where, sort, limit, after, search, fields, preview = false } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Determine which API to use based on the preview flag.\n // preview=true -> preview API, preview=false -> read API\n const apiType: ApiEndpoint = preview ? \"preview\" : \"read\";\n const executeSchema = await context.cms.getExecutableSchema(apiType);\n\n const fieldsSelection = buildFieldsSelection(
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/listEntriesResolver.js","sources":["../../../../src/graphql/schema/cms/listEntriesResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {\n getModel,\n getErrorMessage,\n buildFieldsSelection,\n expandFieldWildcards,\n transformSortToArray,\n transformWhereToNested\n} from \"./helpers.js\";\n\nexport interface ListEntriesArgs {\n modelId: string;\n where?: Record<string, unknown>;\n sort?: Record<string, unknown> | string[];\n limit?: number;\n after?: string;\n search?: string;\n fields: string[];\n preview?: boolean;\n}\n\nexport const createListEntriesResolver = () => {\n return async ({ args, context }: { args: ListEntriesArgs; context: CmsContext }) => {\n const { modelId, where, sort, limit, after, search, fields, preview = false } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Determine which API to use based on the preview flag.\n // preview=true -> preview API, preview=false -> read API\n const apiType: ApiEndpoint = preview ? \"preview\" : \"read\";\n const executeSchema = await context.cms.getExecutableSchema(apiType);\n\n const expandedFields = expandFieldWildcards(fields, model, context);\n const fieldsSelection = buildFieldsSelection(expandedFields);\n\n // Transform sort to array format expected by the underlying GraphQL schema.\n // Handles both object format {createdOn: \"desc\"} and array format [\"createdOn_DESC\"].\n const transformedSort = transformSortToArray(sort);\n\n // Transform dot-notation where keys (e.g. \"values.name\") into nested objects\n // (e.g. { values: { name: ... } }) so they match the typed ListWhereInput.\n const transformedWhere = transformWhereToNested(where);\n\n const query = /* GraphQL */ `\n query List${model.pluralApiName}(\n $where: ${model.singularApiName}ListWhereInput\n $sort: [${model.singularApiName}ListSorter!]\n $limit: Int\n $after: String\n $search: String\n ) {\n list${model.pluralApiName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${fieldsSelection}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n\n const result = (await executeSchema({\n query,\n variables: { where: transformedWhere, sort: transformedSort, limit, after, search }\n })) as ExecutionResult;\n\n if (result.errors && result.errors.length > 0) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: result.errors.map(e => e.message).join(\"; \"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n\n const operationName = `list${model.pluralApiName}`;\n return (\n result.data?.[operationName] || {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: null\n }\n );\n } catch (error) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: getErrorMessage(error, \"Failed to list entries\"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n };\n};\n"],"names":["createListEntriesResolver","args","context","modelId","where","sort","limit","after","search","fields","preview","model","getModel","apiType","executeSchema","expandedFields","expandFieldWildcards","fieldsSelection","buildFieldsSelection","transformedSort","transformSortToArray","transformedWhere","transformWhereToNested","query","result","e","operationName","error","getErrorMessage"],"mappings":";AAuBO,MAAMA,4BAA4B,IAC9B,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAkD;QAC3E,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,KAAK,EAAE,GAAGT;QAEhF,IAAI;YACA,MAAMU,QAAQ,MAAMC,SAASV,SAASC;YAItC,MAAMU,UAAuBH,UAAU,YAAY;YACnD,MAAMI,gBAAgB,MAAMZ,QAAQ,GAAG,CAAC,mBAAmB,CAACW;YAE5D,MAAME,iBAAiBC,qBAAqBP,QAAQE,OAAOT;YAC3D,MAAMe,kBAAkBC,qBAAqBH;YAI7C,MAAMI,kBAAkBC,qBAAqBf;YAI7C,MAAMgB,mBAAmBC,uBAAuBlB;YAEhD,MAAMmB,QAAsB,CAAC;0BACf,EAAEZ,MAAM,aAAa,CAAC;4BACpB,EAAEA,MAAM,eAAe,CAAC;4BACxB,EAAEA,MAAM,eAAe,CAAC;;;;;wBAK5B,EAAEA,MAAM,aAAa,CAAC;;;;;;;;4BAQlB,EAAEM,gBAAgB;;;;;;;;;;;;;;YAclC,CAAC;YAED,MAAMO,SAAU,MAAMV,cAAc;gBAChCS;gBACA,WAAW;oBAAE,OAAOF;oBAAkB,MAAMF;oBAAiBb;oBAAOC;oBAAOC;gBAAO;YACtF;YAEA,IAAIgB,OAAO,MAAM,IAAIA,OAAO,MAAM,CAAC,MAAM,GAAG,GACxC,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASA,OAAO,MAAM,CAAC,GAAG,CAACC,CAAAA,IAAKA,EAAE,OAAO,EAAE,IAAI,CAAC;oBAChD,MAAM;gBACV;YACJ;YAGJ,MAAMC,gBAAgB,CAAC,IAAI,EAAEf,MAAM,aAAa,EAAE;YAClD,OACIa,OAAO,IAAI,EAAE,CAACE,cAAc,IAAI;gBAC5B,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;YACX;QAER,EAAE,OAAOC,OAAO;YACZ,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASC,gBAAgBD,OAAO;oBAChC,MAAM;gBACV;YACJ;QACJ;IACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CoreGraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.core.js";
|
|
2
|
+
declare class GetModelResolver implements CoreGraphQLSchemaFactory.Interface {
|
|
3
|
+
execute(builder: CoreGraphQLSchemaFactory.SchemaBuilder): CoreGraphQLSchemaFactory.Return;
|
|
4
|
+
}
|
|
5
|
+
export declare const GetModelResolverImpl: typeof GetModelResolver & {
|
|
6
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public.js").IGraphQLSchemaFactory>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CoreGraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.core.js";
|
|
2
|
+
import { createGetModelResolver } from "../getModelResolver.js";
|
|
3
|
+
class GetModelResolver {
|
|
4
|
+
async execute(builder) {
|
|
5
|
+
builder.addResolver({
|
|
6
|
+
path: "CmsQuery.getModel",
|
|
7
|
+
resolver: createGetModelResolver
|
|
8
|
+
});
|
|
9
|
+
return builder;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const GetModelResolverImpl = CoreGraphQLSchemaFactory.createImplementation({
|
|
13
|
+
implementation: GetModelResolver,
|
|
14
|
+
dependencies: []
|
|
15
|
+
});
|
|
16
|
+
export { GetModelResolverImpl };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=getModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/resolvers/getModel.js","sources":["../../../../../src/graphql/schema/cms/resolvers/getModel.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.core.js\";\nimport { createGetModelResolver } from \"../getModelResolver.js\";\n\nclass GetModelResolver implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addResolver({\n path: \"CmsQuery.getModel\",\n resolver: createGetModelResolver\n });\n\n return builder;\n }\n}\n\nexport const GetModelResolverImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: GetModelResolver,\n dependencies: []\n});\n"],"names":["GetModelResolver","builder","createGetModelResolver","GetModelResolverImpl","CoreGraphQLSchemaFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAUC;QACd;QAEA,OAAOD;IACX;AACJ;AAEO,MAAME,uBAAuBC,yBAAyB,oBAAoB,CAAC;IAC9E,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -7,3 +7,4 @@ export { UpdateEntryRevisionResolverImpl } from "./updateEntryRevision.js";
|
|
|
7
7
|
export { DeleteEntryRevisionResolverImpl } from "./deleteEntryRevision.js";
|
|
8
8
|
export { PublishEntryRevisionResolverImpl } from "./publishEntryRevision.js";
|
|
9
9
|
export { UnpublishEntryRevisionResolverImpl } from "./unpublishEntryRevision.js";
|
|
10
|
+
export { GetModelResolverImpl } from "./getModel.js";
|
|
@@ -7,3 +7,4 @@ export { UpdateEntryRevisionResolverImpl } from "./updateEntryRevision.js";
|
|
|
7
7
|
export { DeleteEntryRevisionResolverImpl } from "./deleteEntryRevision.js";
|
|
8
8
|
export { PublishEntryRevisionResolverImpl } from "./publishEntryRevision.js";
|
|
9
9
|
export { UnpublishEntryRevisionResolverImpl } from "./unpublishEntryRevision.js";
|
|
10
|
+
export { GetModelResolverImpl } from "./getModel.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/typeDefs/query.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/query.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.core.js\";\n\nclass CmsQueryTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsQuery {\n getEntry(\n modelId: ID!\n where: JSON!\n fields: [String!]!\n preview: Boolean\n ): CmsEntryResponse!\n listEntries(\n modelId: ID!\n where: JSON\n sort: JSON\n limit: Int\n after: String\n search: String\n fields: [String!]!\n preview: Boolean\n ): CmsListResponse!\n }\n\n extend type Query {\n cms: CmsQuery!\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsQueryTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsQueryTypeDefs,\n dependencies: []\n});\n"],"names":["CmsQueryTypeDefs","builder","CmsQueryTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/typeDefs/query.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/query.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.core.js\";\n\nclass CmsQueryTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsQuery {\n getEntry(\n modelId: ID!\n where: JSON!\n fields: [String!]!\n preview: Boolean\n ): CmsEntryResponse!\n listEntries(\n modelId: ID!\n where: JSON\n sort: JSON\n limit: Int\n after: String\n search: String\n fields: [String!]!\n preview: Boolean\n ): CmsListResponse!\n getModel(modelId: ID!): CmsModelResponse!\n }\n\n extend type Query {\n cms: CmsQuery!\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsQueryTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsQueryTypeDefs,\n dependencies: []\n});\n"],"names":["CmsQueryTypeDefs","builder","CmsQueryTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;QAwBnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,uBAAuBC,yBAAyB,oBAAoB,CAAC;IAC9E,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema/cms/typeDefs/responses.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/responses.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.core.js\";\n\nclass CmsResponseTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsEntryResponse {\n data: JSON\n error: CmsError\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n type CmsListResponse {\n data: [JSON!]\n meta: CmsListMeta\n error: CmsError\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsResponseTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsResponseTypeDefs,\n dependencies: []\n});\n"],"names":["CmsResponseTypeDefs","builder","CmsResponseTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC
|
|
1
|
+
{"version":3,"file":"graphql/schema/cms/typeDefs/responses.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/responses.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.core.js\";\n\nclass CmsResponseTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsEntryResponse {\n data: JSON\n error: CmsError\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n type CmsListResponse {\n data: [JSON!]\n meta: CmsListMeta\n error: CmsError\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n\n type CmsModelResponse {\n data: JSON\n error: CmsError\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsResponseTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsResponseTypeDefs,\n dependencies: []\n});\n"],"names":["CmsResponseTypeDefs","builder","CmsResponseTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2BnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,0BAA0BC,yBAAyB,oBAAoB,CAAC;IACjF,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ErrorResponse, NotFoundError, Response } from "@webiny/handler-graphql";
|
|
2
2
|
import { createCmsGraphQLSchemaPlugin } from "../../plugins/index.js";
|
|
3
|
+
import { ValuesSelectionGenerator } from "../../features/contentModel/ValuesSelectionGenerator/abstractions.js";
|
|
4
|
+
import { ComponentMapGenerator } from "../../features/contentModel/ComponentMapGenerator/abstractions.js";
|
|
5
|
+
import { RefModelsGenerator } from "../../features/contentModel/RefModelsGenerator/abstractions.js";
|
|
3
6
|
const createModelsSchema = ({ context })=>{
|
|
4
7
|
const resolvers = {
|
|
5
8
|
Query: {
|
|
@@ -36,7 +39,22 @@ const createModelsSchema = ({ context })=>{
|
|
|
36
39
|
return Array.isArray(field.tags) ? field.tags : [];
|
|
37
40
|
}
|
|
38
41
|
},
|
|
42
|
+
CmsContentModelMetadata: {
|
|
43
|
+
valuesSelection: (model, _, ctx)=>{
|
|
44
|
+
const generator = ctx.container.resolve(ValuesSelectionGenerator);
|
|
45
|
+
return generator.generate(model);
|
|
46
|
+
},
|
|
47
|
+
componentMap: (model, _, ctx)=>{
|
|
48
|
+
const generator = ctx.container.resolve(ComponentMapGenerator);
|
|
49
|
+
return generator.generate(model);
|
|
50
|
+
},
|
|
51
|
+
refModels: async (model, _, ctx)=>{
|
|
52
|
+
const generator = ctx.container.resolve(RefModelsGenerator);
|
|
53
|
+
return generator.generate(model);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
39
56
|
CmsContentModel: {
|
|
57
|
+
metadata: (model)=>model,
|
|
40
58
|
tags (model) {
|
|
41
59
|
const hasType = (model.tags || []).find((tag)=>tag.startsWith("type:"));
|
|
42
60
|
return hasType ? model.tags : [
|
|
@@ -44,7 +62,11 @@ const createModelsSchema = ({ context })=>{
|
|
|
44
62
|
...model.tags || []
|
|
45
63
|
];
|
|
46
64
|
},
|
|
47
|
-
plugin: (model)=>model.isPlugin ?? false
|
|
65
|
+
plugin: (model)=>model.isPlugin ?? false,
|
|
66
|
+
valuesSelection: (model, _, ctx)=>{
|
|
67
|
+
const generator = ctx.container.resolve(ValuesSelectionGenerator);
|
|
68
|
+
return generator.generate(model);
|
|
69
|
+
}
|
|
48
70
|
}
|
|
49
71
|
};
|
|
50
72
|
let manageSchema = "";
|
|
@@ -129,6 +151,7 @@ const createModelsSchema = ({ context })=>{
|
|
|
129
151
|
type: String!
|
|
130
152
|
tags: [String!]
|
|
131
153
|
list: Boolean
|
|
154
|
+
disabled: Boolean
|
|
132
155
|
predefinedValues: CmsPredefinedValuesInput
|
|
133
156
|
renderer: CmsFieldRendererInput
|
|
134
157
|
validation: [CmsFieldValidationInput]
|
|
@@ -153,6 +176,7 @@ const createModelsSchema = ({ context })=>{
|
|
|
153
176
|
imageFieldId: String
|
|
154
177
|
tags: [String!]
|
|
155
178
|
defaultFields: Boolean
|
|
179
|
+
settings: JSON
|
|
156
180
|
}
|
|
157
181
|
|
|
158
182
|
input CmsContentModelCreateFromInput {
|
|
@@ -178,6 +202,7 @@ const createModelsSchema = ({ context })=>{
|
|
|
178
202
|
descriptionFieldId: String
|
|
179
203
|
imageFieldId: String
|
|
180
204
|
tags: [String!]
|
|
205
|
+
settings: JSON
|
|
181
206
|
}
|
|
182
207
|
|
|
183
208
|
extend type Mutation {
|
|
@@ -243,6 +268,7 @@ const createModelsSchema = ({ context })=>{
|
|
|
243
268
|
type: String!
|
|
244
269
|
tags: [String!]!
|
|
245
270
|
list: Boolean
|
|
271
|
+
disabled: Boolean
|
|
246
272
|
predefinedValues: CmsPredefinedValues
|
|
247
273
|
renderer: CmsFieldRenderer
|
|
248
274
|
validation: [CmsFieldValidation!]
|
|
@@ -251,6 +277,16 @@ const createModelsSchema = ({ context })=>{
|
|
|
251
277
|
rules: [CmsFieldRule!]
|
|
252
278
|
}
|
|
253
279
|
|
|
280
|
+
type CmsContentModelRefModel {
|
|
281
|
+
valuesSelection: String
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
type CmsContentModelMetadata {
|
|
285
|
+
valuesSelection: String
|
|
286
|
+
componentMap: JSON
|
|
287
|
+
refModels: JSON
|
|
288
|
+
}
|
|
289
|
+
|
|
254
290
|
type CmsContentModel {
|
|
255
291
|
name: String!
|
|
256
292
|
singularApiName: String!
|
|
@@ -269,8 +305,11 @@ const createModelsSchema = ({ context })=>{
|
|
|
269
305
|
imageFieldId: String
|
|
270
306
|
tags: [String!]!
|
|
271
307
|
tenant: String!
|
|
308
|
+
settings: JSON
|
|
272
309
|
# Returns true if the content model is registered via a plugin.
|
|
273
310
|
plugin: Boolean!
|
|
311
|
+
valuesSelection: String
|
|
312
|
+
metadata: CmsContentModelMetadata
|
|
274
313
|
}
|
|
275
314
|
|
|
276
315
|
type CmsContentModelResponse {
|