@webiny/api-aco 5.37.8 → 5.38.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.
Files changed (108) hide show
  1. package/apps/AcoApp.d.ts +4 -0
  2. package/apps/AcoApp.js +44 -5
  3. package/apps/AcoApp.js.map +1 -1
  4. package/apps/AcoApps.js +3 -1
  5. package/apps/app.gql.js +6 -4
  6. package/apps/app.gql.js.map +1 -1
  7. package/apps/index.js +3 -1
  8. package/createAcoContext.js +98 -15
  9. package/createAcoContext.js.map +1 -1
  10. package/createAcoGraphQL.js +5 -2
  11. package/createAcoGraphQL.js.map +1 -1
  12. package/createAcoHooks.js +9 -3
  13. package/createAcoHooks.js.map +1 -1
  14. package/createAcoModels.js +5 -2
  15. package/createAcoModels.js.map +1 -1
  16. package/createAcoStorageOperations.js +5 -2
  17. package/createAcoStorageOperations.js.map +1 -1
  18. package/fields/index.js +3 -1
  19. package/fields/location.js +3 -1
  20. package/filter/filter.crud.d.ts +3 -0
  21. package/filter/filter.crud.js +94 -0
  22. package/filter/filter.crud.js.map +1 -0
  23. package/filter/filter.gql.d.ts +3 -0
  24. package/filter/filter.gql.js +150 -0
  25. package/filter/filter.gql.js.map +1 -0
  26. package/filter/filter.model.d.ts +4 -0
  27. package/filter/filter.model.js +127 -0
  28. package/filter/filter.model.js.map +1 -0
  29. package/filter/filter.so.d.ts +3 -0
  30. package/filter/filter.so.js +96 -0
  31. package/filter/filter.so.js.map +1 -0
  32. package/filter/filter.types.d.ts +95 -0
  33. package/filter/filter.types.js +14 -0
  34. package/filter/filter.types.js.map +1 -0
  35. package/folder/folder.crud.d.ts +8 -1
  36. package/folder/folder.crud.js +197 -15
  37. package/folder/folder.crud.js.map +1 -1
  38. package/folder/folder.gql.js +75 -7
  39. package/folder/folder.gql.js.map +1 -1
  40. package/folder/folder.model.js +52 -3
  41. package/folder/folder.model.js.map +1 -1
  42. package/folder/folder.so.js +12 -4
  43. package/folder/folder.so.js.map +1 -1
  44. package/folder/folder.types.d.ts +23 -0
  45. package/folder/folder.types.js +3 -1
  46. package/folder/folder.types.js.map +1 -1
  47. package/folder/onFolderBeforeDeleteAco.hook.d.ts +2 -0
  48. package/folder/{onFolderBeforeDelete.hook.js → onFolderBeforeDeleteAco.hook.js} +8 -6
  49. package/folder/onFolderBeforeDeleteAco.hook.js.map +1 -0
  50. package/folder/onFolderBeforeDeleteFm.hook.d.ts +2 -0
  51. package/folder/onFolderBeforeDeleteFm.hook.js +49 -0
  52. package/folder/onFolderBeforeDeleteFm.hook.js.map +1 -0
  53. package/folder/onFolderBeforeDeleteHcms.hook.d.ts +2 -0
  54. package/folder/onFolderBeforeDeleteHcms.hook.js +56 -0
  55. package/folder/onFolderBeforeDeleteHcms.hook.js.map +1 -0
  56. package/index.d.ts +1 -0
  57. package/index.js +12 -2
  58. package/index.js.map +1 -1
  59. package/package.json +25 -20
  60. package/plugins/AcoAppModifierPlugin.js +3 -1
  61. package/plugins/AcoAppRegisterPlugin.js +3 -1
  62. package/plugins/index.js +3 -1
  63. package/record/graphql/createAppResolvers.js +11 -9
  64. package/record/graphql/createAppResolvers.js.map +1 -1
  65. package/record/graphql/createAppSchema.js +3 -1
  66. package/record/record.crud.js +3 -1
  67. package/record/record.gql.js +3 -1
  68. package/record/record.model.js +3 -1
  69. package/record/record.so.js +3 -1
  70. package/record/record.types.d.ts +2 -1
  71. package/record/record.types.js +3 -1
  72. package/record/record.types.js.map +1 -1
  73. package/types.d.ts +19 -5
  74. package/types.js +16 -1
  75. package/types.js.map +1 -1
  76. package/utils/FolderLevelPermissions.d.ts +68 -0
  77. package/utils/FolderLevelPermissions.js +370 -0
  78. package/utils/FolderLevelPermissions.js.map +1 -0
  79. package/utils/acoRecordId.js +3 -1
  80. package/utils/createListSort.js +3 -1
  81. package/utils/createModelField.js +3 -1
  82. package/utils/createOperationsWrapper.js +3 -1
  83. package/utils/decorators/CmsEntriesCrudDecorators.d.ts +11 -0
  84. package/utils/decorators/CmsEntriesCrudDecorators.js +244 -0
  85. package/utils/decorators/CmsEntriesCrudDecorators.js.map +1 -0
  86. package/utils/decorators/constants.d.ts +1 -0
  87. package/utils/decorators/constants.js +10 -0
  88. package/utils/decorators/constants.js.map +1 -0
  89. package/utils/decorators/where.d.ts +14 -0
  90. package/utils/decorators/where.js +45 -0
  91. package/utils/decorators/where.js.map +1 -0
  92. package/utils/ensureAuthentication.d.ts +2 -0
  93. package/utils/{checkPermissions.js → ensureAuthentication.js} +5 -3
  94. package/utils/ensureAuthentication.js.map +1 -0
  95. package/utils/fieldResolver.js +3 -1
  96. package/utils/getFieldValues.d.ts +2 -0
  97. package/utils/getFieldValues.js +9 -1
  98. package/utils/getFieldValues.js.map +1 -1
  99. package/utils/getFolderAndItsAncestors.d.ts +2 -2
  100. package/utils/getFolderAndItsAncestors.js +16 -11
  101. package/utils/getFolderAndItsAncestors.js.map +1 -1
  102. package/utils/isInstallationPending.js +3 -1
  103. package/utils/modelFactory.js +3 -1
  104. package/utils/resolve.js +3 -1
  105. package/folder/onFolderBeforeDelete.hook.d.ts +0 -2
  106. package/folder/onFolderBeforeDelete.hook.js.map +0 -1
  107. package/utils/checkPermissions.d.ts +0 -2
  108. package/utils/checkPermissions.js.map +0 -1
