@webiny/api-aco 0.0.0-unstable.9e825fd5fb → 0.0.0-unstable.a9593f74dd

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 (183) hide show
  1. package/README.md +6 -6
  2. package/apps/AcoApp.d.ts +21 -0
  3. package/apps/AcoApp.js +143 -0
  4. package/apps/AcoApp.js.map +1 -0
  5. package/apps/AcoApps.d.ts +10 -0
  6. package/apps/AcoApps.js +75 -0
  7. package/apps/AcoApps.js.map +1 -0
  8. package/apps/app.gql.d.ts +3 -0
  9. package/apps/app.gql.js +60 -0
  10. package/apps/app.gql.js.map +1 -0
  11. package/apps/index.d.ts +2 -0
  12. package/apps/index.js +29 -0
  13. package/apps/index.js.map +1 -0
  14. package/createAcoContext.d.ts +5 -1
  15. package/createAcoContext.js +159 -28
  16. package/createAcoContext.js.map +1 -1
  17. package/createAcoGraphQL.d.ts +2 -2
  18. package/createAcoGraphQL.js +39 -6
  19. package/createAcoGraphQL.js.map +1 -1
  20. package/createAcoHooks.js +9 -3
  21. package/createAcoHooks.js.map +1 -1
  22. package/createAcoModels.js +6 -42
  23. package/createAcoModels.js.map +1 -1
  24. package/createAcoStorageOperations.d.ts +0 -1
  25. package/createAcoStorageOperations.js +10 -7
  26. package/createAcoStorageOperations.js.map +1 -1
  27. package/{createAcoFields.d.ts → fields/index.d.ts} +1 -1
  28. package/fields/index.js +14 -0
  29. package/fields/index.js.map +1 -0
  30. package/fields/location.d.ts +2 -0
  31. package/fields/location.js +46 -0
  32. package/fields/location.js.map +1 -0
  33. package/filter/filter.crud.d.ts +3 -0
  34. package/filter/filter.crud.js +94 -0
  35. package/filter/filter.crud.js.map +1 -0
  36. package/filter/filter.gql.d.ts +3 -0
  37. package/filter/filter.gql.js +153 -0
  38. package/filter/filter.gql.js.map +1 -0
  39. package/filter/filter.model.d.ts +2 -0
  40. package/filter/filter.model.js +125 -0
  41. package/filter/filter.model.js.map +1 -0
  42. package/filter/filter.so.d.ts +3 -0
  43. package/filter/filter.so.js +98 -0
  44. package/filter/filter.so.js.map +1 -0
  45. package/filter/filter.types.d.ts +95 -0
  46. package/filter/filter.types.js +14 -0
  47. package/filter/filter.types.js.map +1 -0
  48. package/folder/folder.crud.d.ts +8 -1
  49. package/folder/folder.crud.js +201 -4
  50. package/folder/folder.crud.js.map +1 -1
  51. package/folder/folder.gql.js +98 -6
  52. package/folder/folder.gql.js.map +1 -1
  53. package/folder/folder.model.d.ts +1 -3
  54. package/folder/folder.model.js +54 -25
  55. package/folder/folder.model.js.map +1 -1
  56. package/folder/folder.so.js +38 -18
  57. package/folder/folder.so.js.map +1 -1
  58. package/folder/folder.types.d.ts +35 -3
  59. package/folder/folder.types.js +3 -1
  60. package/folder/folder.types.js.map +1 -1
  61. package/folder/onFolderBeforeDeleteAco.hook.d.ts +2 -0
  62. package/folder/onFolderBeforeDeleteAco.hook.js +67 -0
  63. package/folder/onFolderBeforeDeleteAco.hook.js.map +1 -0
  64. package/folder/onFolderBeforeDeleteFm.hook.d.ts +2 -0
  65. package/folder/onFolderBeforeDeleteFm.hook.js +49 -0
  66. package/folder/onFolderBeforeDeleteFm.hook.js.map +1 -0
  67. package/folder/onFolderBeforeDeleteHcms.hook.d.ts +2 -0
  68. package/folder/onFolderBeforeDeleteHcms.hook.js +56 -0
  69. package/folder/onFolderBeforeDeleteHcms.hook.js.map +1 -0
  70. package/index.d.ts +9 -1
  71. package/index.js +57 -5
  72. package/index.js.map +1 -1
  73. package/package.json +38 -32
  74. package/plugins/AcoAppModifierPlugin.d.ts +43 -0
  75. package/plugins/AcoAppModifierPlugin.js +58 -0
  76. package/plugins/AcoAppModifierPlugin.js.map +1 -0
  77. package/plugins/AcoAppRegisterPlugin.d.ts +8 -0
  78. package/plugins/AcoAppRegisterPlugin.js +21 -0
  79. package/plugins/AcoAppRegisterPlugin.js.map +1 -0
  80. package/plugins/index.d.ts +2 -0
  81. package/plugins/index.js +29 -0
  82. package/plugins/index.js.map +1 -0
  83. package/record/graphql/createAppResolvers.d.ts +14 -0
  84. package/record/graphql/createAppResolvers.js +115 -0
  85. package/record/graphql/createAppResolvers.js.map +1 -0
  86. package/record/graphql/createAppSchema.d.ts +9 -0
  87. package/record/graphql/createAppSchema.js +147 -0
  88. package/record/graphql/createAppSchema.js.map +1 -0
  89. package/record/record.crud.js +49 -13
  90. package/record/record.crud.js.map +1 -1
  91. package/record/record.gql.d.ts +8 -3
  92. package/record/record.gql.js +38 -112
  93. package/record/record.gql.js.map +1 -1
  94. package/record/record.model.d.ts +7 -3
  95. package/record/record.model.js +42 -13
  96. package/record/record.model.js.map +1 -1
  97. package/record/record.so.js +109 -45
  98. package/record/record.so.js.map +1 -1
  99. package/record/record.types.d.ts +71 -18
  100. package/record/record.types.js +3 -1
  101. package/record/record.types.js.map +1 -1
  102. package/types.d.ts +69 -8
  103. package/types.js +52 -4
  104. package/types.js.map +1 -1
  105. package/utils/FolderLevelPermissions.d.ts +71 -0
  106. package/utils/FolderLevelPermissions.js +353 -0
  107. package/utils/FolderLevelPermissions.js.map +1 -0
  108. package/utils/acoRecordId.d.ts +6 -0
  109. package/utils/acoRecordId.js +35 -0
  110. package/utils/acoRecordId.js.map +1 -0
  111. package/utils/createListSort.js +3 -1
  112. package/utils/createListSort.js.map +1 -1
  113. package/utils/createModelField.js +3 -1
  114. package/utils/createModelField.js.map +1 -1
  115. package/utils/createOperationsWrapper.js +3 -1
  116. package/utils/createOperationsWrapper.js.map +1 -1
  117. package/utils/decorators/CmsEntriesCrudDecorators.d.ts +11 -0
  118. package/utils/decorators/CmsEntriesCrudDecorators.js +232 -0
  119. package/utils/decorators/CmsEntriesCrudDecorators.js.map +1 -0
  120. package/utils/decorators/constants.d.ts +1 -0
  121. package/utils/decorators/constants.js +10 -0
  122. package/utils/decorators/constants.js.map +1 -0
  123. package/utils/decorators/where.d.ts +14 -0
  124. package/utils/decorators/where.js +52 -0
  125. package/utils/decorators/where.js.map +1 -0
  126. package/utils/ensureAuthentication.d.ts +2 -0
  127. package/utils/ensureAuthentication.js +16 -0
  128. package/utils/ensureAuthentication.js.map +1 -0
  129. package/utils/getFolderAndItsAncestors.d.ts +7 -0
  130. package/utils/getFolderAndItsAncestors.js +53 -0
  131. package/utils/getFolderAndItsAncestors.js.map +1 -0
  132. package/utils/isInstallationPending.js +3 -1
  133. package/utils/isInstallationPending.js.map +1 -1
  134. package/utils/modelFactory.d.ts +1 -3
  135. package/utils/modelFactory.js +7 -10
  136. package/utils/modelFactory.js.map +1 -1
  137. package/utils/pickEntryFieldValues.d.ts +3 -0
  138. package/utils/pickEntryFieldValues.js +31 -0
  139. package/utils/pickEntryFieldValues.js.map +1 -0
  140. package/utils/resolve.d.ts +3 -2
  141. package/utils/resolve.js +13 -2
  142. package/utils/resolve.js.map +1 -1
  143. package/context/folders.d.ts +0 -2
  144. package/context/folders.js +0 -261
  145. package/context/folders.js.map +0 -1
  146. package/context/index.d.ts +0 -2
  147. package/context/index.js +0 -22
  148. package/context/index.js.map +0 -1
  149. package/context/links.d.ts +0 -2
  150. package/context/links.js +0 -270
  151. package/context/links.js.map +0 -1
  152. package/createAcoCrud.d.ts +0 -2
  153. package/createAcoCrud.js +0 -17
  154. package/createAcoCrud.js.map +0 -1
  155. package/createAcoFields.js +0 -40
  156. package/createAcoFields.js.map +0 -1
  157. package/folder/onFolderBeforeDelete.hook.d.ts +0 -2
  158. package/folder/onFolderBeforeDelete.hook.js +0 -53
  159. package/folder/onFolderBeforeDelete.hook.js.map +0 -1
  160. package/graphql/base.gql.d.ts +0 -3
  161. package/graphql/base.gql.js +0 -63
  162. package/graphql/base.gql.js.map +0 -1
  163. package/graphql/folders.gql.d.ts +0 -3
  164. package/graphql/folders.gql.js +0 -126
  165. package/graphql/folders.gql.js.map +0 -1
  166. package/graphql/index.d.ts +0 -1
  167. package/graphql/index.js +0 -15
  168. package/graphql/index.js.map +0 -1
  169. package/graphql/links.gql.d.ts +0 -3
  170. package/graphql/links.gql.js +0 -123
  171. package/graphql/links.gql.js.map +0 -1
  172. package/subscriptions/afterFolderDelete.d.ts +0 -3
  173. package/subscriptions/afterFolderDelete.js +0 -62
  174. package/subscriptions/afterFolderDelete.js.map +0 -1
  175. package/subscriptions/index.d.ts +0 -3
  176. package/subscriptions/index.js +0 -14
  177. package/subscriptions/index.js.map +0 -1
  178. package/utils/fieldResolver.d.ts +0 -16
  179. package/utils/fieldResolver.js +0 -44
  180. package/utils/fieldResolver.js.map +0 -1
  181. package/utils/getFieldValues.d.ts +0 -2
  182. package/utils/getFieldValues.js +0 -19
  183. package/utils/getFieldValues.js.map +0 -1
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.filterSchema = void 0;
7
+ var _responses = require("@webiny/handler-graphql/responses");
8
+ var _GraphQLSchemaPlugin = require("@webiny/handler-graphql/plugins/GraphQLSchemaPlugin");
9
+ var _ensureAuthentication = require("../utils/ensureAuthentication");
10
+ var _resolve = require("../utils/resolve");
11
+ const filterSchema = new _GraphQLSchemaPlugin.GraphQLSchemaPlugin({
12
+ typeDefs: /* GraphQL */`
13
+ enum OperationEnum {
14
+ AND
15
+ OR
16
+ }
17
+
18
+ type GroupFilter {
19
+ field: String!
20
+ condition: String!
21
+ value: String!
22
+ }
23
+
24
+ type Group {
25
+ operation: OperationEnum!
26
+ filters: [GroupFilter]!
27
+ }
28
+
29
+ type Filter {
30
+ id: ID!
31
+ name: String!
32
+ description: String
33
+ namespace: String!
34
+ operation: OperationEnum!
35
+ groups: [Group]!
36
+ createdOn: DateTime
37
+ modifiedOn: DateTime
38
+ savedOn: DateTime
39
+ createdBy: AcoUser
40
+ modifiedBy: AcoUser
41
+ savedBy: AcoUser
42
+ }
43
+
44
+ input GroupFilterInput {
45
+ field: String!
46
+ condition: String!
47
+ value: String!
48
+ }
49
+
50
+ input GroupInput {
51
+ operation: OperationEnum!
52
+ filters: [GroupFilterInput]!
53
+ }
54
+
55
+ input FilterCreateInput {
56
+ id: ID!
57
+ name: String!
58
+ description: String
59
+ namespace: String!
60
+ operation: OperationEnum!
61
+ groups: [GroupInput]!
62
+ }
63
+
64
+ input FilterUpdateInput {
65
+ name: String
66
+ description: String
67
+ namespace: String
68
+ operation: OperationEnum
69
+ groups: [GroupInput]
70
+ }
71
+
72
+ input FiltersListWhereInput {
73
+ namespace: String
74
+ }
75
+
76
+ type FilterResponse {
77
+ data: Filter
78
+ error: AcoError
79
+ }
80
+
81
+ type FilterListResponse {
82
+ data: [Filter]
83
+ error: AcoError
84
+ }
85
+
86
+ extend type AcoQuery {
87
+ getFilter(id: ID!): FilterResponse
88
+ listFilters(
89
+ where: FiltersListWhereInput!
90
+ limit: Int
91
+ after: String
92
+ sort: AcoSort
93
+ ): FilterListResponse
94
+ }
95
+
96
+ extend type AcoMutation {
97
+ createFilter(data: FilterCreateInput!): FilterResponse
98
+ updateFilter(id: ID!, data: FilterUpdateInput!): FilterResponse
99
+ deleteFilter(id: ID!): AcoBooleanResponse
100
+ }
101
+ `,
102
+ resolvers: {
103
+ AcoQuery: {
104
+ getFilter: async (_, {
105
+ id
106
+ }, context) => {
107
+ return (0, _resolve.resolve)(() => {
108
+ (0, _ensureAuthentication.ensureAuthentication)(context);
109
+ return context.aco.filter.get(id);
110
+ });
111
+ },
112
+ listFilters: async (_, args, context) => {
113
+ try {
114
+ (0, _ensureAuthentication.ensureAuthentication)(context);
115
+ const [entries, meta] = await context.aco.filter.list(args);
116
+ return new _responses.ListResponse(entries, meta);
117
+ } catch (e) {
118
+ return new _responses.ErrorResponse(e);
119
+ }
120
+ }
121
+ },
122
+ AcoMutation: {
123
+ createFilter: async (_, {
124
+ data
125
+ }, context) => {
126
+ return (0, _resolve.resolve)(() => {
127
+ (0, _ensureAuthentication.ensureAuthentication)(context);
128
+ return context.aco.filter.create(data);
129
+ });
130
+ },
131
+ updateFilter: async (_, {
132
+ id,
133
+ data
134
+ }, context) => {
135
+ return (0, _resolve.resolve)(() => {
136
+ (0, _ensureAuthentication.ensureAuthentication)(context);
137
+ return context.aco.filter.update(id, data);
138
+ });
139
+ },
140
+ deleteFilter: async (_, {
141
+ id
142
+ }, context) => {
143
+ return (0, _resolve.resolve)(() => {
144
+ (0, _ensureAuthentication.ensureAuthentication)(context);
145
+ return context.aco.filter.delete(id);
146
+ });
147
+ }
148
+ }
149
+ }
150
+ });
151
+ exports.filterSchema = filterSchema;
152
+
153
+ //# sourceMappingURL=filter.gql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_responses","require","_GraphQLSchemaPlugin","_ensureAuthentication","_resolve","filterSchema","GraphQLSchemaPlugin","typeDefs","resolvers","AcoQuery","getFilter","_","id","context","resolve","ensureAuthentication","aco","filter","get","listFilters","args","entries","meta","list","ListResponse","e","ErrorResponse","AcoMutation","createFilter","data","create","updateFilter","update","deleteFilter","delete","exports"],"sources":["filter.gql.ts"],"sourcesContent":["import { ErrorResponse, ListResponse } from \"@webiny/handler-graphql/responses\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin\";\n\nimport { ensureAuthentication } from \"~/utils/ensureAuthentication\";\nimport { resolve } from \"~/utils/resolve\";\n\nimport { AcoContext } from \"~/types\";\n\nexport const filterSchema = new GraphQLSchemaPlugin<AcoContext>({\n typeDefs: /* GraphQL */ `\n enum OperationEnum {\n AND\n OR\n }\n\n type GroupFilter {\n field: String!\n condition: String!\n value: String!\n }\n\n type Group {\n operation: OperationEnum!\n filters: [GroupFilter]!\n }\n\n type Filter {\n id: ID!\n name: String!\n description: String\n namespace: String!\n operation: OperationEnum!\n groups: [Group]!\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n }\n\n input GroupFilterInput {\n field: String!\n condition: String!\n value: String!\n }\n\n input GroupInput {\n operation: OperationEnum!\n filters: [GroupFilterInput]!\n }\n\n input FilterCreateInput {\n id: ID!\n name: String!\n description: String\n namespace: String!\n operation: OperationEnum!\n groups: [GroupInput]!\n }\n\n input FilterUpdateInput {\n name: String\n description: String\n namespace: String\n operation: OperationEnum\n groups: [GroupInput]\n }\n\n input FiltersListWhereInput {\n namespace: String\n }\n\n type FilterResponse {\n data: Filter\n error: AcoError\n }\n\n type FilterListResponse {\n data: [Filter]\n error: AcoError\n }\n\n extend type AcoQuery {\n getFilter(id: ID!): FilterResponse\n listFilters(\n where: FiltersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FilterListResponse\n }\n\n extend type AcoMutation {\n createFilter(data: FilterCreateInput!): FilterResponse\n updateFilter(id: ID!, data: FilterUpdateInput!): FilterResponse\n deleteFilter(id: ID!): AcoBooleanResponse\n }\n `,\n resolvers: {\n AcoQuery: {\n getFilter: async (_, { id }, context) => {\n return resolve(() => {\n ensureAuthentication(context);\n return context.aco.filter.get(id);\n });\n },\n listFilters: async (_, args: any, context) => {\n try {\n ensureAuthentication(context);\n const [entries, meta] = await context.aco.filter.list(args);\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n AcoMutation: {\n createFilter: async (_, { data }, context) => {\n return resolve(() => {\n ensureAuthentication(context);\n return context.aco.filter.create(data);\n });\n },\n updateFilter: async (_, { id, data }, context) => {\n return resolve(() => {\n ensureAuthentication(context);\n return context.aco.filter.update(id, data);\n });\n },\n deleteFilter: async (_, { id }, context) => {\n return resolve(() => {\n ensureAuthentication(context);\n return context.aco.filter.delete(id);\n });\n }\n }\n }\n});\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAIO,MAAMI,YAAY,GAAG,IAAIC,wCAAmB,CAAa;EAC5DC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAoB,EAACF,OAAO,CAAC;UAC7B,OAAOA,OAAO,CAACG,GAAG,CAACC,MAAM,CAACa,MAAM,CAACD,IAAI,CAAC;QAC1C,CAAC,CAAC;MACN,CAAC;MACDE,YAAY,EAAE,MAAAA,CAAOpB,CAAC,EAAE;QAAEC,EAAE;QAAEiB;MAAK,CAAC,EAAEhB,OAAO,KAAK;QAC9C,OAAO,IAAAC,gBAAO,EAAC,MAAM;UACjB,IAAAC,0CAAoB,EAACF,OAAO,CAAC;UAC7B,OAAOA,OAAO,CAACG,GAAG,CAACC,MAAM,CAACe,MAAM,CAACpB,EAAE,EAAEiB,IAAI,CAAC;QAC9C,CAAC,CAAC;MACN,CAAC;MACDI,YAAY,EAAE,MAAAA,CAAOtB,CAAC,EAAE;QAAEC;MAAG,CAAC,EAAEC,OAAO,KAAK;QACxC,OAAO,IAAAC,gBAAO,EAAC,MAAM;UACjB,IAAAC,0CAAoB,EAACF,OAAO,CAAC;UAC7B,OAAOA,OAAO,CAACG,GAAG,CAACC,MAAM,CAACiB,MAAM,CAACtB,EAAE,CAAC;QACxC,CAAC,CAAC;MACN;IACJ;EACJ;AACJ,CAAC,CAAC;AAACuB,OAAA,CAAA9B,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const FILTER_MODEL_ID = "acoFilter";
2
+ export declare const createFilterModelDefinition: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFilterModelDefinition = exports.FILTER_MODEL_ID = void 0;
7
+ var _createModelField = require("../utils/createModelField");
8
+ var _apiHeadlessCms = require("@webiny/api-headless-cms");
9
+ const name = () => (0, _createModelField.createModelField)({
10
+ label: "Name",
11
+ fieldId: "name",
12
+ type: "text",
13
+ validation: [{
14
+ name: "required",
15
+ message: "Value is required."
16
+ }]
17
+ });
18
+ const description = () => (0, _createModelField.createModelField)({
19
+ label: "Description",
20
+ fieldId: "description",
21
+ type: "text"
22
+ });
23
+ const namespace = () => (0, _createModelField.createModelField)({
24
+ label: "Model Id",
25
+ fieldId: "namespace",
26
+ type: "text",
27
+ validation: [{
28
+ name: "required",
29
+ message: "Value is required."
30
+ }]
31
+ });
32
+ const operation = () => (0, _createModelField.createModelField)({
33
+ label: "Operation",
34
+ fieldId: "operation",
35
+ type: "text",
36
+ predefinedValues: {
37
+ enabled: true,
38
+ values: [{
39
+ label: "AND",
40
+ value: "AND"
41
+ }, {
42
+ label: "OR",
43
+ value: "OR"
44
+ }]
45
+ },
46
+ multipleValues: false,
47
+ validation: [{
48
+ name: "required",
49
+ message: "Value is required."
50
+ }]
51
+ });
52
+ const groups = fields => (0, _createModelField.createModelField)({
53
+ label: "Groups",
54
+ fieldId: "groups",
55
+ type: "object",
56
+ multipleValues: true,
57
+ settings: {
58
+ fields,
59
+ layout: fields.map(field => [field.storageId])
60
+ },
61
+ listValidation: [{
62
+ name: "minLength",
63
+ message: "At least one group is required.",
64
+ settings: {
65
+ value: "1"
66
+ }
67
+ }]
68
+ });
69
+ const filters = fields => (0, _createModelField.createModelField)({
70
+ label: "Filters",
71
+ fieldId: "filters",
72
+ type: "object",
73
+ multipleValues: true,
74
+ settings: {
75
+ fields,
76
+ layout: fields.map(field => [field.storageId])
77
+ },
78
+ listValidation: [{
79
+ name: "minLength",
80
+ message: "At least one filter is required.",
81
+ settings: {
82
+ value: "1"
83
+ }
84
+ }]
85
+ });
86
+ const field = () => (0, _createModelField.createModelField)({
87
+ label: "Field",
88
+ fieldId: "field",
89
+ type: "text",
90
+ validation: [{
91
+ name: "required",
92
+ message: "Value is required."
93
+ }]
94
+ });
95
+ const condition = () => (0, _createModelField.createModelField)({
96
+ label: "Condition",
97
+ fieldId: "condition",
98
+ type: "text",
99
+ validation: [{
100
+ name: "required",
101
+ message: "Value is required."
102
+ }]
103
+ });
104
+ const value = () => (0, _createModelField.createModelField)({
105
+ label: "Value",
106
+ fieldId: "value",
107
+ type: "text",
108
+ validation: [{
109
+ name: "required",
110
+ message: "Value is required."
111
+ }]
112
+ });
113
+ const FILTER_MODEL_ID = "acoFilter";
114
+ exports.FILTER_MODEL_ID = FILTER_MODEL_ID;
115
+ const createFilterModelDefinition = () => {
116
+ return (0, _apiHeadlessCms.createPrivateModelDefinition)({
117
+ name: "ACO - Filter",
118
+ modelId: FILTER_MODEL_ID,
119
+ titleFieldId: "name",
120
+ fields: [name(), description(), namespace(), operation(), groups([operation(), filters([field(), condition(), value()])])]
121
+ });
122
+ };
123
+ exports.createFilterModelDefinition = createFilterModelDefinition;
124
+
125
+ //# sourceMappingURL=filter.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_createModelField","require","_apiHeadlessCms","name","createModelField","label","fieldId","type","validation","message","description","namespace","operation","predefinedValues","enabled","values","value","multipleValues","groups","fields","settings","layout","map","field","storageId","listValidation","filters","condition","FILTER_MODEL_ID","exports","createFilterModelDefinition","createPrivateModelDefinition","modelId","titleFieldId"],"sources":["filter.model.ts"],"sourcesContent":["import { createModelField } from \"~/utils/createModelField\";\nimport { createPrivateModelDefinition } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst name = () =>\n createModelField({\n label: \"Name\",\n fieldId: \"name\",\n type: \"text\",\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nconst description = () =>\n createModelField({\n label: \"Description\",\n fieldId: \"description\",\n type: \"text\"\n });\n\nconst namespace = () =>\n createModelField({\n label: \"Model Id\",\n fieldId: \"namespace\",\n type: \"text\",\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nconst operation = () =>\n createModelField({\n label: \"Operation\",\n fieldId: \"operation\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"AND\",\n value: \"AND\"\n },\n {\n label: \"OR\",\n value: \"OR\"\n }\n ]\n },\n multipleValues: false,\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nconst groups = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Groups\",\n fieldId: \"groups\",\n type: \"object\",\n multipleValues: true,\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"At least one group is required.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst filters = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Filters\",\n fieldId: \"filters\",\n type: \"object\",\n multipleValues: true,\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"At least one filter is required.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst field = () =>\n createModelField({\n label: \"Field\",\n fieldId: \"field\",\n type: \"text\",\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nconst condition = () =>\n createModelField({\n label: \"Condition\",\n fieldId: \"condition\",\n type: \"text\",\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nconst value = () =>\n createModelField({\n label: \"Value\",\n fieldId: \"value\",\n type: \"text\",\n validation: [\n {\n name: \"required\",\n message: \"Value is required.\"\n }\n ]\n });\n\nexport const FILTER_MODEL_ID = \"acoFilter\";\n\nexport const createFilterModelDefinition = () => {\n return createPrivateModelDefinition({\n name: \"ACO - Filter\",\n modelId: FILTER_MODEL_ID,\n titleFieldId: \"name\",\n fields: [\n name(),\n description(),\n namespace(),\n operation(),\n groups([operation(), filters([field(), condition(), value()])])\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAGA,MAAME,IAAI,GAAGA,CAAA,KACT,IAAAC,kCAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,CACR;IACIL,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Ae,GAAG,WAAW;AAACC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAEpC,MAAME,2BAA2B,GAAGA,CAAA,KAAM;EAC7C,OAAO,IAAAC,4CAA4B,EAAC;IAChC5B,IAAI,EAAE,cAAc;IACpB6B,OAAO,EAAEJ,eAAe;IACxBK,YAAY,EAAE,MAAM;IACpBd,MAAM,EAAE,CACJhB,IAAI,CAAC,CAAC,EACNO,WAAW,CAAC,CAAC,EACbC,SAAS,CAAC,CAAC,EACXC,SAAS,CAAC,CAAC,EACXM,MAAM,CAAC,CAACN,SAAS,CAAC,CAAC,EAAEc,OAAO,CAAC,CAACH,KAAK,CAAC,CAAC,EAAEI,SAAS,CAAC,CAAC,EAAEX,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EAEvE,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAC,2BAAA,GAAAA,2BAAA"}
@@ -0,0 +1,3 @@
1
+ import { CreateAcoStorageOperationsParams } from "../createAcoStorageOperations";
2
+ import { AcoFilterStorageOperations } from "./filter.types";
3
+ export declare const createFilterOperations: (params: CreateAcoStorageOperationsParams) => AcoFilterStorageOperations;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createFilterOperations = void 0;
8
+ var _omit = _interopRequireDefault(require("lodash/omit"));
9
+ var _error = _interopRequireDefault(require("@webiny/error"));
10
+ var _filter = require("./filter.model");
11
+ var _createListSort = require("../utils/createListSort");
12
+ var _createOperationsWrapper = require("../utils/createOperationsWrapper");
13
+ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
14
+ var _constants = require("@webiny/api-headless-cms/constants");
15
+ const createFilterOperations = params => {
16
+ const {
17
+ cms,
18
+ security
19
+ } = params;
20
+ const {
21
+ withModel
22
+ } = (0, _createOperationsWrapper.createOperationsWrapper)({
23
+ ...params,
24
+ modelName: _filter.FILTER_MODEL_ID
25
+ });
26
+ return {
27
+ getFilter({
28
+ id
29
+ }) {
30
+ return withModel(async model => {
31
+ const entry = await cms.getEntryById(model, id);
32
+ if (!entry) {
33
+ throw new _error.default("Could not load filter.", "GET_FILTER_ERROR", {
34
+ id
35
+ });
36
+ }
37
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
38
+ });
39
+ },
40
+ listFilters(params) {
41
+ return withModel(async model => {
42
+ const {
43
+ sort,
44
+ where
45
+ } = params;
46
+ const createdBy = security.getIdentity().id;
47
+ const [entries, meta] = await cms.listLatestEntries(model, {
48
+ ...params,
49
+ sort: (0, _createListSort.createListSort)(sort),
50
+ where: {
51
+ ...({
52
+ ...where,
53
+ createdBy
54
+ } || {})
55
+ }
56
+ });
57
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
58
+ });
59
+ },
60
+ createFilter({
61
+ data
62
+ }) {
63
+ return withModel(async model => {
64
+ const entry = await cms.createEntry(model, data);
65
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
66
+ });
67
+ },
68
+ updateFilter({
69
+ id,
70
+ data
71
+ }) {
72
+ return withModel(async model => {
73
+ const original = await cms.getEntryById(model, id);
74
+ const input = {
75
+ /**
76
+ * We are omitting the standard entry meta fields:
77
+ * we don't want to override them with the ones coming from the `original` entry.
78
+ */
79
+ ...(0, _omit.default)(original, _constants.ENTRY_META_FIELDS),
80
+ ...data
81
+ };
82
+ const entry = await cms.updateEntry(model, original.id, input);
83
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
84
+ });
85
+ },
86
+ deleteFilter({
87
+ id
88
+ }) {
89
+ return withModel(async model => {
90
+ await cms.deleteEntry(model, id);
91
+ return true;
92
+ });
93
+ }
94
+ };
95
+ };
96
+ exports.createFilterOperations = createFilterOperations;
97
+
98
+ //# sourceMappingURL=filter.so.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_omit","_interopRequireDefault","require","_error","_filter","_createListSort","_createOperationsWrapper","_pickEntryFieldValues","_constants","createFilterOperations","params","cms","security","withModel","createOperationsWrapper","modelName","FILTER_MODEL_ID","getFilter","id","model","entry","getEntryById","WebinyError","pickEntryFieldValues","listFilters","sort","where","createdBy","getIdentity","entries","meta","listLatestEntries","createListSort","map","createFilter","data","createEntry","updateFilter","original","input","omit","ENTRY_META_FIELDS","updateEntry","deleteFilter","deleteEntry","exports"],"sources":["filter.so.ts"],"sourcesContent":["import omit from \"lodash/omit\";\nimport WebinyError from \"@webiny/error\";\nimport { FILTER_MODEL_ID } from \"./filter.model\";\nimport { CreateAcoStorageOperationsParams } from \"~/createAcoStorageOperations\";\nimport { createListSort } from \"~/utils/createListSort\";\nimport { createOperationsWrapper } from \"~/utils/createOperationsWrapper\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport { AcoFilterStorageOperations, Filter } from \"./filter.types\";\nimport { ENTRY_META_FIELDS } from \"@webiny/api-headless-cms/constants\";\n\nexport const createFilterOperations = (\n params: CreateAcoStorageOperationsParams\n): AcoFilterStorageOperations => {\n const { cms, security } = params;\n\n const { withModel } = createOperationsWrapper({\n ...params,\n modelName: FILTER_MODEL_ID\n });\n\n return {\n getFilter({ id }) {\n return withModel(async model => {\n const entry = await cms.getEntryById(model, id);\n\n if (!entry) {\n throw new WebinyError(\"Could not load filter.\", \"GET_FILTER_ERROR\", {\n id\n });\n }\n\n return pickEntryFieldValues(entry);\n });\n },\n listFilters(params) {\n return withModel(async model => {\n const { sort, where } = params;\n const createdBy = security.getIdentity().id;\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n sort: createListSort(sort),\n where: {\n ...({ ...where, createdBy } || {})\n }\n });\n\n return [entries.map(pickEntryFieldValues<Filter>), meta];\n });\n },\n createFilter({ data }) {\n return withModel(async model => {\n const entry = await cms.createEntry(model, data);\n return pickEntryFieldValues(entry);\n });\n },\n updateFilter({ id, data }) {\n return withModel(async model => {\n const original = await cms.getEntryById(model, id);\n\n const input = {\n /**\n * We are omitting the standard entry meta fields:\n * we don't want to override them with the ones coming from the `original` entry.\n */\n ...omit(original, ENTRY_META_FIELDS),\n ...data\n };\n\n const entry = await cms.updateEntry(model, original.id, input);\n return pickEntryFieldValues(entry);\n });\n },\n deleteFilter({ id }) {\n return withModel(async model => {\n await cms.deleteEntry(model, id);\n return true;\n });\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AAEA,IAAAM,UAAA,GAAAN,OAAA;AAEO,MAAMO,sBAAsB,GAC/BC,MAAwC,IACX;EAC7B,MAAM;IAAEC,GAAG;IAAEC;EAAS,CAAC,GAAGF,MAAM;EAEhC,MAAM;IAAEG;EAAU,CAAC,GAAG,IAAAC,gDAAuB,EAAC;IAC1C,GAAGJ,MAAM;IACTK,SAAS,EAAEC;EACf,CAAC,CAAC;EAEF,OAAO;IACHC,SAASA,CAAC;MAAEC;IAAG,CAAC,EAAE;MACd,OAAOL,SAAS,CAAC,MAAMM,KAAK,IAAI;QAC5B,MAAMC,KAAK,GAAG,MAAMT,GAAG,CAACU,YAAY,CAACF,KAAK,EAAED,EAAE,CAAC;QAE/C,IAAI,CAACE,KAAK,EAAE;UACR,MAAM,IAAIE,cAAW,CAAC,wBAAwB,EAAE,kBAAkB,EAAE;YAChEJ;UACJ,CAAC,CAAC;QACN;QAEA,OAAO,IAAAK,0CAAoB,EAACH,KAAK,CAAC;MACtC,CAAC,CAAC;IACN,CAAC;IACDI,WAAWA,CAACd,MAAM,EAAE;MAChB,OAAOG,SAAS,CAAC,MAAMM,KAAK,IAAI;QAC5B,MAAM;UAAEM,IAAI;UAAEC;QAAM,CAAC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;IACN,CAAC;IACDuB,YAAYA,CAAC;MAAEzB;IAAG,CAAC,EAAE;MACjB,OAAOL,SAAS,CAAC,MAAMM,KAAK,IAAI;QAC5B,MAAMR,GAAG,CAACiC,WAAW,CAACzB,KAAK,EAAED,EAAE,CAAC;QAChC,OAAO,IAAI;MACf,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAAC2B,OAAA,CAAApC,sBAAA,GAAAA,sBAAA"}
@@ -0,0 +1,95 @@
1
+ import { AcoBaseFields, ListMeta, ListSort } from "../types";
2
+ import { Topic } from "@webiny/pubsub/types";
3
+ export declare enum Operation {
4
+ AND = "AND",
5
+ OR = "OR"
6
+ }
7
+ export interface GroupFilter {
8
+ field: string;
9
+ condition: string;
10
+ value: string;
11
+ }
12
+ export interface Group {
13
+ operation: Operation;
14
+ filters: GroupFilter[];
15
+ }
16
+ export interface Filter extends AcoBaseFields {
17
+ name: string;
18
+ description?: string;
19
+ namespace: string;
20
+ operation: Operation;
21
+ groups: Group[];
22
+ }
23
+ export interface ListFiltersWhere {
24
+ namespace: string;
25
+ }
26
+ export interface ListFiltersParams {
27
+ where: ListFiltersWhere;
28
+ sort?: ListSort;
29
+ limit?: number;
30
+ after?: string | null;
31
+ }
32
+ export declare type CreateFilterParams = Pick<Filter, "id" | "name" | "description" | "namespace" | "operation" | "groups">;
33
+ export interface UpdateFilterParams {
34
+ name?: string;
35
+ description?: string;
36
+ namespace?: string;
37
+ operation?: Operation;
38
+ groups?: Group[];
39
+ }
40
+ export interface DeleteFilterParams {
41
+ id: string;
42
+ }
43
+ export interface StorageOperationsGetFilterParams {
44
+ id: string;
45
+ }
46
+ export declare type StorageOperationsListFiltersParams = ListFiltersParams;
47
+ export interface StorageOperationsCreateFilterParams {
48
+ data: CreateFilterParams;
49
+ }
50
+ export interface StorageOperationsUpdateFilterParams {
51
+ id: string;
52
+ data: UpdateFilterParams;
53
+ }
54
+ export declare type StorageOperationsDeleteFilterParams = DeleteFilterParams;
55
+ export interface OnFilterBeforeCreateTopicParams {
56
+ input: CreateFilterParams;
57
+ }
58
+ export interface OnFilterAfterCreateTopicParams {
59
+ filter: Filter;
60
+ }
61
+ export interface OnFilterBeforeUpdateTopicParams {
62
+ original: Filter;
63
+ input: Record<string, any>;
64
+ }
65
+ export interface OnFilterAfterUpdateTopicParams {
66
+ original: Filter;
67
+ filter: Filter;
68
+ input: Record<string, any>;
69
+ }
70
+ export interface OnFilterBeforeDeleteTopicParams {
71
+ filter: Filter;
72
+ }
73
+ export interface OnFilterAfterDeleteTopicParams {
74
+ filter: Filter;
75
+ }
76
+ export interface AcoFilterCrud {
77
+ get(id: string): Promise<Filter>;
78
+ list(params: ListFiltersParams): Promise<[Filter[], ListMeta]>;
79
+ create(data: CreateFilterParams): Promise<Filter>;
80
+ update(id: string, data: UpdateFilterParams): Promise<Filter>;
81
+ delete(id: string): Promise<boolean>;
82
+ onFilterBeforeCreate: Topic<OnFilterBeforeCreateTopicParams>;
83
+ onFilterAfterCreate: Topic<OnFilterAfterCreateTopicParams>;
84
+ onFilterBeforeUpdate: Topic<OnFilterBeforeUpdateTopicParams>;
85
+ onFilterAfterUpdate: Topic<OnFilterAfterUpdateTopicParams>;
86
+ onFilterBeforeDelete: Topic<OnFilterBeforeDeleteTopicParams>;
87
+ onFilterAfterDelete: Topic<OnFilterAfterDeleteTopicParams>;
88
+ }
89
+ export interface AcoFilterStorageOperations {
90
+ getFilter(params: StorageOperationsGetFilterParams): Promise<Filter>;
91
+ listFilters(params: StorageOperationsListFiltersParams): Promise<[Filter[], ListMeta]>;
92
+ createFilter(params: StorageOperationsCreateFilterParams): Promise<Filter>;
93
+ updateFilter(params: StorageOperationsUpdateFilterParams): Promise<Filter>;
94
+ deleteFilter(params: StorageOperationsDeleteFilterParams): Promise<boolean>;
95
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Operation = void 0;
7
+ let Operation = /*#__PURE__*/function (Operation) {
8
+ Operation["AND"] = "AND";
9
+ Operation["OR"] = "OR";
10
+ return Operation;
11
+ }({});
12
+ exports.Operation = Operation;
13
+
14
+ //# sourceMappingURL=filter.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Operation","exports"],"sources":["filter.types.ts"],"sourcesContent":["import { AcoBaseFields, ListMeta, ListSort } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\n\nexport enum Operation {\n AND = \"AND\",\n OR = \"OR\"\n}\n\nexport interface GroupFilter {\n field: string;\n condition: string;\n value: string;\n}\n\nexport interface Group {\n operation: Operation;\n filters: GroupFilter[];\n}\n\nexport interface Filter extends AcoBaseFields {\n name: string;\n description?: string;\n namespace: string;\n operation: Operation;\n groups: Group[];\n}\n\nexport interface ListFiltersWhere {\n namespace: string;\n}\n\nexport interface ListFiltersParams {\n where: ListFiltersWhere;\n sort?: ListSort;\n limit?: number;\n after?: string | null;\n}\n\nexport type CreateFilterParams = Pick<\n Filter,\n \"id\" | \"name\" | \"description\" | \"namespace\" | \"operation\" | \"groups\"\n>;\n\nexport interface UpdateFilterParams {\n name?: string;\n description?: string;\n namespace?: string;\n operation?: Operation;\n groups?: Group[];\n}\n\nexport interface DeleteFilterParams {\n id: string;\n}\n\nexport interface StorageOperationsGetFilterParams {\n id: string;\n}\n\nexport type StorageOperationsListFiltersParams = ListFiltersParams;\n\nexport interface StorageOperationsCreateFilterParams {\n data: CreateFilterParams;\n}\n\nexport interface StorageOperationsUpdateFilterParams {\n id: string;\n data: UpdateFilterParams;\n}\n\nexport type StorageOperationsDeleteFilterParams = DeleteFilterParams;\n\nexport interface OnFilterBeforeCreateTopicParams {\n input: CreateFilterParams;\n}\n\nexport interface OnFilterAfterCreateTopicParams {\n filter: Filter;\n}\n\nexport interface OnFilterBeforeUpdateTopicParams {\n original: Filter;\n input: Record<string, any>;\n}\n\nexport interface OnFilterAfterUpdateTopicParams {\n original: Filter;\n filter: Filter;\n input: Record<string, any>;\n}\n\nexport interface OnFilterBeforeDeleteTopicParams {\n filter: Filter;\n}\n\nexport interface OnFilterAfterDeleteTopicParams {\n filter: Filter;\n}\n\nexport interface AcoFilterCrud {\n get(id: string): Promise<Filter>;\n list(params: ListFiltersParams): Promise<[Filter[], ListMeta]>;\n create(data: CreateFilterParams): Promise<Filter>;\n update(id: string, data: UpdateFilterParams): Promise<Filter>;\n delete(id: string): Promise<boolean>;\n onFilterBeforeCreate: Topic<OnFilterBeforeCreateTopicParams>;\n onFilterAfterCreate: Topic<OnFilterAfterCreateTopicParams>;\n onFilterBeforeUpdate: Topic<OnFilterBeforeUpdateTopicParams>;\n onFilterAfterUpdate: Topic<OnFilterAfterUpdateTopicParams>;\n onFilterBeforeDelete: Topic<OnFilterBeforeDeleteTopicParams>;\n onFilterAfterDelete: Topic<OnFilterAfterDeleteTopicParams>;\n}\n\nexport interface AcoFilterStorageOperations {\n getFilter(params: StorageOperationsGetFilterParams): Promise<Filter>;\n listFilters(params: StorageOperationsListFiltersParams): Promise<[Filter[], ListMeta]>;\n createFilter(params: StorageOperationsCreateFilterParams): Promise<Filter>;\n updateFilter(params: StorageOperationsUpdateFilterParams): Promise<Filter>;\n deleteFilter(params: StorageOperationsDeleteFilterParams): Promise<boolean>;\n}\n"],"mappings":";;;;;;IAGYA,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAAC,OAAA,CAAAD,SAAA,GAAAA,SAAA"}
@@ -1,3 +1,10 @@
1
1
  import { CreateAcoParams } from "../types";
2
2
  import { AcoFolderCrud } from "./folder.types";
3
- export declare const createFolderCrudMethods: ({ storageOperations }: CreateAcoParams) => AcoFolderCrud;
3
+ import { AdminUser } from "@webiny/api-admin-users/types";
4
+ import { Team } from "@webiny/api-security/types";
5
+ interface CreateFolderCrudMethodsParams extends CreateAcoParams {
6
+ listAdminUsers: () => Promise<AdminUser[]>;
7
+ listTeams: () => Promise<Team[]>;
8
+ }
9
+ export declare const createFolderCrudMethods: ({ storageOperations, folderLevelPermissions, listAdminUsers, listTeams }: CreateFolderCrudMethodsParams) => AcoFolderCrud;
10
+ export {};