@webiny/api-headless-cms 5.23.1-beta.0 → 5.24.0
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/content/graphQLHandlerFactory.js +8 -2
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +3 -2
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +3 -2
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +3 -2
- package/content/plugins/crud/contentEntry/markLockedFields.d.ts +2 -1
- package/content/plugins/crud/contentModel/afterCreate.d.ts +3 -2
- package/content/plugins/crud/contentModel/afterDelete.d.ts +3 -2
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +3 -2
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +3 -2
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +3 -2
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +3 -2
- package/content/plugins/crud/contentModel/beforeUpdate.js +69 -0
- package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +2 -2
- package/content/plugins/crud/contentModel/models.js +9 -0
- package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +3 -2
- package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +3 -2
- package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +3 -2
- package/content/plugins/graphqlFields/datetime.js +3 -1
- package/content/plugins/graphqlFields/object.js +9 -13
- package/content/plugins/graphqlFields/ref.js +25 -5
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +1 -1
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +1 -0
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +1 -1
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +1 -0
- package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +3 -3
- package/content/plugins/schema/createFieldResolvers.d.ts +8 -7
- package/content/plugins/schema/createFieldResolvers.js +25 -12
- package/content/plugins/schema/createManageResolvers.d.ts +7 -6
- package/content/plugins/schema/createManageSDL.d.ts +5 -4
- package/content/plugins/schema/createPreviewResolvers.d.ts +8 -6
- package/content/plugins/schema/createReadResolvers.d.ts +8 -6
- package/content/plugins/schema/createReadSDL.d.ts +7 -6
- package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +5 -4
- package/content/plugins/schema/resolvers/manage/resolveCreate.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +5 -4
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveDelete.js +4 -8
- package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveList.d.ts +4 -2
- package/content/plugins/schema/resolvers/manage/resolveList.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveRepublish.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +3 -2
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +3 -2
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +2 -4
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +6 -1
- package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +5 -4
- package/content/plugins/schema/resolvers/manage/resolveUpdate.js +2 -4
- package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +4 -2
- package/content/plugins/schema/resolvers/preview/resolveList.d.ts +4 -2
- package/content/plugins/schema/resolvers/preview/resolveList.js +2 -4
- package/content/plugins/schema/resolvers/read/resolveGet.d.ts +4 -2
- package/content/plugins/schema/resolvers/read/resolveList.d.ts +4 -2
- package/content/plugins/schema/resolvers/read/resolveList.js +2 -4
- package/content/plugins/storage/StorageTransformPlugin.d.ts +2 -2
- package/content/plugins/storage/object.js +9 -8
- package/content/plugins/utils/createTypeName.d.ts +3 -3
- package/content/plugins/utils/getEntryTitle.d.ts +1 -1
- package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +7 -6
- package/content/plugins/utils/getSchemaFromFieldPlugins.js +6 -6
- package/content/plugins/utils/pluralizedTypeName.d.ts +1 -1
- package/content/plugins/utils/renderFields.d.ts +11 -12
- package/content/plugins/utils/renderFields.js +1 -1
- package/content/plugins/utils/renderGetFilterFields.d.ts +5 -4
- package/content/plugins/utils/renderGetFilterFields.js +23 -13
- package/content/plugins/utils/renderInputFields.d.ts +10 -10
- package/content/plugins/utils/renderListFilterFields.d.ts +7 -6
- package/content/plugins/utils/renderListFilterFields.js +24 -12
- package/content/plugins/utils/renderSortEnum.js +5 -5
- package/migrateCMSPermissions.d.ts +2 -2
- package/migrateCMSPermissions.js +4 -0
- package/package.json +24 -23
- package/plugins/graphql/system.d.ts +4 -3
- package/plugins/graphql/system.js +5 -3
- package/plugins/upgrades/v5.5.0/index.js +4 -0
- package/types.d.ts +12 -12
- package/utils.d.ts +4 -4
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CmsModel, CmsFieldTypePlugins, CmsContext } from "../../../types";
|
|
2
|
+
interface CreateReadResolversParams {
|
|
3
|
+
models: CmsModel[];
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
context: CmsContext;
|
|
6
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
+
}
|
|
2
8
|
export interface CreateReadResolvers {
|
|
3
|
-
(params:
|
|
4
|
-
models: CmsModel[];
|
|
5
|
-
model: CmsModel;
|
|
6
|
-
context: CmsContext;
|
|
7
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
8
|
-
}): any;
|
|
9
|
+
(params: CreateReadResolversParams): any;
|
|
9
10
|
}
|
|
10
11
|
export declare const createReadResolvers: CreateReadResolvers;
|
|
12
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CmsModel, CmsFieldTypePlugins } from "../../../types";
|
|
2
|
-
interface
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
-
}): string;
|
|
2
|
+
interface CreateReadSDLParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
5
|
}
|
|
8
|
-
|
|
6
|
+
interface CreateReadSDL {
|
|
7
|
+
(params: CreateReadSDLParams): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const createReadSDL: CreateReadSDL;
|
|
9
10
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
3
|
-
data:
|
|
4
|
-
}
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, CreateCmsEntryInput } from "../../../../../types";
|
|
2
|
+
interface ResolveCreateArgs {
|
|
3
|
+
data: CreateCmsEntryInput;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveCreate = ResolverFactory<any, ResolveCreateArgs>;
|
|
5
6
|
export declare const resolveCreate: ResolveCreate;
|
|
6
7
|
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveCreate = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const entry = await cms.createEntry(model, args.data);
|
|
14
|
+
const entry = await context.cms.createEntry(model, args.data);
|
|
17
15
|
return new _responses.Response(entry);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, CreateFromCmsEntryInput } from "../../../../../types";
|
|
2
|
+
interface ResolveCreateFromArgs {
|
|
3
3
|
revision: string;
|
|
4
|
-
data:
|
|
5
|
-
}
|
|
4
|
+
data: CreateFromCmsEntryInput;
|
|
5
|
+
}
|
|
6
|
+
declare type ResolveCreateFrom = ResolverFactory<any, ResolveCreateFromArgs>;
|
|
6
7
|
export declare const resolveCreateFrom: ResolveCreateFrom;
|
|
7
8
|
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveCreateFrom = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const newRevision = await cms.createEntryRevisionFrom(model, args.revision, args.data || {});
|
|
14
|
+
const newRevision = await context.cms.createEntryRevisionFrom(model, args.revision, args.data || {});
|
|
17
15
|
return new _responses.Response(newRevision);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveDeleteArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveDelete = ResolverFactory<any, ResolveDeleteArgs>;
|
|
6
|
+
export declare const resolveDelete: ResolveDelete;
|
|
7
|
+
export {};
|
|
@@ -11,20 +11,16 @@ var _utils = require("@webiny/utils");
|
|
|
11
11
|
|
|
12
12
|
const resolveDelete = ({
|
|
13
13
|
model
|
|
14
|
-
}) => async (_, {
|
|
15
|
-
revision
|
|
16
|
-
}, {
|
|
17
|
-
cms
|
|
18
|
-
}) => {
|
|
14
|
+
}) => async (_, args, context) => {
|
|
19
15
|
try {
|
|
20
16
|
const {
|
|
21
17
|
version
|
|
22
|
-
} = (0, _utils.parseIdentifier)(revision);
|
|
18
|
+
} = (0, _utils.parseIdentifier)(args.revision);
|
|
23
19
|
|
|
24
20
|
if (version) {
|
|
25
|
-
await cms.deleteEntryRevision(model, revision);
|
|
21
|
+
await context.cms.deleteEntryRevision(model, args.revision);
|
|
26
22
|
} else {
|
|
27
|
-
await cms.deleteEntry(model, revision);
|
|
23
|
+
await context.cms.deleteEntry(model, args.revision);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
return new _responses.Response(true);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveGetArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveGet = ResolverFactory<any, ResolveGetArgs>;
|
|
6
|
+
export declare const resolveGet: ResolveGet;
|
|
7
|
+
export {};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveGetByIdsArgs {
|
|
3
|
+
revisions: string[];
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveGetByIds = ResolverFactory<any, ResolveGetByIdsArgs>;
|
|
6
|
+
export declare const resolveGetByIds: ResolveGetByIds;
|
|
7
|
+
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveGetByIds = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const response = await cms.getEntriesByIds(model, args.revisions);
|
|
14
|
+
const response = await context.cms.getEntriesByIds(model, args.revisions);
|
|
17
15
|
return new _responses.Response(response);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveGetRevisionsArgs {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveGetRevisions = ResolverFactory<any, ResolveGetRevisionsArgs>;
|
|
6
|
+
export declare const resolveGetRevisions: ResolveGetRevisions;
|
|
7
|
+
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveGetRevisions = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const revisions = await cms.getEntryRevisions(model, args.id);
|
|
14
|
+
const revisions = await context.cms.getEntryRevisions(model, args.id);
|
|
17
15
|
return new _responses.Response(revisions.sort((a, b) => b.version - a.version));
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, CmsEntryListParams } from "../../../../../types";
|
|
2
|
+
declare type ResolveList = ResolverFactory<any, CmsEntryListParams>;
|
|
3
|
+
export declare const resolveList: ResolveList;
|
|
4
|
+
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveList = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const response = await cms.listLatestEntries(model, args);
|
|
14
|
+
const response = await context.cms.listLatestEntries(model, args);
|
|
17
15
|
return new _responses.ListResponse(...response);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ListErrorResponse(e);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolvePublishArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolvePublish = ResolverFactory<any, ResolvePublishArgs>;
|
|
6
|
+
export declare const resolvePublish: ResolvePublish;
|
|
7
|
+
export {};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveRepublishArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveRepublish = ResolverFactory<any, ResolveRepublishArgs>;
|
|
6
|
+
export declare const resolveRepublish: ResolveRepublish;
|
|
7
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveRequestChangesArgs {
|
|
3
3
|
revision: string;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveRequestChanges = ResolverFactory<any, ResolveRequestChangesArgs>;
|
|
5
6
|
export declare const resolveRequestChanges: ResolveRequestChanges;
|
|
6
7
|
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveRequestChanges = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const entry = await cms.requestEntryChanges(model, args.revision);
|
|
14
|
+
const entry = await context.cms.requestEntryChanges(model, args.revision);
|
|
17
15
|
return new _responses.Response(entry);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveRequestReviewArgs {
|
|
3
3
|
revision: string;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveRequestReview = ResolverFactory<any, ResolveRequestReviewArgs>;
|
|
5
6
|
export declare const resolveRequestReview: ResolveRequestReview;
|
|
6
7
|
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveRequestReview = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const entry = await cms.requestEntryReview(model, args.revision);
|
|
14
|
+
const entry = await context.cms.requestEntryReview(model, args.revision);
|
|
17
15
|
return new _responses.Response(entry);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
2
|
+
interface ResolveUnpublishArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
declare type ResolveUnpublish = ResolverFactory<any, ResolveUnpublishArgs>;
|
|
6
|
+
export declare const resolveUnpublish: ResolveUnpublish;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, UpdateCmsEntryInput } from "../../../../../types";
|
|
2
|
+
interface ResolveUpdateArgs {
|
|
3
3
|
revision: string;
|
|
4
|
-
data:
|
|
5
|
-
}
|
|
4
|
+
data: UpdateCmsEntryInput;
|
|
5
|
+
}
|
|
6
|
+
declare type ResolveUpdate = ResolverFactory<any, ResolveUpdateArgs>;
|
|
6
7
|
export declare const resolveUpdate: ResolveUpdate;
|
|
7
8
|
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveUpdate = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const entry = await cms.updateEntry(model, args.revision, args.data);
|
|
14
|
+
const entry = await context.cms.updateEntry(model, args.revision, args.data);
|
|
17
15
|
return new _responses.Response(entry);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ErrorResponse(e);
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryListParams, CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
+
declare type ResolveGet = ResolverFactory<any, CmsEntryListParams>;
|
|
3
|
+
export declare const resolveGet: ResolveGet;
|
|
4
|
+
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, CmsEntryListParams } from "../../../../../types";
|
|
2
|
+
declare type ResolveList = ResolverFactory<any, CmsEntryListParams>;
|
|
3
|
+
export declare const resolveList: ResolveList;
|
|
4
|
+
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveList = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const response = await cms.listLatestEntries(model, args);
|
|
14
|
+
const response = await context.cms.listLatestEntries(model, args);
|
|
17
15
|
return new _responses.ListResponse(...response);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ListErrorResponse(e);
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryListParams, CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
+
declare type ResolveGet = ResolverFactory<any, CmsEntryListParams>;
|
|
3
|
+
export declare const resolveGet: ResolveGet;
|
|
4
|
+
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { CmsEntryResolverFactory as ResolverFactory } from "../../../../../types";
|
|
2
|
-
|
|
1
|
+
import { CmsEntryResolverFactory as ResolverFactory, CmsEntryListParams } from "../../../../../types";
|
|
2
|
+
declare type ResolveList = ResolverFactory<any, CmsEntryListParams>;
|
|
3
|
+
export declare const resolveList: ResolveList;
|
|
4
|
+
export {};
|
|
@@ -9,11 +9,9 @@ var _responses = require("@webiny/handler-graphql/responses");
|
|
|
9
9
|
|
|
10
10
|
const resolveList = ({
|
|
11
11
|
model
|
|
12
|
-
}) => async (_, args, {
|
|
13
|
-
cms
|
|
14
|
-
}) => {
|
|
12
|
+
}) => async (_, args, context) => {
|
|
15
13
|
try {
|
|
16
|
-
const response = await cms.listPublishedEntries(model, args);
|
|
14
|
+
const response = await context.cms.listPublishedEntries(model, args);
|
|
17
15
|
return new _responses.ListResponse(...response);
|
|
18
16
|
} catch (e) {
|
|
19
17
|
return new _responses.ListErrorResponse(e);
|
|
@@ -15,7 +15,7 @@ export interface FromStorageParams<T> {
|
|
|
15
15
|
getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;
|
|
16
16
|
plugins: PluginsContainer;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface StorageTransformPluginParams<T, R> {
|
|
19
19
|
fieldType: string;
|
|
20
20
|
toStorage: (params: ToStorageParams<T>) => Promise<R>;
|
|
21
21
|
fromStorage: (params: FromStorageParams<R>) => Promise<T>;
|
|
@@ -24,7 +24,7 @@ export declare class StorageTransformPlugin<T = any, R = any> extends Plugin {
|
|
|
24
24
|
static readonly type: string;
|
|
25
25
|
get fieldType(): string;
|
|
26
26
|
private readonly config;
|
|
27
|
-
constructor(config:
|
|
27
|
+
constructor(config: StorageTransformPluginParams<T, R>);
|
|
28
28
|
toStorage(params: ToStorageParams<T>): Promise<R>;
|
|
29
29
|
fromStorage(params: FromStorageParams<R>): Promise<T>;
|
|
30
30
|
}
|
|
@@ -19,14 +19,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
|
-
const processValue = async
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const processValue = async params => {
|
|
23
|
+
const {
|
|
24
|
+
fields,
|
|
25
|
+
sourceValue,
|
|
26
|
+
getStoragePlugin,
|
|
27
|
+
plugins,
|
|
28
|
+
model,
|
|
29
|
+
operation
|
|
30
|
+
} = params;
|
|
30
31
|
return await (0, _pReduce.default)(fields, async (values, field) => {
|
|
31
32
|
const plugin = getStoragePlugin(field.type);
|
|
32
33
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const createTypeName: (modelId: string) =>
|
|
2
|
-
export declare const createReadTypeName: (baseTypeName: string) =>
|
|
3
|
-
export declare const createManageTypeName: (baseTypeName: string) =>
|
|
1
|
+
export declare const createTypeName: (modelId: string) => string;
|
|
2
|
+
export declare const createReadTypeName: (baseTypeName: string) => string;
|
|
3
|
+
export declare const createManageTypeName: (baseTypeName: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CmsEntry, CmsModel } from "../../../types";
|
|
2
|
-
export declare function getEntryTitle(model: CmsModel, entry: CmsEntry):
|
|
2
|
+
export declare function getEntryTitle(model: CmsModel, entry: CmsEntry): string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { CmsModel, CmsContext, CmsFieldTypePlugins } from "../../../types";
|
|
1
|
+
import { CmsModel, CmsContext, CmsFieldTypePlugins, ApiEndpoint } from "../../../types";
|
|
2
2
|
import { GraphQLSchemaDefinition } from "@webiny/handler-graphql/types";
|
|
3
|
+
interface RenderTypesFromFieldPluginsParams {
|
|
4
|
+
models: CmsModel[];
|
|
5
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
+
type: ApiEndpoint;
|
|
7
|
+
}
|
|
3
8
|
interface RenderTypesFromFieldPlugins {
|
|
4
|
-
(params:
|
|
5
|
-
models: CmsModel[];
|
|
6
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
-
type: string;
|
|
8
|
-
}): GraphQLSchemaDefinition<CmsContext>[];
|
|
9
|
+
(params: RenderTypesFromFieldPluginsParams): GraphQLSchemaDefinition<CmsContext>[];
|
|
9
10
|
}
|
|
10
11
|
export declare const getSchemaFromFieldPlugins: RenderTypesFromFieldPlugins;
|
|
11
12
|
export {};
|
|
@@ -15,15 +15,15 @@ const getSchemaFromFieldPlugins = ({
|
|
|
15
15
|
fieldTypePlugins,
|
|
16
16
|
type
|
|
17
17
|
}) => {
|
|
18
|
-
return Object.values(fieldTypePlugins).map(
|
|
18
|
+
return Object.values(fieldTypePlugins).map(plugin => {
|
|
19
19
|
// Render gql types generated by field type plugins
|
|
20
|
-
if (typeof
|
|
21
|
-
return
|
|
22
|
-
models
|
|
23
|
-
});
|
|
20
|
+
if (typeof plugin[TYPE_MAP[type]].createSchema !== "function") {
|
|
21
|
+
return null;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
return
|
|
24
|
+
return plugin[TYPE_MAP[type]].createSchema({
|
|
25
|
+
models
|
|
26
|
+
});
|
|
27
27
|
}).filter(Boolean);
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pluralizedTypeName: (typeName: string) =>
|
|
1
|
+
export declare const pluralizedTypeName: (typeName: string) => string;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { CmsFieldTypePlugins, CmsModel, CmsModelFieldDefinition } from "../../../types";
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../../../types";
|
|
2
|
+
interface RenderFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
type: ApiEndpoint;
|
|
5
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
+
}
|
|
2
7
|
interface RenderFields {
|
|
3
|
-
(params:
|
|
4
|
-
model: CmsModel;
|
|
5
|
-
type: string;
|
|
6
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
-
}): CmsModelFieldDefinition[];
|
|
8
|
+
(params: RenderFieldsParams): CmsModelFieldDefinition[];
|
|
8
9
|
}
|
|
9
10
|
export declare const renderFields: RenderFields;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
fieldTypePlugins: any;
|
|
15
|
-
}) => any;
|
|
11
|
+
interface RenderFieldParams extends RenderFieldsParams {
|
|
12
|
+
field: CmsModelField;
|
|
13
|
+
}
|
|
14
|
+
export declare const renderField: ({ model, type, field, fieldTypePlugins }: RenderFieldParams) => CmsModelFieldDefinition | null;
|
|
16
15
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CmsFieldTypePlugins, CmsModel } from "../../../types";
|
|
2
|
+
interface RenderGetFilterFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
5
|
+
}
|
|
2
6
|
interface RenderGetFilterFields {
|
|
3
|
-
(params:
|
|
4
|
-
model: CmsModel;
|
|
5
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
-
}): string;
|
|
7
|
+
(params: RenderGetFilterFieldsParams): string;
|
|
7
8
|
}
|
|
8
9
|
export declare const renderGetFilterFields: RenderGetFilterFields;
|
|
9
10
|
export {};
|
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.renderGetFilterFields = void 0;
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
const getCreateFilters = (plugins, fieldType) => {
|
|
9
|
+
if (!plugins[fieldType] || !plugins[fieldType].read.createGetFilters) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return plugins[fieldType].read.createGetFilters;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
const renderGetFilterFields = ({
|
|
13
17
|
model,
|
|
14
18
|
fieldTypePlugins
|
|
15
19
|
}) => {
|
|
16
|
-
const fieldIds = model.fields.filter(
|
|
20
|
+
const fieldIds = model.fields.filter(field => {
|
|
17
21
|
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
18
22
|
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
19
23
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
20
24
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
21
25
|
// could've just removed the plugin from the backend.
|
|
22
|
-
|
|
26
|
+
if (!fieldTypePlugins[field.type]) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fieldTypePlugins[field.type].isSearchable;
|
|
23
31
|
}).map(f => f.fieldId);
|
|
24
32
|
const filters = ["id: ID", "entryId: String"];
|
|
25
33
|
|
|
26
|
-
for (
|
|
27
|
-
const field = model.fields.find(item => item.fieldId ===
|
|
28
|
-
const createGetFilters = (
|
|
34
|
+
for (const id of fieldIds) {
|
|
35
|
+
const field = model.fields.find(item => item.fieldId === id);
|
|
36
|
+
const createGetFilters = getCreateFilters(fieldTypePlugins, field.type);
|
|
29
37
|
|
|
30
|
-
if (typeof createGetFilters
|
|
31
|
-
|
|
32
|
-
model,
|
|
33
|
-
field
|
|
34
|
-
}));
|
|
38
|
+
if (typeof createGetFilters !== "function") {
|
|
39
|
+
continue;
|
|
35
40
|
}
|
|
41
|
+
|
|
42
|
+
filters.push(createGetFilters({
|
|
43
|
+
model,
|
|
44
|
+
field
|
|
45
|
+
}));
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
return filters.filter(Boolean).join("\n");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CmsFieldTypePlugins, CmsModel, CmsModelFieldDefinition } from "../../../types";
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../../../types";
|
|
2
|
+
interface RenderInputFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
5
|
+
}
|
|
6
|
+
interface RenderInputFieldParams extends RenderInputFieldsParams {
|
|
7
|
+
field: CmsModelField;
|
|
8
|
+
}
|
|
2
9
|
interface RenderInputFields {
|
|
3
|
-
(params:
|
|
4
|
-
model: CmsModel;
|
|
5
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
-
}): CmsModelFieldDefinition[];
|
|
10
|
+
(params: RenderInputFieldsParams): CmsModelFieldDefinition[];
|
|
7
11
|
}
|
|
8
12
|
export declare const renderInputFields: RenderInputFields;
|
|
9
|
-
export declare const renderInputField: ({ model, field, fieldTypePlugins }:
|
|
10
|
-
model: any;
|
|
11
|
-
field: any;
|
|
12
|
-
fieldTypePlugins: any;
|
|
13
|
-
}) => CmsModelFieldDefinition;
|
|
13
|
+
export declare const renderInputField: ({ model, field, fieldTypePlugins }: RenderInputFieldParams) => CmsModelFieldDefinition;
|
|
14
14
|
export {};
|