@webbio/strapi-plugin-page-builder 0.9.0-platform → 0.9.2-platform

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.
Files changed (30) hide show
  1. package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +1 -0
  2. package/admin/src/components/PlatformFilteredSelectField/hooks/useRelationLoad.tsx +4 -2
  3. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInput.tsx +1 -2
  4. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/useRelation.ts +170 -0
  5. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/getRelationLink.ts +5 -0
  6. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/normalizeRelations.ts +52 -0
  7. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useDragAndDrop.ts +2 -2
  8. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useKeyboardDragAndDrop.ts +69 -69
  9. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/usePrev.ts +5 -5
  10. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/dragAndDrop.ts +6 -6
  11. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/paths.ts +14 -21
  12. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/refs.ts +6 -6
  13. package/admin/src/components/StrapiCore/content-manager/shared/contracts/collection-types.ts +207 -207
  14. package/admin/src/components/StrapiCore/content-manager/shared/contracts/components.ts +42 -42
  15. package/admin/src/components/StrapiCore/content-manager/shared/contracts/content-types.ts +74 -74
  16. package/admin/src/components/StrapiCore/content-manager/shared/contracts/init.ts +12 -12
  17. package/admin/src/components/StrapiCore/content-manager/shared/contracts/relations.ts +57 -57
  18. package/admin/src/components/StrapiCore/content-manager/shared/contracts/review-workflows.ts +52 -52
  19. package/admin/src/components/StrapiCore/content-manager/shared/contracts/single-types.ts +65 -65
  20. package/admin/src/components/StrapiCore/content-manager/shared/contracts/uid.ts +31 -31
  21. package/dist/package.json +1 -1
  22. package/dist/server/bootstrap/permissions.js +97 -69
  23. package/dist/server/middlewares/mikkel.js +35 -0
  24. package/dist/server/policies/platformSelector.js +18 -0
  25. package/dist/server/utils/graphql.js +100 -0
  26. package/dist/server/utils/paginationValidation.js +31 -0
  27. package/dist/tsconfig.server.tsbuildinfo +1 -1
  28. package/package.json +1 -1
  29. package/server/bootstrap/permissions.ts +103 -72
  30. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/normalizeRelations.ts +0 -7
@@ -3,114 +3,114 @@ import { errors } from '@strapi/utils';
3
3
  import { ComponentConfiguration } from './components';
4
4
 
5
5
  export type Settings = {
6
- bulkable: boolean;
7
- filterable: boolean;
8
- searchable: boolean;
9
- pageSize: number;
10
- mainField: string;
11
- defaultSortBy: string;
12
- defaultSortOrder: string;
6
+ bulkable: boolean;
7
+ filterable: boolean;
8
+ searchable: boolean;
9
+ pageSize: number;
10
+ mainField: string;
11
+ defaultSortBy: string;
12
+ defaultSortOrder: string;
13
13
  };
14
14
 
15
15
  export type Metadatas = {
16
- [key: string]: {
17
- edit: {
18
- label?: string;
19
- description?: string;
20
- placeholder?: string;
21
- visible?: boolean;
22
- editable?: boolean;
23
- };
24
- list: {
25
- label?: string;
26
- searchable?: boolean;
27
- sortable?: boolean;
28
- };
29
- };
16
+ [key: string]: {
17
+ edit: {
18
+ label?: string;
19
+ description?: string;
20
+ placeholder?: string;
21
+ visible?: boolean;
22
+ editable?: boolean;
23
+ };
24
+ list: {
25
+ label?: string;
26
+ searchable?: boolean;
27
+ sortable?: boolean;
28
+ };
29
+ };
30
30
  };
31
31
 
32
32
  export type Layouts = {
33
- list: string[];
34
- edit: { name: string; size: number }[][];
33
+ list: string[];
34
+ edit: { name: string; size: number }[][];
35
35
  };
36
36
 
