@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
@@ -1 +1 @@
1
- {"version":3,"names":["setupAcoContext","context","tenancy","security","i18n","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getIdentity","aco","createAcoCrud","storageOperations","createAcoStorageOperations","cms","getCmsContext","createAcoContext","ContextPlugin","createAcoHooks"],"sources":["createAcoContext.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport WebinyError from \"@webiny/error\";\n\nimport { createAcoCrud } from \"~/createAcoCrud\";\nimport { createAcoHooks } from \"~/createAcoHooks\";\nimport { createAcoStorageOperations } from \"~/createAcoStorageOperations\";\nimport { isInstallationPending } from \"~/utils/isInstallationPending\";\n\nimport { AcoContext } from \"~/types\";\n\nconst setupAcoContext = (context: AcoContext) => {\n const { tenancy, security, i18n } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-aco/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getIdentity = () => security.getIdentity();\n\n context.aco = createAcoCrud({\n getLocale,\n getIdentity,\n getTenant,\n storageOperations: createAcoStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n })\n });\n};\n\nexport const createAcoContext = () => {\n return new ContextPlugin<AcoContext>(async context => {\n if (isInstallationPending(context)) {\n return;\n }\n\n await setupAcoContext(context);\n await createAcoHooks(context);\n });\n};\n"],"mappings":";;;;;;;AAAA;AAGA;AAEA;AACA;AACA;AACA;AAIA,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EAC7C,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGH,OAAO;EAE3C,IAAI,IAAAI,4CAAqB,EAAC;IAAEH,OAAO;IAAEE;EAAK,CAAC,CAAC,EAAE;IAC1C;EACJ;EAEA,MAAME,SAAS,GAAG,MAAkB;IAChC,MAAMC,MAAM,GAAGH,IAAI,CAACI,gBAAgB,EAAE;IACtC,IAAI,CAACD,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CACjB,sDAAsD,EACtD,cAAc,CACjB;IACL;IAEA,OAAOF,MAAM;EACjB,CAAC;EAED,MAAMG,SAAS,GAAG,MAAc;IAC5B,OAAOR,OAAO,CAACS,gBAAgB,EAAE;EACrC,CAAC;EAED,MAAMC,WAAW,GAAG,MAAMT,QAAQ,CAACS,WAAW,EAAE;EAEhDX,OAAO,CAACY,GAAG,GAAG,IAAAC,4BAAa,EAAC;IACxBR,SAAS;IACTM,WAAW;IACXF,SAAS;IACTK,iBAAiB,EAAE,IAAAC,sDAA0B,EAAC;MAC1C;AACZ;AACA;MACYC,GAAG,EAAEhB,OAAO,CAACgB,GAAG;MAChB;AACZ;AACA;MACYC,aAAa,EAAE,MAAMjB,OAAO;MAC5BE;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAEM,MAAMgB,gBAAgB,GAAG,MAAM;EAClC,OAAO,IAAIC,kBAAa,CAAa,MAAMnB,OAAO,IAAI;IAClD,IAAI,IAAAI,4CAAqB,EAACJ,OAAO,CAAC,EAAE;MAChC;IACJ;IAEA,MAAMD,eAAe,CAACC,OAAO,CAAC;IAC9B,MAAM,IAAAoB,8BAAc,EAACpB,OAAO,CAAC;EACjC,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_api","_createAcoHooks","_createAcoStorageOperations","_isInstallationPending","_folder","_record","_apps","_record2","_plugins","_FolderLevelPermissions","_CmsEntriesCrudDecorators","_folder2","_createOperationsWrapper","_pickEntryFieldValues","_filter","setupAcoContext","context","setupAcoContextParams","tenancy","security","i18n","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","storageOperations","createAcoStorageOperations","cms","getCmsContext","folderLevelPermissions","FolderLevelPermissions","getIdentity","getIdentityTeam","withoutAuthorization","identity","adminUser","adminUsers","getUser","where","id","team","getTeam","listPermissions","listAllFolders","type","withModel","createOperationsWrapper","modelName","FOLDER_MODEL_ID","model","results","entries","list","limit","latest","sort","items","map","pickEntryFieldValues","canUseTeams","wcp","canUseFolderLevelPermissions","useFolderLevelPermissions","isAuthorizationEnabled","params","defaultRecordModel","getModel","SEARCH_RECORD_MODEL_ID","apps","AcoApps","plugins","byType","AcoAppRegisterPlugin","plugin","register","app","listAdminUsers","listUsers","listTeams","aco","folder","createFolderCrudMethods","search","createSearchRecordCrudMethods","filter","createFilterCrudMethods","getApp","name","get","listApps","registerApp","CmsEntriesCrudDecorators","decorate","createAcoContext","ContextPlugin","isInstallationPending","benchmark","measure","createAcoHooks","exports"],"sources":["createAcoContext.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { createAcoHooks } from \"~/createAcoHooks\";\nimport { createAcoStorageOperations } from \"~/createAcoStorageOperations\";\nimport { isInstallationPending } from \"~/utils/isInstallationPending\";\nimport { AcoContext, CreateAcoParams, Folder, IAcoAppRegisterParams } from \"~/types\";\nimport { createFolderCrudMethods } from \"~/folder/folder.crud\";\nimport { createSearchRecordCrudMethods } from \"~/record/record.crud\";\nimport { AcoApps } from \"./apps\";\nimport { SEARCH_RECORD_MODEL_ID } from \"~/record/record.model\";\nimport { AcoAppRegisterPlugin } from \"~/plugins\";\nimport { FolderLevelPermissions } from \"~/utils/FolderLevelPermissions\";\nimport { CmsEntriesCrudDecorators } from \"~/utils/decorators/CmsEntriesCrudDecorators\";\nimport { FOLDER_MODEL_ID } from \"~/folder/folder.model\";\nimport { createOperationsWrapper } from \"~/utils/createOperationsWrapper\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport { createFilterCrudMethods } from \"~/filter/filter.crud\";\n\ninterface CreateAcoContextParams {\n useFolderLevelPermissions?: boolean;\n}\n\nconst setupAcoContext = async (\n context: AcoContext,\n setupAcoContextParams: CreateAcoContextParams\n): Promise<void> => {\n const { tenancy, security, i18n } = context;\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-aco/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const storageOperations = createAcoStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n });\n\n const folderLevelPermissions = new FolderLevelPermissions({\n getIdentity: () => security.getIdentity(),\n getIdentityTeam: async () => {\n return security.withoutAuthorization(async () => {\n const identity = security.getIdentity();\n if (!identity) {\n return null;\n }\n\n const adminUser = await context.adminUsers.getUser({ where: { id: identity.id } });\n if (!adminUser) {\n return null;\n }\n\n if (!adminUser.team) {\n return null;\n }\n\n return context.security.getTeam({ where: { id: adminUser.team } });\n });\n },\n listPermissions: () => security.listPermissions(),\n listAllFolders: type => {\n // When retrieving a list of all folders, we want to do it in the\n // fastest way and that is by directly using CMS's storage operations.\n const { withModel } = createOperationsWrapper({\n modelName: FOLDER_MODEL_ID,\n cms: context.cms,\n getCmsContext: () => context,\n security\n });\n\n return withModel(async model => {\n const results = await context.cms.storageOperations.entries.list(model, {\n limit: 100_000,\n where: {\n type,\n\n // Folders always work with latest entries. We never publish them.\n latest: true\n },\n sort: [\"title_ASC\"]\n });\n\n return results.items.map(pickEntryFieldValues<Folder>);\n });\n },\n canUseTeams: () => context.wcp.canUseTeams(),\n canUseFolderLevelPermissions: () => {\n if (setupAcoContextParams.useFolderLevelPermissions === false) {\n return false;\n }\n\n return context.wcp.canUseFolderLevelPermissions();\n },\n isAuthorizationEnabled: () => context.security.isAuthorizationEnabled()\n });\n\n const params: CreateAcoParams = {\n getLocale,\n getTenant,\n storageOperations,\n folderLevelPermissions\n };\n\n const defaultRecordModel = await context.security.withoutAuthorization(async () => {\n return context.cms.getModel(SEARCH_RECORD_MODEL_ID);\n });\n\n if (!defaultRecordModel) {\n throw new WebinyError(`There is no default record model in ${SEARCH_RECORD_MODEL_ID}`);\n }\n\n /**\n * First we need to create all the apps.\n */\n const apps = new AcoApps(context, params);\n const plugins = context.plugins.byType<AcoAppRegisterPlugin>(AcoAppRegisterPlugin.type);\n for (const plugin of plugins) {\n await apps.register({\n model: defaultRecordModel,\n ...plugin.app\n });\n }\n\n const listAdminUsers = () => {\n return security.withoutAuthorization(async () => {\n return context.adminUsers.listUsers();\n });\n };\n const listTeams = () => {\n return security.withoutAuthorization(async () => {\n return context.security.listTeams();\n });\n };\n\n context.aco = {\n folder: createFolderCrudMethods({\n ...params,\n listAdminUsers,\n listTeams\n }),\n search: createSearchRecordCrudMethods(params),\n folderLevelPermissions,\n filter: createFilterCrudMethods(params),\n apps,\n getApp: (name: string) => apps.get(name),\n listApps: () => apps.list(),\n registerApp: async (params: IAcoAppRegisterParams) => {\n return apps.register({\n model: defaultRecordModel,\n ...params\n });\n }\n };\n\n if (context.wcp.canUseFolderLevelPermissions()) {\n new CmsEntriesCrudDecorators({ context }).decorate();\n\n // PB decorators registered here: packages/api-page-builder-aco/src/index.ts\n // new PageBuilderCrudDecorators({ context }).decorate();\n }\n};\n\nexport const createAcoContext = (params: CreateAcoContextParams = {}) => {\n const plugin = new ContextPlugin<AcoContext>(async context => {\n /**\n * We can skip the ACO initialization if the installation is pending.\n */\n if (isInstallationPending(context)) {\n return;\n }\n await context.benchmark.measure(\"aco.context.setup\", async () => {\n await setupAcoContext(context, params);\n });\n\n await context.benchmark.measure(\"aco.context.hooks\", async () => {\n await createAcoHooks(context);\n });\n });\n\n plugin.name = \"aco.createContext\";\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAGA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,yBAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AACA,IAAAa,wBAAA,GAAAb,OAAA;AACA,IAAAc,qBAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AAMA,MAAMgB,eAAe,GAAG,MAAAA,CACpBC,OAAmB,EACnBC,qBAA6C,KAC7B;EAChB,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGJ,OAAO;EAE3C,MAAMK,SAAS,GAA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,QAAQ,EAAEA,CAAA,KAAMrB,IAAI,CAAChB,IAAI,CAAC,CAAC;IAC3BsC,WAAW,EAAE,MAAO1B,MAA6B,IAAK;MAClD,OAAOI,IAAI,CAACM,QAAQ,CAAC;QACjBzB,KAAK,EAAEgB,kBAAkB;QACzB,GAAGD;MACP,CAAC,CAAC;IACN;EACJ,CAAC;EAED,IAAIlD,OAAO,CAAC8C,GAAG,CAACC,4BAA4B,CAAC,CAAC,EAAE;IAC5C,IAAI8B,kDAAwB,CAAC;MAAE7E;IAAQ,CAAC,CAAC,CAAC8E,QAAQ,CAAC,CAAC;;IAEpD;IACA;EACJ;AACJ,CAAC;;AAEM,MAAMC,gBAAgB,GAAGA,CAAC7B,MAA8B,GAAG,CAAC,CAAC,KAAK;EACrE,MAAMS,MAAM,GAAG,IAAIqB,kBAAa,CAAa,MAAMhF,OAAO,IAAI;IAC1D;AACR;AACA;IACQ,IAAI,IAAAiF,4CAAqB,EAACjF,OAAO,CAAC,EAAE;MAChC;IACJ;IACA,MAAMA,OAAO,CAACkF,SAAS,CAACC,OAAO,CAAC,mBAAmB,EAAE,YAAY;MAC7D,MAAMpF,eAAe,CAACC,OAAO,EAAEkD,MAAM,CAAC;IAC1C,CAAC,CAAC;IAEF,MAAMlD,OAAO,CAACkF,SAAS,CAACC,OAAO,CAAC,mBAAmB,EAAE,YAAY;MAC7D,MAAM,IAAAC,8BAAc,EAACpF,OAAO,CAAC;IACjC,CAAC,CAAC;EACN,CAAC,CAAC;EAEF2D,MAAM,CAACc,IAAI,GAAG,mBAAmB;EAEjC,OAAOd,MAAM;AACjB,CAAC;AAAC0B,OAAA,CAAAN,gBAAA,GAAAA,gBAAA"}
@@ -1,3 +1,3 @@
1
- import { ContextPlugin } from "@webiny/api";
1
+ import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
2
  import { AcoContext } from "./types";