@@ -57,21 +57,27 @@ const createFolderOperations = params => {
57
57
  params
58
58
  }) => {
59
59
  return withModel(async model => {
60
+ var _listResult$items;
60
61
  const {
61
62
  type,
62
63
  slug,
63
64
  parentId
64
65
  } = params;
65
- const [existings] = await cms.listLatestEntries(model, {
66
+
67
+ // We don't need to perform any kind of authorization or checks here. We just need to check
68
+ // if the folder already exists in the database. Hence the direct storage operations access.
69
+ const listResult = await cms.storageOperations.entries.list(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
66
70
  where: {
71
+ // Folders always work with latest entries. We never publish them.
72
+ latest: true,
67
73
  type,
68
74
  slug,
69
75
  parentId,
70
76
  id_not: id
71
77
  },
72
78
  limit: 1
73
- });
74
- if (existings.length > 0) {
79
+ }));
80
+ if ((listResult === null || listResult === void 0 || (_listResult$items = listResult.items) === null || _listResult$items === void 0 ? void 0 : _listResult$items.length) > 0) {
75
81
  throw new _error.default(`Folder with slug "${slug}" already exists at this level.`, "FOLDER_ALREADY_EXISTS", {
76
82
  id,
77
83
  params
@@ -148,4 +154,6 @@ const createFolderOperations = params => {
148
154
  }
149
155
  };
150
156
  };
151
- exports.createFolderOperations = createFolderOperations;
157
+ exports.createFolderOperations = createFolderOperations;
158
+
159
+ //# sourceMappingURL=folder.so.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_folder","_createAcoStorageOperations","_createListSort","_createOperationsWrapper","_getFieldValues","createFolderOperations","params","cms","withModel","createOperationsWrapper","_objectSpread2","default","modelName","FOLDER_MODEL_ID","getFolder","id","slug","type","parentId","model","entry","getEntryById","getEntry","where","latest","WebinyError","getFolderFieldValues","baseFields","checkExistingFolder","existings","listLatestEntries","id_not","limit","length","listFolders","sort","entries","meta","createListSort","map","createFolder","data","createEntry","updateFolder","original","undefined","input","updateEntry","deleteFolder","deleteEntry","exports"],"sources":["folder.so.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { FOLDER_MODEL_ID } from \"./folder.model\";\nimport { baseFields, CreateAcoStorageOperationsParams } from \"~/createAcoStorageOperations\";\nimport { createListSort } from \"~/utils/createListSort\";\nimport { createOperationsWrapper } from \"~/utils/createOperationsWrapper\";\nimport { getFolderFieldValues } from \"~/utils/getFieldValues\";\n\nimport { AcoFolderStorageOperations } from \"./folder.types\";\n\ninterface AcoCheckExistingFolderParams {\n params: {\n type: string;\n slug: string;\n parentId?: string | null;\n };\n id?: string;\n}\n\nexport const createFolderOperations = (\n params: CreateAcoStorageOperationsParams\n): AcoFolderStorageOperations => {\n const { cms } = params;\n\n const { withModel } = createOperationsWrapper({\n ...params,\n modelName: FOLDER_MODEL_ID\n });\n\n const getFolder: AcoFolderStorageOperations[\"getFolder\"] = ({ id, slug, type, parentId }) => {\n return withModel(async model => {\n let entry;\n\n if (id) {\n entry = await cms.getEntryById(model, id);\n } else if (slug && type) {\n entry = await cms.getEntry(model, {\n where: { slug, type, parentId, latest: true }\n });\n }\n\n if (!entry) {\n throw new WebinyError(\"Could not load folder.\", \"GET_FOLDER_ERROR\", {\n id,\n slug,\n type,\n parentId\n });\n }\n\n return getFolderFieldValues(entry, baseFields);\n });\n };\n\n const checkExistingFolder = ({ id, params }: AcoCheckExistingFolderParams) => {\n return withModel(async model => {\n const { type, slug, parentId } = params;\n\n const [existings] = await cms.listLatestEntries(model, {\n where: {\n type,\n slug,\n parentId,\n id_not: id\n },\n limit: 1\n });\n\n if (existings.length > 0) {\n throw new WebinyError(\n `Folder with slug \"${slug}\" already exists at this level.`,\n \"FOLDER_ALREADY_EXISTS\",\n {\n id,\n params\n }\n );\n }\n\n return;\n });\n };\n\n return {\n getFolder,\n listFolders(params) {\n return withModel(async model => {\n const { sort, where } = params;\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n sort: createListSort(sort),\n where: {\n ...(where || {})\n }\n });\n\n return [entries.map(entry => getFolderFieldValues(entry, baseFields)), meta];\n });\n },\n createFolder({ data }) {\n return withModel(async model => {\n await checkExistingFolder({\n params: {\n type: data.type,\n slug: data.slug,\n parentId: data.parentId\n }\n });\n\n const entry = await cms.createEntry(model, {\n ...data,\n parentId: data.parentId || null\n });\n\n return getFolderFieldValues(entry, baseFields);\n });\n },\n updateFolder({ id, data }) {\n return withModel(async model => {\n const { slug, parentId } = data;\n\n const original = await getFolder({ id });\n\n await checkExistingFolder({\n id,\n params: {\n type: original.type,\n slug: slug || original.slug,\n parentId: parentId !== undefined ? parentId : original.parentId // parentId can be `null`\n }\n });\n\n const input = {\n ...original,\n ...data\n };\n\n const entry = await cms.updateEntry(model, id, input);\n return getFolderFieldValues(entry, baseFields);\n });\n },\n deleteFolder({ id }) {\n return withModel(async model => {\n await cms.deleteEntry(model, id);\n return true;\n });\n }\n };\n};\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EAAEJ,EAAE,EAAE+B,KAAK,CAAC;QACrD,OAAO,IAAApB,oCAAoB,EAACN,KAAK,EAAEO,sCAAU,CAAC;MAClD,CAAC,CAAC;IACN,CAAC;IACDqB,YAAYA,CAAC;MAAEjC;IAAG,CAAC,EAAE;MACjB,OAAOP,SAAS,CAAC,MAAMW,KAAK,IAAI;QAC5B,MAAMZ,GAAG,CAAC0C,WAAW,CAAC9B,KAAK,EAAEJ,EAAE,CAAC;QAChC,OAAO,IAAI;MACf,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACmC,OAAA,CAAA7C,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_folder","_createAcoStorageOperations","_createListSort","_createOperationsWrapper","_getFieldValues","createFolderOperations","params","cms","withModel","createOperationsWrapper","_objectSpread2","default","modelName","FOLDER_MODEL_ID","getFolder","id","slug","type","parentId","model","entry","getEntryById","getEntry","where","latest","WebinyError","getFolderFieldValues","baseFields","checkExistingFolder","_listResult$items","listResult","storageOperations","entries","list","id_not","limit","items","length","listFolders","sort","meta","listLatestEntries","createListSort","map","createFolder","data","createEntry","updateFolder","original","undefined","input","updateEntry","deleteFolder","deleteEntry","exports"],"sources":["folder.so.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { FOLDER_MODEL_ID } from \"./folder.model\";\nimport { baseFields, CreateAcoStorageOperationsParams } from \"~/createAcoStorageOperations\";\nimport { createListSort } from \"~/utils/createListSort\";\nimport { createOperationsWrapper } from \"~/utils/createOperationsWrapper\";\nimport { getFolderFieldValues } from \"~/utils/getFieldValues\";\n\nimport { AcoFolderStorageOperations } from \"./folder.types\";\n\ninterface AcoCheckExistingFolderParams {\n params: {\n type: string;\n slug: string;\n parentId?: string | null;\n };\n id?: string;\n}\n\nexport const createFolderOperations = (\n params: CreateAcoStorageOperationsParams\n): AcoFolderStorageOperations => {\n const { cms } = params;\n\n const { withModel } = createOperationsWrapper({\n ...params,\n modelName: FOLDER_MODEL_ID\n });\n\n const getFolder: AcoFolderStorageOperations[\"getFolder\"] = ({ id, slug, type, parentId }) => {\n return withModel(async model => {\n let entry;\n\n if (id) {\n entry = await cms.getEntryById(model, id);\n } else if (slug && type) {\n entry = await cms.getEntry(model, {\n where: { slug, type, parentId, latest: true }\n });\n }\n\n if (!entry) {\n throw new WebinyError(\"Could not load folder.\", \"GET_FOLDER_ERROR\", {\n id,\n slug,\n type,\n parentId\n });\n }\n\n return getFolderFieldValues(entry, baseFields);\n });\n };\n\n const checkExistingFolder = ({ id, params }: AcoCheckExistingFolderParams) => {\n return withModel(async model => {\n const { type, slug, parentId } = params;\n\n // We don't need to perform any kind of authorization or checks here. We just need to check\n // if the folder already exists in the database. Hence the direct storage operations access.\n const listResult = await cms.storageOperations.entries.list(model, {\n ...params,\n where: {\n // Folders always work with latest entries. We never publish them.\n latest: true,\n type,\n slug,\n parentId,\n id_not: id\n },\n limit: 1\n });\n\n if (listResult?.items?.length > 0) {\n throw new WebinyError(\n `Folder with slug \"${slug}\" already exists at this level.`,\n \"FOLDER_ALREADY_EXISTS\",\n {\n id,\n params\n }\n );\n }\n\n return;\n });\n };\n\n return {\n getFolder,\n listFolders(params) {\n return withModel(async model => {\n const { sort, where } = params;\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n sort: createListSort(sort),\n where: {\n ...(where || {})\n }\n });\n\n return [entries.map(entry => getFolderFieldValues(entry, baseFields)), meta];\n });\n },\n createFolder({ data }) {\n return withModel(async model => {\n await checkExistingFolder({\n params: {\n type: data.type,\n slug: data.slug,\n parentId: data.parentId\n }\n });\n\n const entry = await cms.createEntry(model, {\n ...data,\n parentId: data.parentId || null\n });\n\n return getFolderFieldValues(entry, baseFields);\n });\n },\n updateFolder({ id, data }) {\n return withModel(async model => {\n const { slug, parentId } = data;\n\n const original = await getFolder({ id });\n\n await checkExistingFolder({\n id,\n params: {\n type: original.type,\n slug: slug || original.slug,\n parentId: parentId !== undefined ? parentId : original.parentId // parentId can be `null`\n }\n });\n\n const input = {\n ...original,\n ...data\n };\n\n const entry = await cms.updateEntry(model, id, input);\n return getFolderFieldValues(entry, baseFields);\n });\n },\n deleteFolder({ id }) {\n return withModel(async model => {\n await cms.deleteEntry(model, id);\n return true;\n });\n }\n };\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAaO,MAAMM,sBAAsB,GAC/BC,MAAwC,IACX;EAC7B,MAAM;IAAEC;EAAI,CAAC,GAAGD,MAAM;EAEtB,MAAM;IAAEE;EAAU,CAAC,GAAG,IAAAC,gDAAuB,MAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACtCL,MAAM;IACTM,SAAS,EAAEC;EAAe,EAC7B,CAAC;EAEF,MAAMC,SAAkD,GAAGA,CAAC;IAAEC,EAAE;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAS,CAAC,KAAK;IACzF,OAAOV,SAAS,CAAC,MAAMW,KAAK,IAAI;MAC5B,IAAIC,KAAK;MAET,IAAIL,EAAE,EAAE;QACJK,KAAK,GAAG,MAAMb,GAAG,CAACc,YAAY,CAACF,KAAK,EAAEJ,EAAE,CAAC;MAC7C,CAAC,MAAM,IAAIC,IAAI,IAAIC,IAAI,EAAE;QACrBG,KAAK,GAAG,MAAMb,GAAG,CAACe,QAAQ,CAACH,KAAK,EAAE;UAC9BI,KAAK,EAAE;YAAEP,IAAI;YAAEC,IAAI;YAAEC,QAAQ;YAAEM,MAAM,EAAE;UAAK;QAChD,CAAC,CAAC;MACN;MAEA,IAAI,CAACJ,KAAK,EAAE;QACR,MAAM,IAAIK,cAAW,CAAC,wBAAwB,EAAE,kBAAkB,EAAE;UACh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Bb,EAAE;UACFT,MAAM,EAAE;YACJW,IAAI,EAAE+B,QAAQ,CAAC/B,IAAI;YACnBD,IAAI,EAAEA,IAAI,IAAIgC,QAAQ,CAAChC,IAAI;YAC3BE,QAAQ,EAAEA,QAAQ,KAAK+B,SAAS,GAAG/B,QAAQ,GAAG8B,QAAQ,CAAC9B,QAAQ,CAAC;UACpE;QACJ,CAAC,CAAC;;QAEF,MAAMgC,KAAK,OAAAxC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACJqC,QAAQ,GACRH,IAAI,CACV;QAED,MAAMzB,KAAK,GAAG,MAAMb,GAAG,CAAC4C,WAAW,CAAChC,KAAK,EAAEJ,EAAE,EAAEmC,KAAK,CAAC;QACrD,OAAO,IAAAxB,oCAAoB,EAACN,KAAK,EAAEO,sCAAU,CAAC;MAClD,CAAC,CAAC;IACN,CAAC;IACDyB,YAAYA,CAAC;MAAErC;IAAG,CAAC,EAAE;MACjB,OAAOP,SAAS,CAAC,MAAMW,KAAK,IAAI;QAC5B,MAAMZ,GAAG,CAAC8C,WAAW,CAAClC,KAAK,EAAEJ,EAAE,CAAC;QAChC,OAAO,IAAI;MACf,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACuC,OAAA,CAAAjD,sBAAA,GAAAA,sBAAA"}
@@ -1,5 +1,6 @@
1
1
  import { ListMeta, ListSort, User } from "../types";
2
2
  import { Topic } from "@webiny/pubsub/types";
3
+ import { FolderPermission } from "../utils/FolderLevelPermissions";
3
4
  export interface Folder {
4
5
  id: string;
5
6
  entryId: string;
@@ -8,6 +9,7 @@ export interface Folder {
8
9
  savedOn: string;
9
10
  title: string;
10
11
  slug: string;
12
+ permissions?: FolderPermission[];
11
13
  type: string;
12
14
  parentId?: string | null;
13
15
  }
@@ -21,15 +23,27 @@ export interface ListFoldersParams {
21
23
  limit?: number;
22
24
  after?: string | null;
23
25
  }
26
+ export declare type ListAllFoldersParams = Omit<ListFoldersParams, "limit" | "after">;
24
27
  export declare type CreateFolderParams = Pick<Folder, "title" | "slug" | "type" | "parentId">;
25
28
  export interface UpdateFolderParams {
26
29
  title?: string;
27
30
  slug?: string;
31
+ permissions?: FolderPermission[];
28
32
  parentId?: string;
29
33
  }
30
34
  export interface DeleteFolderParams {
31
35
  id: string;
32
36
  }
37
+ export interface FolderLevelPermissionsTarget<TMeta = Record<string, any>> {
38
+ id: string;
39
+ target: string;
40
+ name: string;
41
+ type: string;
42
+ meta: TMeta;
43
+ }
44
+ export interface FolderLevelPermissionsTargetListMeta {
45
+ totalCount: number;
46
+ }
33
47
  export interface StorageOperationsGetFolderParams {
34
48
  id?: string;
35
49
  slug?: string;
@@ -69,9 +83,18 @@ export interface OnFolderAfterDeleteTopicParams {
69
83
  export interface AcoFolderCrud {
70
84
  get(id: string): Promise<Folder>;
71
85
  list(params: ListFoldersParams): Promise<[Folder[], ListMeta]>;
86
+ listFolderLevelPermissionsTargets(): Promise<[
87
+ FolderLevelPermissionsTarget[],
88
+ FolderLevelPermissionsTargetListMeta
89
+ ]>;
90
+ listAll(params: ListAllFoldersParams): Promise<[Folder[], ListMeta]>;
72
91
  create(data: CreateFolderParams): Promise<Folder>;
73
92
  update(id: string, data: UpdateFolderParams): Promise<Folder>;
74
93
  delete(id: string): Promise<Boolean>;
94
+ getAncestors(folder: Folder): Promise<Folder[]>;
95
+ /**
96
+ * @deprecated use `getAncestors` instead
97
+ */
75
98
  getFolderWithAncestors(id: string): Promise<Folder[]>;
76
99
  onFolderBeforeCreate: Topic<OnFolderBeforeCreateTopicParams>;
77
100
  onFolderAfterCreate: Topic<OnFolderAfterCreateTopicParams>;
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=folder.types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["folder.types.ts"],"sourcesContent":["import { ListMeta, ListSort, User } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\n\nexport interface Folder {\n id: string;\n entryId: string;\n createdOn: string;\n createdBy: User;\n savedOn: string;\n title: string;\n slug: string;\n type: string;\n parentId?: string | null;\n}\n\nexport interface ListFoldersWhere {\n type: string;\n parentId?: string | null;\n}\n\nexport interface ListFoldersParams {\n where: ListFoldersWhere;\n sort?: ListSort;\n limit?: number;\n after?: string | null;\n}\n\nexport type CreateFolderParams = Pick<Folder, \"title\" | \"slug\" | \"type\" | \"parentId\">;\n\nexport interface UpdateFolderParams {\n title?: string;\n slug?: string;\n parentId?: string;\n}\n\nexport interface DeleteFolderParams {\n id: string;\n}\n\nexport interface StorageOperationsGetFolderParams {\n id?: string;\n slug?: string;\n type?: string;\n parentId?: string | null;\n}\n\nexport type StorageOperationsListFoldersParams = ListFoldersParams;\n\nexport interface StorageOperationsCreateFolderParams {\n data: CreateFolderParams;\n}\n\nexport interface StorageOperationsUpdateFolderParams {\n id: string;\n data: UpdateFolderParams;\n}\n\nexport type StorageOperationsDeleteFolderParams = DeleteFolderParams;\n\nexport interface OnFolderBeforeCreateTopicParams {\n input: CreateFolderParams;\n}\n\nexport interface OnFolderAfterCreateTopicParams {\n folder: Folder;\n}\n\nexport interface OnFolderBeforeUpdateTopicParams {\n original: Folder;\n input: Record<string, any>;\n}\n\nexport interface OnFolderAfterUpdateTopicParams {\n original: Folder;\n folder: Folder;\n input: Record<string, any>;\n}\n\nexport interface OnFolderBeforeDeleteTopicParams {\n folder: Folder;\n}\n\nexport interface OnFolderAfterDeleteTopicParams {\n folder: Folder;\n}\n\nexport interface AcoFolderCrud {\n get(id: string): Promise<Folder>;\n list(params: ListFoldersParams): Promise<[Folder[], ListMeta]>;\n create(data: CreateFolderParams): Promise<Folder>;\n update(id: string, data: UpdateFolderParams): Promise<Folder>;\n delete(id: string): Promise<Boolean>;\n getFolderWithAncestors(id: string): Promise<Folder[]>;\n onFolderBeforeCreate: Topic<OnFolderBeforeCreateTopicParams>;\n onFolderAfterCreate: Topic<OnFolderAfterCreateTopicParams>;\n onFolderBeforeUpdate: Topic<OnFolderBeforeUpdateTopicParams>;\n onFolderAfterUpdate: Topic<OnFolderAfterUpdateTopicParams>;\n onFolderBeforeDelete: Topic<OnFolderBeforeDeleteTopicParams>;\n onFolderAfterDelete: Topic<OnFolderAfterDeleteTopicParams>;\n}\n\nexport interface AcoFolderStorageOperations {\n getFolder(params: StorageOperationsGetFolderParams): Promise<Folder>;\n listFolders(params: StorageOperationsListFoldersParams): Promise<[Folder[], ListMeta]>;\n createFolder(params: StorageOperationsCreateFolderParams): Promise<Folder>;\n updateFolder(params: StorageOperationsUpdateFolderParams): Promise<Folder>;\n deleteFolder(params: StorageOperationsDeleteFolderParams): Promise<boolean>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["folder.types.ts"],"sourcesContent":["import { ListMeta, ListSort, User } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { FolderPermission } from \"~/utils/FolderLevelPermissions\";\n\nexport interface Folder {\n id: string;\n entryId: string;\n createdOn: string;\n createdBy: User;\n savedOn: string;\n title: string;\n slug: string;\n permissions?: FolderPermission[];\n type: string;\n parentId?: string | null;\n}\n\nexport interface ListFoldersWhere {\n type: string;\n parentId?: string | null;\n}\n\nexport interface ListFoldersParams {\n where: ListFoldersWhere;\n sort?: ListSort;\n limit?: number;\n after?: string | null;\n}\n\nexport type ListAllFoldersParams = Omit<ListFoldersParams, \"limit\" | \"after\">;\n\nexport type CreateFolderParams = Pick<Folder, \"title\" | \"slug\" | \"type\" | \"parentId\">;\n\nexport interface UpdateFolderParams {\n title?: string;\n slug?: string;\n permissions?: FolderPermission[];\n parentId?: string;\n}\n\nexport interface DeleteFolderParams {\n id: string;\n}\n\nexport interface FolderLevelPermissionsTarget<TMeta = Record<string, any>> {\n id: string;\n target: string;\n name: string;\n type: string;\n meta: TMeta;\n}\n\nexport interface FolderLevelPermissionsTargetListMeta {\n totalCount: number;\n}\n\nexport interface StorageOperationsGetFolderParams {\n id?: string;\n slug?: string;\n type?: string;\n parentId?: string | null;\n}\n\nexport type StorageOperationsListFoldersParams = ListFoldersParams;\n\nexport interface StorageOperationsCreateFolderParams {\n data: CreateFolderParams;\n}\n\nexport interface StorageOperationsUpdateFolderParams {\n id: string;\n data: UpdateFolderParams;\n}\n\nexport type StorageOperationsDeleteFolderParams = DeleteFolderParams;\n\nexport interface OnFolderBeforeCreateTopicParams {\n input: CreateFolderParams;\n}\n\nexport interface OnFolderAfterCreateTopicParams {\n folder: Folder;\n}\n\nexport interface OnFolderBeforeUpdateTopicParams {\n original: Folder;\n input: Record<string, any>;\n}\n\nexport interface OnFolderAfterUpdateTopicParams {\n original: Folder;\n folder: Folder;\n input: Record<string, any>;\n}\n\nexport interface OnFolderBeforeDeleteTopicParams {\n folder: Folder;\n}\n\nexport interface OnFolderAfterDeleteTopicParams {\n folder: Folder;\n}\n\nexport interface AcoFolderCrud {\n get(id: string): Promise<Folder>;\n\n list(params: ListFoldersParams): Promise<[Folder[], ListMeta]>;\n\n listFolderLevelPermissionsTargets(): Promise<\n [FolderLevelPermissionsTarget[], FolderLevelPermissionsTargetListMeta]\n >;\n\n listAll(params: ListAllFoldersParams): Promise<[Folder[], ListMeta]>;\n\n create(data: CreateFolderParams): Promise<Folder>;\n\n update(id: string, data: UpdateFolderParams): Promise<Folder>;\n\n delete(id: string): Promise<Boolean>;\n\n getAncestors(folder: Folder): Promise<Folder[]>;\n\n /**\n * @deprecated use `getAncestors` instead\n */\n getFolderWithAncestors(id: string): Promise<Folder[]>;\n\n onFolderBeforeCreate: Topic<OnFolderBeforeCreateTopicParams>;\n onFolderAfterCreate: Topic<OnFolderAfterCreateTopicParams>;\n onFolderBeforeUpdate: Topic<OnFolderBeforeUpdateTopicParams>;\n onFolderAfterUpdate: Topic<OnFolderAfterUpdateTopicParams>;\n onFolderBeforeDelete: Topic<OnFolderBeforeDeleteTopicParams>;\n onFolderAfterDelete: Topic<OnFolderAfterDeleteTopicParams>;\n}\n\nexport interface AcoFolderStorageOperations {\n getFolder(params: StorageOperationsGetFolderParams): Promise<Folder>;\n\n listFolders(params: StorageOperationsListFoldersParams): Promise<[Folder[], ListMeta]>;\n\n createFolder(params: StorageOperationsCreateFolderParams): Promise<Folder>;\n\n updateFolder(params: StorageOperationsUpdateFolderParams): Promise<Folder>;\n\n deleteFolder(params: StorageOperationsDeleteFolderParams): Promise<boolean>;\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { AcoContext } from "../types";
2
+ export declare const onFolderBeforeDeleteAcoHook: ({ aco }: AcoContext) => void;
@@ -4,14 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.onFolderBeforeDeleteHook = void 0;
7
+ exports.onFolderBeforeDeleteAcoHook = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
9
  const throwDeleteError = folder => {
10
- throw new _error.default("Error: delete all child folders and entries before proceeding.", "DELETE_FOLDER_WITH_CHILDREN", {
10
+ throw new _error.default("Delete all child folders and entries before proceeding.", "DELETE_FOLDER_WITH_CHILDREN", {
11
11
  folder
12
12
  });
13
13
  };
14
- const onFolderBeforeDeleteHook = ({
14
+ const onFolderBeforeDeleteAcoHook = ({
15
15
  aco
16
16
  }) => {
17
17
  aco.folder.onFolderBeforeDelete.subscribe(async ({
@@ -56,10 +56,12 @@ const onFolderBeforeDeleteHook = ({
56
56
  throwDeleteError(folder);
57
57
  } catch (error) {
58
58
  throw _error.default.from(error, {
59
- message: "Error while executing onFolderBeforeDelete hook",
60
- code: "ACO_BEFORE_FOLDER_DELETE_HOOK"
59
+ message: "Error while executing onFolderBeforeDeleteAcoHook hook.",
60
+ code: "ACO_BEFORE_FOLDER_DELETE_ACO_HOOK"
61
61
  });
62
62
  }
63
63
  });
64
64
  };
65
- exports.onFolderBeforeDeleteHook = onFolderBeforeDeleteHook;
65
+ exports.onFolderBeforeDeleteAcoHook = onFolderBeforeDeleteAcoHook;
66
+
67
+ //# sourceMappingURL=onFolderBeforeDeleteAco.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","throwDeleteError","folder","WebinyError","onFolderBeforeDeleteAcoHook","aco","onFolderBeforeDelete","subscribe","id","type","children","list","where","parentId","limit","length","app","undefined","getApp","records","search","location","folderId","error","from","message","code","exports"],"sources":["onFolderBeforeDeleteAco.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { AcoContext, Folder, IAcoApp } from \"~/types\";\n\nconst throwDeleteError = (folder: Folder) => {\n throw new WebinyError(\n \"Delete all child folders and entries before proceeding.\",\n \"DELETE_FOLDER_WITH_CHILDREN\",\n {\n folder\n }\n );\n};\n\nexport const onFolderBeforeDeleteAcoHook = ({ aco }: AcoContext) => {\n aco.folder.onFolderBeforeDelete.subscribe(async ({ folder }) => {\n try {\n const { id, type } = folder;\n /**\n * First we check for the child folders.\n */\n const [children] = await aco.folder.list({\n where: {\n type,\n parentId: id\n },\n limit: 1\n });\n\n if (children.length > 0) {\n throwDeleteError(folder);\n }\n\n let app: IAcoApp | undefined = undefined;\n try {\n app = aco.getApp(type);\n } catch {\n return;\n }\n const [records] = await app.search.list({\n where: {\n type,\n location: {\n folderId: id\n }\n },\n limit: 1\n });\n if (records.length === 0) {\n return;\n }\n throwDeleteError(folder);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFolderBeforeDeleteAcoHook hook.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_ACO_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,MAAMC,gBAAgB,GAAIC,MAAc,IAAK;EACzC,MAAM,IAAIC,cAAW,CACjB,yDAAyD,EACzD,6BAA6B,EAC7B;IACID;EACJ,CACJ,CAAC;AACL,CAAC;AAEM,MAAME,2BAA2B,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAAK;EAChEA,GAAG,CAACH,MAAM,CAACI,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEL;EAAO,CAAC,KAAK;IAC5D,IAAI;MACA,MAAM;QAAEM,EAAE;QAAEC;MAAK,CAAC,GAAGP,MAAM;MAC3B;AACZ;AACA;MACY,MAAM,CAACQ,QAAQ,CAAC,GAAG,MAAML,GAAG,CAACH,MAAM,CAACS,IAAI,CAAC;QACrCC,KAAK,EAAE;UACHH,IAAI;UACJI,QAAQ,EAAEL;QACd,CAAC;QACDM,KAAK,EAAE;MACX,CAAC,CAAC;MAEF,IAAIJ,QAAQ,CAACK,MAAM,GAAG,CAAC,EAAE;QACrBd,gBAAgB,CAACC,MAAM,CAAC;MAC5B;MAEA,IAAIc,GAAwB,GAAGC,SAAS;MACxC,IAAI;QACAD,GAAG,GAAGX,GAAG,CAACa,MAAM,CAACT,IAAI,CAAC;MAC1B,CAAC,CAAC,MAAM;QACJ;MACJ;MACA,MAAM,CAACU,OAAO,CAAC,GAAG,MAAMH,GAAG,CAACI,MAAM,CAACT,IAAI,CAAC;QACpCC,KAAK,EAAE;UACHH,IAAI;UACJY,QAAQ,EAAE;YACNC,QAAQ,EAAEd;UACd;QACJ,CAAC;QACDM,KAAK,EAAE;MACX,CAAC,CAAC;MACF,IAAIK,OAAO,CAACJ,MAAM,KAAK,CAAC,EAAE;QACtB;MACJ;MACAd,gBAAgB,CAACC,MAAM,CAAC;IAC5B,CAAC,CAAC,OAAOqB,KAAK,EAAE;MACZ,MAAMpB,cAAW,CAACqB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,yDAAyD;QAClEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAvB,2BAAA,GAAAA,2BAAA"}
@@ -0,0 +1,2 @@
1
+ import { AcoContext } from "../types";
2
+ export declare const onFolderBeforeDeleteFmHook: (context: AcoContext) => void;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.onFolderBeforeDeleteFmHook = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const onFolderBeforeDeleteFmHook = context => {
10
+ context.aco.folder.onFolderBeforeDelete.subscribe(async ({
11
+ folder
12
+ }) => {
13
+ try {
14
+ const {
15
+ id,
16
+ type
17
+ } = folder;
18
+
19
+ /**
20
+ * Exit if the folder type is not related to File Manager
21
+ */
22
+ if (type !== "FmFile") {
23
+ return;
24
+ }
25
+ const [files] = await context.fileManager.listFiles({
26
+ where: {
27
+ location: {
28
+ folderId: id
29
+ }
30
+ },
31
+ limit: 1
32
+ });
33
+ if (files.length === 0) {
34
+ return;
35
+ }
36
+ throw new _error.default("Delete all child folders and files before proceeding.", "DELETE_FOLDER_WITH_CHILDREN", {
37
+ folder
38
+ });
39
+ } catch (error) {
40
+ throw _error.default.from(error, {
41
+ message: "Error while executing onFolderBeforeDeleteFmHook hook.",
42
+ code: "ACO_BEFORE_FOLDER_DELETE_FILE_HOOK"
43
+ });
44
+ }
45
+ });
46
+ };
47
+ exports.onFolderBeforeDeleteFmHook = onFolderBeforeDeleteFmHook;
48
+
49
+ //# sourceMappingURL=onFolderBeforeDeleteFm.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","onFolderBeforeDeleteFmHook","context","aco","folder","onFolderBeforeDelete","subscribe","id","type","files","fileManager","listFiles","where","location","folderId","limit","length","WebinyError","error","from","message","code","exports"],"sources":["onFolderBeforeDeleteFm.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { AcoContext } from \"~/types\";\n\nexport const onFolderBeforeDeleteFmHook = (context: AcoContext) => {\n context.aco.folder.onFolderBeforeDelete.subscribe(async ({ folder }) => {\n try {\n const { id, type } = folder;\n\n /**\n * Exit if the folder type is not related to File Manager\n */\n if (type !== \"FmFile\") {\n return;\n }\n\n const [files] = await context.fileManager.listFiles({\n where: {\n location: {\n folderId: id\n }\n },\n limit: 1\n });\n\n if (files.length === 0) {\n return;\n }\n\n throw new WebinyError(\n \"Delete all child folders and files before proceeding.\",\n \"DELETE_FOLDER_WITH_CHILDREN\",\n {\n folder\n }\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFolderBeforeDeleteFmHook hook.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_FILE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGO,MAAMC,0BAA0B,GAAIC,OAAmB,IAAK;EAC/DA,OAAO,CAACC,GAAG,CAACC,MAAM,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAO,CAAC,KAAK;IACpE,IAAI;MACA,MAAM;QAAEG,EAAE;QAAEC;MAAK,CAAC,GAAGJ,MAAM;;MAE3B;AACZ;AACA;MACY,IAAII,IAAI,KAAK,QAAQ,EAAE;QACnB;MACJ;MAEA,MAAM,CAACC,KAAK,CAAC,GAAG,MAAMP,OAAO,CAACQ,WAAW,CAACC,SAAS,CAAC;QAChDC,KAAK,EAAE;UACHC,QAAQ,EAAE;YACNC,QAAQ,EAAEP;UACd;QACJ,CAAC;QACDQ,KAAK,EAAE;MACX,CAAC,CAAC;MAEF,IAAIN,KAAK,CAACO,MAAM,KAAK,CAAC,EAAE;QACpB;MACJ;MAEA,MAAM,IAAIC,cAAW,CACjB,uDAAuD,EACvD,6BAA6B,EAC7B;QACIb;MACJ,CACJ,CAAC;IACL,CAAC,CAAC,OAAOc,KAAK,EAAE;MACZ,MAAMD,cAAW,CAACE,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAArB,0BAAA,GAAAA,0BAAA"}
@@ -0,0 +1,2 @@
1
+ import { AcoContext } from "../types";
2
+ export declare const onFolderBeforeDeleteHcmsHook: (context: AcoContext) => void;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.onFolderBeforeDeleteHcmsHook = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const onFolderBeforeDeleteHcmsHook = context => {
10
+ context.aco.folder.onFolderBeforeDelete.subscribe(async ({
11
+ folder
12
+ }) => {
13
+ try {
14
+ const {
15
+ id,
16
+ type
17
+ } = folder;
18
+ const modelId = type.split(":")[1];
19
+ if (!modelId) {
20
+ return;
21
+ }
22
+ let model = null;
23
+ try {
24
+ model = await context.cms.getModel(modelId);
25
+ if (!model) {
26
+ return;
27
+ }
28
+ } catch {
29
+ return;
30
+ }
31
+ const [entries] = await context.cms.listEntries(model, {
32
+ where: {
33
+ latest: true,
34
+ wbyAco_location: {
35
+ folderId: id
36
+ }
37
+ },
38
+ limit: 1
39
+ });
40
+ if (entries.length === 0) {
41
+ return;
42
+ }
43
+ throw new _error.default("Delete all child folders and entries before proceeding.", "DELETE_FOLDER_WITH_CHILDREN", {
44
+ folder
45
+ });
46
+ } catch (error) {
47
+ throw _error.default.from(error, {
48
+ message: "Error while executing onFolderBeforeDeleteHcmsHook hook.",
49
+ code: "ACO_BEFORE_FOLDER_DELETE_HCMS_HOOK"
50
+ });
51
+ }
52
+ });
53
+ };
54
+ exports.onFolderBeforeDeleteHcmsHook = onFolderBeforeDeleteHcmsHook;
55
+
56
+ //# sourceMappingURL=onFolderBeforeDeleteHcms.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","onFolderBeforeDeleteHcmsHook","context","aco","folder","onFolderBeforeDelete","subscribe","id","type","modelId","split","model","cms","getModel","entries","listEntries","where","latest","wbyAco_location","folderId","limit","length","WebinyError","error","from","message","code","exports"],"sources":["onFolderBeforeDeleteHcms.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { AcoContext } from \"~/types\";\n\nexport const onFolderBeforeDeleteHcmsHook = (context: AcoContext) => {\n context.aco.folder.onFolderBeforeDelete.subscribe(async ({ folder }) => {\n try {\n const { id, type } = folder;\n\n const modelId = type.split(\":\")[1];\n\n if (!modelId) {\n return;\n }\n\n let model: CmsModel | null = null;\n try {\n model = await context.cms.getModel(modelId);\n\n if (!model) {\n return;\n }\n } catch {\n return;\n }\n\n const [entries] = await context.cms.listEntries(model, {\n where: {\n latest: true,\n wbyAco_location: {\n folderId: id\n }\n },\n limit: 1\n });\n\n if (entries.length === 0) {\n return;\n }\n\n throw new WebinyError(\n \"Delete all child folders and entries before proceeding.\",\n \"DELETE_FOLDER_WITH_CHILDREN\",\n {\n folder\n }\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFolderBeforeDeleteHcmsHook hook.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_HCMS_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,4BAA4B,GAAIC,OAAmB,IAAK;EACjEA,OAAO,CAACC,GAAG,CAACC,MAAM,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAO,CAAC,KAAK;IACpE,IAAI;MACA,MAAM;QAAEG,EAAE;QAAEC;MAAK,CAAC,GAAGJ,MAAM;MAE3B,MAAMK,OAAO,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;MAElC,IAAI,CAACD,OAAO,EAAE;QACV;MACJ;MAEA,IAAIE,KAAsB,GAAG,IAAI;MACjC,IAAI;QACAA,KAAK,GAAG,MAAMT,OAAO,CAACU,GAAG,CAACC,QAAQ,CAACJ,OAAO,CAAC;QAE3C,IAAI,CAACE,KAAK,EAAE;UACR;QACJ;MACJ,CAAC,CAAC,MAAM;QACJ;MACJ;MAEA,MAAM,CAACG,OAAO,CAAC,GAAG,MAAMZ,OAAO,CAACU,GAAG,CAACG,WAAW,CAACJ,KAAK,EAAE;QACnDK,KAAK,EAAE;UACHC,MAAM,EAAE,IAAI;UACZC,eAAe,EAAE;YACbC,QAAQ,EAAEZ;UACd;QACJ,CAAC;QACDa,KAAK,EAAE;MACX,CAAC,CAAC;MAEF,IAAIN,OAAO,CAACO,MAAM,KAAK,CAAC,EAAE;QACtB;MACJ;MAEA,MAAM,IAAIC,cAAW,CACjB,yDAAyD,EACzD,6BAA6B,EAC7B;QACIlB;MACJ,CACJ,CAAC;IACL,CAAC,CAAC,OAAOmB,KAAK,EAAE;MACZ,MAAMD,cAAW,CAACE,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,0DAA0D;QACnEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAA1B,4BAAA,GAAAA,4BAAA"}
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { SEARCH_RECORD_MODEL_ID } from "./record/record.model";
2
2
  export { FOLDER_MODEL_ID } from "./folder/folder.model";
3
+ export { FILTER_MODEL_ID } from "./filter/filter.model";
3
4
  export * from "./apps";
4
5
  export * from "./plugins";
5
6
  export declare const createAco: () => (import("@webiny/api-headless-cms/types").CmsModelFieldToGraphQLPlugin<import("@webiny/api-headless-cms/types").CmsModelField> | import("@webiny/api").ContextPlugin<import("./types").AcoContext> | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("./types").AcoContext>)[];
package/index.js CHANGED
@@ -6,8 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  var _exportNames = {
7
7
  createAco: true,
8
8
  SEARCH_RECORD_MODEL_ID: true,
9
- FOLDER_MODEL_ID: true
9
+ FOLDER_MODEL_ID: true,
10
+ FILTER_MODEL_ID: true
10
11
  };
12
+ Object.defineProperty(exports, "FILTER_MODEL_ID", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _filter.FILTER_MODEL_ID;
16
+ }
17
+ });
11
18
  Object.defineProperty(exports, "FOLDER_MODEL_ID", {
12
19
  enumerable: true,
13
20
  get: function () {
@@ -26,6 +33,7 @@ var _createAcoGraphQL = require("./createAcoGraphQL");
26
33
  var _fields = require("./fields");
27
34
  var _record = require("./record/record.model");
28
35
  var _folder = require("./folder/folder.model");
36
+ var _filter = require("./filter/filter.model");
29
37
  var _apps = require("./apps");
30
38
  Object.keys(_apps).forEach(function (key) {
31
39
  if (key === "default" || key === "__esModule") return;
@@ -53,4 +61,6 @@ Object.keys(_plugins).forEach(function (key) {
53
61
  const createAco = () => {
54
62
  return [...(0, _fields.createFields)(), (0, _createAcoContext.createAcoContext)(), ...(0, _createAcoGraphQL.createAcoGraphQL)()];
55
63
  };
56
- exports.createAco = createAco;
64
+ exports.createAco = createAco;
65
+
66
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_createAcoContext","require","_createAcoGraphQL","_fields","_record","_folder","_apps","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins","createAco","createFields","createAcoContext","createAcoGraphQL"],"sources":["index.ts"],"sourcesContent":["import { createAcoContext } from \"~/createAcoContext\";\nimport { createAcoGraphQL } from \"~/createAcoGraphQL\";\nimport { createFields } from \"~/fields\";\n\nexport { SEARCH_RECORD_MODEL_ID } from \"./record/record.model\";\nexport { FOLDER_MODEL_ID } from \"./folder/folder.model\";\nexport * from \"./apps\";\nexport * from \"./plugins\";\n\nexport const createAco = () => {\n return [...createFields(), createAcoContext(), ...createAcoGraphQL()];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,G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{"version":3,"names":["_createAcoContext","require","_createAcoGraphQL","_fields","_record","_folder","_filter","_apps","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins","createAco","createFields","createAcoContext","createAcoGraphQL"],"sources":["index.ts"],"sourcesContent":["import { createAcoContext } from \"~/createAcoContext\";\nimport { createAcoGraphQL } from \"~/createAcoGraphQL\";\nimport { createFields } from \"~/fields\";\n\nexport { SEARCH_RECORD_MODEL_ID } from \"./record/record.model\";\nexport { FOLDER_MODEL_ID } from \"./folder/folder.model\";\nexport { FILTER_MODEL_ID } from \"./filter/filter.model\";\nexport * from \"./apps\";\nexport * from \"./plugins\";\n\nexport const createAco = () => {\n return [...createFields(), createAcoContext(), ...createAcoGraphQL()];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAAAO,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,QAAA,GAAAnB,OAAA;AAAAO,MAAA,CAAAC,IAAA,CAAAW,QAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,QAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AAEO,MAAMU,SAAS,GAAGA,CAAA,KAAM;EAC3B,OAAO,CAAC,GAAG,IAAAC,oBAAY,EAAC,CAAC,EAAE,IAAAC,kCAAgB,EAAC,CAAC,EAAE,GAAG,IAAAC,kCAAgB,EAAC,CAAC,CAAC;AACzE,CAAC;AAACR,OAAA,CAAAK,SAAA,GAAAA,SAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-aco",
3
- "version": "5.37.8",
3
+ "version": "5.38.0-beta.1",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "aco:base"
@@ -23,16 +23,18 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@ungap/structured-clone": "1.2.0",
26
- "@webiny/api": "5.37.8",
27
- "@webiny/api-headless-cms": "5.37.8",
28
- "@webiny/api-i18n": "5.37.8",
29
- "@webiny/api-security": "5.37.8",
30
- "@webiny/api-tenancy": "5.37.8",
31
- "@webiny/error": "5.37.8",
32
- "@webiny/handler": "5.37.8",
33
- "@webiny/handler-graphql": "5.37.8",
34
- "@webiny/pubsub": "5.37.8",
35
- "@webiny/utils": "5.37.8",
26
+ "@webiny/api": "5.38.0-beta.1",
27
+ "@webiny/api-authentication": "5.38.0-beta.1",
28
+ "@webiny/api-headless-cms": "5.38.0-beta.1",
29
+ "@webiny/api-i18n": "5.38.0-beta.1",
30
+ "@webiny/api-security": "5.38.0-beta.1",
31
+ "@webiny/api-tenancy": "5.38.0-beta.1",
32
+ "@webiny/error": "5.38.0-beta.1",
33
+ "@webiny/handler": "5.38.0-beta.1",
34
+ "@webiny/handler-graphql": "5.38.0-beta.1",
35
+ "@webiny/pubsub": "5.38.0-beta.1",
36
+ "@webiny/utils": "5.38.0-beta.1",
37
+ "@webiny/validation": "5.38.0-beta.1",
36
38
  "lodash": "4.17.21"
37
39
  },
38
40
  "devDependencies": {
@@ -42,19 +44,22 @@
42
44
  "@babel/preset-typescript": "7.22.5",
43
45
  "@babel/runtime": "7.22.6",
44
46
  "@types/ungap__structured-clone": "0.3.0",
45
- "@webiny/api-i18n-ddb": "5.37.8",
46
- "@webiny/api-security-so-ddb": "5.37.8",
47
- "@webiny/api-tenancy-so-ddb": "5.37.8",
48
- "@webiny/api-wcp": "5.37.8",
49
- "@webiny/cli": "5.37.8",
50
- "@webiny/handler-aws": "5.37.8",
51
- "@webiny/plugins": "5.37.8",
52
- "@webiny/project-utils": "5.37.8",
47
+ "@webiny/api-admin-users": "5.38.0-beta.1",
48
+ "@webiny/api-file-manager": "5.38.0-beta.1",
49
+ "@webiny/api-i18n-ddb": "5.38.0-beta.1",
50
+ "@webiny/api-security-so-ddb": "5.38.0-beta.1",
51
+ "@webiny/api-tenancy-so-ddb": "5.38.0-beta.1",
52
+ "@webiny/api-wcp": "5.38.0-beta.1",
53
+ "@webiny/cli": "5.38.0-beta.1",
54
+ "@webiny/handler-aws": "5.38.0-beta.1",
55
+ "@webiny/plugins": "5.38.0-beta.1",
56
+ "@webiny/project-utils": "5.38.0-beta.1",
57
+ "@webiny/wcp": "5.38.0-beta.1",
53
58
  "graphql": "15.8.0",
54
59
  "prettier": "2.8.8",
55
60
  "rimraf": "3.0.2",
56
61
  "ttypescript": "1.5.15",
57
62
  "typescript": "4.7.4"
58
63
  },
59
- "gitHead": "7af94ec35e4614ac89549a544352fd2ceba1ba42"
64
+ "gitHead": "6daf38d3ed0c029a8fea005c2b6246e5b325a09c"
60
65
  }
@@ -56,4 +56,6 @@ const createAcoAppModifier = (name, cb) => {
56
56
  cb
57
57
  });
58
58
  };
59
- exports.createAcoAppModifier = createAcoAppModifier;
59
+ exports.createAcoAppModifier = createAcoAppModifier;
60
+
61
+ //# sourceMappingURL=AcoAppModifierPlugin.js.map
@@ -19,4 +19,6 @@ exports.AcoAppRegisterPlugin = AcoAppRegisterPlugin;
19
19
  const registerAcoApp = app => {
20
20
  return new AcoAppRegisterPlugin(app);
21
21
  };
22
- exports.registerAcoApp = registerAcoApp;
22
+ exports.registerAcoApp = registerAcoApp;
23
+
24
+ //# sourceMappingURL=AcoAppRegisterPlugin.js.map
package/plugins/index.js CHANGED
@@ -24,4 +24,6 @@ Object.keys(_AcoAppModifierPlugin).forEach(function (key) {
24
24
  return _AcoAppModifierPlugin[key];
25
25
  }
26
26
  });
27
- });
27
+ });
28
+
29
+ //# sourceMappingURL=index.js.map
@@ -10,7 +10,7 @@ var _createFieldResolvers = require("@webiny/api-headless-cms/graphql/schema/cre
10
10
  var _resolve = require("../../utils/resolve");
11
11
  var _utils = require("@webiny/utils");
12
12
  var _acoRecordId = require("../../utils/acoRecordId");
13
- var _checkPermissions = require("../../utils/checkPermissions");
13
+ var _ensureAuthentication = require("../../utils/ensureAuthentication");
14
14
  const createAppResolvers = params => {
15
15
  const {
16
16
  app,
@@ -42,19 +42,19 @@ const createAppResolvers = params => {
42
42
  SearchQuery: {
43
43
  [`get${apiName}`]: async (_, args, context) => {
44
44
  return (0, _resolve.resolve)(() => {
45
- (0, _checkPermissions.checkPermissions)(context);
45
+ (0, _ensureAuthentication.ensureAuthentication)(context);
46
46
  return app.search.get(args.id);
47
47
  });
48
48
  },
49
49
  [`list${apiName}`]: async (_, args, context) => {
50
50
  return (0, _resolve.resolveList)(() => {
51
- (0, _checkPermissions.checkPermissions)(context);
51
+ (0, _ensureAuthentication.ensureAuthentication)(context);
52
52
  return app.search.list(args);
53
53
  });
54
54
  },
55
55
  [`list${apiName}Tags`]: async (_, args, context) => {
56
56
  return (0, _resolve.resolveList)(() => {
57
- (0, _checkPermissions.checkPermissions)(context);
57
+ (0, _ensureAuthentication.ensureAuthentication)(context);
58
58
  return app.search.listTags(args);
59
59
  });
60
60
  }
@@ -63,7 +63,7 @@ const createAppResolvers = params => {
63
63
  [`create${apiName}`]: async (_, args, context) => {
64
64
  return (0, _resolve.resolve)(() => {
65
65
  var _args$data;
66
- (0, _checkPermissions.checkPermissions)(context);
66
+ (0, _ensureAuthentication.ensureAuthentication)(context);
67
67
  const {
68
68
  id
69
69
  } = (0, _utils.parseIdentifier)((_args$data = args.data) === null || _args$data === void 0 ? void 0 : _args$data.id);
@@ -74,7 +74,7 @@ const createAppResolvers = params => {
74
74
  },
75
75
  [`update${apiName}`]: async (_, args, context) => {
76
76
  return (0, _resolve.resolve)(() => {
77
- (0, _checkPermissions.checkPermissions)(context);
77
+ (0, _ensureAuthentication.ensureAuthentication)(context);
78
78
  const {
79
79
  id
80
80
  } = (0, _utils.parseIdentifier)(args.id);
@@ -83,7 +83,7 @@ const createAppResolvers = params => {
83
83
  },
84
84
  [`move${apiName}`]: async (_, args, context) => {
85
85
  return (0, _resolve.resolve)(() => {
86
- (0, _checkPermissions.checkPermissions)(context);
86
+ (0, _ensureAuthentication.ensureAuthentication)(context);
87
87
  const {
88
88
  id
89
89
  } = (0, _utils.parseIdentifier)(args.id);
@@ -92,7 +92,7 @@ const createAppResolvers = params => {
92
92
  },
93
93
  [`delete${apiName}`]: async (_, args, context) => {
94
94
  return (0, _resolve.resolve)(() => {
95
- (0, _checkPermissions.checkPermissions)(context);
95
+ (0, _ensureAuthentication.ensureAuthentication)(context);
96
96
  const {
97
97
  id
98
98
  } = (0, _utils.parseIdentifier)(args.id);
@@ -105,4 +105,6 @@ const createAppResolvers = params => {
105
105
  delete resolvers[apiName].entryId;
106
106
  return resolvers;
107
107
  };
108
- exports.createAppResolvers = createAppResolvers;
108
+ exports.createAppResolvers = createAppResolvers;
109
+
110
+ //# sourceMappingURL=createAppResolvers.js.map