37
37
  export type Configuration = {
38
- uid?: string;
39
- settings: Settings;
40
- metadatas: Metadatas;
41
- layouts: Layouts;
38
+ uid?: string;
39
+ settings: Settings;
40
+ metadatas: Metadatas;
41
+ layouts: Layouts;
42
42
  };
43
43
 
44
44
  export interface ContentType extends Schema.ContentType {
45
- isDisplayed: boolean;
46
- apiID: string;
45
+ isDisplayed: boolean;
46
+ apiID: string;
47
47
  }
48
48
 
49
49
  /**
50
50
  * GET /content-types
51
51
  */
52
52
  export declare namespace FindContentTypes {
53
- export interface Request {
54
- body: {};
55
- query: {};
56
- }
57
- export interface Response {
58
- data: ContentType[];
59
- error?: errors.ApplicationError | errors.YupValidationError;
60
- }
53
+ export interface Request {
54
+ body: {};
55
+ query: {};
56
+ }
57
+ export interface Response {
58
+ data: ContentType[];
59
+ error?: errors.ApplicationError | errors.YupValidationError;
60
+ }
61
61
  }
62
62
 
63
63
  /**
64
64
  * GET /content-types-settings
65
65
  */
66
66
  export declare namespace FindContentTypesSettings {
67
- export interface Request {
68
- body: {};
69
- query: {};
70
- }
71
- export interface Response {
72
- data: Array<{
73
- uid: string;
74
- settings: Settings;
75
- }>;
76
- error?: errors.ApplicationError;
77
- }
67
+ export interface Request {
68
+ body: {};
69
+ query: {};
70
+ }
71
+ export interface Response {
72
+ data: Array<{
73
+ uid: string;
74
+ settings: Settings;
75
+ }>;
76
+ error?: errors.ApplicationError;
77
+ }
78
78
  }
79
79
 
80
80
  /**
81
81
  * GET /content-types/:uid/configuration
82
82
  */
83
83
  export declare namespace FindContentTypeConfiguration {
84
- export interface Request {
85
- body: {};
86
- query: {};
87
- }
88
- export interface Response {
89
- data: {
90
- contentType: Configuration;
91
- components: Record<string, ComponentConfiguration>;
92
- };
93
- error?: errors.ApplicationError;
94
- }
84
+ export interface Request {
85
+ body: {};
86
+ query: {};
87
+ }
88
+ export interface Response {
89
+ data: {
90
+ contentType: Configuration;
91
+ components: Record<string, ComponentConfiguration>;
92
+ };
93
+ error?: errors.ApplicationError;
94
+ }
95
95
  }
96
96
 
97
97
  /**
98
98
  * PUT /content-types/:uid/configuration
99
99
  */
100
100
  export declare namespace UpdateContentTypeConfiguration {
101
- export interface Request {
102
- body: {
103
- layouts: Layouts;
104
- metadatas: Metadatas;
105
- settings: Settings;
106
- };
107
- query: {};
108
- }
109
- export interface Response {
110
- data: {
111
- contentType: Configuration;
112
- components: Record<string, ComponentConfiguration>;
113
- };
114
- error?: errors.ApplicationError | errors.YupValidationError;
115
- }
101
+ export interface Request {
102
+ body: {
103
+ layouts: Layouts;
104
+ metadatas: Metadatas;
105
+ settings: Settings;
106
+ };
107
+ query: {};
108
+ }
109
+ export interface Response {
110
+ data: {
111
+ contentType: Configuration;
112
+ components: Record<string, ComponentConfiguration>;
113
+ };
114
+ error?: errors.ApplicationError | errors.YupValidationError;
115
+ }
116
116
  }
@@ -6,17 +6,17 @@ import { ContentType } from './content-types';
6
6
  * GET /init
7
7
  */
