@webiny/api-aco 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/createAcoGraphQL.js +4 -4
  2. package/createAcoGraphQL.js.map +1 -1
  3. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +1 -1
  4. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts +1 -1
  5. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +3 -3
  6. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +3 -3
  7. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
  8. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/CanAccessFolder.d.ts +1 -1
  9. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/CanAccessFolder.js.map +1 -1
  10. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/CanAccessFolderContent.d.ts +1 -1
  11. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/CanAccessFolderContent.js.map +1 -1
  12. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissions.d.ts +1 -1
  13. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissions.js.map +1 -1
  14. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +2 -2
  15. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
  16. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +1 -1
  17. package/features/folder/CreateFolder/CreateFolderUseCase.d.ts +1 -1
  18. package/features/folder/CreateFolder/CreateFolderUseCase.js +1 -1
  19. package/features/folder/CreateFolder/CreateFolderUseCase.js.map +1 -1
  20. package/features/folder/CreateFolder/abstractions.d.ts +1 -1
  21. package/features/folder/CreateFolder/abstractions.js.map +1 -1
  22. package/features/folder/CreateFolder/events.d.ts +3 -3
  23. package/features/folder/CreateFolder/events.js +1 -1
  24. package/features/folder/CreateFolder/events.js.map +1 -1
  25. package/features/folder/DeleteFolder/DeleteFolderUseCase.d.ts +1 -1
  26. package/features/folder/DeleteFolder/DeleteFolderUseCase.js +1 -1
  27. package/features/folder/DeleteFolder/DeleteFolderUseCase.js.map +1 -1
  28. package/features/folder/DeleteFolder/abstractions.d.ts +1 -1
  29. package/features/folder/DeleteFolder/abstractions.js.map +1 -1
  30. package/features/folder/DeleteFolder/events.d.ts +3 -3
  31. package/features/folder/DeleteFolder/events.js +1 -1
  32. package/features/folder/DeleteFolder/events.js.map +1 -1
  33. package/features/folder/EnsureFolderIsEmptyOnDelete/GenericFolderBeforeDeleteHandler.d.ts +1 -1
  34. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.d.ts +1 -1
  35. package/features/folder/GetFolder/abstractions.d.ts +1 -1
  36. package/features/folder/GetFolder/abstractions.js.map +1 -1
  37. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.d.ts +2 -2
  38. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.js +2 -2
  39. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.js.map +1 -1
  40. package/features/folder/UpdateFolder/UpdateFolderUseCase.d.ts +1 -1
  41. package/features/folder/UpdateFolder/UpdateFolderUseCase.js +1 -1
  42. package/features/folder/UpdateFolder/UpdateFolderUseCase.js.map +1 -1
  43. package/features/folder/UpdateFolder/abstractions.d.ts +1 -1
  44. package/features/folder/UpdateFolder/abstractions.js.map +1 -1
  45. package/features/folder/UpdateFolder/events.d.ts +3 -3
  46. package/features/folder/UpdateFolder/events.js +1 -1
  47. package/features/folder/UpdateFolder/events.js.map +1 -1
  48. package/folder/createFolderTypeDefs.d.ts +3 -2
  49. package/folder/createFolderTypeDefs.js +4 -4
  50. package/folder/createFolderTypeDefs.js.map +1 -1
  51. package/package.json +24 -33
  52. package/utils/compress.js +1 -1
  53. package/utils/compress.js.map +1 -1
@@ -3,9 +3,9 @@ import { filterSchema } from "./filter/filter.gql.js";
3
3
  import { createFoldersSchema } from "./folder/folder.gql.js";
4
4
  import { ContextPlugin } from "@webiny/api";
5
5
  import { isHeadlessCmsReady } from "@webiny/api-headless-cms";
6
- import { createFieldTypePluginRecords } from "@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js";
7
6
  import { createGraphQLSchemaPluginFromFieldPlugins } from "@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js";
8
7
  import { FOLDER_MODEL_ID } from "./domain/folder/folder.model.js";
8
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
9
9
  const emptyResolver = () => ({});