3
- export declare const createAcoGraphQL: () => ContextPlugin<AcoContext>;
3
+ export declare const createAcoGraphQL: () => GraphQLSchemaPlugin<AcoContext>[];
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createAcoGraphQL = void 0;
7
- var _api = require("@webiny/api");
8
7
  var _handlerGraphql = require("@webiny/handler-graphql");
8
+ var _filter = require("./filter/filter.gql");
9
9
  var _folder = require("./folder/folder.gql");
10
- var _record = require("./record/record.gql");
10
+ var _app = require("./apps/app.gql");
11
11
  const emptyResolver = () => ({});
12
12
  const baseSchema = new _handlerGraphql.GraphQLSchemaPlugin({
13
13
  typeDefs: /* GraphQL */`
@@ -59,10 +59,43 @@ const baseSchema = new _handlerGraphql.GraphQLSchemaPlugin({
59
59
  input AcoSort {
60
60
  id: AcoSortDirection
61
61
  createdOn: AcoSortDirection
62
+ modifiedOn: AcoSortDirection
62
63
  savedOn: AcoSortDirection
63
64
  title: AcoSortDirection
64
65
  }
65
66
 
67
+ input AcoSearchRecordTagListWhereInput {
68
+ tags_in: [String!]
69
+ tags_startsWith: String
70
+ tags_not_startsWith: String
71
+ createdBy: ID
72
+ AND: [AcoSearchRecordTagListWhereInput!]
73
+ OR: [AcoSearchRecordTagListWhereInput!]
74
+ }
75
+
76
+ type AcoSearchRecordMoveResponse {
77
+ data: Boolean
78
+ error: AcoError
79
+ }
80
+
81
+ type TagItem {
82
+ tag: String!
83
+ count: Int!
84
+ }
85
+
86
+ type AcoSearchRecordTagListResponse {
87
+ data: [TagItem!]
88
+ error: AcoError
89
+ meta: AcoMeta
90
+ }
91
+
92
+ type AcoSearchLocationType {
93
+ folderId: ID!
94
+ }
95
+ input AcoSearchLocationInput {
96
+ folderId: ID!
97
+ }
98
+
66
99
  extend type Query {
67
100
  aco: AcoQuery
68
101
  search: SearchQuery
@@ -85,8 +118,8 @@ const baseSchema = new _handlerGraphql.GraphQLSchemaPlugin({
85
118
  }
86
119
  });
87
120
  const createAcoGraphQL = () => {
88
- return new _api.ContextPlugin(context => {
89
- context.plugins.register([baseSchema, _folder.folderSchema, _record.searchRecordSchema]);
90
- });
121
+ return [baseSchema, _app.appGql, _folder.folderSchema, _filter.filterSchema];
91
122
  };
92
- exports.createAcoGraphQL = createAcoGraphQL;
123
+ exports.createAcoGraphQL = createAcoGraphQL;
124
+
125
+ //# sourceMappingURL=createAcoGraphQL.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","aco","search","Mutation","createAcoGraphQL","ContextPlugin","context","plugins","register","folderSchema","searchRecordSchema"],"sources":["createAcoGraphQL.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\n\nimport { folderSchema } from \"~/folder/folder.gql\";\nimport { searchRecordSchema } from \"~/record/record.gql\";\n\nimport { AcoContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type AcoQuery {\n _empty: String\n }\n\n type AcoMutation {\n _empty: String\n }\n\n type SearchQuery {\n _empty: String\n }\n\n type SearchMutation {\n _empty: String\n }\n\n type AcoMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n\n type AcoUser {\n id: ID\n displayName: String\n type: String\n }\n\n type AcoError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type AcoBooleanResponse {\n data: Boolean\n error: AcoError\n }\n\n enum AcoSortDirection {\n ASC\n DESC\n }\n\n input AcoSort {\n id: AcoSortDirection\n createdOn: AcoSortDirection\n savedOn: AcoSortDirection\n title: AcoSortDirection\n }\n\n extend type Query {\n aco: AcoQuery\n search: SearchQuery\n }\n\n extend type Mutation {\n aco: AcoMutation\n search: SearchMutation\n }\n `,\n resolvers: {\n Query: {\n aco: emptyResolver,\n search: emptyResolver\n },\n Mutation: {\n aco: emptyResolver,\n search: emptyResolver\n }\n }\n});\n\nexport const createAcoGraphQL = () => {\n return new ContextPlugin<AcoContext>(context => {\n context.plugins.register([baseSchema, folderSchema, searchRecordSchema]);\n });\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AAIA,MAAMA,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIC,mCAAmB,CAAC;EACvCC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN,aAAa;MAClBO,MAAM,EAAEP;IACZ,CAAC;IACDQ,QAAQ,EAAE;MACNF,GAAG,EAAEN,aAAa;MAClBO,MAAM,EAAEP;IACZ;EACJ;AACJ,CAAC,CAAC;AAEK,MAAMS,gBAAgB,GAAG,MAAM;EAClC,OAAO,IAAIC,kBAAa,CAAaC,OAAO,IAAI;IAC5CA,OAAO,CAACC,OAAO,CAACC,QAAQ,CAAC,CAACZ,UAAU,EAAEa,oBAAY,EAAEC,0BAAkB,CAAC,CAAC;EAC5E,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["_handlerGraphql","require","_filter","_folder","_app","emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","aco","search","Mutation","createAcoGraphQL","appGql","folderSchema","filterSchema","exports"],"sources":["createAcoGraphQL.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { filterSchema } from \"~/filter/filter.gql\";\nimport { folderSchema } from \"~/folder/folder.gql\";\nimport { appGql } from \"~/apps/app.gql\";\nimport { AcoContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type AcoQuery {\n _empty: String\n }\n\n type AcoMutation {\n _empty: String\n }\n\n type SearchQuery {\n _empty: String\n }\n\n type SearchMutation {\n _empty: String\n }\n\n type AcoMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n\n type AcoUser {\n id: ID\n displayName: String\n type: String\n }\n\n type AcoError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type AcoBooleanResponse {\n data: Boolean\n error: AcoError\n }\n\n enum AcoSortDirection {\n ASC\n DESC\n }\n\n input AcoSort {\n id: AcoSortDirection\n createdOn: AcoSortDirection\n modifiedOn: AcoSortDirection\n savedOn: AcoSortDirection\n title: AcoSortDirection\n }\n\n input AcoSearchRecordTagListWhereInput {\n tags_in: [String!]\n tags_startsWith: String\n tags_not_startsWith: String\n createdBy: ID\n AND: [AcoSearchRecordTagListWhereInput!]\n OR: [AcoSearchRecordTagListWhereInput!]\n }\n\n type AcoSearchRecordMoveResponse {\n data: Boolean\n error: AcoError\n }\n\n type TagItem {\n tag: String!\n count: Int!\n }\n\n type AcoSearchRecordTagListResponse {\n data: [TagItem!]\n error: AcoError\n meta: AcoMeta\n }\n\n type AcoSearchLocationType {\n folderId: ID!\n }\n input AcoSearchLocationInput {\n folderId: ID!\n }\n\n extend type Query {\n aco: AcoQuery\n search: SearchQuery\n }\n\n extend type Mutation {\n aco: AcoMutation\n search: SearchMutation\n }\n `,\n resolvers: {\n Query: {\n aco: emptyResolver,\n search: emptyResolver\n },\n Mutation: {\n aco: emptyResolver,\n search: emptyResolver\n }\n }\n});\n\nexport const createAcoGraphQL = (): GraphQLSchemaPlugin<AcoContext>[] => {\n return [baseSchema, appGql, folderSchema, filterSchema];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAGA,MAAMI,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIC,mCAAmB,CAAC;EACvCC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN,aAAa;MAClBO,MAAM,EAAEP;IACZ,CAAC;IACDQ,QAAQ,EAAE;MACNF,GAAG,EAAEN,aAAa;MAClBO,MAAM,EAAEP;IACZ;EACJ;AACJ,CAAC,CAAC;AAEK,MAAMS,gBAAgB,GAAGA,CAAA,KAAyC;EACrE,OAAO,CAACR,UAAU,EAAES,WAAM,EAAEC,oBAAY,EAAEC,oBAAY,CAAC;AAC3D,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA"}
package/createAcoHooks.js CHANGED
@@ -4,8 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createAcoHooks = void 0;
7
- var _onFolderBeforeDelete = require("./folder/onFolderBeforeDelete.hook");
7
+ var _onFolderBeforeDeleteAco = require("./folder/onFolderBeforeDeleteAco.hook");
8
+ var _onFolderBeforeDeleteHcms = require("./folder/onFolderBeforeDeleteHcms.hook");
9
+ var _onFolderBeforeDeleteFm = require("./folder/onFolderBeforeDeleteFm.hook");
8
10
  const createAcoHooks = context => {
9
- (0, _onFolderBeforeDelete.onFolderBeforeDeleteHook)(context);
11
+ (0, _onFolderBeforeDeleteAco.onFolderBeforeDeleteAcoHook)(context);
12
+ (0, _onFolderBeforeDeleteHcms.onFolderBeforeDeleteHcmsHook)(context);
13
+ (0, _onFolderBeforeDeleteFm.onFolderBeforeDeleteFmHook)(context);
10
14
  };
11
- exports.createAcoHooks = createAcoHooks;
15
+ exports.createAcoHooks = createAcoHooks;
16
+
17
+ //# sourceMappingURL=createAcoHooks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAcoHooks","context","onFolderBeforeDeleteHook"],"sources":["createAcoHooks.ts"],"sourcesContent":["import { onFolderBeforeDeleteHook } from \"~/folder/onFolderBeforeDelete.hook\";\n\nimport { AcoContext } from \"~/types\";\n\nexport const createAcoHooks = (context: AcoContext) => {\n onFolderBeforeDeleteHook(context);\n};\n"],"mappings":";;;;;;AAAA;AAIO,MAAMA,cAAc,GAAIC,OAAmB,IAAK;EACnD,IAAAC,8CAAwB,EAACD,OAAO,CAAC;AACrC,CAAC;AAAC"}
1
+ {"version":3,"names":["_onFolderBeforeDeleteAco","require","_onFolderBeforeDeleteHcms","_onFolderBeforeDeleteFm","createAcoHooks","context","onFolderBeforeDeleteAcoHook","onFolderBeforeDeleteHcmsHook","onFolderBeforeDeleteFmHook","exports"],"sources":["createAcoHooks.ts"],"sourcesContent":["import { onFolderBeforeDeleteAcoHook } from \"~/folder/onFolderBeforeDeleteAco.hook\";\nimport { onFolderBeforeDeleteHcmsHook } from \"~/folder/onFolderBeforeDeleteHcms.hook\";\nimport { onFolderBeforeDeleteFmHook } from \"~/folder/onFolderBeforeDeleteFm.hook\";\n\nimport { AcoContext } from \"~/types\";\n\nexport const createAcoHooks = (context: AcoContext) => {\n onFolderBeforeDeleteAcoHook(context);\n onFolderBeforeDeleteHcmsHook(context);\n onFolderBeforeDeleteFmHook(context);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAIO,MAAMG,cAAc,GAAIC,OAAmB,IAAK;EACnD,IAAAC,oDAA2B,EAACD,OAAO,CAAC;EACpC,IAAAE,sDAA4B,EAACF,OAAO,CAAC;EACrC,IAAAG,kDAA0B,EAACH,OAAO,CAAC;AACvC,CAAC;AAACI,OAAA,CAAAL,cAAA,GAAAA,cAAA"}
@@ -1,58 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createAcoModels = void 0;
8
- var _apiHeadlessCms = require("@webiny/api-headless-cms");
9
- var _error = _interopRequireDefault(require("@webiny/error"));
7
+ var _filter = require("./filter/filter.model");
10
8
  var _folder = require("./folder/folder.model");
11
9
  var _record = require("./record/record.model");
12
10
  var _modelFactory = require("./utils/modelFactory");
13
- var _isInstallationPending = require("./utils/isInstallationPending");
14
11
  const createAcoModels = context => {
15
- /**
16
- * This should never happen in the actual project.
17
- * It is to make sure that we load setup context before the CRUD init in our internal code.
18
- */
19
- if (!context.cms) {
20
- console.warn("Creating model before cms init.");
21
- return;
22
- }
23
- if ((0, _isInstallationPending.isInstallationPending)({
24
- tenancy: context.tenancy,
25
- i18n: context.i18n
26
- })) {
27
- return;
28
- }
29
- const locale = context.i18n.getContentLocale();
30
- if (!locale) {
31
- throw new _error.default("Missing content locale in api-aco/storageOperations/index.ts", "LOCALE_ERROR");
32
- }
33
- const groupId = "contentModelGroup_aco";
34
-
35
- /**
36
- * Create a CmsGroup.
37
- */
38
- const cmsGroupPlugin = new _apiHeadlessCms.CmsGroupPlugin({
39
- id: groupId,
40
- slug: "aco",
41
- name: "ACO",
42
- description: "Group for Advanced Content Organisation and Search",
43
- icon: "fas/folder",
44
- isPrivate: true
45
- });
46
-
47
12
  /**
48
13
  * Create CmsModel plugins.
49
14
  */
50
- const modelDefinitions = [(0, _folder.createFolderModelDefinition)(), (0, _record.createSearchModelDefinition)()];
15
+ const modelDefinitions = [(0, _folder.createFolderModelDefinition)(), (0, _record.createSearchModelDefinition)(), (0, _filter.createFilterModelDefinition)()];
51
16
  const cmsModelPlugins = modelDefinitions.map(modelDefinition => {
52
17
  return (0, _modelFactory.modelFactory)({
53
- group: cmsGroupPlugin.contentModelGroup,
54
- tenant: context.tenancy.getCurrentTenant().id,
55
- locale: locale.code,
56
18
  modelDefinition
57
19
  });
58
20
  });
@@ -60,6 +22,8 @@ const createAcoModels = context => {
60
22
  /**
61
23
  * Register them so that they are accessible in cms context
62
24
  */
63
- context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);
25
+ context.plugins.register([cmsModelPlugins]);
64
26
  };
65
- exports.createAcoModels = createAcoModels;
27
+ exports.createAcoModels = createAcoModels;
28
+
29
+ //# sourceMappingURL=createAcoModels.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAcoModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","groupId","cmsGroupPlugin","CmsGroupPlugin","id","slug","name","description","icon","isPrivate","modelDefinitions","createFolderModelDefinition","createSearchModelDefinition","cmsModelPlugins","map","modelDefinition","modelFactory","group","contentModelGroup","tenant","getCurrentTenant","code","plugins","register"],"sources":["createAcoModels.ts"],"sourcesContent":["import { CmsGroupPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nimport { createFolderModelDefinition } from \"~/folder/folder.model\";\nimport { createSearchModelDefinition } from \"~/record/record.model\";\nimport { modelFactory } from \"~/utils/modelFactory\";\nimport { isInstallationPending } from \"~/utils/isInstallationPending\";\n\nexport const createAcoModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-aco/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n const groupId = \"contentModelGroup_aco\";\n\n /**\n * Create a CmsGroup.\n */\n const cmsGroupPlugin = new CmsGroupPlugin({\n id: groupId,\n slug: \"aco\",\n name: \"ACO\",\n description: \"Group for Advanced Content Organisation and Search\",\n icon: \"fas/folder\",\n isPrivate: true\n });\n\n /**\n * Create CmsModel plugins.\n */\n const modelDefinitions = [createFolderModelDefinition(), createSearchModelDefinition()];\n const cmsModelPlugins = modelDefinitions.map(modelDefinition => {\n return modelFactory({\n group: cmsGroupPlugin.contentModelGroup,\n tenant: context.tenancy.getCurrentTenant().id,\n locale: locale.code,\n modelDefinition\n });\n });\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAEA;AACA;AACA;AACA;AAEO,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4CAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEA,MAAMC,MAAM,GAAGP,OAAO,CAACM,IAAI,CAACE,gBAAgB,EAAE;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cAAc,CACjB;EACL;EAEA,MAAMC,OAAO,GAAG,uBAAuB;;EAEvC;AACJ;AACA;EACI,MAAMC,cAAc,GAAG,IAAIC,8BAAc,CAAC;IACtCC,EAAE,EAAEH,OAAO;IACXI,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,KAAK;IACXC,WAAW,EAAE,oDAAoD;IACjEC,IAAI,EAAE,YAAY;IAClBC,SAAS,EAAE;EACf,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMC,gBAAgB,GAAG,CAAC,IAAAC,mCAA2B,GAAE,EAAE,IAAAC,mCAA2B,GAAE,CAAC;EACvF,MAAMC,eAAe,GAAGH,gBAAgB,CAACI,GAAG,CAACC,eAAe,IAAI;IAC5D,OAAO,IAAAC,0BAAY,EAAC;MAChBC,KAAK,EAAEf,cAAc,CAACgB,iBAAiB;MACvCC,MAAM,EAAE5B,OAAO,CAACK,OAAO,CAACwB,gBAAgB,EAAE,CAAChB,EAAE;MAC7CN,MAAM,EAAEA,MAAM,CAACuB,IAAI;MACnBN;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;AACJ;AACA;EACIxB,OAAO,CAAC+B,OAAO,CAACC,QAAQ,CAAC,CAACrB,cAAc,EAAEW,eAAe,CAAC,CAAC;AAC/D,CAAC;AAAC"}
1
+ {"version":3,"names":["_filter","require","_folder","_record","_modelFactory","createAcoModels","context","modelDefinitions","createFolderModelDefinition","createSearchModelDefinition","createFilterModelDefinition","cmsModelPlugins","map","modelDefinition","modelFactory","plugins","register","exports"],"sources":["createAcoModels.ts"],"sourcesContent":["import { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { createFilterModelDefinition } from \"~/filter/filter.model\";\nimport { createFolderModelDefinition } from \"~/folder/folder.model\";\nimport { createSearchModelDefinition } from \"~/record/record.model\";\nimport { modelFactory } from \"~/utils/modelFactory\";\n\nexport const createAcoModels = (context: CmsContext) => {\n /**\n * Create CmsModel plugins.\n */\n const modelDefinitions = [\n createFolderModelDefinition(),\n createSearchModelDefinition(),\n createFilterModelDefinition()\n ];\n const cmsModelPlugins = modelDefinitions.map(modelDefinition => {\n return modelFactory({\n modelDefinition\n });\n });\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsModelPlugins]);\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEO,MAAMI,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;EACI,MAAMC,gBAAgB,GAAG,CACrB,IAAAC,mCAA2B,EAAC,CAAC,EAC7B,IAAAC,mCAA2B,EAAC,CAAC,EAC7B,IAAAC,mCAA2B,EAAC,CAAC,CAChC;EACD,MAAMC,eAAe,GAAGJ,gBAAgB,CAACK,GAAG,CAACC,eAAe,IAAI;IAC5D,OAAO,IAAAC,0BAAY,EAAC;MAChBD;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;AACJ;AACA;EACIP,OAAO,CAACS,OAAO,CAACC,QAAQ,CAAC,CAACL,eAAe,CAAC,CAAC;AAC/C,CAAC;AAACM,OAAA,CAAAZ,eAAA,GAAAA,eAAA"}
@@ -6,5 +6,4 @@ export interface CreateAcoStorageOperationsParams {
6
6
  security: Security;
7
7
  getCmsContext: () => CmsContext;
8
8
  }
9
- export declare const baseFields: string[];
10
9
  export declare const createAcoStorageOperations: (params: CreateAcoStorageOperationsParams) => AcoStorageOperations;
@@ -1,19 +1,22 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.createAcoStorageOperations = exports.baseFields = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
6
+ exports.createAcoStorageOperations = void 0;
7
+ var _filter = require("./filter/filter.so");
9
8
  var _folder = require("./folder/folder.so");
10
9
  var _record = require("./record/record.so");
11
10
  var _createAcoModels = require("./createAcoModels");
12
- const baseFields = ["id", "entryId", "createdBy", "createdOn", "savedOn"];
13
- exports.baseFields = baseFields;
14
11
  const createAcoStorageOperations = params => {
15
12
  const context = params.getCmsContext();
16
13
  (0, _createAcoModels.createAcoModels)(context);
17
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _folder.createFolderOperations)(params)), (0, _record.createSearchRecordOperations)(params));
14
+ return {
15
+ ...(0, _folder.createFolderOperations)(params),
16
+ ...(0, _record.createSearchRecordOperations)(params),
17
+ ...(0, _filter.createFilterOperations)(params)
18
+ };
18
19
  };