8
8
  export declare namespace GetInitData {
9
- export interface Request {
10
- body: {};
11
- query: {};
12
- }
9
+ export interface Request {
10
+ body: {};
11
+ query: {};
12
+ }
13
13
 
14
- export interface Response {
15
- data: {
16
- fieldSizes: Record<string, { default: number; isResizeable: boolean }>;
17
- components: Component[];
18
- contentTypes: ContentType[];
19
- };
20
- error?: errors.ApplicationError;
21
- }
14
+ export interface Response {
15
+ data: {
16
+ fieldSizes: Record<string, { default: number; isResizeable: boolean }>;
17
+ components: Component[];
18
+ contentTypes: ContentType[];
19
+ };
20
+ error?: errors.ApplicationError;
21
+ }
22
22
  }
@@ -4,77 +4,77 @@ import { errors } from '@strapi/utils';
4
4
  type PaginationQuery = EntityService.Params.Pagination.PageNotation;
5
5
 
6
6
  export interface RelationResult {
7
- id: Entity.ID;
8
- publishedAt: string | null;
7
+ id: Entity.ID;
8
+ publishedAt: string | null;
9
9
  }
10
10
 
11
11
  /**
12
12
  * GET /relations/:model/:targetField
13
13
  */
14
14
  export declare namespace FindAvailable {
15
- export interface Request {
16
- body: {};
17
- query: {
18
- pageSize: PaginationQuery['pageSize'];
19
- page: PaginationQuery['page'];
20
- };
21
- }
15
+ export interface Request {
16
+ body: {};
17
+ query: {
18
+ pageSize: PaginationQuery['pageSize'];
19
+ page: PaginationQuery['page'];
20
+ };
21
+ }
22
22
 
23
- export interface Params {
24
- model: string;
25
- targetField: string;
26
- }
23
+ export interface Params {
24
+ model: string;
25
+ targetField: string;
26
+ }
27
27
 
28
- export type Response =
29
- | {
30
- results: RelationResult[];
31
- pagination: {
32
- page: NonNullable<PaginationQuery['page']>;
33
- pageSize: NonNullable<PaginationQuery['pageSize']>;
34
- pageCount: number;
35
- total: number;
36
- };
37
- error?: never;
38
- }
39
- | {
40
- results?: never;
41
- pagination?: never;
42
- error?: errors.ApplicationError | errors.YupValidationError;
43
- };
28
+ export type Response =
29
+ | {
30
+ results: RelationResult[];
31
+ pagination: {
32
+ page: NonNullable<PaginationQuery['page']>;
33
+ pageSize: NonNullable<PaginationQuery['pageSize']>;
34
+ pageCount: number;
35
+ total: number;
36
+ };
37
+ error?: never;
38
+ }
39
+ | {
40
+ results?: never;
41
+ pagination?: never;
42
+ error?: errors.ApplicationError | errors.YupValidationError;
43
+ };
44
44
  }
45
45
 
46
46
  /**
47
47
  * GET /relations/:model/:id/:targetField
48
48
  */
49
49
  export declare namespace FindExisting {
50
- export interface Request {
51
- body: {};
52
- query: {};
53
- }
50
+ export interface Request {
51
+ body: {};
52
+ query: {};
53
+ }
54
54
 
55
- export interface Params {
56
- model: string;
57
- targetField: string;
58
- id: number;
59
- }
55
+ export interface Params {
56
+ model: string;
57
+ targetField: string;
58
+ id: number;
59
+ }
60
60
 
61
- export type Response =
62
- | {
63
- results: RelationResult[];
64
- pagination: {
65
- page: NonNullable<PaginationQuery['page']>;
66
- pageSize: NonNullable<PaginationQuery['pageSize']>;
67
- pageCount: number;
68
- total: number;
69
- };
70
- error?: never;
71
- }
72
- | {
73
- data: RelationResult;
74
- error?: never;
75
- }
76
- | {
77
- data?: never;
78
- error: errors.ApplicationError | errors.YupValidationError;
79
- };
61
+ export type Response =
62
+ | {
63
+ results: RelationResult[];
64
+ pagination: {
65
+ page: NonNullable<PaginationQuery['page']>;
66
+ pageSize: NonNullable<PaginationQuery['pageSize']>;
67
+ pageCount: number;
68
+ total: number;
69
+ };
70
+ error?: never;
71
+ }
72
+ | {
73
+ data: RelationResult;
74
+ error?: never;
75
+ }
76
+ | {
77
+ data?: never;
78
+ error: errors.ApplicationError | errors.YupValidationError;
79
+ };
80
80
  }