10
10
  const baseSchema = new GraphQLSchemaPlugin({
11
11
  typeDefs: /* GraphQL */`
@@ -76,17 +76,17 @@ export const createAcoGraphQL = () => {
76
76
  if (!(await isHeadlessCmsReady(context))) {
77
77
  return;
78
78
  }
79
+ const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);
79
80
  await context.security.withoutAuthorization(async () => {
80
81
  const model = await context.cms.getModel(FOLDER_MODEL_ID);
81
82
  const models = await context.cms.listModels();
82
- const fieldPlugins = createFieldTypePluginRecords(context.plugins);
83
83
  /**
84
84
  * We need to register all plugins for all the CMS fields.
85
85
  */
86
86
  const plugins = createGraphQLSchemaPluginFromFieldPlugins({
87
87
  models,
88
88
  type: "manage",
89
- fieldTypePlugins: fieldPlugins,
89
+ fieldRegistry,
90
90
  createPlugin: ({
91
91
  schema,
92
92
  type,
@@ -100,7 +100,7 @@ export const createAcoGraphQL = () => {
100
100
  const graphQlPlugin = createFoldersSchema({
101
101
  model,
102
102
  models,
103
- plugins: fieldPlugins
103
+ fieldRegistry
104
104
  });
105
105
  context.plugins.register([...plugins, graphQlPlugin]);
106
106
  });
@@ -1 +1 @@
1
- {"version":3,"names":["GraphQLSchemaPlugin","filterSchema","createFoldersSchema","ContextPlugin","isHeadlessCmsReady","createFieldTypePluginRecords","createGraphQLSchemaPluginFromFieldPlugins","FOLDER_MODEL_ID","emptyResolver","baseSchema","typeDefs","resolvers","Query","aco","Mutation","createAcoGraphQL","folderSchema","context","security","withoutAuthorization","model","cms","getModel","models","listModels","fieldPlugins","plugins","type","fieldTypePlugins","createPlugin","schema","fieldType","plugin","name","graphQlPlugin","register"],"sources":["createAcoGraphQL.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { filterSchema } from \"~/filter/filter.gql.js\";\nimport { createFoldersSchema } from \"~/folder/folder.gql.js\";\nimport type { AcoContext } from \"~/types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createFieldTypePluginRecords } from \"@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js\";\nimport { FOLDER_MODEL_ID } from \"~/domain/folder/folder.model.js\";\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 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 extend type Query {\n aco: AcoQuery\n }\n\n extend type Mutation {\n aco: AcoMutation\n }\n `,\n resolvers: {\n Query: {\n aco: emptyResolver\n },\n Mutation: {\n aco: emptyResolver\n }\n }\n});\n\nexport const createAcoGraphQL = () => {\n const folderSchema = new ContextPlugin<AcoContext>(async context => {\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n await context.security.withoutAuthorization(async () => {\n const model = (await context.cms.getModel(FOLDER_MODEL_ID)) as CmsModel;\n const models = await context.cms.listModels();\n const fieldPlugins = createFieldTypePluginRecords(context.plugins);\n /**\n * We need to register all plugins for all the CMS fields.\n */\n const plugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldTypePlugins: fieldPlugins,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `aco.graphql.folder.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const graphQlPlugin = createFoldersSchema({\n model,\n models,\n plugins: fieldPlugins\n });\n\n context.plugins.register([...plugins, graphQlPlugin]);\n });\n });\n\n return [baseSchema, folderSchema, filterSchema];\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAE5B,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D,SAASC,4BAA4B,QAAQ,yEAAyE;AACtH,SAASC,yCAAyC,QAAQ,6DAA6D;AACvH,SAASC,eAAe;AAExB,MAAMC,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIT,mBAAmB,CAAC;EACvCU,QAAQ,EAAE,aAAc;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ACb,CAAC,CAAC;MAEFR,OAAO,CAACS,OAAO,CAACS,QAAQ,CAAC,CAAC,GAAGT,OAAO,EAAEQ,aAAa,CAAC,CAAC;IACzD,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,CAACzB,UAAU,EAAEO,YAAY,EAAEf,YAAY,CAAC;AACnD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["GraphQLSchemaPlugin","filterSchema","createFoldersSchema","ContextPlugin","isHeadlessCmsReady","createGraphQLSchemaPluginFromFieldPlugins","FOLDER_MODEL_ID","CmsModelFieldToGraphQLRegistry","emptyResolver","baseSchema","typeDefs","resolvers","Query","aco","Mutation","createAcoGraphQL","folderSchema","context","fieldRegistry","container","resolve","security","withoutAuthorization","model","cms","getModel","models","listModels","plugins","type","createPlugin","schema","fieldType","plugin","name","graphQlPlugin","register"],"sources":["createAcoGraphQL.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { filterSchema } from \"~/filter/filter.gql.js\";\nimport { createFoldersSchema } from \"~/folder/folder.gql.js\";\nimport type { AcoContext } from \"~/types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js\";\nimport { FOLDER_MODEL_ID } from \"~/domain/folder/folder.model.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\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 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 extend type Query {\n aco: AcoQuery\n }\n\n extend type Mutation {\n aco: AcoMutation\n }\n `,\n resolvers: {\n Query: {\n aco: emptyResolver\n },\n Mutation: {\n aco: emptyResolver\n }\n }\n});\n\nexport const createAcoGraphQL = () => {\n const folderSchema = new ContextPlugin<AcoContext>(async context => {\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n\n await context.security.withoutAuthorization(async () => {\n const model = (await context.cms.getModel(FOLDER_MODEL_ID)) as CmsModel;\n const models = await context.cms.listModels();\n /**\n * We need to register all plugins for all the CMS fields.\n */\n const plugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldRegistry,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `aco.graphql.folder.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const graphQlPlugin = createFoldersSchema({\n model,\n models,\n fieldRegistry\n });\n\n context.plugins.register([...plugins, graphQlPlugin]);\n });\n });\n\n return [baseSchema, folderSchema, filterSchema];\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAE5B,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D,SAASC,yCAAyC,QAAQ,6DAA6D;AACvH,SAASC,eAAe;AACxB,SAASC,8BAA8B,QAAQ,qDAAqD;AAEpG,MAAMC,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UA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AI,UAAUG,SAAS,EAAE;UACpE,OAAOC,MAAM;QACjB;MACJ,CAAC,CAAC;MAEF,MAAME,aAAa,GAAGjC,mBAAmB,CAAC;QACtCqB,KAAK;QACLG,MAAM;QACNR;MACJ,CAAC,CAAC;MAEFD,OAAO,CAACW,OAAO,CAACQ,QAAQ,CAAC,CAAC,GAAGR,OAAO,EAAEO,aAAa,CAAC,CAAC;IACzD,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,CAAC1B,UAAU,EAAEO,YAAY,EAAEf,YAAY,CAAC;AACnD,CAAC","ignoreList":[]}
@@ -9,6 +9,6 @@ declare class CreateFlpOnFolderCreatedHandlerImpl implements FolderAfterCreateEv
9
9
  handle(event: FolderAfterCreateEvent): Promise<void>;
10
10
  }
11
11
  export declare const CreateFlpOnFolderCreatedHandler: typeof CreateFlpOnFolderCreatedHandlerImpl & {
12
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("~/features/folder/CreateFolder/abstractions.js").FolderAfterCreatePayload>>>;
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("~/features/folder/CreateFolder/abstractions.js").FolderAfterCreatePayload>>>;
13
13
  };
14
14
  export {};
@@ -9,6 +9,6 @@ declare class DeleteFlpOnFolderDeletedHandlerImpl implements FolderAfterDeleteEv
9
9
  handle(event: FolderAfterDeleteEvent): Promise<void>;
10
10
  }
11
11
  export declare const DeleteFlpOnFolderDeletedHandler: typeof DeleteFlpOnFolderDeletedHandlerImpl & {
12
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderAfterDeletePayload>>>;
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderAfterDeletePayload>>>;
13
13
  };
14
14
  export {};
@@ -1,6 +1,6 @@
1
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
2
- import { WcpContext } from "@webiny/api-core/features/WcpContext";
3
- import { ListUserTeamsUseCase } from "@webiny/api-core/features/ListUserTeams";
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
+ import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
3
+ import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTeams/index.js";
4
4
  import { type CanAccessFolderContentParams, type CanAccessFolderParams } from "./useCases/index.js";
5
5
  import { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from "./abstractions.js";
6
6
  import type { FolderLevelPermission, FolderPermission, ListFlpsParams } from "../../../types.js";
@@ -1,7 +1,7 @@
1
1
  import { createImplementation } from "@webiny/di";
2
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
3
- import { WcpContext } from "@webiny/api-core/features/WcpContext";
4
- import { ListUserTeamsUseCase } from "@webiny/api-core/features/ListUserTeams";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
3
+ import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
4
+ import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTeams/index.js";
5
5
  import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/index.js";
6
6
  import { CanAccessFolder, CanAccessFolderContent, CanCreateFolderInRoot, CheckNotInheritedPermissions, GetDefaultPermissions, GetDefaultPermissionsWithTeams } from "./useCases/index.js";
7
7
  import { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from "./abstractions.js";
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","IdentityContext","WcpContext","ListUserTeamsUseCase","NotAuthorizedError","CanAccessFolder","CanAccessFolderContent","CanCreateFolderInRoot","CheckNotInheritedPermissions","GetDefaultPermissions","GetDefaultPermissionsWithTeams","FolderLevelPermissions","FolderLevelPermissionsAbstraction","ListFlpsUseCase","GetFlpUseCase","FolderLevelPermissionsImpl","constructor","identityContext","wcpContext","listUserTeamsUseCase","getFlpUseCase","listFlpsUseCase","canUseFolderLevelPermissions","enabled","identity","getIdentity","type","canUseTeams","canCreateFolderInRoot","canCreateFolderInRootUseCase","execute","permissionsIncludeNonInheritedPermissions","permissions","checkNotInheritedPermissionsUseCase","canAccessFolder","params","isAuthorizationEnabled","canAccessFolderUseCase","canAccessFolderContent","canUseFlp","authEnabled","canAccessFolderContentUseCase","ensureCanAccessFolder","result","ensureCanAccessFolderContent","canManageFolderContent","flp","rwd","canManageFolderStructure","canManageFolderPermissions","managePermissions","getDefaultPermissions","getDefaultPermissionsUseCase","getDefaultPermissionsWithTeams","listFolderLevelPermissions","flps","Promise","all","map","id","getFolderLevelPermissions","abstraction","implementation","dependencies"],"sources":["FolderLevelPermissions.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport { WcpContext } from \"@webiny/api-core/features/WcpContext\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/ListUserTeams\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport {\n CanAccessFolder,\n CanAccessFolderContent,\n type CanAccessFolderContentParams,\n type CanAccessFolderParams,\n CanCreateFolderInRoot,\n CheckNotInheritedPermissions,\n GetDefaultPermissions,\n GetDefaultPermissionsWithTeams\n} from \"./useCases/index.js\";\nimport { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from \"./abstractions.js\";\nimport type { FolderLevelPermission, FolderPermission, ListFlpsParams } from \"~/types.js\";\nimport { ListFlpsUseCase } from \"~/features/flp/ListFlps/index.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/index.js\";\n\nclass FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private wcpContext: WcpContext.Interface,\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n private getFlpUseCase: GetFlpUseCase.Interface,\n private listFlpsUseCase: ListFlpsUseCase.Interface\n ) {}\n\n public canUseFolderLevelPermissions(enabled?: boolean): boolean {\n if (enabled === false) {\n return false;\n }\n\n const identity = this.identityContext.getIdentity();\n\n // FLPs only work with authenticated identities (logged-in users).\n if (!identity) {\n return false;\n }\n\n // At the moment, we only want FLP to be used with identities of type \"admin\".\n // This temporarily addresses the issue of API keys not being able to access content, because\n // FLPs doesn't work with them. Once we start adding FLPs to API keys, we can remove this check.\n if (identity.type !== \"admin\") {\n return false;\n }\n\n return this.wcpContext.canUseFolderLevelPermissions();\n }\n\n public canUseTeams(): boolean {\n return this.wcpContext.canUseTeams();\n }\n\n public canCreateFolderInRoot(): boolean {\n const canCreateFolderInRootUseCase = new CanCreateFolderInRoot();\n return canCreateFolderInRootUseCase.execute();\n }\n\n public permissionsIncludeNonInheritedPermissions(permissions: FolderPermission[]): boolean {\n const checkNotInheritedPermissionsUseCase = new CheckNotInheritedPermissions();\n return checkNotInheritedPermissionsUseCase.execute(permissions);\n }\n\n public async canAccessFolder(params: CanAccessFolderParams): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n const canAccessFolderUseCase = new CanAccessFolder(this.identityContext);\n return await canAccessFolderUseCase.execute(params);\n }\n\n public async canAccessFolderContent(params: CanAccessFolderContentParams): Promise<boolean> {\n const canUseFlp = this.canUseFolderLevelPermissions();\n const authEnabled = this.identityContext.isAuthorizationEnabled();\n\n if (!canUseFlp || !authEnabled) {\n return true;\n }\n\n const canAccessFolderContentUseCase = new CanAccessFolderContent(this.identityContext);\n return await canAccessFolderContentUseCase.execute(params);\n }\n\n public async ensureCanAccessFolder(params: CanAccessFolderParams): Promise<void> {\n const result = await this.canAccessFolder(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async ensureCanAccessFolderContent(params: CanAccessFolderContentParams): Promise<void> {\n const result = await this.canAccessFolderContent(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async canManageFolderContent(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolderContent({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolder({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean> {\n if (!this.canUseFolderLevelPermissions()) {\n return false;\n }\n\n if (!this.identityContext.isAuthorizationEnabled()) {\n return true;\n }\n\n return await this.canAccessFolder({\n permissions: flp.permissions,\n rwd: \"w\",\n managePermissions: true\n });\n }\n\n public getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n const getDefaultPermissionsUseCase = new GetDefaultPermissions(this.identityContext);\n\n if (this.canUseTeams()) {\n const getDefaultPermissionsWithTeams = new GetDefaultPermissionsWithTeams(\n this.identityContext,\n this.listUserTeamsUseCase,\n getDefaultPermissionsUseCase\n );\n\n return getDefaultPermissionsWithTeams.execute(permissions);\n }\n\n return getDefaultPermissionsUseCase.execute(permissions);\n }\n\n public async listFolderLevelPermissions(params: ListFlpsParams): Promise<\n Array<{\n id: string;\n permissions: FolderPermission[];\n }>\n > {\n const flps = await this.listFlpsUseCase.execute(params);\n\n return Promise.all(\n flps.map(async flp => ({\n id: flp.id,\n permissions: await this.getDefaultPermissions(flp.permissions)\n }))\n );\n }\n\n public async getFolderLevelPermissions(id: string): Promise<FolderPermission[]> {\n const flp = await this.getFlpUseCase.execute(id);\n return await this.getDefaultPermissions(flp?.permissions ?? []);\n }\n}\n\nexport const FolderLevelPermissions = createImplementation({\n abstraction: FolderLevelPermissionsAbstraction,\n implementation: FolderLevelPermissionsImpl,\n dependencies: [\n IdentityContext,\n WcpContext,\n ListUserTeamsUseCase,\n GetFlpUseCase,\n ListFlpsUseCase\n ]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,oBAAoB,QAAQ,yCAAyC;AAC9E,SAASC,kBAAkB,QAAQ,oDAAoD;AACvF,SACIC,eAAe,EACfC,sBAAsB,EAGtBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,qBAAqB,EACrBC,8BAA8B;AAElC,SAASC,sBAAsB,IAAIC,iCAAiC;AAEpE,SAASC,eAAe;AACxB,SAASC,aAAa;AAEtB,MAAMC,0BAA0B,CAAwD;EACpFC,WAAWA,CACCC,eAA0C,EAC1CC,UAAgC,EAChCC,oBAAoD,EACpDC,aAAsC,EACtCC,eAA0C,EACpD;IAAA,KALUJ,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,UAAgC,GAAhCA,UAAgC;IAAA,KAChCC,oBAAoD,GAApDA,oBAAoD;IAAA,KACpDC,aAAsC,GAAtCA,aAAsC;IAAA,KACtCC,eAA0C,GAA1CA,eAA0C;EACnD;EAEIC,4BAA4BA,CAACC,OAAiB,EAAW;IAC5D,IAAIA,OAAO,KAAK,KAAK,EAAE;MACnB,OAAO,KAAK;IAChB;IAEA,MAAMC,QAAQ,GAAG,IAAI,CAACP,eAAe,CAACQ,WAAW,CAAC,CAAC;;IAEnD;IACA,IAAI,CAACD,QAAQ,EAAE;MACX,OAAO,KAAK;IAChB;;IAEA;IACA;IACA;IACA,IAAIA,QAAQ,CAACE,IAAI,KAAK,OAAO,EAAE;MAC3B,OAAO,KAAK;IAChB;IAEA,O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CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createImplementation","IdentityContext","WcpContext","ListUserTeamsUseCase","NotAuthorizedError","CanAccessFolder","CanAccessFolderContent","CanCreateFolderInRoot","CheckNotInheritedPermissions","GetDefaultPermissions","GetDefaultPermissionsWithTeams","FolderLevelPermissions","FolderLevelPermissionsAbstraction","ListFlpsUseCase","GetFlpUseCase","FolderLevelPermissionsImpl","constructor","identityContext","wcpContext","listUserTeamsUseCase","getFlpUseCase","listFlpsUseCase","canUseFolderLevelPermissions","enabled","identity","getIdentity","type","canUseTeams","canCreateFolderInRoot","canCreateFolderInRootUseCase","execute","permissionsIncludeNonInheritedPermissions","permissions","checkNotInheritedPermissionsUseCase","canAccessFolder","params","isAuthorizationEnabled","canAccessFolderUseCase","canAccessFolderContent","canUseFlp","authEnabled","canAccessFolderContentUseCase","ensureCanAccessFolder","result","ensureCanAccessFolderContent","canManageFolderContent","flp","rwd","canManageFolderStructure","canManageFolderPermissions","managePermissions","getDefaultPermissions","getDefaultPermissionsUseCase","getDefaultPermissionsWithTeams","listFolderLevelPermissions","flps","Promise","all","map","id","getFolderLevelPermissions","abstraction","implementation","dependencies"],"sources":["FolderLevelPermissions.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport {\n CanAccessFolder,\n CanAccessFolderContent,\n type CanAccessFolderContentParams,\n type CanAccessFolderParams,\n CanCreateFolderInRoot,\n CheckNotInheritedPermissions,\n GetDefaultPermissions,\n GetDefaultPermissionsWithTeams\n} from \"./useCases/index.js\";\nimport { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from \"./abstractions.js\";\nimport type { FolderLevelPermission, FolderPermission, ListFlpsParams } from \"~/types.js\";\nimport { ListFlpsUseCase } from \"~/features/flp/ListFlps/index.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/index.js\";\n\nclass FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private wcpContext: WcpContext.Interface,\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n private getFlpUseCase: GetFlpUseCase.Interface,\n private listFlpsUseCase: ListFlpsUseCase.Interface\n ) {}\n\n public canUseFolderLevelPermissions(enabled?: boolean): boolean {\n if (enabled === false) {\n return false;\n }\n\n const identity = this.identityContext.getIdentity();\n\n // FLPs only work with authenticated identities (logged-in users).\n if (!identity) {\n return false;\n }\n\n // At the moment, we only want FLP to be used with identities of type \"admin\".\n // This temporarily addresses the issue of API keys not being able to access content, because\n // FLPs doesn't work with them. Once we start adding FLPs to API keys, we can remove this check.\n if (identity.type !== \"admin\") {\n return false;\n }\n\n return this.wcpContext.canUseFolderLevelPermissions();\n }\n\n public canUseTeams(): boolean {\n return this.wcpContext.canUseTeams();\n }\n\n public canCreateFolderInRoot(): boolean {\n const canCreateFolderInRootUseCase = new CanCreateFolderInRoot();\n return canCreateFolderInRootUseCase.execute();\n }\n\n public permissionsIncludeNonInheritedPermissions(permissions: FolderPermission[]): boolean {\n const checkNotInheritedPermissionsUseCase = new CheckNotInheritedPermissions();\n return checkNotInheritedPermissionsUseCase.execute(permissions);\n }\n\n public async canAccessFolder(params: CanAccessFolderParams): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n const canAccessFolderUseCase = new CanAccessFolder(this.identityContext);\n return await canAccessFolderUseCase.execute(params);\n }\n\n public async canAccessFolderContent(params: CanAccessFolderContentParams): Promise<boolean> {\n const canUseFlp = this.canUseFolderLevelPermissions();\n const authEnabled = this.identityContext.isAuthorizationEnabled();\n\n if (!canUseFlp || !authEnabled) {\n return true;\n }\n\n const canAccessFolderContentUseCase = new CanAccessFolderContent(this.identityContext);\n return await canAccessFolderContentUseCase.execute(params);\n }\n\n public async ensureCanAccessFolder(params: CanAccessFolderParams): Promise<void> {\n const result = await this.canAccessFolder(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async ensureCanAccessFolderContent(params: CanAccessFolderContentParams): Promise<void> {\n const result = await this.canAccessFolderContent(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async canManageFolderContent(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolderContent({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolder({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean> {\n if (!this.canUseFolderLevelPermissions()) {\n return false;\n }\n\n if (!this.identityContext.isAuthorizationEnabled()) {\n return true;\n }\n\n return await this.canAccessFolder({\n permissions: flp.permissions,\n rwd: \"w\",\n managePermissions: true\n });\n }\n\n public getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n const getDefaultPermissionsUseCase = new GetDefaultPermissions(this.identityContext);\n\n if (this.canUseTeams()) {\n const getDefaultPermissionsWithTeams = new GetDefaultPermissionsWithTeams(\n this.identityContext,\n this.listUserTeamsUseCase,\n getDefaultPermissionsUseCase\n );\n\n return getDefaultPermissionsWithTeams.execute(permissions);\n }\n\n return getDefaultPermissionsUseCase.execute(permissions);\n }\n\n public async listFolderLevelPermissions(params: ListFlpsParams): Promise<\n Array<{\n id: string;\n permissions: FolderPermission[];\n }>\n > {\n const flps = await this.listFlpsUseCase.execute(params);\n\n return Promise.all(\n flps.map(async flp => ({\n id: flp.id,\n permissions: await this.getDefaultPermissions(flp.permissions)\n }))\n );\n }\n\n public async getFolderLevelPermissions(id: string): Promise<FolderPermission[]> {\n const flp = await this.getFlpUseCase.execute(id);\n return await this.getDefaultPermissions(flp?.permissions ?? []);\n }\n}\n\nexport const FolderLevelPermissions = createImplementation({\n abstraction: FolderLevelPermissionsAbstraction,\n implementation: FolderLevelPermissionsImpl,\n dependencies: [\n IdentityContext,\n WcpContext,\n ListUserTeamsUseCase,\n GetFlpUseCase,\n ListFlpsUseCase\n ]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,UAAU,QAAQ,mDAAmD;AAC9E,SAASC,oBAAoB,QAAQ,wDAAwD;AAC7F,SAASC,kBAAkB,QAAQ,oDAAoD;AACvF,SACIC,eAAe,EACfC,sBAAsB,EAGtBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,qBAAqB,EACrBC,8BAA8B;AAElC,SAASC,sBAAsB,IAAIC,iCAAiC;AAEpE,SAASC,eAAe;AACxB,SAASC,aAAa;AAEtB,MAAMC,0BAA0B,CAAwD;EACpFC,WAAWA,CACCC,eAA0C,EAC1CC,UAAgC,EAChCC,oBAAoD,EACpDC,aAAsC,EACtCC,eAA0C,EACpD;IAAA,KALUJ,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,UAAgC,GAAhCA,UAAgC;IAAA,KAChCC,oBAAoD,GAApDA,oBAAoD;IAAA,KACpDC,aAAsC,GAAtCA,aAAsC;IAAA,KACtCC,eAA0C,GAA1CA,eAA0C;EACnD;EAEIC,4BAA4BA,CAACC,OAAiB,EAAW;IAC5D,IAAIA,OAAO,KAAK,KAAK,EAAE;MACnB,OAAO,KAAK;IAChB;IAEA,MAAMC,QAAQ,GAAG,IAAI,CAACP,eAAe,CAACQ,WAAW,CAAC,CAAC;;IAEnD;IACA,IAAI,CAACD,QAAQ,EAA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C9CkD,cAAc,EAAE/C,0BAA0B;EAC1CgD,YAAY,EAAE,CACV9D,eAAe,EACfC,UAAU,EACVC,oBAAoB,EACpBW,aAAa,EACbD,eAAe;AAEvB,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
2
  import type { CanAccessFolderParams, ICanAccessFolder } from "./ICanAccessFolder.js";
3
3
  export declare class CanAccessFolder implements ICanAccessFolder {
4
4
  private identityContext;
@@ -1 +1 @@
1
- {"version":3,"names":["CanAccessFolder","constructor","identityContext","execute","permissions","rwd","managePermissions","length","identity","getIdentity","currentIdentityPermission","find","p","target","id","level"],"sources":["CanAccessFolder.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { CanAccessFolderParams, ICanAccessFolder } from \"./ICanAccessFolder.js\";\n\nexport class CanAccessFolder implements ICanAccessFolder {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute({ permissions = [], rwd, managePermissions }: CanAccessFolderParams) {\n if (!permissions.length) {\n return true;\n }\n\n const identity = this.identityContext.getIdentity();\n const currentIdentityPermission = permissions.find(p => {\n return p.target === `admin:${identity.id}`;\n });\n\n if (!currentIdentityPermission) {\n return false;\n }\n\n const { level } = currentIdentityPermission;\n\n if (managePermissions) {\n return level === \"owner\";\n }\n\n // If the user has a `no-access` level, they are explicitly denied access to the current folder.\n if (level === \"no-access\") {\n return false;\n }\n\n // Checking for \"write\" or \"delete\" access. Allow only if the\n // user is has `owner` or `editor` level or the folder is public (no FLP assigned).\n if (rwd !== \"r\") {\n return level === \"owner\" || level === \"editor\" || level === \"public\";\n }\n\n return true;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,eAAe,CAA6B;EACrDC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAAC;IAAEC,WAAW,GAAG,EAAE;IAAEC,GAAG;IAAEC;EAAyC,CAAC,EAAE;IAC/E,IAAI,CAACF,WAAW,CAACG,MAAM,EAAE;MACrB,OAAO,IAAI;IACf;IAEA,MAAMC,QAAQ,GAAG,IAAI,CAACN,eAAe,CAACO,WAAW,CAAC,CAAC;IACnD,MAAMC,yBAAyB,GAAGN,WAAW,CAACO,IAAI,CAACC,CAAC,IAAI;MACpD,OAAOA,CAAC,CAACC,MAAM,KAAK,SAASL,QAAQ,CAACM,EAAE,EAAE;IAC9C,CAAC,CAAC;IAEF,IAAI,CAACJ,yBAAyB,EAAE;MAC5B,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK;IAAM,CAAC,GAAGL,yBAAyB;IAE3C,IAAIJ,iBAAiB,EAAE;MACnB,OAAOS,KAAK,KAAK,OAAO;IAC5B;;IAEA;IACA,IAAIA,KAAK,KAAK,WAAW,EAAE;MACvB,OAAO,KAAK;IAChB;;IAEA;IACA;IACA,IAAIV,GAAG,KAAK,GAAG,EAAE;MACb,OAAOU,KAAK,KAAK,OAAO,IAAIA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,QAAQ;IACxE;IAEA,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["CanAccessFolder","constructor","identityContext","execute","permissions","rwd","managePermissions","length","identity","getIdentity","currentIdentityPermission","find","p","target","id","level"],"sources":["CanAccessFolder.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { CanAccessFolderParams, ICanAccessFolder } from \"./ICanAccessFolder.js\";\n\nexport class CanAccessFolder implements ICanAccessFolder {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute({ permissions = [], rwd, managePermissions }: CanAccessFolderParams) {\n if (!permissions.length) {\n return true;\n }\n\n const identity = this.identityContext.getIdentity();\n const currentIdentityPermission = permissions.find(p => {\n return p.target === `admin:${identity.id}`;\n });\n\n if (!currentIdentityPermission) {\n return false;\n }\n\n const { level } = currentIdentityPermission;\n\n if (managePermissions) {\n return level === \"owner\";\n }\n\n // If the user has a `no-access` level, they are explicitly denied access to the current folder.\n if (level === \"no-access\") {\n return false;\n }\n\n // Checking for \"write\" or \"delete\" access. Allow only if the\n // user is has `owner` or `editor` level or the folder is public (no FLP assigned).\n if (rwd !== \"r\") {\n return level === \"owner\" || level === \"editor\" || level === \"public\";\n }\n\n return true;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,eAAe,CAA6B;EACrDC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAAC;IAAEC,WAAW,GAAG,EAAE;IAAEC,GAAG;IAAEC;EAAyC,CAAC,EAAE;IAC/E,IAAI,CAACF,WAAW,CAACG,MAAM,EAAE;MACrB,OAAO,IAAI;IACf;IAEA,MAAMC,QAAQ,GAAG,IAAI,CAACN,eAAe,CAACO,WAAW,CAAC,CAAC;IACnD,MAAMC,yBAAyB,GAAGN,WAAW,CAACO,IAAI,CAACC,CAAC,IAAI;MACpD,OAAOA,CAAC,CAACC,MAAM,KAAK,SAASL,QAAQ,CAACM,EAAE,EAAE;IAC9C,CAAC,CAAC;IAEF,IAAI,CAACJ,yBAAyB,EAAE;MAC5B,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK;IAAM,CAAC,GAAGL,yBAAyB;IAE3C,IAAIJ,iBAAiB,EAAE;MACnB,OAAOS,KAAK,KAAK,OAAO;IAC5B;;IAEA;IACA,IAAIA,KAAK,KAAK,WAAW,EAAE;MACvB,OAAO,KAAK;IAChB;;IAEA;IACA;IACA,IAAIV,GAAG,KAAK,GAAG,EAAE;MACb,OAAOU,KAAK,KAAK,OAAO,IAAIA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,QAAQ;IACxE;IAEA,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { IdentityContext } from "@webiny/api-core/features/IdentityContext";
1
+ import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
2
  import type { CanAccessFolderContentParams, ICanAccessFolderContent } from "./ICanAccessFolderContent.js";
3
3
  export declare class CanAccessFolderContent implements ICanAccessFolderContent {
4
4
  private identityContext;
@@ -1 +1 @@
1
- {"version":3,"names":["CanAccessFolderContent","constructor","identityContext","execute","permissions","rwd","identity","getIdentity","currentIdentityPermission","find","p","target","id","level"],"sources":["CanAccessFolderContent.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type {\n CanAccessFolderContentParams,\n ICanAccessFolderContent\n} from \"./ICanAccessFolderContent.js\";\n\nexport class CanAccessFolderContent implements ICanAccessFolderContent {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute({ permissions = [], rwd }: CanAccessFolderContentParams) {\n const identity = this.identityContext.getIdentity();\n\n const currentIdentityPermission = permissions.find(p => {\n return p.target === `admin:${identity.id}`;\n });\n\n if (!currentIdentityPermission) {\n return false;\n }\n\n const { level } = currentIdentityPermission;\n\n // If the user has a `no-access` level, they are explicitly denied access to the current folder.\n if (level === \"no-access\") {\n return false;\n }\n\n // If the user is not an owner and we're checking for \"write\" or\n // \"delete\" access, then we can immediately return false.\n if (rwd !== \"r\") {\n return level !== \"viewer\";\n }\n\n return true;\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,sBAAsB,CAAoC;EACnEC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAAC;IAAEC,WAAW,GAAG,EAAE;IAAEC;EAAkC,CAAC,EAAE;IACnE,MAAMC,QAAQ,GAAG,IAAI,CAACJ,eAAe,CAACK,WAAW,CAAC,CAAC;IAEnD,MAAMC,yBAAyB,GAAGJ,WAAW,CAACK,IAAI,CAACC,CAAC,IAAI;MACpD,OAAOA,CAAC,CAACC,MAAM,KAAK,SAASL,QAAQ,CAACM,EAAE,EAAE;IAC9C,CAAC,CAAC;IAEF,IAAI,CAACJ,yBAAyB,EAAE;MAC5B,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK;IAAM,CAAC,GAAGL,yBAAyB;;IAE3C;IACA,IAAIK,KAAK,KAAK,WAAW,EAAE;MACvB,OAAO,KAAK;IAChB;;IAEA;IACA;IACA,IAAIR,GAAG,KAAK,GAAG,EAAE;MACb,OAAOQ,KAAK,KAAK,QAAQ;IAC7B;IAEA,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["CanAccessFolderContent","constructor","identityContext","execute","permissions","rwd","identity","getIdentity","currentIdentityPermission","find","p","target","id","level"],"sources":["CanAccessFolderContent.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type {\n CanAccessFolderContentParams,\n ICanAccessFolderContent\n} from \"./ICanAccessFolderContent.js\";\n\nexport class CanAccessFolderContent implements ICanAccessFolderContent {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute({ permissions = [], rwd }: CanAccessFolderContentParams) {\n const identity = this.identityContext.getIdentity();\n\n const currentIdentityPermission = permissions.find(p => {\n return p.target === `admin:${identity.id}`;\n });\n\n if (!currentIdentityPermission) {\n return false;\n }\n\n const { level } = currentIdentityPermission;\n\n // If the user has a `no-access` level, they are explicitly denied access to the current folder.\n if (level === \"no-access\") {\n return false;\n }\n\n // If the user is not an owner and we're checking for \"write\" or\n // \"delete\" access, then we can immediately return false.\n if (rwd !== \"r\") {\n return level !== \"viewer\";\n }\n\n return true;\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,sBAAsB,CAAoC;EACnEC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAAC;IAAEC,WAAW,GAAG,EAAE;IAAEC;EAAkC,CAAC,EAAE;IACnE,MAAMC,QAAQ,GAAG,IAAI,CAACJ,eAAe,CAACK,WAAW,CAAC,CAAC;IAEnD,MAAMC,yBAAyB,GAAGJ,WAAW,CAACK,IAAI,CAACC,CAAC,IAAI;MACpD,OAAOA,CAAC,CAACC,MAAM,KAAK,SAASL,QAAQ,CAACM,EAAE,EAAE;IAC9C,CAAC,CAAC;IAEF,IAAI,CAACJ,yBAAyB,EAAE;MAC5B,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK;IAAM,CAAC,GAAGL,yBAAyB;;IAE3C;IACA,IAAIK,KAAK,KAAK,WAAW,EAAE;MACvB,OAAO,KAAK;IAChB;;IAEA;IACA;IACA,IAAIR,GAAG,KAAK,GAAG,EAAE;MACb,OAAOQ,KAAK,KAAK,QAAQ;IAC7B;IAEA,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { IdentityContext } from "@webiny/api-core/features/IdentityContext";
1
+ import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
2
  import type { IGetDefaultPermissions } from "./IGetDefaultPermissions.js";
3
3
  import type { FolderPermission } from "../../../../../flp/flp.types.js";
4
4
  export declare class GetDefaultPermissions implements IGetDefaultPermissions {
@@ -1 +1 @@
1
- {"version":3,"names":["DefaultPermissionsMerger","GetDefaultPermissions","constructor","identityContext","execute","permissions","identity","getIdentity","identityPermissions","listPermissions","merge"],"sources":["GetDefaultPermissions.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { DefaultPermissionsMerger } from \"./DefaultPermissionsMerger.js\";\n\nexport class GetDefaultPermissions implements IGetDefaultPermissions {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute(permissions: FolderPermission[]) {\n const identity = this.identityContext.getIdentity();\n const identityPermissions = await this.identityContext.listPermissions();\n\n return DefaultPermissionsMerger.merge(identity, identityPermissions, permissions);\n }\n}\n"],"mappings":"AAGA,SAASA,wBAAwB;AAEjC,OAAO,MAAMC,qBAAqB,CAAmC;EACjEC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAACC,WAA+B,EAAE;IAC3C,MAAMC,QAAQ,GAAG,IAAI,CAACH,eAAe,CAACI,WAAW,CAAC,CAAC;IACnD,MAAMC,mBAAmB,GAAG,MAAM,IAAI,CAACL,eAAe,CAACM,eAAe,CAAC,CAAC;IAExE,OAAOT,wBAAwB,CAACU,KAAK,CAACJ,QAAQ,EAAEE,mBAAmB,EAAEH,WAAW,CAAC;EACrF;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DefaultPermissionsMerger","GetDefaultPermissions","constructor","identityContext","execute","permissions","identity","getIdentity","identityPermissions","listPermissions","merge"],"sources":["GetDefaultPermissions.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { DefaultPermissionsMerger } from \"./DefaultPermissionsMerger.js\";\n\nexport class GetDefaultPermissions implements IGetDefaultPermissions {\n constructor(private identityContext: IdentityContext.Interface) {}\n\n async execute(permissions: FolderPermission[]) {\n const identity = this.identityContext.getIdentity();\n const identityPermissions = await this.identityContext.listPermissions();\n\n return DefaultPermissionsMerger.merge(identity, identityPermissions, permissions);\n }\n}\n"],"mappings":"AAGA,SAASA,wBAAwB;AAEjC,OAAO,MAAMC,qBAAqB,CAAmC;EACjEC,WAAWA,CAASC,eAA0C,EAAE;IAAA,KAA5CA,eAA0C,GAA1CA,eAA0C;EAAG;EAEjE,MAAMC,OAAOA,CAACC,WAA+B,EAAE;IAC3C,MAAMC,QAAQ,GAAG,IAAI,CAACH,eAAe,CAACI,WAAW,CAAC,CAAC;IACnD,MAAMC,mBAAmB,GAAG,MAAM,IAAI,CAACL,eAAe,CAACM,eAAe,CAAC,CAAC;IAExE,OAAOT,wBAAwB,CAACU,KAAK,CAACJ,QAAQ,EAAEE,mBAAmB,EAAEH,WAAW,CAAC;EACrF;AACJ","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { IGetDefaultPermissions } from "./IGetDefaultPermissions.js";
2
2
  import type { FolderPermission } from "../../../../../flp/flp.types.js";
3
- import type { IdentityContext } from "@webiny/api-core/features/IdentityContext";
4
- import { ListUserTeamsUseCase } from "@webiny/api-core/features/ListUserTeams";
3
+ import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
4
+ import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTeams/index.js";
5
5
  export declare class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {
6
6
  private identityContext;
7
7
  private listUserTeamsUseCase;
@@ -1 +1 @@
1
- {"version":3,"names":["GetDefaultPermissionsWithTeams","constructor","identityContext","listUserTeamsUseCase","decoretee","execute","originalPermissions","identity","getIdentity","listTeamsResult","id","identityTeams","isOk","value","permissions","length","identityTeam","teamPermission","find","p","target","slug","push","level","inheritedFrom"],"sources":["GetDefaultPermissionsWithTeams.ts"],"sourcesContent":["import type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport type { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/ListUserTeams\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\n\nexport class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {\n private identityContext: IdentityContext.Interface;\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface;\n private decoretee: IGetDefaultPermissions;\n\n constructor(\n identityContext: IdentityContext.Interface,\n listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n decoretee: IGetDefaultPermissions\n ) {\n this.identityContext = identityContext;\n this.listUserTeamsUseCase = listUserTeamsUseCase;\n this.decoretee = decoretee;\n }\n\n async execute(originalPermissions: FolderPermission[]) {\n /**\n * Retrieves the list of teams the current identity belongs to and checks if any of these teams\n * have permissions for the folder. If a team has permissions, the current identity is granted\n * the same permissions, inheriting them from the team.\n */\n const identity = this.identityContext.getIdentity();\n\n // Get teams for current identity\n const listTeamsResult = await this.listUserTeamsUseCase.execute(identity.id);\n const identityTeams: Team[] = listTeamsResult.isOk() ? listTeamsResult.value : [];\n\n const permissions = [...originalPermissions]; // Clone the original permissions to avoid mutation.\n\n if (identity && identityTeams.length) {\n for (const identityTeam of identityTeams) {\n // Check if the team has permissions for the folder.\n const teamPermission = permissions.find(\n p => p.target === `team:${identityTeam.slug}`\n );\n\n if (teamPermission) {\n // Grant the current identity the same permissions as the team, marking them as inherited.\n permissions.push({\n target: `admin:${identity.id}`,\n level: teamPermission.level,\n inheritedFrom: \"team:\" + identityTeam.slug\n });\n }\n }\n }\n\n return await this.decoretee.execute(permissions);\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,8BAA8B,CAAmC;EAK1EC,WAAWA,CACPC,eAA0C,EAC1CC,oBAAoD,EACpDC,SAAiC,EACnC;IACE,IAAI,CAACF,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACC,oBAAoB,GAAGA,oBAAoB;IAChD,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,mBAAuC,EAAE;IACnD;AACR;AACA;AACA;AACA;IACQ,MAAMC,QAAQ,GAAG,IAAI,CAACL,eAAe,CAACM,WAAW,CAAC,CAAC;;IAEnD;IACA,MAAMC,eAAe,GAAG,MAAM,IAAI,CAACN,oBAAoB,CAACE,OAAO,CAACE,QAAQ,CAACG,EAAE,CAAC;IAC5E,MAAMC,aAAqB,GAAGF,eAAe,CAACG,IAAI,CAAC,CAAC,GAAGH,eAAe,CAACI,KAAK,GAAG,EAAE;IAEjF,MAAMC,WAAW,GAAG,CAAC,GAAGR,mBAAmB,CAAC,CAAC,CAAC;;IAE9C,IAAIC,QAAQ,IAAII,aAAa,CAACI,MAAM,EAAE;MAClC,KAAK,MAAMC,YAAY,IAAIL,aAAa,EAAE;QACtC;QACA,MAAMM,cAAc,GAAGH,WAAW,CAACI,IAAI,CACnCC,CAAC,IAAIA,CAAC,CAACC,MAAM,KAAK,QAAQJ,YAAY,CAACK,IAAI,EAC/C,CAAC;QAED,IAAIJ,cAAc,EAAE;UAChB;UACAH,WAAW,CAACQ,IAAI,CAAC;YACbF,MAAM,EAAE,SAASb,QAAQ,CAACG,EAAE,EAAE;YAC9Ba,KAAK,EAAEN,cAAc,CAACM,KAAK;YAC3BC,aAAa,EAAE,OAAO,GAAGR,YAAY,CAACK;UAC1C,CAAC,CAAC;QACN;MACJ;IACJ;IAEA,OAAO,MAAM,IAAI,CAACjB,SAAS,CAACC,OAAO,CAACS,WAAW,CAAC;EACpD;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["GetDefaultPermissionsWithTeams","constructor","identityContext","listUserTeamsUseCase","decoretee","execute","originalPermissions","identity","getIdentity","listTeamsResult","id","identityTeams","isOk","value","permissions","length","identityTeam","teamPermission","find","p","target","slug","push","level","inheritedFrom"],"sources":["GetDefaultPermissionsWithTeams.ts"],"sourcesContent":["import type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\n\nexport class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {\n private identityContext: IdentityContext.Interface;\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface;\n private decoretee: IGetDefaultPermissions;\n\n constructor(\n identityContext: IdentityContext.Interface,\n listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n decoretee: IGetDefaultPermissions\n ) {\n this.identityContext = identityContext;\n this.listUserTeamsUseCase = listUserTeamsUseCase;\n this.decoretee = decoretee;\n }\n\n async execute(originalPermissions: FolderPermission[]) {\n /**\n * Retrieves the list of teams the current identity belongs to and checks if any of these teams\n * have permissions for the folder. If a team has permissions, the current identity is granted\n * the same permissions, inheriting them from the team.\n */\n const identity = this.identityContext.getIdentity();\n\n // Get teams for current identity\n const listTeamsResult = await this.listUserTeamsUseCase.execute(identity.id);\n const identityTeams: Team[] = listTeamsResult.isOk() ? listTeamsResult.value : [];\n\n const permissions = [...originalPermissions]; // Clone the original permissions to avoid mutation.\n\n if (identity && identityTeams.length) {\n for (const identityTeam of identityTeams) {\n // Check if the team has permissions for the folder.\n const teamPermission = permissions.find(\n p => p.target === `team:${identityTeam.slug}`\n );\n\n if (teamPermission) {\n // Grant the current identity the same permissions as the team, marking them as inherited.\n permissions.push({\n target: `admin:${identity.id}`,\n level: teamPermission.level,\n inheritedFrom: \"team:\" + identityTeam.slug\n });\n }\n }\n }\n\n return await this.decoretee.execute(permissions);\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,8BAA8B,CAAmC;EAK1EC,WAAWA,CACPC,eAA0C,EAC1CC,oBAAoD,EACpDC,SAAiC,EACnC;IACE,IAAI,CAACF,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACC,oBAAoB,GAAGA,oBAAoB;IAChD,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,mBAAuC,EAAE;IACnD;AACR;AACA;AACA;AACA;IACQ,MAAMC,QAAQ,GAAG,IAAI,CAACL,eAAe,CAACM,WAAW,CAAC,CAAC;;IAEnD;IACA,MAAMC,eAAe,GAAG,MAAM,IAAI,CAACN,oBAAoB,CAACE,OAAO,CAACE,QAAQ,CAACG,EAAE,CAAC;IAC5E,MAAMC,aAAqB,GAAGF,eAAe,CAACG,IAAI,CAAC,CAAC,GAAGH,eAAe,CAACI,KAAK,GAAG,EAAE;IAEjF,MAAMC,WAAW,GAAG,CAAC,GAAGR,mBAAmB,CAAC,CAAC,CAAC;;IAE9C,IAAIC,QAAQ,IAAII,aAAa,CAACI,MAAM,EAAE;MAClC,KAAK,MAAMC,YAAY,IAAIL,aAAa,EAAE;QACtC;QACA,MAAMM,cAAc,GAAGH,WAAW,CAACI,IAAI,CACnCC,CAAC,IAAIA,CAAC,CAACC,MAAM,KAAK,QAAQJ,YAAY,CAACK,IAAI,EAC/C,CAAC;QAED,IAAIJ,cAAc,EAAE;UAChB;UACAH,WAAW,CAACQ,IAAI,CAAC;YACbF,MAAM,EAAE,SAASb,QAAQ,CAACG,EAAE,EAAE;YAC9Ba,KAAK,EAAEN,cAAc,CAACM,KAAK;YAC3BC,aAAa,EAAE,OAAO,GAAGR,YAAY,CAACK;UAC1C,CAAC,CAAC;QACN;MACJ;IACJ;IAEA,OAAO,MAAM,IAAI,CAACjB,SAAS,CAACC,OAAO,CAACS,WAAW,CAAC;EACpD;AACJ","ignoreList":[]}
@@ -9,6 +9,6 @@ declare class UpdateFlpOnFolderUpdatedHandlerImpl implements FolderAfterUpdateEv
9
9
  handle(event: FolderAfterUpdateEvent): Promise<void>;
10
10
  }
11
11
  export declare const UpdateFlpOnFolderUpdatedHandler: typeof UpdateFlpOnFolderUpdatedHandlerImpl & {
12
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("../../folder/UpdateFolder/abstractions.js").FolderAfterUpdatePayload>>>;
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("../../folder/UpdateFolder/abstractions.js").FolderAfterUpdatePayload>>>;
13
13
  };
14
14
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { CreateFolderUseCase as UseCaseAbstraction, CreateFolderRepository } from "./abstractions.js";
4
4
  import type { Folder, CreateFolderParams } from "../../../folder/folder.types.js";
5
5
  declare class CreateFolderUseCaseImpl implements UseCaseAbstraction.Interface {
@@ -1,5 +1,5 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { createImplementation } from "@webiny/di";
4
4
  import { CreateFolderUseCase as UseCaseAbstraction, CreateFolderRepository } from "./abstractions.js";
5
5
  import { FolderBeforeCreateEvent, FolderAfterCreateEvent } from "./events.js";
@@ -1 +1 @@
1
- {"version":3,"names":["Result","EventPublisher","createImplementation","CreateFolderUseCase","UseCaseAbstraction","CreateFolderRepository","FolderBeforeCreateEvent","FolderAfterCreateEvent","CreateFolderUseCaseImpl","constructor","eventPublisher","repository","execute","params","beforeCreateEvent","input","publish","result","isFail","folder","value","afterCreateEvent","ok","abstraction","implementation","dependencies"],"sources":["CreateFolderUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/EventPublisher\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n CreateFolderUseCase as UseCaseAbstraction,\n CreateFolderRepository\n} from \"./abstractions.js\";\nimport { FolderBeforeCreateEvent, FolderAfterCreateEvent } from \"./events.js\";\nimport type { Folder, CreateFolderParams } from \"~/folder/folder.types.js\";\n\nclass CreateFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private repository: CreateFolderRepository.Interface\n ) {}\n\n async execute(params: CreateFolderParams): Promise<Result<Folder, UseCaseAbstraction.Error>> {\n // Publish before create event\n const beforeCreateEvent = new FolderBeforeCreateEvent({\n input: params\n });\n\n await this.eventPublisher.publish(beforeCreateEvent);\n\n // Execute the create operation\n const result = await this.repository.execute(params);\n\n if (result.isFail()) {\n return result;\n }\n\n const folder = result.value;\n\n // Publish after create event\n const afterCreateEvent = new FolderAfterCreateEvent({\n folder\n });\n\n await this.eventPublisher.publish(afterCreateEvent);\n\n return Result.ok(folder);\n }\n}\n\nexport const CreateFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: CreateFolderUseCaseImpl,\n dependencies: [EventPublisher, CreateFolderRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,cAAc,QAEX,0CAA0C;AACjD,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,mBAAmB,IAAIC,kBAAkB,EACzCC,sBAAsB;AAE1B,SAASC,uBAAuB,EAAEC,sBAAsB;AAGxD,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CACCC,cAAmD,EACnDC,UAA4C,EACtD;IAAA,KAFUD,cAAmD,GAAnDA,cAAmD;IAAA,KACnDC,UAA4C,GAA5CA,UAA4C;EACrD;EAEH,MAAMC,OAAOA,CAACC,MAA0B,EAAqD;IACzF;IACA,MAAMC,iBAAiB,GAAG,IAAIR,uBAAuB,CAAC;MAClDS,KAAK,EAAEF;IACX,CAAC,CAAC;IAEF,MAAM,IAAI,CAACH,cAAc,CAACM,OAAO,CAACF,iBAAiB,CAAC;;IAEpD;IACA,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACN,UAAU,CAACC,OAAO,CAACC,MAAM,CAAC;IAEpD,IAAII,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOD,MAAM;IACjB;IAEA,MAAME,MAAM,GAAGF,MAAM,CAACG,KAAK;;IAE3B;IACA,MAAMC,gBAAgB,GAAG,IAAId,sBAAsB,CAAC;MAChDY;IACJ,CAAC,CAAC;IAEF,MAAM,IAAI,CAACT,cAAc,CAACM,OAAO,CAACK,gBAAgB,CAAC;IAEnD,OAAOrB,MAAM,CAACsB,EAAE,CAACH,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMhB,mBAAmB,GAAGD,oBAAoB,CAAC;EACpDqB,WAAW,EAAEnB,kBAAkB;EAC/BoB,cAAc,EAAEhB,uBAAuB;EACvCiB,YAAY,EAAE,CAACxB,cAAc,EAAEI,sBAAsB;AACzD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","EventPublisher","createImplementation","CreateFolderUseCase","UseCaseAbstraction","CreateFolderRepository","FolderBeforeCreateEvent","FolderAfterCreateEvent","CreateFolderUseCaseImpl","constructor","eventPublisher","repository","execute","params","beforeCreateEvent","input","publish","result","isFail","folder","value","afterCreateEvent","ok","abstraction","implementation","dependencies"],"sources":["CreateFolderUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n CreateFolderUseCase as UseCaseAbstraction,\n CreateFolderRepository\n} from \"./abstractions.js\";\nimport { FolderBeforeCreateEvent, FolderAfterCreateEvent } from \"./events.js\";\nimport type { Folder, CreateFolderParams } from \"~/folder/folder.types.js\";\n\nclass CreateFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private repository: CreateFolderRepository.Interface\n ) {}\n\n async execute(params: CreateFolderParams): Promise<Result<Folder, UseCaseAbstraction.Error>> {\n // Publish before create event\n const beforeCreateEvent = new FolderBeforeCreateEvent({\n input: params\n });\n\n await this.eventPublisher.publish(beforeCreateEvent);\n\n // Execute the create operation\n const result = await this.repository.execute(params);\n\n if (result.isFail()) {\n return result;\n }\n\n const folder = result.value;\n\n // Publish after create event\n const afterCreateEvent = new FolderAfterCreateEvent({\n folder\n });\n\n await this.eventPublisher.publish(afterCreateEvent);\n\n return Result.ok(folder);\n }\n}\n\nexport const CreateFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: CreateFolderUseCaseImpl,\n dependencies: [EventPublisher, CreateFolderRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,cAAc,QAEX,mDAAmD;AAC1D,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,mBAAmB,IAAIC,kBAAkB,EACzCC,sBAAsB;AAE1B,SAASC,uBAAuB,EAAEC,sBAAsB;AAGxD,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CACCC,cAAmD,EACnDC,UAA4C,EACtD;IAAA,KAFUD,cAAmD,GAAnDA,cAAmD;IAAA,KACnDC,UAA4C,GAA5CA,UAA4C;EACrD;EAEH,MAAMC,OAAOA,CAACC,MAA0B,EAAqD;IACzF;IACA,MAAMC,iBAAiB,GAAG,IAAIR,uBAAuB,CAAC;MAClDS,KAAK,EAAEF;IACX,CAAC,CAAC;IAEF,MAAM,IAAI,CAACH,cAAc,CAACM,OAAO,CAACF,iBAAiB,CAAC;;IAEpD;IACA,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACN,UAAU,CAACC,OAAO,CAACC,MAAM,CAAC;IAEpD,IAAII,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOD,MAAM;IACjB;IAEA,MAAME,MAAM,GAAGF,MAAM,CAACG,KAAK;;IAE3B;IACA,MAAMC,gBAAgB,GAAG,IAAId,sBAAsB,CAAC;MAChDY;IACJ,CAAC,CAAC;IAEF,MAAM,IAAI,CAACT,cAAc,CAACM,OAAO,CAACK,gBAAgB,CAAC;IAEnD,OAAOrB,MAAM,CAACsB,EAAE,CAACH,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMhB,mBAAmB,GAAGD,oBAAoB,CAAC;EACpDqB,WAAW,EAAEnB,kBAAkB;EAC/BoB,cAAc,EAAEhB,uBAAuB;EACvCiB,YAAY,EAAE,CAACxB,cAAc,EAAEI,sBAAsB;AACzD,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { Result } from "@webiny/feature/api";
2
- import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/EventPublisher";
2
+ import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { Folder, CreateFolderParams } from "../../../folder/folder.types.js";
4
4
  import type { FolderNotAuthorizedError, FolderPersistenceError, FolderValidationError } from "../../../domain/folder/errors.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","CreateFolderRepository","CreateFolderUseCase","FolderBeforeCreateEventHandler","FolderAfterCreateEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { Folder, CreateFolderParams } from \"~/folder/folder.types.js\";\nimport type {\n FolderNotAuthorizedError,\n FolderPersistenceError,\n FolderValidationError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * CreateFolder repository interface\n */\nexport interface ICreateFolderRepository {\n execute(data: CreateFolderParams): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface ICreateFolderRepositoryErrors {\n validation: FolderValidationError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = ICreateFolderRepositoryErrors[keyof ICreateFolderRepositoryErrors];\n\n/** Persist a newly created folder. */\nexport const CreateFolderRepository =\n createAbstraction<ICreateFolderRepository>(\"CreateFolderRepository\");\n\nexport namespace CreateFolderRepository {\n export type Interface = ICreateFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * CreateFolder use case interface\n */\nexport interface ICreateFolderUseCase {\n execute(params: CreateFolderParams): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface ICreateFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype UseCaseError = ICreateFolderUseCaseErrors[keyof ICreateFolderUseCaseErrors];\n\n/** Create a new folder. */\nexport const CreateFolderUseCase = createAbstraction<ICreateFolderUseCase>(\"CreateFolderUseCase\");\n\nexport namespace CreateFolderUseCase {\n export type Interface = ICreateFolderUseCase;\n export type Return = Promise<Result<Folder, UseCaseError>>;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeCreatePayload {\n input: CreateFolderParams;\n}\n\nexport interface FolderAfterCreatePayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is created. */\nexport const FolderBeforeCreateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeCreatePayload>>\n>(\"FolderBeforeCreateEventHandler\");\n\nexport namespace FolderBeforeCreateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeCreatePayload>>;\n export type Event = DomainEvent<FolderBeforeCreatePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is created. */\nexport const FolderAfterCreateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterCreatePayload>>\n>(\"FolderAfterCreateEventHandler\");\n\nexport namespace FolderAfterCreateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterCreatePayload>>;\n export type Event = DomainEvent<FolderAfterCreatePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAUvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAaA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAQjG;;AASA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","CreateFolderRepository","CreateFolderUseCase","FolderBeforeCreateEventHandler","FolderAfterCreateEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { Folder, CreateFolderParams } from \"~/folder/folder.types.js\";\nimport type {\n FolderNotAuthorizedError,\n FolderPersistenceError,\n FolderValidationError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * CreateFolder repository interface\n */\nexport interface ICreateFolderRepository {\n execute(data: CreateFolderParams): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface ICreateFolderRepositoryErrors {\n validation: FolderValidationError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = ICreateFolderRepositoryErrors[keyof ICreateFolderRepositoryErrors];\n\n/** Persist a newly created folder. */\nexport const CreateFolderRepository =\n createAbstraction<ICreateFolderRepository>(\"CreateFolderRepository\");\n\nexport namespace CreateFolderRepository {\n export type Interface = ICreateFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * CreateFolder use case interface\n */\nexport interface ICreateFolderUseCase {\n execute(params: CreateFolderParams): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface ICreateFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype UseCaseError = ICreateFolderUseCaseErrors[keyof ICreateFolderUseCaseErrors];\n\n/** Create a new folder. */\nexport const CreateFolderUseCase = createAbstraction<ICreateFolderUseCase>(\"CreateFolderUseCase\");\n\nexport namespace CreateFolderUseCase {\n export type Interface = ICreateFolderUseCase;\n export type Return = Promise<Result<Folder, UseCaseError>>;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeCreatePayload {\n input: CreateFolderParams;\n}\n\nexport interface FolderAfterCreatePayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is created. */\nexport const FolderBeforeCreateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeCreatePayload>>\n>(\"FolderBeforeCreateEventHandler\");\n\nexport namespace FolderBeforeCreateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeCreatePayload>>;\n export type Event = DomainEvent<FolderBeforeCreatePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is created. */\nexport const FolderAfterCreateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterCreatePayload>>\n>(\"FolderAfterCreateEventHandler\");\n\nexport namespace FolderAfterCreateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterCreatePayload>>;\n export type Event = DomainEvent<FolderAfterCreatePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAUvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAaA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAQjG;;AASA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import type { FolderBeforeCreatePayload, FolderAfterCreatePayload } from "./abstractions.js";
3
3
  export declare class FolderBeforeCreateEvent extends DomainEvent<FolderBeforeCreatePayload> {
4
4
  eventType: "folder.beforeCreate";
5
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderBeforeCreatePayload>>>;
5
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderBeforeCreatePayload>>>;
6
6
  }
7
7
  export declare class FolderAfterCreateEvent extends DomainEvent<FolderAfterCreatePayload> {
8
8
  eventType: "folder.afterCreate";
9
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderAfterCreatePayload>>>;
9
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderAfterCreatePayload>>>;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import { FolderBeforeCreateEventHandler, FolderAfterCreateEventHandler } from "./abstractions.js";
3
3
  // FolderBeforeCreate Event
4
4
  export class FolderBeforeCreateEvent extends DomainEvent {
@@ -1 +1 @@
1
- {"version":3,"names":["DomainEvent","FolderBeforeCreateEventHandler","FolderAfterCreateEventHandler","FolderBeforeCreateEvent","eventType","getHandlerAbstraction","FolderAfterCreateEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport { FolderBeforeCreateEventHandler, FolderAfterCreateEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeCreatePayload, FolderAfterCreatePayload } from \"./abstractions.js\";\n\n// FolderBeforeCreate Event\nexport class FolderBeforeCreateEvent extends DomainEvent<FolderBeforeCreatePayload> {\n eventType = \"folder.beforeCreate\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeCreateEventHandler;\n }\n}\n\n// FolderAfterCreate Event\nexport class FolderAfterCreateEvent extends DomainEvent<FolderAfterCreatePayload> {\n eventType = \"folder.afterCreate\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterCreateEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0CAA0C;AACtE,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DomainEvent","FolderBeforeCreateEventHandler","FolderAfterCreateEventHandler","FolderBeforeCreateEvent","eventType","getHandlerAbstraction","FolderAfterCreateEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { FolderBeforeCreateEventHandler, FolderAfterCreateEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeCreatePayload, FolderAfterCreatePayload } from \"./abstractions.js\";\n\n// FolderBeforeCreate Event\nexport class FolderBeforeCreateEvent extends DomainEvent<FolderBeforeCreatePayload> {\n eventType = \"folder.beforeCreate\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeCreateEventHandler;\n }\n}\n\n// FolderAfterCreate Event\nexport class FolderAfterCreateEvent extends DomainEvent<FolderAfterCreatePayload> {\n eventType = \"folder.afterCreate\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterCreateEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mDAAmD;AAC/E,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { DeleteFolderUseCase as UseCaseAbstraction, DeleteFolderRepository } from "./abstractions.js";
4
4
  import { GetFolderRepository } from "../GetFolder/abstractions.js";
5
5
  declare class DeleteFolderUseCaseImpl implements UseCaseAbstraction.Interface {
@@ -1,5 +1,5 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { DeleteFolderUseCase as UseCaseAbstraction, DeleteFolderRepository } from "./abstractions.js";
4
4
  import { GetFolderRepository } from "../GetFolder/abstractions.js";
5
5
  import { FolderBeforeDeleteEvent, FolderAfterDeleteEvent } from "./events.js";
@@ -1 +1 @@
1
- {"version":3,"names":["Result","EventPublisher","DeleteFolderUseCase","UseCaseAbstraction","DeleteFolderRepository","GetFolderRepository","FolderBeforeDeleteEvent","FolderAfterDeleteEvent","createImplementation","FolderNotAuthorizedError","FolderNotEmptyError","DeleteFolderUseCaseImpl","constructor","eventPublisher","getFolderRepository","repository","execute","id","getFolderResult","isFail","fail","error","folder","value","beforeDeleteEvent","publish","err","code","result","afterDeleteEvent","ok","abstraction","implementation","dependencies"],"sources":["DeleteFolderUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/EventPublisher\";\nimport {\n DeleteFolderUseCase as UseCaseAbstraction,\n DeleteFolderRepository\n} from \"./abstractions.js\";\nimport { GetFolderRepository } from \"../GetFolder/abstractions.js\";\nimport { FolderBeforeDeleteEvent, FolderAfterDeleteEvent } from \"./events.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport { FolderNotAuthorizedError, FolderNotEmptyError } from \"~/domain/folder/errors.js\";\n\nclass DeleteFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private getFolderRepository: GetFolderRepository.Interface,\n private repository: DeleteFolderRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n // Get the folder before deletion\n const getFolderResult = await this.getFolderRepository.execute(id);\n\n if (getFolderResult.isFail()) {\n return Result.fail(getFolderResult.error);\n }\n\n const folder = getFolderResult.value;\n\n // Publish before delete event\n const beforeDeleteEvent = new FolderBeforeDeleteEvent({\n folder\n });\n\n try {\n await this.eventPublisher.publish(beforeDeleteEvent);\n } catch (err) {\n if (err.code === \"Aco/Folder/NotEmpty\") {\n return Result.fail(new FolderNotEmptyError());\n }\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n // Execute the delete operation\n const result = await this.repository.execute(folder);\n\n if (result.isFail()) {\n return result;\n }\n\n // Publish after delete event\n const afterDeleteEvent = new FolderAfterDeleteEvent({\n folder\n });\n\n await this.eventPublisher.publish(afterDeleteEvent);\n\n return Result.ok();\n }\n}\n\nexport const DeleteFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: DeleteFolderUseCaseImpl,\n dependencies: [EventPublisher, GetFolderRepository, DeleteFolderRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,cAAc,QAEX,0CAA0C;AACjD,SACIC,mBAAmB,IAAIC,kBAAkB,EACzCC,sBAAsB;AAE1B,SAASC,mBAAmB;AAC5B,SAASC,uBAAuB,EAAEC,sBAAsB;AACxD,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SAASC,wBAAwB,EAAEC,mBAAmB;AAEtD,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CACCC,cAAmD,EACnDC,mBAAkD,E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M,oBAAoB,CAAC;EACpDuB,WAAW,EAAE5B,kBAAkB;EAC/B6B,cAAc,EAAErB,uBAAuB;EACvCsB,YAAY,EAAE,CAAChC,cAAc,EAAEI,mBAAmB,EAAED,sBAAsB;AAC9E,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","EventPublisher","DeleteFolderUseCase","UseCaseAbstraction","DeleteFolderRepository","GetFolderRepository","FolderBeforeDeleteEvent","FolderAfterDeleteEvent","createImplementation","FolderNotAuthorizedError","FolderNotEmptyError","DeleteFolderUseCaseImpl","constructor","eventPublisher","getFolderRepository","repository","execute","id","getFolderResult","isFail","fail","error","folder","value","beforeDeleteEvent","publish","err","code","result","afterDeleteEvent","ok","abstraction","implementation","dependencies"],"sources":["DeleteFolderUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport {\n DeleteFolderUseCase as UseCaseAbstraction,\n DeleteFolderRepository\n} from \"./abstractions.js\";\nimport { GetFolderRepository } from \"../GetFolder/abstractions.js\";\nimport { FolderBeforeDeleteEvent, FolderAfterDeleteEvent } from \"./events.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport { FolderNotAuthorizedError, FolderNotEmptyError } from \"~/domain/folder/errors.js\";\n\nclass DeleteFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private getFolderRepository: GetFolderRepository.Interface,\n private repository: DeleteFolderRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n // Get the folder before deletion\n const getFolderResult = await this.getFolderRepository.execute(id);\n\n if (getFolderResult.isFail()) {\n return Result.fail(getFolderResult.error);\n }\n\n const folder = getFolderResult.value;\n\n // Publish before delete event\n const beforeDeleteEvent = new FolderBeforeDeleteEvent({\n folder\n });\n\n try {\n await this.eventPublisher.publish(beforeDeleteEvent);\n } catch (err) {\n if (err.code === \"Aco/Folder/NotEmpty\") {\n return Result.fail(new FolderNotEmptyError());\n }\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n // Execute the delete operation\n const result = await this.repository.execute(folder);\n\n if (result.isFail()) {\n return result;\n }\n\n // Publish after delete event\n const afterDeleteEvent = new FolderAfterDeleteEvent({\n folder\n });\n\n await this.eventPublisher.publish(afterDeleteEvent);\n\n return Result.ok();\n }\n}\n\nexport const DeleteFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: DeleteFolderUseCaseImpl,\n dependencies: [EventPublisher, GetFolderRepository, DeleteFolderRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,cAAc,QAEX,mDAAmD;AAC1D,SACIC,mBAAmB,IAAIC,kBAAkB,EACzCC,sBAAsB;AAE1B,SAASC,mBAAmB;AAC5B,SAASC,uBAAuB,EAAEC,sBAAsB;AACxD,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SAASC,wBAAwB,EAAEC,mBAAmB;AAEtD,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CACCC,cAAmD,EACnDC,mBAAkD,EAClDC,UAA4C,EACtD;IAAA,KAHUF,cAAmD,GAAnDA,cAAmD;IAAA,KACnDC,mBAAkD,GAAlDA,mBAAkD;IAAA,KAClDC,UAA4C,GAA5CA,UAA4C;EACrD;EAEH,MAAMC,OAAOA,CAACC,EAAU,EAAmD;IACvE;IACA,MAAMC,eAAe,GAAG,MAAM,IAAI,CAACJ,mBAAmB,CAACE,OAAO,CAACC,EAAE,CAAC;IAElE,IAAIC,eAAe,CAACC,MAAM,CAAC,CAAC,EAAE;MAC1B,OAAOnB,MAAM,CAACoB,IAAI,CAACF,eAAe,CAACG,KAAK,CAAC;IAC7C;IAEA,MAAMC,MAAM,GAAGJ,eAAe,CAACK,KAAK;;IAEpC;IACA,MAAMC,iBAAiB,GAAG,IAAIlB,uBAAuB,CAAC;MAClDgB;IACJ,CAAC,CAAC;IAEF,IAAI;MACA,MAAM,IAAI,CAACT,cAAc,CAACY,OAAO,CAACD,iBAAiB,CAAC;IACxD,CAAC,CAAC,OAAOE,GAAG,EAAE;MACV,IAAIA,GAAG,CAACC,IAAI,KAAK,qBAAqB,EAAE;QACpC,OAAO3B,MAAM,CAACoB,IAAI,CAAC,IAAIV,mBAAmB,CAAC,CAAC,CAAC;MACjD;MACA,OAAOV,MAAM,CAACoB,IAAI,CAAC,IAAIX,wBAAwB,CAAC,CAAC,CAAC;IACtD;;IAEA;IACA,MAAMmB,MAAM,GAAG,MAAM,IAAI,CAACb,UAAU,CAACC,OAAO,CAACM,MAAM,CAAC;IAEpD,IAAIM,MAAM,CAACT,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOS,MAAM;IACjB;;IAEA;IACA,MAAMC,gBAAgB,GAAG,IAAItB,sBAAsB,CAAC;MAChDe;IACJ,CAAC,CAAC;IAEF,MAAM,IAAI,CAACT,cAAc,CAACY,OAAO,CAACI,gBAAgB,CAAC;IAEnD,OAAO7B,MAAM,CAAC8B,EAAE,CAAC,CAAC;EACtB;AACJ;AAEA,OAAO,MAAM5B,mBAAmB,GAAGM,oBAAoB,CAAC;EACpDuB,WAAW,EAAE5B,kBAAkB;EAC/B6B,cAAc,EAAErB,uBAAuB;EACvCsB,YAAY,EAAE,CAAChC,cAAc,EAAEI,mBAAmB,EAAED,sBAAsB;AAC9E,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { Result } from "@webiny/feature/api";
2
- import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/EventPublisher";
2
+ import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { Folder } from "../../../folder/folder.types.js";
4
4
  import { type FolderNotAuthorizedError, FolderNotEmptyError, type FolderNotFoundError, type FolderPersistenceError } from "../../../domain/folder/errors.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","DeleteFolderRepository","DeleteFolderUseCase","FolderBeforeDeleteEventHandler","FolderAfterDeleteEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { Folder } from \"~/folder/folder.types.js\";\nimport {\n type FolderNotAuthorizedError,\n FolderNotEmptyError,\n type FolderNotFoundError,\n type FolderPersistenceError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * DeleteFolder repository interface\n */\nexport interface IDeleteFolderRepository {\n execute(folder: Folder): Promise<Result<void, RepositoryError>>;\n}\n\nexport interface IDeleteFolderRepositoryErrors {\n notAuthorized: FolderNotAuthorizedError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = IDeleteFolderRepositoryErrors[keyof IDeleteFolderRepositoryErrors];\n\n/** Persist folder deletion. */\nexport const DeleteFolderRepository =\n createAbstraction<IDeleteFolderRepository>(\"DeleteFolderRepository\");\n\nexport namespace DeleteFolderRepository {\n export type Interface = IDeleteFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * DeleteFolder use case interface\n */\nexport interface IDeleteFolderUseCase {\n execute(id: string): Promise<Result<void, UseCaseError>>;\n}\n\nexport interface IDeleteFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n notEmpty: FolderNotEmptyError;\n persistence: FolderPersistenceError;\n}\n\ntype UseCaseError = IDeleteFolderUseCaseErrors[keyof IDeleteFolderUseCaseErrors];\n\n/** Delete a folder. */\nexport const DeleteFolderUseCase = createAbstraction<IDeleteFolderUseCase>(\"DeleteFolderUseCase\");\n\nexport namespace DeleteFolderUseCase {\n export type Interface = IDeleteFolderUseCase;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeDeletePayload {\n folder: Folder;\n}\n\nexport interface FolderAfterDeletePayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is deleted. */\nexport const FolderBeforeDeleteEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeDeletePayload>>\n>(\"FolderBeforeDeleteEventHandler\");\n\nexport namespace FolderBeforeDeleteEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeDeletePayload>>;\n export type Event = DomainEvent<FolderBeforeDeletePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is deleted. */\nexport const FolderAfterDeleteEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterDeletePayload>>\n>(\"FolderAfterDeleteEventHandler\");\n\nexport namespace FolderAfterDeleteEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterDeletePayload>>;\n export type Event = DomainEvent<FolderAfterDeletePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAWvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAcA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;;AASA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","DeleteFolderRepository","DeleteFolderUseCase","FolderBeforeDeleteEventHandler","FolderAfterDeleteEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { Folder } from \"~/folder/folder.types.js\";\nimport {\n type FolderNotAuthorizedError,\n FolderNotEmptyError,\n type FolderNotFoundError,\n type FolderPersistenceError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * DeleteFolder repository interface\n */\nexport interface IDeleteFolderRepository {\n execute(folder: Folder): Promise<Result<void, RepositoryError>>;\n}\n\nexport interface IDeleteFolderRepositoryErrors {\n notAuthorized: FolderNotAuthorizedError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = IDeleteFolderRepositoryErrors[keyof IDeleteFolderRepositoryErrors];\n\n/** Persist folder deletion. */\nexport const DeleteFolderRepository =\n createAbstraction<IDeleteFolderRepository>(\"DeleteFolderRepository\");\n\nexport namespace DeleteFolderRepository {\n export type Interface = IDeleteFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * DeleteFolder use case interface\n */\nexport interface IDeleteFolderUseCase {\n execute(id: string): Promise<Result<void, UseCaseError>>;\n}\n\nexport interface IDeleteFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n notEmpty: FolderNotEmptyError;\n persistence: FolderPersistenceError;\n}\n\ntype UseCaseError = IDeleteFolderUseCaseErrors[keyof IDeleteFolderUseCaseErrors];\n\n/** Delete a folder. */\nexport const DeleteFolderUseCase = createAbstraction<IDeleteFolderUseCase>(\"DeleteFolderUseCase\");\n\nexport namespace DeleteFolderUseCase {\n export type Interface = IDeleteFolderUseCase;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeDeletePayload {\n folder: Folder;\n}\n\nexport interface FolderAfterDeletePayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is deleted. */\nexport const FolderBeforeDeleteEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeDeletePayload>>\n>(\"FolderBeforeDeleteEventHandler\");\n\nexport namespace FolderBeforeDeleteEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeDeletePayload>>;\n export type Event = DomainEvent<FolderBeforeDeletePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is deleted. */\nexport const FolderAfterDeleteEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterDeletePayload>>\n>(\"FolderAfterDeleteEventHandler\");\n\nexport namespace FolderAfterDeleteEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterDeletePayload>>;\n export type Event = DomainEvent<FolderAfterDeletePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAWvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAcA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;;AASA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import type { FolderBeforeDeletePayload, FolderAfterDeletePayload } from "./abstractions.js";
3
3
  export declare class FolderBeforeDeleteEvent extends DomainEvent<FolderBeforeDeletePayload> {
4
4
  eventType: "folder.beforeDelete";
5
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderBeforeDeletePayload>>>;
5
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderBeforeDeletePayload>>>;
6
6
  }
7
7
  export declare class FolderAfterDeleteEvent extends DomainEvent<FolderAfterDeletePayload> {
8
8
  eventType: "folder.afterDelete";
9
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderAfterDeletePayload>>>;
9
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderAfterDeletePayload>>>;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import { FolderBeforeDeleteEventHandler, FolderAfterDeleteEventHandler } from "./abstractions.js";
3
3
  // FolderBeforeDelete Event
4
4
  export class FolderBeforeDeleteEvent extends DomainEvent {
@@ -1 +1 @@
1
- {"version":3,"names":["DomainEvent","FolderBeforeDeleteEventHandler","FolderAfterDeleteEventHandler","FolderBeforeDeleteEvent","eventType","getHandlerAbstraction","FolderAfterDeleteEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport { FolderBeforeDeleteEventHandler, FolderAfterDeleteEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeDeletePayload, FolderAfterDeletePayload } from \"./abstractions.js\";\n\n// FolderBeforeDelete Event\nexport class FolderBeforeDeleteEvent extends DomainEvent<FolderBeforeDeletePayload> {\n eventType = \"folder.beforeDelete\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeDeleteEventHandler;\n }\n}\n\n// FolderAfterDelete Event\nexport class FolderAfterDeleteEvent extends DomainEvent<FolderAfterDeletePayload> {\n eventType = \"folder.afterDelete\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterDeleteEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0CAA0C;AACtE,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DomainEvent","FolderBeforeDeleteEventHandler","FolderAfterDeleteEventHandler","FolderBeforeDeleteEvent","eventType","getHandlerAbstraction","FolderAfterDeleteEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { FolderBeforeDeleteEventHandler, FolderAfterDeleteEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeDeletePayload, FolderAfterDeletePayload } from \"./abstractions.js\";\n\n// FolderBeforeDelete Event\nexport class FolderBeforeDeleteEvent extends DomainEvent<FolderBeforeDeletePayload> {\n eventType = \"folder.beforeDelete\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeDeleteEventHandler;\n }\n}\n\n// FolderAfterDelete Event\nexport class FolderAfterDeleteEvent extends DomainEvent<FolderAfterDeletePayload> {\n eventType = \"folder.afterDelete\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterDeleteEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mDAAmD;AAC/E,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
@@ -7,6 +7,6 @@ declare class GenericFolderBeforeDeleteHandlerImpl implements FolderBeforeDelete
7
7
  handle(event: FolderBeforeDeleteEvent): Promise<void>;
8
8
  }
9
9
  export declare const GenericFolderBeforeDeleteHandler: typeof GenericFolderBeforeDeleteHandlerImpl & {
10
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderBeforeDeletePayload>>>;
10
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderBeforeDeletePayload>>>;
11
11
  };
12
12
  export {};
@@ -11,6 +11,6 @@ declare class ModelFolderBeforeDeleteHandlerImpl implements FolderBeforeDeleteEv
11
11
  handle(event: FolderBeforeDeleteEvent): Promise<void>;
12
12
  }
13
13
  export declare const ModelFolderBeforeDeleteHandler: typeof ModelFolderBeforeDeleteHandlerImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderBeforeDeletePayload>>>;
14
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderBeforeDeletePayload>>>;
15
15
  };
16
16
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { Result } from "@webiny/feature/api";
2
- import { DomainEvent, IEventHandler } from "@webiny/api-core/features/EventPublisher";
2
+ import { DomainEvent, IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { Folder, GetFolderParams } from "../../../folder/folder.types.js";
4
4
  import type { FolderNotAuthorizedError, FolderNotFoundError, FolderPersistenceError } from "../../../domain/folder/errors.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","GetFolderRepository","GetFolderUseCase","FolderBeforeGetEventHandler","FolderAfterGetEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport { DomainEvent, IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { Folder, GetFolderParams } from \"~/folder/folder.types.js\";\nimport type {\n FolderNotAuthorizedError,\n FolderNotFoundError,\n FolderPersistenceError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * GetFolder repository interface\n */\nexport interface IGetFolderRepository {\n execute(id: string): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface IGetFolderRepositoryErrors {\n notFound: FolderNotFoundError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = IGetFolderRepositoryErrors[keyof IGetFolderRepositoryErrors];\n\nexport const GetFolderRepository = createAbstraction<IGetFolderRepository>(\"GetFolderRepository\");\n\nexport namespace GetFolderRepository {\n export type Interface = IGetFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * GetFolder use case interface\n */\nexport interface IGetFolderUseCase {\n execute(id: string): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface IGetFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n persistence: FolderPersistenceError;\n}\n\ntype UseCaseError = IGetFolderUseCaseErrors[keyof IGetFolderUseCaseErrors];\n\n/** Retrieve a folder. */\nexport const GetFolderUseCase = createAbstraction<IGetFolderUseCase>(\"GetFolderUseCase\");\n\nexport namespace GetFolderUseCase {\n export type Interface = IGetFolderUseCase;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeGetPayload {\n params: GetFolderParams;\n}\n\nexport interface FolderAfterGetPayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is retrieved. */\nexport const FolderBeforeGetEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeGetPayload>>\n>(\"FolderBeforeGetEventHandler\");\n\nexport namespace FolderBeforeGetEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeGetPayload>>;\n export type Event = DomainEvent<FolderBeforeGetPayload>;\n}\n\n/** Hook into folder lifecycle after a folder is retrieved. */\nexport const FolderAfterGetEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterGetPayload>>\n>(\"FolderAfterGetEventHandler\");\n\nexport namespace FolderAfterGetEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterGetPayload>>;\n export type Event = DomainEvent<FolderAfterGetPayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAUvD;AACA;AACA;;AAYA,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;AACA;AACA;;AAaA;AACA,OAAO,MAAME,gBAAgB,GAAGF,iBAAiB,CAAoB,kBAAkB,CAAC;;AAOxF;;AASA;AACA;AACA,OAAO,MAAMG,2BAA2B,GAAGH,iBAAiB,CAE1D,6BAA6B,CAAC;AAOhC;AACA,OAAO,MAAMI,0BAA0B,GAAGJ,iBAAiB,CAEzD,4BAA4B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","GetFolderRepository","GetFolderUseCase","FolderBeforeGetEventHandler","FolderAfterGetEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport { DomainEvent, IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { Folder, GetFolderParams } from \"~/folder/folder.types.js\";\nimport type {\n FolderNotAuthorizedError,\n FolderNotFoundError,\n FolderPersistenceError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * GetFolder repository interface\n */\nexport interface IGetFolderRepository {\n execute(id: string): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface IGetFolderRepositoryErrors {\n notFound: FolderNotFoundError;\n persistence: FolderPersistenceError;\n}\n\ntype RepositoryError = IGetFolderRepositoryErrors[keyof IGetFolderRepositoryErrors];\n\nexport const GetFolderRepository = createAbstraction<IGetFolderRepository>(\"GetFolderRepository\");\n\nexport namespace GetFolderRepository {\n export type Interface = IGetFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * GetFolder use case interface\n */\nexport interface IGetFolderUseCase {\n execute(id: string): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface IGetFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n persistence: FolderPersistenceError;\n}\n\ntype UseCaseError = IGetFolderUseCaseErrors[keyof IGetFolderUseCaseErrors];\n\n/** Retrieve a folder. */\nexport const GetFolderUseCase = createAbstraction<IGetFolderUseCase>(\"GetFolderUseCase\");\n\nexport namespace GetFolderUseCase {\n export type Interface = IGetFolderUseCase;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeGetPayload {\n params: GetFolderParams;\n}\n\nexport interface FolderAfterGetPayload {\n folder: Folder;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is retrieved. */\nexport const FolderBeforeGetEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeGetPayload>>\n>(\"FolderBeforeGetEventHandler\");\n\nexport namespace FolderBeforeGetEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeGetPayload>>;\n export type Event = DomainEvent<FolderBeforeGetPayload>;\n}\n\n/** Hook into folder lifecycle after a folder is retrieved. */\nexport const FolderAfterGetEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterGetPayload>>\n>(\"FolderAfterGetEventHandler\");\n\nexport namespace FolderAfterGetEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterGetPayload>>;\n export type Event = DomainEvent<FolderAfterGetPayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAUvD;AACA;AACA;;AAYA,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;AACA;AACA;;AAaA;AACA,OAAO,MAAME,gBAAgB,GAAGF,iBAAiB,CAAoB,kBAAkB,CAAC;;AAOxF;;AASA;AACA;AACA,OAAO,MAAMG,2BAA2B,GAAGH,iBAAiB,CAE1D,6BAA6B,CAAC;AAOhC;AACA,OAAO,MAAMI,0BAA0B,GAAGJ,iBAAiB,CAEzD,4BAA4B,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { ListFolderLevelPermissionsTargetsUseCase as UseCaseAbstraction } from "./abstractions.js";
2
- import { ListUsersUseCase } from "@webiny/api-core/features/ListUsers";
3
- import { ListTeamsUseCase } from "@webiny/api-core/features/ListTeams";
2
+ import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
3
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
4
4
  declare class ListFolderLevelPermissionsTargetsUseCaseImpl implements UseCaseAbstraction.Interface {
5
5
  private listAdminUsers;
6
6
  private listTeams;
@@ -1,8 +1,8 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { ListFolderLevelPermissionsTargetsUseCase as UseCaseAbstraction } from "./abstractions.js";
3
3
  import { validation } from "@webiny/validation";
4
- import { ListUsersUseCase } from "@webiny/api-core/features/ListUsers";
5
- import { ListTeamsUseCase } from "@webiny/api-core/features/ListTeams";
4
+ import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
5
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
6
6
  class ListFolderLevelPermissionsTargetsUseCaseImpl {
7
7
  constructor(listAdminUsers, listTeams) {
8
8
  this.listAdminUsers = listAdminUsers;
@@ -1 +1 @@
1
- {"version":3,"names":["Result","ListFolderLevelPermissionsTargetsUseCase","UseCaseAbstraction","validation","ListUsersUseCase","ListTeamsUseCase","ListFolderLevelPermissionsTargetsUseCaseImpl","constructor","listAdminUsers","listTeams","execute","adminUsersResult","teamsResult","isFail","ok","totalCount","adminUsers","value","teams","teamTargets","map","team","id","type","target","slug","name","meta","adminUserTargets","user","displayName","firstName","lastName","filter","Boolean","join","email","validateSync","image","avatar","src","results","length","createImplementation","implementation","dependencies"],"sources":["ListFolderLevelPermissionsTargetsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListFolderLevelPermissionsTargetsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { validation } from \"@webiny/validation\";\nimport { ListUsersUseCase } from \"@webiny/api-core/features/ListUsers\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/ListTeams\";\n\nclass ListFolderLevelPermissionsTargetsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private listAdminUsers: ListUsersUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface\n ) {}\n\n public async execute(): UseCaseAbstraction.Return {\n const adminUsersResult = await this.listAdminUsers.execute();\n const teamsResult = await this.listTeams.execute();\n\n if (adminUsersResult.isFail() || teamsResult.isFail()) {\n return Result.ok([[], { totalCount: 0 }]);\n }\n\n const adminUsers = adminUsersResult.value;\n const teams = teamsResult.value;\n\n const teamTargets = teams.map(team => ({\n id: team.id,\n type: \"team\",\n target: `team:${team.slug}`,\n name: team.name || \"\",\n meta: {}\n }));\n\n const adminUserTargets = adminUsers.map(user => {\n let name = user.displayName;\n if (!name) {\n // For backwards compatibility, we also want to try concatenating first and last name.\n name = [user.firstName, user.lastName].filter(Boolean).join(\" \");\n }\n\n // We're doing the validation because, with non-Cognito IdPs (Okta, Auth0), the email\n // field might actually contain a non-email value: `id:${IdP_Identity_ID}`. In that case,\n // let's not assign anything to the `email` field.\n let email: string | null = user.email;\n try {\n validation.validateSync(email, \"email\");\n } catch {\n email = null;\n }\n\n const image = user.avatar?.src || null;\n\n return {\n id: user.id,\n type: \"admin\",\n target: `admin:${user.id}`,\n name,\n meta: {\n email,\n image\n }\n };\n });\n\n const results = [...teamTargets, ...adminUserTargets];\n const meta = { totalCount: results.length };\n\n return Result.ok([results, meta]);\n }\n}\n\nexport const ListFolderLevelPermissionsTargetsUseCase = UseCaseAbstraction.createImplementation({\n implementation: List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,IAAIH,IAAI,GAAGG,IAAI,CAACC,WAAW;MAC3B,IAAI,CAACJ,IAAI,EAAE;QACP;QACAA,IAAI,GAAG,CAACG,IAAI,CAACE,SAAS,EAAEF,IAAI,CAACG,QAAQ,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MACpE;;MAEA;MACA;MACA;MACA,IAAIC,KAAoB,GAAGP,IAAI,CAACO,KAAK;MACrC,IAAI;QACAjC,UAAU,CAACkC,YAAY,CAACD,KAAK,EAAE,OAAO,CAAC;MAC3C,CAAC,CAAC,MAAM;QACJA,KAAK,GAAG,IAAI;MAChB;MAEA,MAAME,KAAK,GAAGT,IAAI,CAACU,MAAM,EAAEC,GAAG,IAAI,IAAI;MAEtC,OAAO;QACHlB,EAAE,EAAEO,IAAI,CAACP,EAAE;QACXC,IAAI,EAAE,OAAO;QACbC,MAAM,EAAE,SAASK,IAAI,CAACP,EAAE,EAAE;QAC1BI,IAAI;QACJC,IAAI,EAAE;UACFS,KAAK;UACLE;QACJ;MACJ,CAAC;IACL,CAAC,CAAC;IAEF,MAAMG,OAAO,GAAG,CAAC,GAAGtB,WAAW,EAAE,GAAGS,gBAAgB,CAAC;IACrD,MAAMD,IAAI,GAAG;MAAEZ,UAAU,EAAE0B,OAAO,CAACC;IAAO,CAAC;IAE3C,OAAO1C,MAAM,CAACc,EAAE,CAAC,CAAC2B,OAAO,EAAEd,IAAI,CAAC,CAAC;EACrC;AACJ;AAEA,OAAO,MAAM1B,wCAAwC,GAAGC,kBAAkB,CAACyC,oBAAoB,CAAC;EAC5FC,cAAc,EAAEtC,4CAA4C;EAC5DuC,YAAY,EAAE,CAACzC,gBAAgB,EAAEC,gBAAgB;AACrD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","ListFolderLevelPermissionsTargetsUseCase","UseCaseAbstraction","validation","ListUsersUseCase","ListTeamsUseCase","ListFolderLevelPermissionsTargetsUseCaseImpl","constructor","listAdminUsers","listTeams","execute","adminUsersResult","teamsResult","isFail","ok","totalCount","adminUsers","value","teams","teamTargets","map","team","id","type","target","slug","name","meta","adminUserTargets","user","displayName","firstName","lastName","filter","Boolean","join","email","validateSync","image","avatar","src","results","length","createImplementation","implementation","dependencies"],"sources":["ListFolderLevelPermissionsTargetsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListFolderLevelPermissionsTargetsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { validation } from \"@webiny/validation\";\nimport { ListUsersUseCase } from \"@webiny/api-core/features/users/ListUsers/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nclass ListFolderLevelPermissionsTargetsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private listAdminUsers: ListUsersUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface\n ) {}\n\n public async execute(): UseCaseAbstraction.Return {\n const adminUsersResult = await this.listAdminUsers.execute();\n const teamsResult = await this.listTeams.execute();\n\n if (adminUsersResult.isFail() || teamsResult.isFail()) {\n return Result.ok([[], { totalCount: 0 }]);\n }\n\n const adminUsers = adminUsersResult.value;\n const teams = teamsResult.value;\n\n const teamTargets = teams.map(team => ({\n id: team.id,\n type: \"team\",\n target: `team:${team.slug}`,\n name: team.name || \"\",\n meta: {}\n }));\n\n const adminUserTargets = adminUsers.map(user => {\n let name = user.displayName;\n if (!name) {\n // For backwards compatibility, we also want to try concatenating first and last name.\n name = [user.firstName, user.lastName].filter(Boolean).join(\" \");\n }\n\n // We're doing the validation because, with non-Cognito IdPs (Okta, Auth0), the email\n // field might actually contain a non-email value: `id:${IdP_Identity_ID}`. In that case,\n // let's not assign anything to the `email` field.\n let email: string | null = user.email;\n try {\n validation.validateSync(email, \"email\");\n } catch {\n email = null;\n }\n\n const image = user.avatar?.src || null;\n\n return {\n id: user.id,\n type: \"admin\",\n target: `admin:${user.id}`,\n name,\n meta: {\n email,\n image\n }\n };\n });\n\n const results = [...teamTargets, ...adminUserTargets];\n const meta = { totalCount: results.length };\n\n return Result.ok([results, meta]);\n }\n}\n\nexport const ListFolderLevelPermissionsTargetsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFolderLevelPermissionsTargetsUseCaseImpl,\n dependencies: [ListUsersUseCase, ListTeamsUseCase]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,wCAAwC,IAAIC,kBAAkB;AACvE,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,oDAAoD;AACrF,SAASC,gBAAgB,QAAQ,6DAA6D;AAE9F,MAAMC,4CAA4C,CAAyC;EACvFC,WAAWA,CACCC,cAA0C,EAC1CC,SAAqC,EAC/C;IAAA,KAFUD,cAA0C,GAA1CA,cAA0C;IAAA,KAC1CC,SAAqC,GAArCA,SAAqC;EAC9C;EAEH,MAAaC,OAAOA,CAAA,EAA8B;IAC9C,MAAMC,gBAAgB,GAAG,MAAM,IAAI,CAACH,cAAc,CAACE,OAAO,CAAC,CAAC;IAC5D,MAAME,WAAW,GAAG,MAAM,IAAI,CAACH,SAAS,CAACC,OAAO,CAAC,CAAC;IAElD,IAAIC,gBAAgB,CAACE,MAAM,CAAC,CAAC,IAAID,WAAW,CAACC,MAAM,CAAC,CAAC,EAAE;MACnD,OAAOb,MAAM,CAACc,EAAE,CAAC,CAAC,EAAE,EAAE;QAAEC,UAAU,EAAE;MAAE,CAAC,CAAC,CAAC;IAC7C;IAEA,MAAMC,UAAU,GAAGL,gBAAgB,CAACM,KAAK;IACzC,MAAMC,KAAK,GAAGN,WAAW,CAACK,KAAK;IAE/B,MAAME,WAAW,GAAGD,KAAK,CAACE,GAAG,CAACC,IAAI,KAAK;MACnCC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQH,IAAI,CAACI,IAAI,EAAE;MAC3BC,IAAI,EAAEL,IAAI,CAACK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":[]}
@@ -1,5 +1,5 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher as EventPublisherAbstraction } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { UpdateFolderRepository, UpdateFolderUseCase as UseCaseAbstraction } from "./abstractions.js";
4
4
  import { GetFolderRepository } from "../GetFolder/abstractions.js";
5
5
  import type { Folder, UpdateFolderParams } from "../../../folder/folder.types.js";
@@ -1,5 +1,5 @@
1
1
  import { createImplementation, Result } from "@webiny/feature/api";
2
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { UpdateFolderRepository, UpdateFolderUseCase as UseCaseAbstraction } from "./abstractions.js";
4
4
  import { GetFolderRepository } from "../GetFolder/abstractions.js";
5
5
  import { FolderAfterUpdateEvent, FolderBeforeUpdateEvent } from "./events.js";
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","Result","EventPublisher","UpdateFolderRepository","UpdateFolderUseCase","UseCaseAbstraction","GetFolderRepository","FolderAfterUpdateEvent","FolderBeforeUpdateEvent","UpdateFolderUseCaseImpl","constructor","eventPublisher","getFolderRepository","repository","execute","id","input","useCaseInput","data","originalResult","isFail","original","value","beforeUpdateEvent","publish","result","folder","afterUpdateEvent","ok","abstraction","implementation","dependencies"],"sources":["UpdateFolderUseCase.ts"],"sourcesContent":["import { createImplementation, Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/EventPublisher\";\nimport {\n UpdateFolderRepository,\n UpdateFolderUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\nimport { GetFolderRepository } from \"../GetFolder/abstractions.js\";\nimport { FolderAfterUpdateEvent, FolderBeforeUpdateEvent } from \"./events.js\";\nimport type { Folder, UpdateFolderParams } from \"~/folder/folder.types.js\";\n\nclass UpdateFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private getFolderRepository: GetFolderRepository.Interface,\n private repository: UpdateFolderRepository.Interface\n ) {}\n\n async execute(\n id: string,\n input: UpdateFolderParams\n ): Promise<Result<Folder, UseCaseAbstraction.Error>> {\n const useCaseInput = { id, data: input };\n\n // Get original folder for events\n const originalResult = await this.getFolderRepository.execute(id);\n\n if (originalResult.isFail()) {\n return originalResult;\n }\n\n const original = originalResult.value;\n\n // Publish before update event\n const beforeUpdateEvent = new FolderBeforeUpdateEvent({\n original,\n input: useCaseInput\n });\n\n await this.eventPublisher.publish(beforeUpdateEvent);\n\n // Execute the update operation\n const result = await this.repository.execute(id, input);\n\n if (result.isFail()) {\n return result;\n }\n\n const folder = result.value;\n\n // Publish after update event\n const afterUpdateEvent = new FolderAfterUpdateEvent({\n original,\n folder,\n input: useCaseInput\n });\n\n await this.eventPublisher.publish(afterUpdateEvent);\n\n return Result.ok(folder);\n }\n}\n\nexport const UpdateFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: UpdateFolderUseCaseImpl,\n dependencies: [EventPublisher, GetFolderRepository, UpdateFolderRepository]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,MAAM,QAAQ,qBAAqB;AAClE,SACIC,cAAc,QAEX,0CAA0C;AACjD,SACIC,sBAAsB,EACtBC,mBAAmB,IAAIC,kBAAkB;AAE7C,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB,EAAEC,uBAAuB;AAGxD,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CACCC,cAAmD,EACnDC,mBAAkD,EAClDC,UAA4C,EACtD;IAAA,KAHUF,cAAmD,GAAnDA,cAAmD;IAAA,KACnDC,mBAAkD,GAAlDA,mBAAkD;IAAA,KAClDC,UAA4C,GAA5CA,UAA4C;EACrD;EAEH,MAAMC,OAAOA,CACTC,EAAU,EACVC,KAAyB,EACwB;IACjD,MAAMC,YAAY,GAAG;MAAEF,EAAE;MAAEG,IAAI,EAAEF;IAAM,CAAC;;IAExC;IACA,MAAMG,cAAc,GAAG,MAAM,IAAI,CAACP,mBAAmB,CAACE,OAAO,CAACC,EAAE,CAAC;IAEjE,IAAII,cAAc,CAACC,MAAM,CAAC,CAAC,EAAE;MACzB,OAAOD,cAAc;IACzB;IAEA,MAAME,QAAQ,GAAGF,cAAc,CAACG,KAAK;;IAErC;IACA,MAAMC,iBAAiB,GAAG,IAAIf,uBAAuB,CAAC;MAClDa,QAAQ;MACRL,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAM,IAAI,CAACN,cAAc,CAACa,OAAO,CAACD,iBAAiB,CAAC;;IAEpD;IACA,MAAME,MAAM,GAAG,MAAM,IAAI,CAACZ,UAAU,CAACC,OAAO,CAACC,EAAE,EAAEC,KAAK,CAAC;IAEvD,IAAIS,MAAM,CAACL,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOK,MAAM;IACjB;IAEA,MAAMC,MAAM,GAAGD,MAAM,CAACH,KAAK;;IAE3B;IACA,MAAMK,gBAAgB,GAAG,IAAIpB,sBAAsB,CAAC;MAChDc,QAAQ;MACRK,MAAM;MACNV,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAM,IAAI,CAACN,cAAc,CAACa,OAAO,CAACG,gBAAgB,CAAC;IAEnD,OAAO1B,MAAM,CAAC2B,EAAE,CAACF,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMtB,mBAAmB,GAAGJ,oBAAoB,CAAC;EACpD6B,WAAW,EAAExB,kBAAkB;EAC/ByB,cAAc,EAAErB,uBAAuB;EACvCsB,YAAY,EAAE,CAAC7B,cAAc,EAAEI,mBAAmB,EAAEH,sBAAsB;AAC9E,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createImplementation","Result","EventPublisher","UpdateFolderRepository","UpdateFolderUseCase","UseCaseAbstraction","GetFolderRepository","FolderAfterUpdateEvent","FolderBeforeUpdateEvent","UpdateFolderUseCaseImpl","constructor","eventPublisher","getFolderRepository","repository","execute","id","input","useCaseInput","data","originalResult","isFail","original","value","beforeUpdateEvent","publish","result","folder","afterUpdateEvent","ok","abstraction","implementation","dependencies"],"sources":["UpdateFolderUseCase.ts"],"sourcesContent":["import { createImplementation, Result } from \"@webiny/feature/api\";\nimport {\n EventPublisher,\n EventPublisher as EventPublisherAbstraction\n} from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport {\n UpdateFolderRepository,\n UpdateFolderUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\nimport { GetFolderRepository } from \"../GetFolder/abstractions.js\";\nimport { FolderAfterUpdateEvent, FolderBeforeUpdateEvent } from \"./events.js\";\nimport type { Folder, UpdateFolderParams } from \"~/folder/folder.types.js\";\n\nclass UpdateFolderUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private eventPublisher: EventPublisherAbstraction.Interface,\n private getFolderRepository: GetFolderRepository.Interface,\n private repository: UpdateFolderRepository.Interface\n ) {}\n\n async execute(\n id: string,\n input: UpdateFolderParams\n ): Promise<Result<Folder, UseCaseAbstraction.Error>> {\n const useCaseInput = { id, data: input };\n\n // Get original folder for events\n const originalResult = await this.getFolderRepository.execute(id);\n\n if (originalResult.isFail()) {\n return originalResult;\n }\n\n const original = originalResult.value;\n\n // Publish before update event\n const beforeUpdateEvent = new FolderBeforeUpdateEvent({\n original,\n input: useCaseInput\n });\n\n await this.eventPublisher.publish(beforeUpdateEvent);\n\n // Execute the update operation\n const result = await this.repository.execute(id, input);\n\n if (result.isFail()) {\n return result;\n }\n\n const folder = result.value;\n\n // Publish after update event\n const afterUpdateEvent = new FolderAfterUpdateEvent({\n original,\n folder,\n input: useCaseInput\n });\n\n await this.eventPublisher.publish(afterUpdateEvent);\n\n return Result.ok(folder);\n }\n}\n\nexport const UpdateFolderUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: UpdateFolderUseCaseImpl,\n dependencies: [EventPublisher, GetFolderRepository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AAM;MACNV,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAM,IAAI,CAACN,cAAc,CAACa,OAAO,CAACG,gBAAgB,CAAC;IAEnD,OAAO1B,MAAM,CAAC2B,EAAE,CAACF,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMtB,mBAAmB,GAAGJ,oBAAoB,CAAC;EACpD6B,WAAW,EAAExB,kBAAkB;EAC/ByB,cAAc,EAAErB,uBAAuB;EACvCsB,YAAY,EAAE,CAAC7B,cAAc,EAAEI,mBAAmB,EAAEH,sBAAsB;AAC9E,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { Result } from "@webiny/feature/api";
2
- import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/EventPublisher";
2
+ import type { DomainEvent, IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { Folder, UpdateFolderParams } from "../../../folder/folder.types.js";
4
4
  import { FolderCannotMoveToNewParent, type FolderNotAuthorizedError, type FolderNotFoundError, type FolderPersistenceError, type FolderValidationError } from "../../../domain/folder/errors.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","UpdateFolderRepository","UpdateFolderUseCase","FolderBeforeUpdateEventHandler","FolderAfterUpdateEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { Folder, UpdateFolderParams } from \"~/folder/folder.types.js\";\nimport {\n FolderCannotMoveToNewParent,\n type FolderNotAuthorizedError,\n type FolderNotFoundError,\n type FolderPersistenceError,\n type FolderValidationError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * UpdateFolder repository interface\n */\nexport interface IUpdateFolderRepository {\n execute(id: string, data: UpdateFolderParams): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface IUpdateFolderRepositoryErrors {\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype RepositoryError = IUpdateFolderRepositoryErrors[keyof IUpdateFolderRepositoryErrors];\n\n/** Persist folder updates. */\nexport const UpdateFolderRepository =\n createAbstraction<IUpdateFolderRepository>(\"UpdateFolderRepository\");\n\nexport namespace UpdateFolderRepository {\n export type Interface = IUpdateFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * UpdateFolder use case interface\n */\nexport interface IUpdateFolderUseCase {\n execute(id: string, data: UpdateFolderParams): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface IUpdateFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n cannotMoveToNewParent: FolderCannotMoveToNewParent;\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype UseCaseError = IUpdateFolderUseCaseErrors[keyof IUpdateFolderUseCaseErrors];\n\n/** Update a folder. */\nexport const UpdateFolderUseCase = createAbstraction<IUpdateFolderUseCase>(\"UpdateFolderUseCase\");\n\nexport namespace UpdateFolderUseCase {\n export type Interface = IUpdateFolderUseCase;\n export type Return = Promise<Result<Folder, UseCaseError>>;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeUpdatePayload {\n original: Folder;\n input: Record<string, any>;\n}\n\nexport interface FolderAfterUpdatePayload {\n original: Folder;\n folder: Folder;\n input: Record<string, any>;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is updated. */\nexport const FolderBeforeUpdateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>\n>(\"FolderBeforeUpdateEventHandler\");\n\nexport namespace FolderBeforeUpdateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>;\n export type Event = DomainEvent<FolderBeforeUpdatePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is updated. */\nexport const FolderAfterUpdateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterUpdatePayload>>\n>(\"FolderAfterUpdateEventHandler\");\n\nexport namespace FolderAfterUpdateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterUpdatePayload>>;\n export type Event = DomainEvent<FolderAfterUpdatePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAYvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAeA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAQjG;;AAYA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","UpdateFolderRepository","UpdateFolderUseCase","FolderBeforeUpdateEventHandler","FolderAfterUpdateEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { Folder, UpdateFolderParams } from \"~/folder/folder.types.js\";\nimport {\n FolderCannotMoveToNewParent,\n type FolderNotAuthorizedError,\n type FolderNotFoundError,\n type FolderPersistenceError,\n type FolderValidationError\n} from \"~/domain/folder/errors.js\";\n\n/**\n * UpdateFolder repository interface\n */\nexport interface IUpdateFolderRepository {\n execute(id: string, data: UpdateFolderParams): Promise<Result<Folder, RepositoryError>>;\n}\n\nexport interface IUpdateFolderRepositoryErrors {\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype RepositoryError = IUpdateFolderRepositoryErrors[keyof IUpdateFolderRepositoryErrors];\n\n/** Persist folder updates. */\nexport const UpdateFolderRepository =\n createAbstraction<IUpdateFolderRepository>(\"UpdateFolderRepository\");\n\nexport namespace UpdateFolderRepository {\n export type Interface = IUpdateFolderRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * UpdateFolder use case interface\n */\nexport interface IUpdateFolderUseCase {\n execute(id: string, data: UpdateFolderParams): Promise<Result<Folder, UseCaseError>>;\n}\n\nexport interface IUpdateFolderUseCaseErrors {\n notAuthorized: FolderNotAuthorizedError;\n notFound: FolderNotFoundError;\n cannotMoveToNewParent: FolderCannotMoveToNewParent;\n persistence: FolderPersistenceError;\n validation: FolderValidationError;\n}\n\ntype UseCaseError = IUpdateFolderUseCaseErrors[keyof IUpdateFolderUseCaseErrors];\n\n/** Update a folder. */\nexport const UpdateFolderUseCase = createAbstraction<IUpdateFolderUseCase>(\"UpdateFolderUseCase\");\n\nexport namespace UpdateFolderUseCase {\n export type Interface = IUpdateFolderUseCase;\n export type Return = Promise<Result<Folder, UseCaseError>>;\n export type Error = UseCaseError;\n}\n\n// Event Payload Types\nexport interface FolderBeforeUpdatePayload {\n original: Folder;\n input: Record<string, any>;\n}\n\nexport interface FolderAfterUpdatePayload {\n original: Folder;\n folder: Folder;\n input: Record<string, any>;\n}\n\n// Event Handler Abstractions\n/** Hook into folder lifecycle before a folder is updated. */\nexport const FolderBeforeUpdateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>\n>(\"FolderBeforeUpdateEventHandler\");\n\nexport namespace FolderBeforeUpdateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>;\n export type Event = DomainEvent<FolderBeforeUpdatePayload>;\n}\n\n/** Hook into folder lifecycle after a folder is updated. */\nexport const FolderAfterUpdateEventHandler = createAbstraction<\n IEventHandler<DomainEvent<FolderAfterUpdatePayload>>\n>(\"FolderAfterUpdateEventHandler\");\n\nexport namespace FolderAfterUpdateEventHandler {\n export type Interface = IEventHandler<DomainEvent<FolderAfterUpdatePayload>>;\n export type Event = DomainEvent<FolderAfterUpdatePayload>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAYvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC;;AAOxE;AACA;AACA;;AAeA;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAQjG;;AAYA;AACA;AACA,OAAO,MAAMG,8BAA8B,GAAGH,iBAAiB,CAE7D,gCAAgC,CAAC;AAOnC;AACA,OAAO,MAAMI,6BAA6B,GAAGJ,iBAAiB,CAE5D,+BAA+B,CAAC","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import type { FolderBeforeUpdatePayload, FolderAfterUpdatePayload } from "./abstractions.js";
3
3
  export declare class FolderBeforeUpdateEvent extends DomainEvent<FolderBeforeUpdatePayload> {
4
4
  eventType: "folder.beforeUpdate";
5
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>>;
5
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderBeforeUpdatePayload>>>;
6
6
  }
7
7
  export declare class FolderAfterUpdateEvent extends DomainEvent<FolderAfterUpdatePayload> {
8
8
  eventType: "folder.afterUpdate";
9
- getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<FolderAfterUpdatePayload>>>;
9
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<DomainEvent<FolderAfterUpdatePayload>>>;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
2
  import { FolderBeforeUpdateEventHandler, FolderAfterUpdateEventHandler } from "./abstractions.js";
3
3
  // FolderBeforeUpdate Event
4
4
  export class FolderBeforeUpdateEvent extends DomainEvent {
@@ -1 +1 @@
1
- {"version":3,"names":["DomainEvent","FolderBeforeUpdateEventHandler","FolderAfterUpdateEventHandler","FolderBeforeUpdateEvent","eventType","getHandlerAbstraction","FolderAfterUpdateEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport { FolderBeforeUpdateEventHandler, FolderAfterUpdateEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeUpdatePayload, FolderAfterUpdatePayload } from \"./abstractions.js\";\n\n// FolderBeforeUpdate Event\nexport class FolderBeforeUpdateEvent extends DomainEvent<FolderBeforeUpdatePayload> {\n eventType = \"folder.beforeUpdate\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeUpdateEventHandler;\n }\n}\n\n// FolderAfterUpdate Event\nexport class FolderAfterUpdateEvent extends DomainEvent<FolderAfterUpdatePayload> {\n eventType = \"folder.afterUpdate\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterUpdateEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0CAA0C;AACtE,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DomainEvent","FolderBeforeUpdateEventHandler","FolderAfterUpdateEventHandler","FolderBeforeUpdateEvent","eventType","getHandlerAbstraction","FolderAfterUpdateEvent"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { FolderBeforeUpdateEventHandler, FolderAfterUpdateEventHandler } from \"./abstractions.js\";\nimport type { FolderBeforeUpdatePayload, FolderAfterUpdatePayload } from \"./abstractions.js\";\n\n// FolderBeforeUpdate Event\nexport class FolderBeforeUpdateEvent extends DomainEvent<FolderBeforeUpdatePayload> {\n eventType = \"folder.beforeUpdate\" as const;\n\n getHandlerAbstraction() {\n return FolderBeforeUpdateEventHandler;\n }\n}\n\n// FolderAfterUpdate Event\nexport class FolderAfterUpdateEvent extends DomainEvent<FolderAfterUpdatePayload> {\n eventType = \"folder.afterUpdate\" as const;\n\n getHandlerAbstraction() {\n return FolderAfterUpdateEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mDAAmD;AAC/E,SAASC,8BAA8B,EAAEC,6BAA6B;AAGtE;AACA,OAAO,MAAMC,uBAAuB,SAASH,WAAW,CAA4B;EAChFI,SAAS,GAAG,qBAAqB;EAEjCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,8BAA8B;EACzC;AACJ;;AAEA;AACA,OAAO,MAAMK,sBAAsB,SAASN,WAAW,CAA2B;EAC9EI,SAAS,GAAG,oBAAoB;EAEhCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,6BAA6B;EACxC;AACJ","ignoreList":[]}
@@ -1,7 +1,8 @@
1
- import type { CmsFieldTypePlugins, CmsModel } from "@webiny/api-headless-cms/types/index.js";
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
2
3
  export interface CreateFolderTypeDefsParams {
3
4
  model: CmsModel;
4
5
  models: CmsModel[];
5
- plugins: CmsFieldTypePlugins;
6
+ fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
6
7
  }
7
8
  export declare const createFolderTypeDefs: (params: CreateFolderTypeDefsParams) => string;
@@ -21,7 +21,7 @@ export const createFolderTypeDefs = params => {
21
21
  const {
22
22
  model,
23
23
  models,
24
- plugins: fieldTypePlugins
24
+ fieldRegistry
25
25
  } = params;
26
26
  const {
27
27
  fields
@@ -31,19 +31,19 @@ export const createFolderTypeDefs = params => {
31
31
  model,
32
32
  fields,
33
33
  type: "manage",
34
- fieldTypePlugins
34
+ fieldRegistry
35
35
  });
36
36
  const inputCreateFields = renderInputFields({
37
37
  models,
38
38
  model,
39
39
  fields,
40
- fieldTypePlugins
40
+ fieldRegistry
41
41
  });
42
42
  const inputUpdateFields = renderInputFields({
43
43
  models,
44
44
  model,
45
45
  fields: createUpdateFields(fields),
46
- fieldTypePlugins
46
+ fieldRegistry
47
47
  });
48
48
  return /* GraphQL */`
49
49
  ${fieldTypes.map(f => f.typeDefs).join("\n")}
@@ -1 +1 @@
1
- {"version":3,"names":["renderFields","renderInputFields","removeFieldRequiredValidation","field","validation","filter","name","listValidation","v","createUpdateFields","fields","reduce","collection","push","createFolderTypeDefs","params","model","models","plugins","fieldTypePlugins","fieldTypes","type","inputCreateFields","inputUpdateFields","map","f","typeDefs","join"],"sources":["createFolderTypeDefs.ts"],"sourcesContent":["import type {\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields.js\";\nimport { renderInputFields } from \"@webiny/api-headless-cms/utils/renderInputFields.js\";\n\nexport interface CreateFolderTypeDefsParams {\n model: CmsModel;\n models: CmsModel[];\n plugins: CmsFieldTypePlugins;\n}\n\nconst removeFieldRequiredValidation = (field: CmsModelField) => {\n if (field.validation) {\n field.validation = field.validation.filter(validation => validation.name !== \"required\");\n }\n if (field.listValidation) {\n field.listValidation = field.listValidation.filter(v => v.name !== \"required\");\n }\n return field;\n};\n\nconst createUpdateFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.reduce<CmsModelField[]>((collection, field) => {\n collection.push(removeFieldRequiredValidation({ ...field }));\n return collection;\n }, []);\n};\n\nexport const createFolderTypeDefs = (params: CreateFolderTypeDefsParams): string => {\n const { model, models, plugins: fieldTypePlugins } = params;\n const { fields } = model;\n\n const fieldTypes = renderFields({\n models,\n model,\n fields,\n type: \"manage\",\n fieldTypePlugins\n });\n const inputCreateFields = renderInputFields({\n models,\n model,\n fields,\n fieldTypePlugins\n });\n const inputUpdateFields = renderInputFields({\n models,\n model,\n fields: createUpdateFields(fields),\n fieldTypePlugins\n });\n\n return /* GraphQL */ `\n ${fieldTypes.map(f => f.typeDefs).join(\"\\n\")}\n \n type Folder {\n id: ID!\n # Tells us if the current user can manage folder structure.\n canManageStructure: Boolean\n\n # Tells us if the current user can manage folder permissions.\n canManagePermissions: Boolean\n\n # Tells us if the current user can manage folder content.\n canManageContent: Boolean\n\n # Tells us if the folder contains non-inherited permissions.\n hasNonInheritedPermissions: Boolean\n\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n \n ${fieldTypes.map(f => f.fields).join(\"\\n\")}\n }\n\n ${inputCreateFields.map(f => f.typeDefs).join(\"\\n\")}\n \n input FolderCreateInput {\n # Pass an ID if you want to create a folder with a specific ID.\n id: ID \n \n ${inputCreateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FolderUpdateInput {\n ${inputUpdateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FoldersListWhereInput {\n type: String!\n parentId: ID\n parentId_in: [ID]\n slug: String\n slug_not: String\n slug_contains: String\n slug_not_contains: String\n slug_in: [String]\n slug_not_in: [String]\n slug_startsWith: String\n slug_not_startsWith: String\n path: String\n path_not: String\n path_contains: String\n path_not_contains: String\n path_in: [String]\n path_not_in: [String]\n path_startsWith: String\n path_not_startsWith: String\n createdBy: ID\n }\n \n type FolderResponse {\n data: Folder\n error: AcoError\n }\n\n type FoldersListResponse {\n data: [Folder]\n error: AcoError\n meta: AcoMeta\n }\n\n type FoldersHierarchyData {\n parents: [Folder]\n siblings: [Folder]\n }\n\n type FoldersHierarchyResponse {\n data: FoldersHierarchyData\n error: AcoError\n }\n\n type FolderLevelPermissionsTarget {\n id: ID!\n type: String!\n target: ID!\n name: String!\n meta: JSON\n }\n\n type FolderLevelPermissionsTargetsListMeta {\n totalCount: Int!\n }\n\n type FolderLevelPermissionsTargetsListResponse {\n data: [FolderLevelPermissionsTarget]\n meta: FolderLevelPermissionsTargetsListMeta\n error: AcoError\n }\n \n type FolderModelResponse {\n data: JSON\n error: AcoError\n }\n\n extend type AcoQuery {\n getFolderModel: FolderModelResponse!\n getFolder(id: ID!): FolderResponse\n listFolders(\n where: FoldersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FoldersListResponse\n getFolderHierarchy(type: String!, id: ID!): FoldersHierarchyResponse\n listFolderLevelPermissionsTargets: FolderLevelPermissionsTargetsListResponse\n }\n\n extend type AcoMutation {\n createFolder(data: FolderCreateInput!): FolderResponse\n updateFolder(id: ID!, data: FolderUpdateInput!): FolderResponse\n deleteFolder(id: ID!): AcoBooleanResponse\n }\n \n # The base type is dynamically generated from a Folder model\n \n extend type AcoFolder_Permissions {\n inheritedFrom: ID\n }\n \n extend input AcoFolder_PermissionsInput {\n inheritedFrom: ID\n }\n `;\n};\n"],"mappings":"AAKA,SAASA,YAAY,QAAQ,gDAAgD;AAC7E,SAASC,iBAAiB,QAAQ,qDAAqD;AAQvF,MAAMC,6BAA6B,GAAIC,KAAoB,IAAK;EAC5D,IAAIA,KAAK,CAACC,UAAU,EAAE;IAClBD,KAAK,CAACC,UAAU,GAAGD,KAAK,CAACC,UAAU,CAACC,MAAM,CAACD,UAAU,IAAIA,UAAU,CAACE,IAAI,KAAK,UAAU,CAAC;EAC5F;EACA,IAAIH,KAAK,CAACI,cAAc,EAAE;IACtBJ,KAAK,CAACI,cAAc,GAAGJ,KAAK,CAACI,cAAc,CAACF,MAAM,CAACG,CAAC,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A,UAAUL,iBAAiB,CAACE,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA,eAAeL,iBAAiB,CAACE,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACf,MAAM,CAAC,CAACiB,IAAI,CAAC,IAAI,CAAC;AAC9D;AACA;AACA;AACA,cAAcJ,iBAAiB,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACf,MAAM,CAAC,CAACiB,IAAI,CAAC,IAAI,CAAC;AAC7D;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;AACA;AACA;AACA,KAAK;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["renderFields","renderInputFields","removeFieldRequiredValidation","field","validation","filter","name","listValidation","v","createUpdateFields","fields","reduce","collection","push","createFolderTypeDefs","params","model","models","fieldRegistry","fieldTypes","type","inputCreateFields","inputUpdateFields","map","f","typeDefs","join"],"sources":["createFolderTypeDefs.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields.js\";\nimport { renderInputFields } from \"@webiny/api-headless-cms/utils/renderInputFields.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport interface CreateFolderTypeDefsParams {\n model: CmsModel;\n models: CmsModel[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nconst removeFieldRequiredValidation = (field: CmsModelField) => {\n if (field.validation) {\n field.validation = field.validation.filter(validation => validation.name !== \"required\");\n }\n if (field.listValidation) {\n field.listValidation = field.listValidation.filter(v => v.name !== \"required\");\n }\n return field;\n};\n\nconst createUpdateFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.reduce<CmsModelField[]>((collection, field) => {\n collection.push(removeFieldRequiredValidation({ ...field }));\n return collection;\n }, []);\n};\n\nexport const createFolderTypeDefs = (params: CreateFolderTypeDefsParams): string => {\n const { model, models, fieldRegistry } = params;\n const { fields } = model;\n\n const fieldTypes = renderFields({\n models,\n model,\n fields,\n type: \"manage\",\n fieldRegistry\n });\n const inputCreateFields = renderInputFields({\n models,\n model,\n fields,\n fieldRegistry\n });\n const inputUpdateFields = renderInputFields({\n models,\n model,\n fields: createUpdateFields(fields),\n fieldRegistry\n });\n\n return /* GraphQL */ `\n ${fieldTypes.map(f => f.typeDefs).join(\"\\n\")}\n \n type Folder {\n id: ID!\n # Tells us if the current user can manage folder structure.\n canManageStructure: Boolean\n\n # Tells us if the current user can manage folder permissions.\n canManagePermissions: Boolean\n\n # Tells us if the current user can manage folder content.\n canManageContent: Boolean\n\n # Tells us if the folder contains non-inherited permissions.\n hasNonInheritedPermissions: Boolean\n\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n \n ${fieldTypes.map(f => f.fields).join(\"\\n\")}\n }\n\n ${inputCreateFields.map(f => f.typeDefs).join(\"\\n\")}\n \n input FolderCreateInput {\n # Pass an ID if you want to create a folder with a specific ID.\n id: ID \n \n ${inputCreateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FolderUpdateInput {\n ${inputUpdateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FoldersListWhereInput {\n type: String!\n parentId: ID\n parentId_in: [ID]\n slug: String\n slug_not: String\n slug_contains: String\n slug_not_contains: String\n slug_in: [String]\n slug_not_in: [String]\n slug_startsWith: String\n slug_not_startsWith: String\n path: String\n path_not: String\n path_contains: String\n path_not_contains: String\n path_in: [String]\n path_not_in: [String]\n path_startsWith: String\n path_not_startsWith: String\n createdBy: ID\n }\n \n type FolderResponse {\n data: Folder\n error: AcoError\n }\n\n type FoldersListResponse {\n data: [Folder]\n error: AcoError\n meta: AcoMeta\n }\n\n type FoldersHierarchyData {\n parents: [Folder]\n siblings: [Folder]\n }\n\n type FoldersHierarchyResponse {\n data: FoldersHierarchyData\n error: AcoError\n }\n\n type FolderLevelPermissionsTarget {\n id: ID!\n type: String!\n target: ID!\n name: String!\n meta: JSON\n }\n\n type FolderLevelPermissionsTargetsListMeta {\n totalCount: Int!\n }\n\n type FolderLevelPermissionsTargetsListResponse {\n data: [FolderLevelPermissionsTarget]\n meta: FolderLevelPermissionsTargetsListMeta\n error: AcoError\n }\n \n type FolderModelResponse {\n data: JSON\n error: AcoError\n }\n\n extend type AcoQuery {\n getFolderModel: FolderModelResponse!\n getFolder(id: ID!): FolderResponse\n listFolders(\n where: FoldersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FoldersListResponse\n getFolderHierarchy(type: String!, id: ID!): FoldersHierarchyResponse\n listFolderLevelPermissionsTargets: FolderLevelPermissionsTargetsListResponse\n }\n\n extend type AcoMutation {\n createFolder(data: FolderCreateInput!): FolderResponse\n updateFolder(id: ID!, data: FolderUpdateInput!): FolderResponse\n deleteFolder(id: ID!): AcoBooleanResponse\n }\n \n # The base type is dynamically generated from a Folder model\n \n extend type AcoFolder_Permissions {\n inheritedFrom: ID\n }\n \n extend input AcoFolder_PermissionsInput {\n inheritedFrom: ID\n }\n `;\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gDAAgD;AAC7E,SA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c;AACzB,UAAUC,UAAU,CAACI,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcP,UAAU,CAACI,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACd,MAAM,CAAC,CAACgB,IAAI,CAAC,IAAI,CAAC;AACtD;AACA;AACA,UAAUL,iBAAiB,CAACE,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA,eAAeL,iBAAiB,CAACE,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACd,MAAM,CAAC,CAACgB,IAAI,CAAC,IAAI,CAAC;AAC9D;AACA;AACA;AACA,cAAcJ,iBAAiB,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACd,MAAM,CAAC,CAACgB,IAAI,CAAC,IAAI,CAAC;AAC7D;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;AACA;AACA;AACA,KAAK;AACL,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-aco",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -19,48 +19,39 @@
19
19
  "directory": "dist"
20
20
  },
21
21
  "exports": {
22
- "./features/flp/FolderLevelPermissions": "./features/flp/FolderLevelPermissions/index.js",
23
- "./features/folder/CreateFolder": "./features/folder/CreateFolder/index.js",
24
- "./features/folder/UpdateFolder": "./features/folder/UpdateFolder/index.js",
25
- "./features/folder/DeleteFolder": "./features/folder/DeleteFolder/index.js",
26
- "./features/folder/GetAncestors": "./features/folder/GetAncestors/index.js",
27
- "./features/folder/GetFolder": "./features/folder/GetFolder/index.js",
28
- "./features/folder/GetFolderHierarchy": "./features/folder/GetFolderHierarchy/index.js",
29
- "./features/folder/ListFolders": "./features/folder/ListFolders/index.js",
30
- "./features/folder/EnsureFolderIsEmpty": "./features/folder/EnsureFolderIsEmpty/index.js",
31
22
  "./*": "./*",
32
23
  ".": "./index.js"
33
24
  },
34
25
  "dependencies": {
35
- "@webiny/api": "6.1.0",
36
- "@webiny/api-core": "6.1.0",
37
- "@webiny/api-headless-cms": "6.1.0",
38
- "@webiny/aws-sdk": "6.1.0",
39
- "@webiny/db-dynamodb": "6.1.0",
26
+ "@webiny/api": "6.2.0",
27
+ "@webiny/api-core": "6.2.0",
28
+ "@webiny/api-headless-cms": "6.2.0",
29
+ "@webiny/aws-sdk": "6.2.0",
30
+ "@webiny/db-dynamodb": "6.2.0",
40
31
  "@webiny/di": "0.2.3",
41
- "@webiny/error": "6.1.0",
42
- "@webiny/feature": "6.1.0",
43
- "@webiny/handler": "6.1.0",
44
- "@webiny/handler-graphql": "6.1.0",
45
- "@webiny/shared-aco": "6.1.0",
46
- "@webiny/tasks": "6.1.0",
47
- "@webiny/utils": "6.1.0",
48
- "@webiny/validation": "6.1.0",
49
- "lodash": "4.17.23"
32
+ "@webiny/error": "6.2.0",
33
+ "@webiny/feature": "6.2.0",
34
+ "@webiny/handler": "6.2.0",
35
+ "@webiny/handler-graphql": "6.2.0",
36
+ "@webiny/shared-aco": "6.2.0",
37
+ "@webiny/tasks": "6.2.0",
38
+ "@webiny/utils": "6.2.0",
39
+ "@webiny/validation": "6.2.0",
40
+ "lodash": "4.18.1"
50
41
  },
51
42
  "devDependencies": {
52
- "@webiny/api-core-ddb": "6.1.0",
53
- "@webiny/api-file-manager": "6.1.0",
54
- "@webiny/build-tools": "6.1.0",
55
- "@webiny/handler-aws": "6.1.0",
56
- "@webiny/plugins": "6.1.0",
57
- "@webiny/project-utils": "6.1.0",
58
- "@webiny/wcp": "6.1.0",
43
+ "@webiny/api-core-ddb": "6.2.0",
44
+ "@webiny/api-file-manager": "6.2.0",
45
+ "@webiny/build-tools": "6.2.0",
46
+ "@webiny/handler-aws": "6.2.0",
47
+ "@webiny/plugins": "6.2.0",
48
+ "@webiny/project-utils": "6.2.0",
49
+ "@webiny/wcp": "6.2.0",
59
50
  "graphql": "16.13.2",
60
51
  "prettier": "3.6.2",
61
52
  "rimraf": "6.1.3",
62
53
  "typescript": "5.9.3",
63
- "vitest": "4.1.2"
54
+ "vitest": "4.1.4"
64
55
  },
65
- "gitHead": "65e0ac1889b3392c99b8cac6cde508e1e831c715"
56
+ "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
66
57
  }
package/utils/compress.js CHANGED
@@ -1,4 +1,4 @@
1
- import { compress as gzip } from "@webiny/utils/compression/gzip.js";
1
+ import { compress as gzip } from "@webiny/utils/features/compression/legacy/gzip.js";
2
2
  const GZIP = "gzip";
3
3
  const TO_STORAGE_ENCODING = "base64";
4
4
  export const compress = async data => {
@@ -1 +1 @@
1
- {"version":3,"names":["compress","gzip","GZIP","TO_STORAGE_ENCODING","data","value","JSON","stringify","compression","toString"],"sources":["compress.ts"],"sourcesContent":["import { compress as gzip } from \"@webiny/utils/compression/gzip.js\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\n\nexport const compress = async (data: any) => {\n const value = await gzip(JSON.stringify(data));\n\n return {\n compression: GZIP,\n value: value.toString(TO_STORAGE_ENCODING)\n };\n};\n"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,mCAAmC;AAEpE,MAAMC,IAAI,GAAG,MAAM;AACnB,MAAMC,mBAAmB,GAAG,QAAQ;AAEpC,OAAO,MAAMH,QAAQ,GAAG,MAAOI,IAAS,IAAK;EACzC,MAAMC,KAAK,GAAG,MAAMJ,IAAI,CAACK,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;EAE9C,OAAO;IACHI,WAAW,EAAEN,IAAI;IACjBG,KAAK,EAAEA,KAAK,CAACI,QAAQ,CAACN,mBAAmB;EAC7C,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["compress","gzip","GZIP","TO_STORAGE_ENCODING","data","value","JSON","stringify","compression","toString"],"sources":["compress.ts"],"sourcesContent":["import { compress as gzip } from \"@webiny/utils/features/compression/legacy/gzip.js\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\n\nexport const compress = async (data: any) => {\n const value = await gzip(JSON.stringify(data));\n\n return {\n compression: GZIP,\n value: value.toString(TO_STORAGE_ENCODING)\n };\n};\n"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,mDAAmD;AAEpF,MAAMC,IAAI,GAAG,MAAM;AACnB,MAAMC,mBAAmB,GAAG,QAAQ;AAEpC,OAAO,MAAMH,QAAQ,GAAG,MAAOI,IAAS,IAAK;EACzC,MAAMC,KAAK,GAAG,MAAMJ,IAAI,CAACK,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;EAE9C,OAAO;IACHI,WAAW,EAAEN,IAAI;IACjBG,KAAK,EAAEA,KAAK,CAACI,QAAQ,CAACN,mBAAmB;EAC7C,CAAC;AACL,CAAC","ignoreList":[]}