19
- exports.createAcoStorageOperations = createAcoStorageOperations;
20
+ exports.createAcoStorageOperations = createAcoStorageOperations;
21
+
22
+ //# sourceMappingURL=createAcoStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["baseFields","createAcoStorageOperations","params","context","getCmsContext","createAcoModels","createFolderOperations","createSearchRecordOperations"],"sources":["createAcoStorageOperations.ts"],"sourcesContent":["import { CmsContext, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\nimport { createFolderOperations } from \"~/folder/folder.so\";\nimport { createSearchRecordOperations } from \"~/record/record.so\";\nimport { createAcoModels } from \"~/createAcoModels\";\n\nimport { AcoStorageOperations } from \"~/types\";\n\nexport interface CreateAcoStorageOperationsParams {\n cms: HeadlessCms;\n security: Security;\n getCmsContext: () => CmsContext;\n}\n\nexport const baseFields = [\"id\", \"entryId\", \"createdBy\", \"createdOn\", \"savedOn\"];\n\nexport const createAcoStorageOperations = (\n params: CreateAcoStorageOperationsParams\n): AcoStorageOperations => {\n const context = params.getCmsContext();\n\n createAcoModels(context);\n\n return {\n ...createFolderOperations(params),\n ...createSearchRecordOperations(params)\n };\n};\n"],"mappings":";;;;;;;;AAGA;AACA;AACA;AAUO,MAAMA,UAAU,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC;AAAC;AAE1E,MAAMC,0BAA0B,GACnCC,MAAwC,IACjB;EACvB,MAAMC,OAAO,GAAGD,MAAM,CAACE,aAAa,EAAE;EAEtC,IAAAC,gCAAe,EAACF,OAAO,CAAC;EAExB,mEACO,IAAAG,8BAAsB,EAACJ,MAAM,CAAC,GAC9B,IAAAK,oCAA4B,EAACL,MAAM,CAAC;AAE/C,CAAC;AAAC"}
1
+ {"version":3,"names":["_filter","require","_folder","_record","_createAcoModels","createAcoStorageOperations","params","context","getCmsContext","createAcoModels","createFolderOperations","createSearchRecordOperations","createFilterOperations","exports"],"sources":["createAcoStorageOperations.ts"],"sourcesContent":["import { CmsContext, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\nimport { createFilterOperations } from \"~/filter/filter.so\";\nimport { createFolderOperations } from \"~/folder/folder.so\";\nimport { createSearchRecordOperations } from \"~/record/record.so\";\nimport { createAcoModels } from \"~/createAcoModels\";\n\nimport { AcoStorageOperations } from \"~/types\";\n\nexport interface CreateAcoStorageOperationsParams {\n cms: HeadlessCms;\n security: Security;\n getCmsContext: () => CmsContext;\n}\n\nexport const createAcoStorageOperations = (\n params: CreateAcoStorageOperationsParams\n): AcoStorageOperations => {\n const context = params.getCmsContext();\n\n createAcoModels(context);\n\n return {\n ...createFolderOperations(params),\n ...createSearchRecordOperations(params),\n ...createFilterOperations(params)\n };\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAUO,MAAMI,0BAA0B,GACnCC,MAAwC,IACjB;EACvB,MAAMC,OAAO,GAAGD,MAAM,CAACE,aAAa,CAAC,CAAC;EAEtC,IAAAC,gCAAe,EAACF,OAAO,CAAC;EAExB,OAAO;IACH,GAAG,IAAAG,8BAAsB,EAACJ,MAAM,CAAC;IACjC,GAAG,IAAAK,oCAA4B,EAACL,MAAM,CAAC;IACvC,GAAG,IAAAM,8BAAsB,EAACN,MAAM;EACpC,CAAC;AACL,CAAC;AAACO,OAAA,CAAAR,0BAAA,GAAAA,0BAAA"}
@@ -1,2 +1,2 @@
1
1
  import { CmsModelFieldToGraphQLPlugin } from "@webiny/api-headless-cms/types";
2
- export declare const createAcoFields: () => CmsModelFieldToGraphQLPlugin[];
2
+ export declare const createFields: () => CmsModelFieldToGraphQLPlugin[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFields = void 0;
7
+ const createFields = () => {
8
+ return [
9
+ // createLocationField()
10
+ ];
11
+ };
12
+ exports.createFields = createFields;
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFields","exports"],"sources":["index.ts"],"sourcesContent":["import { CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\n\nexport const createFields = (): CmsModelFieldToGraphQLPlugin[] => {\n return [\n // createLocationField()\n ];\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGA,CAAA,KAAsC;EAC9D,OAAO;IACH;EAAA,CACH;AACL,CAAC;AAACC,OAAA,CAAAD,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldToGraphQLPlugin } from "@webiny/api-headless-cms/types";
2
+ export declare const createLocationField: () => CmsModelFieldToGraphQLPlugin;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createLocationField = void 0;
7
+ const createFilters = field => {
8
+ return [`${field.fieldId}: AcoLocationInput`, `${field.fieldId}_in: [AcoLocationInput!]`, `${field.fieldId}_not_in: [AcoLocationInput!]`].join("\n");
9
+ };
10
+ const createLocationField = () => {
11
+ return {
12
+ type: "cms-model-field-to-graphql",
13
+ name: "cms-model-field-to-graphql-location",
14
+ fieldType: "location",
15
+ isSortable: false,
16
+ isSearchable: true,
17
+ read: {
18
+ createGetFilters({
19
+ field
20
+ }) {
21
+ return createFilters(field);
22
+ },
23
+ createListFilters({
24
+ field
25
+ }) {
26
+ return createFilters(field);
27
+ },
28
+ createTypeField() {
29
+ return ``;
30
+ }
31
+ },
32
+ manage: {
33
+ createTypeField() {
34
+ return ``;
35
+ },
36
+ createInputField({
37
+ field
38
+ }) {
39
+ return `${field.fieldId}: AcoLocationInput`;
40
+ }
41
+ }
42
+ };
43
+ };
44
+ exports.createLocationField = createLocationField;
45
+
46
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFilters","field","fieldId","join","createLocationField","type","name","fieldType","isSortable","isSearchable","read","createGetFilters","createListFilters","createTypeField","manage","createInputField","exports"],"sources":["location.ts"],"sourcesContent":["import { CmsModelField, CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\n\nconst createFilters = (field: CmsModelField) => {\n return [\n `${field.fieldId}: AcoLocationInput`,\n `${field.fieldId}_in: [AcoLocationInput!]`,\n `${field.fieldId}_not_in: [AcoLocationInput!]`\n ].join(\"\\n\");\n};\nexport const createLocationField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n type: \"cms-model-field-to-graphql\",\n name: \"cms-model-field-to-graphql-location\",\n fieldType: \"location\",\n isSortable: false,\n isSearchable: true,\n read: {\n createGetFilters({ field }): string {\n return createFilters(field);\n },\n createListFilters({ field }): string {\n return createFilters(field);\n },\n createTypeField(): string {\n return ``;\n }\n },\n manage: {\n createTypeField(): string {\n return ``;\n },\n createInputField({ field }): string {\n return `${field.fieldId}: AcoLocationInput`;\n }\n }\n };\n};\n"],"mappings":";;;;;;AAEA,MAAMA,aAAa,GAAIC,KAAoB,IAAK;EAC5C,OAAO,CACF,GAAEA,KAAK,CAACC,OAAQ,oBAAmB,EACnC,GAAED,KAAK,CAACC,OAAQ,0BAAyB,EACzC,GAAED,KAAK,CAACC,OAAQ,8BAA6B,CACjD,CAACC,IAAI,CAAC,IAAI,CAAC;AAChB,CAAC;AACM,MAAMC,mBAAmB,GAAGA,CAAA,KAAoC;EACnE,OAAO;IACHC,IAAI,EAAE,4BAA4B;IAClCC,IAAI,EAAE,qCAAqC;IAC3CC,SAAS,EAAE,UAAU;IACrBC,UAAU,EAAE,KAAK;IACjBC,YAAY,EAAE,IAAI;IAClBC,IAAI,EAAE;MACFC,gBAAgBA,CAAC;QAAEV;MAAM,CAAC,EAAU;QAChC,OAAOD,aAAa,CAACC,KAAK,CAAC;MAC/B,CAAC;MACDW,iBAAiBA,CAAC;QAAEX;MAAM,CAAC,EAAU;QACjC,OAAOD,aAAa,CAACC,KAAK,CAAC;MAC/B,CAAC;MACDY,eAAeA,CAAA,EAAW;QACtB,OAAQ,EAAC;MACb;IACJ,CAAC;IACDC,MAAM,EAAE;MACJD,eAAeA,CAAA,EAAW;QACtB,OAAQ,EAAC;MACb,CAAC;MACDE,gBAAgBA,CAAC;QAAEd;MAAM,CAAC,EAAU;QAChC,OAAQ,GAAEA,KAAK,CAACC,OAAQ,oBAAmB;MAC/C;IACJ;EACJ,CAAC;AACL,CAAC;AAACc,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA"}
@@ -0,0 +1,3 @@
1
+ import { CreateAcoParams } from "../types";
2
+ import { AcoFilterCrud } from "./filter.types";
3
+ export declare const createFilterCrudMethods: ({ storageOperations }: CreateAcoParams) => AcoFilterCrud;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFilterCrudMethods = void 0;
7
+ var _pubsub = require("@webiny/pubsub");
8
+ const createFilterCrudMethods = ({
9
+ storageOperations
10
+ }) => {
11
+ // create
12
+ const onFilterBeforeCreate = (0, _pubsub.createTopic)("aco.onFilterBeforeCreate");
13
+ const onFilterAfterCreate = (0, _pubsub.createTopic)("aco.onFilterAfterCreate");
14
+ // update
15
+ const onFilterBeforeUpdate = (0, _pubsub.createTopic)("aco.onFilterBeforeUpdate");
16
+ const onFilterAfterUpdate = (0, _pubsub.createTopic)("aco.onFilterAfterUpdate");
17
+ // delete
18
+ const onFilterBeforeDelete = (0, _pubsub.createTopic)("aco.onFilterBeforeDelete");
19
+ const onFilterAfterDelete = (0, _pubsub.createTopic)("aco.onFilterAfterDelete");
20
+ return {
21
+ /**
22
+ * Lifecycle events
23
+ */
24
+ onFilterBeforeCreate,
25
+ onFilterAfterCreate,
26
+ onFilterBeforeUpdate,
27
+ onFilterAfterUpdate,
28
+ onFilterBeforeDelete,
29
+ onFilterAfterDelete,
30
+ async get(id) {
31
+ return storageOperations.getFilter({
32
+ id
33
+ });
34
+ },
35
+ async list(params) {
36
+ return storageOperations.listFilters(params);
37
+ },
38
+ async create(data) {
39
+ await onFilterBeforeCreate.publish({
40
+ input: data
41
+ });
42
+ const filter = await storageOperations.createFilter({
43
+ data
44
+ });
45
+ await onFilterAfterCreate.publish({
46
+ filter
47
+ });
48
+ return filter;
49
+ },
50
+ async update(id, data) {
51
+ const original = await storageOperations.getFilter({
52
+ id
53
+ });
54
+ await onFilterBeforeUpdate.publish({
55
+ original,
56
+ input: {
57
+ id,
58
+ data
59
+ }
60
+ });
61
+ const filter = await storageOperations.updateFilter({
62
+ id,
63
+ data
64
+ });
65
+ await onFilterAfterUpdate.publish({
66
+ original,
67
+ input: {
68
+ id,
69
+ data
70
+ },
71
+ filter
72
+ });
73
+ return filter;
74
+ },
75
+ async delete(id) {
76
+ const filter = await storageOperations.getFilter({
77
+ id
78
+ });
79
+ await onFilterBeforeDelete.publish({
80
+ filter
81
+ });
82
+ await storageOperations.deleteFilter({
83
+ id
84
+ });
85
+ await onFilterAfterDelete.publish({
86
+ filter
87
+ });
88
+ return true;
89
+ }
90
+ };
91
+ };
92
+ exports.createFilterCrudMethods = createFilterCrudMethods;
93
+
94
+ //# sourceMappingURL=filter.crud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_pubsub","require","createFilterCrudMethods","storageOperations","onFilterBeforeCreate","createTopic","onFilterAfterCreate","onFilterBeforeUpdate","onFilterAfterUpdate","onFilterBeforeDelete","onFilterAfterDelete","get","id","getFilter","list","params","listFilters","create","data","publish","input","filter","createFilter","update","original","updateFilter","delete","deleteFilter","exports"],"sources":["filter.crud.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\n\nimport { CreateAcoParams } from \"~/types\";\nimport {\n AcoFilterCrud,\n OnFilterAfterCreateTopicParams,\n OnFilterAfterDeleteTopicParams,\n OnFilterAfterUpdateTopicParams,\n OnFilterBeforeCreateTopicParams,\n OnFilterBeforeDeleteTopicParams,\n OnFilterBeforeUpdateTopicParams\n} from \"./filter.types\";\n\nexport const createFilterCrudMethods = ({ storageOperations }: CreateAcoParams): AcoFilterCrud => {\n // create\n const onFilterBeforeCreate = createTopic<OnFilterBeforeCreateTopicParams>(\n \"aco.onFilterBeforeCreate\"\n );\n const onFilterAfterCreate =\n createTopic<OnFilterAfterCreateTopicParams>(\"aco.onFilterAfterCreate\");\n // update\n const onFilterBeforeUpdate = createTopic<OnFilterBeforeUpdateTopicParams>(\n \"aco.onFilterBeforeUpdate\"\n );\n const onFilterAfterUpdate =\n createTopic<OnFilterAfterUpdateTopicParams>(\"aco.onFilterAfterUpdate\");\n // delete\n const onFilterBeforeDelete = createTopic<OnFilterBeforeDeleteTopicParams>(\n \"aco.onFilterBeforeDelete\"\n );\n const onFilterAfterDelete =\n createTopic<OnFilterAfterDeleteTopicParams>(\"aco.onFilterAfterDelete\");\n\n return {\n /**\n * Lifecycle events\n */\n onFilterBeforeCreate,\n onFilterAfterCreate,\n onFilterBeforeUpdate,\n onFilterAfterUpdate,\n onFilterBeforeDelete,\n onFilterAfterDelete,\n async get(id) {\n return storageOperations.getFilter({ id });\n },\n async list(params) {\n return storageOperations.listFilters(params);\n },\n async create(data) {\n await onFilterBeforeCreate.publish({ input: data });\n const filter = await storageOperations.createFilter({ data });\n await onFilterAfterCreate.publish({ filter });\n return filter;\n },\n async update(id, data) {\n const original = await storageOperations.getFilter({ id });\n await onFilterBeforeUpdate.publish({ original, input: { id, data } });\n const filter = await storageOperations.updateFilter({ id, data });\n await onFilterAfterUpdate.publish({ original, input: { id, data }, filter });\n return filter;\n },\n async delete(id: string) {\n const filter = await storageOperations.getFilter({ id });\n await onFilterBeforeDelete.publish({ filter });\n await storageOperations.deleteFilter({ id });\n await onFilterAfterDelete.publish({ filter });\n return true;\n }\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAaO,MAAMC,uBAAuB,GAAGA,CAAC;EAAEC;AAAmC,CAAC,KAAoB;EAC9F;EACA,MAAMC,oBAAoB,GAAG,IAAAC,mBAAW,EACpC,0BACJ,CAAC;EACD,MAAMC,mBAAmB,GACrB,IAAAD,mBAAW,EAAiC,yBAAyB,CAAC;EAC1E;EACA,MAAME,oBAAoB,GAAG,IAAAF,mBAAW,EACpC,0BACJ,CAAC;EACD,MAAMG,mBAAmB,GACrB,IAAAH,mBAAW,EAAiC,yBAAyB,CAAC;EAC1E;EACA,MAAMI,oBAAoB,GAAG,IAAAJ,mBAAW,EACpC,0BACJ,CAAC;EACD,MAAMK,mBAAmB,GACrB,IAAAL,mBAAW,EAAiC,yBAAyB,CAAC;EAE1E,OAAO;IACH;AACR;AACA;IACQD,oBAAoB;IACpBE,mBAAmB;IACnBC,oBAAoB;IACpBC,mBAAmB;IACnBC,oBAAoB;IACpBC,mBAAmB;IACnB,MAAMC,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOT,iBAAiB,CAACU,SAAS,CAAC;QAAED;MAAG,CAAC,CAAC;IAC9C,CAAC;IACD,MAAME,IAAIA,CAACC,MAAM,EAAE;MACf,OAAOZ,iBAAiB,CAACa,WAAW,CAACD,MAAM,CAAC;IAChD,CAAC;IACD,MAAME,MAAMA,CAACC,IAAI,EAAE;MACf,MAAMd,oBAAoB,CAACe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/GraphQLSchemaPlugin";
2
+ import { AcoContext } from "../types";
3
+ export declare const filterSchema: GraphQLSchemaPlugin<AcoContext>;