@@ -7,82 +7,82 @@ type Entity = EntityService.Result<Common.UID.Schema>;
7
7
  * /content-manager/<collection-type | single-type>/:model/:id/assignee
8
8
  */
9
9
  namespace UpdateAssignee {
10
- export interface Request {
11
- body: {
12
- data: {
13
- id: Entity['id'] | null;
14
- };
15
- };
16
- query: {};
17
- }
10
+ export interface Request {
11
+ body: {
12
+ data: {
13
+ id: Entity['id'] | null;
14
+ };
15
+ };
16
+ query: {};
17
+ }
18
18
 
19
- export interface Params {
20
- model: string;
21
- id: Entity['id'];
22
- }
19
+ export interface Params {
20
+ model: string;
21
+ id: Entity['id'];
22
+ }
23
23
 
24
- export interface Response {
25
- data: Entity;
26
- error?: errors.ApplicationError;
27
- }
24
+ export interface Response {
25
+ data: Entity;
26
+ error?: errors.ApplicationError;
27
+ }
28
28
  }
29
29
 
30
30
  interface StagePermission extends Omit<Entity, 'createdAt' | 'updatedAt'> {
31
- action: string;
32
- actionParameters: object;
33
- subject?: string | null;
34
- role: number;
31
+ action: string;
32
+ actionParameters: object;
33
+ subject?: string | null;
34
+ role: number;
35
35
  }
36
36
 
37
37
  interface Stage extends Entity {
38
- color: string;
39
- name: string;
40
- permissions?: StagePermission[];
38
+ color: string;
39
+ name: string;
40
+ permissions?: StagePermission[];
41
41
  }
42
42
 
43
43
  /**
44
44
  * GET /content-manager/<collection-type | single-type>/:model/:id/stages
45
45
  */
46
46
  namespace GetStages {
47
- export interface Request {
48
- body: {};
49
- query: {};
50
- }
47
+ export interface Request {
48
+ body: {};
49
+ query: {};
50
+ }
51
51
 
52
- export interface Params {
53
- model: string;
54
- id: Entity['id'];
55
- }
52
+ export interface Params {
53
+ model: string;
54
+ id: Entity['id'];
55
+ }
56
56
 
57
- export interface Response {
58
- data: Stage[];
59
- meta?: { workflowCount: number };
60
- error?: errors.ApplicationError;
61
- }
57
+ export interface Response {
58
+ data: Stage[];
59
+ meta?: { workflowCount: number };
60
+ error?: errors.ApplicationError;
61
+ }
62
62
  }
63
63
 
64
64
  /**
65
65
  * PUT /content-manager/<collection-type | single-type>/:model/:id/stage
66
66
  */
67
67
  namespace UpdateStage {
68
- export interface Request {
69
- body: {
70
- data: {
71
- id: Entity['id'];
72
- };
73
- };
74
- query: {};
75
- }
68
+ export interface Request {
69
+ body: {
70
+ data: {
71
+ id: Entity['id'];
72
+ };
73
+ };
74
+ query: {};
75
+ }
76
76
 
77
- export interface Params {
78
- model: string;
79
- id: Entity['id'];
80
- }
77
+ export interface Params {
78
+ model: string;
79
+ id: Entity['id'];
80
+ }
81
81
 
82
- export interface Response {
83
- data: Entity;
84
- error?: errors.ApplicationError;
85
- }
82
+ export interface Response {
83
+ data: Entity;
84
+ error?: errors.ApplicationError;
85
+ }
86
86
  }
87
87
 
88
88
  export type { UpdateAssignee, UpdateStage, GetStages, Stage, StagePermission };
@@ -8,105 +8,105 @@ type Entity = EntityService.Result<Common.UID.Schema>;
8
8
  * GET /single-types/:model
9
9
  */
10
10
  export declare namespace Find {
11
- export interface Request {
12
- body: {};
13
- query: {
14
- locale: string;
15
- };
16
- }
11
+ export interface Request {
12
+ body: {};
13
+ query: {
14
+ locale: string;
15
+ };
16
+ }
17
17
 
18
- export interface Params {
19
- model: string;
20
- }
18
+ export interface Params {
19
+ model: string;
20
+ }
21
21
 
22
- export interface Response {
23
- data: Entity;
24
- error?: errors.ApplicationError;
25
- }
22
+ export interface Response {
23
+ data: Entity;
24
+ error?: errors.ApplicationError;
25
+ }
26
26
  }
27
27
 
28
28
  /**
29
29
  * PUT /single-types/:model
30
30
  */
31
31
  export declare namespace CreateOrUpdate {
32
- export interface Request {
33
- body: Entity;
34
- query: {
35
- plugins: {
36
- i18n: {
37
- locale: string;
38
- };
39
- };
40
- };
41
- }
32
+ export interface Request {
33
+ body: Entity;
34
+ query: {
35
+ plugins: {
36
+ i18n: {
37
+ locale: string;
38
+ };
39
+ };
40
+ };
41
+ }
42
42
 
43
- export interface Response {
44
- data: Entity;
45
- error?: errors.ApplicationError;
46
- }
43
+ export interface Response {
44
+ data: Entity;
45
+ error?: errors.ApplicationError;
46
+ }
47
47
  }
48
48
 
49
49
  /**
50
50
  * DELETE /single-types/:model
51
51
  */
52
52
  export declare namespace Delete {
53
- export interface Request {
54
- body: {};
55
- query: {
56
- locale: string;
57
- };
58
- }
53
+ export interface Request {
54
+ body: {};
55
+ query: {
56
+ locale: string;
57
+ };
58
+ }
59
59
 
60
- export interface Response {
61
- data: Entity;
62
- error?: errors.ApplicationError;
63
- }
60
+ export interface Response {
61
+ data: Entity;
62
+ error?: errors.ApplicationError;
63
+ }
64
64
  }
65
65
 
66
66
  /**
67
67
  * POST /single-types/:model/actions/publish
68
68
  */
69
69
  export declare namespace Publish {
70
- export interface Request {
71
- body: {};
72
- query: {
73
- locale: string;
74
- };
75
- }
70
+ export interface Request {
71
+ body: {};
72
+ query: {
73
+ locale: string;
74
+ };
75
+ }
76
76
 
77
- export interface Response {
78
- data: Entity;
79
- error?: errors.ApplicationError;
80
- }
77
+ export interface Response {
78
+ data: Entity;
79
+ error?: errors.ApplicationError;
80
+ }
81
81
  }
82
82
 
83
83
  /**
84
84
  * POST /single-types/:model/actions/unpublish
85
85
  */
86
86
  export declare namespace UnPublish {
87
- export interface Request {
88
- body: {};
89
- query: {
90
- locale: string;
91
- };
92
- }
93
- export interface Response {
94
- data: Entity;
95
- error?: errors.ApplicationError;
96
- }
87
+ export interface Request {
88
+ body: {};
89
+ query: {
90
+ locale: string;
91
+ };
92
+ }
93
+ export interface Response {
94
+ data: Entity;
95
+ error?: errors.ApplicationError;
96
+ }
97
97
  }
98
98
 
99
99
  /**
100
100
  * GET /single-types/:model/actions/countDraftRelations
101
101
  */
102
102
  export declare namespace CountDraftRelations {
103
- export interface Request {
104
- body: {};
105
- query: {};
106
- }
103
+ export interface Request {
104
+ body: {};
105
+ query: {};
106
+ }
107
107
 
108
- export interface Response {
109
- data: number;
110
- error?: errors.ApplicationError;
111
- }
108
+ export interface Response {
109
+ data: number;
110
+ error?: errors.ApplicationError;
111
+ }
112
112
  }