@webiny/api-core 6.5.2-beta.2 → 6.5.2-beta.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"features/task/TaskDefinition/abstractions.js","sources":["../../../../src/features/task/TaskDefinition/abstractions.ts"],"sourcesContent":["import zod from \"zod\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { ITask } from \"~/features/task/TaskService/index.js\";\nimport { TaskController } from \"~/features/task/TaskController/index.js\";\n\nexport type ITaskInput = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskOutput {\n error?: IResponseError;\n [key: string]: any;\n}\n\n/**\n * Task run params - ONLY the input data\n * All runtime dependencies come from TaskController (injected separately)\n */\nexport interface ITaskRunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n input: I;\n controller: TaskController.Interface<I, O>;\n}\n\n/**\n * Data for creating a new task\n */\nexport interface ITaskCreateData<I = ITaskInput> {\n definitionId: string;\n name: string;\n input: I;\n parentId?: string;\n}\n\n/**\n * Parameters for onBeforeTrigger lifecycle hook\n */\nexport interface ITaskBeforeTriggerParams<I = ITaskInput> {\n data: ITaskCreateData<I>;\n}\n\n/**\n * Task result status enum\n */\nexport enum TaskResultStatus {\n DONE = \"done\",\n CONTINUE = \"continue\",\n ERROR = \"error\",\n ABORTED = \"aborted\"\n}\n\n/**\n * Specific result types\n */\nexport interface ITaskResultDone<O extends ITaskOutput = ITaskOutput> {\n status: TaskResultStatus.DONE;\n message?: string;\n output?: O;\n}\n\nexport interface ITaskResultContinue<I = ITaskInput> {\n status: TaskResultStatus.CONTINUE;\n input: I;\n wait?: number; // seconds to wait before next iteration\n}\n\nexport interface ITaskResultError {\n status: TaskResultStatus.ERROR;\n error: IResponseError;\n}\n\nexport interface ITaskResultAborted {\n status: TaskResultStatus.ABORTED;\n}\n\nexport type ITaskResult<I = ITaskInput, O extends ITaskOutput = ITaskOutput> =\n | ITaskResultDone<O>\n | ITaskResultContinue<I>\n | ITaskResultError\n | ITaskResultAborted;\n\nexport type ISelfCleanupEvent = \"onSuccess\" | \"onError\" | \"onAbort\";\n\nexport type ISelfCleanup = \"always\" | \"never\" | ISelfCleanupEvent | ISelfCleanupEvent[];\n\nexport type ITaskLifecycleHook<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> = {\n task: ITask<I, O>;\n};\n\n/**\n * Core TaskDefinition - minimal interface\n */\nexport interface ITaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n id: string;\n title: string;\n description?: string;\n maxIterations?: number;\n databaseLogs?: boolean;\n isPrivate?: boolean;\n selfCleanup?: ISelfCleanup;\n\n /**\n * Core run method - receives ONLY input params\n * All runtime dependencies (logging, state management, etc.) come from TaskController\n */\n run(params: ITaskRunParams<I, O>): Promise<ITaskResult<I, O>>;\n\n /**\n * Optional lifecycle hooks - receive task data, no context.\n */\n onBeforeTrigger?(params: ITaskBeforeTriggerParams<I>): Promise<void>;\n onDone?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onError?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onAbort?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onMaxIterations?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n */\n createInputValidation?(\n params: ITaskCreateInputValidationParams\n ): GenericRecord<keyof I, zod.Schema> | zod.Schema;\n}\n\nexport interface ITaskCreateInputValidationParams {\n validator: typeof zod;\n}\n\n/** Define a long-running background task with lifecycle hooks. */\nexport const TaskDefinition = createAbstraction<ITaskDefinition>(\"TaskDefinition\");\n\n/**\n * IRunnableTaskDefinition represents a TaskDefinition after decoration/processing.\n * All optional runtime properties are guaranteed to have values (with defaults applied).\n * Used internally by the task runner to ensure consistent behavior.\n */\nexport interface IRunnableTaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> extends ITaskDefinition<I, O> {\n // Override optional properties to be required with guaranteed values\n isPrivate: boolean;\n databaseLogs: boolean;\n maxIterations: number;\n}\n\nexport namespace TaskDefinition {\n export type Interface<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskDefinition<I, O>;\n\n export type TaskInput = ITaskInput;\n\n export type TaskOutput = ITaskOutput;\n\n export type Runnable<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = IRunnableTaskDefinition<I, O>;\n\n export type RunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskRunParams<I, O>;\n\n export type Result<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskResult<I, O>;\n\n export type Task<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n\n export type ResultDone<O extends ITaskOutput = ITaskOutput> = ITaskResultDone<O>;\n export type ResultContinue<I = ITaskInput> = ITaskResultContinue<I>;\n export type ResultError = ITaskResultError;\n export type ResultAborted = ITaskResultAborted;\n export type CreateInputValidationParams = ITaskCreateInputValidationParams;\n export type TaskCreateData<I = ITaskInput> = ITaskCreateData<I>;\n export type BeforeTriggerParams<I = ITaskInput> = ITaskBeforeTriggerParams<I>;\n export type LifecycleHookParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskLifecycleHook<I, O>;\n\n export type SelfCleanupEvent = ISelfCleanupEvent;\n export type SelfCleanup = ISelfCleanup;\n}\n"],"names":["TaskResultStatus","TaskDefinition","createAbstraction"],"mappings":";AAoDO,IAAKA,gCAAgBA,WAAAA,GAAAA,SAAhBA,gBAAgB;;;;;WAAhBA;;AA2FL,MAAMC,iBAAiBC,kBAAmC"}
1
+ {"version":3,"file":"features/task/TaskDefinition/abstractions.js","sources":["../../../../src/features/task/TaskDefinition/abstractions.ts"],"sourcesContent":["import zod from \"zod\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { ITask } from \"~/features/task/TaskService/index.js\";\nimport { TaskController } from \"~/features/task/TaskController/index.js\";\n\nexport type ITaskInput = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskOutput {\n error?: IResponseError;\n [key: string]: any;\n}\n\n/**\n * Task run params - ONLY the input data\n * All runtime dependencies come from TaskController (injected separately)\n */\nexport interface ITaskRunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n input: I;\n controller: TaskController.Interface<I, O>;\n}\n\n/**\n * Data for creating a new task\n */\nexport interface ITaskCreateData<I = ITaskInput> {\n definitionId: string;\n name: string;\n input: I;\n parentId?: string;\n}\n\n/**\n * Parameters for onBeforeTrigger lifecycle hook\n */\nexport interface ITaskBeforeTriggerParams<I = ITaskInput> {\n data: ITaskCreateData<I>;\n}\n\n/**\n * Task result status enum\n */\nexport enum TaskResultStatus {\n DONE = \"done\",\n CONTINUE = \"continue\",\n ERROR = \"error\",\n ABORTED = \"aborted\"\n}\n\n/**\n * Specific result types\n */\nexport interface ITaskResultDone<O extends ITaskOutput = ITaskOutput> {\n status: TaskResultStatus.DONE;\n message?: string;\n output?: O;\n}\n\nexport interface ITaskResultContinue<I = ITaskInput> {\n status: TaskResultStatus.CONTINUE;\n input: I;\n wait?: number; // seconds to wait before next iteration\n}\n\nexport interface ITaskResultError {\n status: TaskResultStatus.ERROR;\n error: IResponseError;\n}\n\nexport interface ITaskResultAborted {\n status: TaskResultStatus.ABORTED;\n}\n\nexport type ITaskResult<I = ITaskInput, O extends ITaskOutput = ITaskOutput> =\n | ITaskResultDone<O>\n | ITaskResultContinue<I>\n | ITaskResultError\n | ITaskResultAborted;\n\nexport type ISelfCleanupEvent = \"onSuccess\" | \"onError\" | \"onAbort\";\n\nexport type ISelfCleanup = \"always\" | \"never\" | ISelfCleanupEvent | ISelfCleanupEvent[];\n\nexport type ITaskLifecycleHook<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> = {\n task: ITask<I, O>;\n};\n\n/**\n * Core TaskDefinition - minimal interface\n */\nexport interface ITaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n id: string;\n title: string;\n description?: string;\n maxIterations?: number;\n databaseLogs?: boolean;\n isPrivate?: boolean;\n selfCleanup?: ISelfCleanup;\n\n /**\n * Core run method - receives ONLY input params\n * All runtime dependencies (logging, state management, etc.) come from TaskController\n */\n run(params: ITaskRunParams<I, O>): Promise<ITaskResult<I, O>>;\n\n /**\n * Optional lifecycle hooks - receive task data, no context.\n */\n onBeforeTrigger?(params: ITaskBeforeTriggerParams<I>): Promise<void>;\n onDone?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onError?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onAbort?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onMaxIterations?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n */\n createInputValidation?(\n params: ITaskCreateInputValidationParams\n ): GenericRecord<keyof I, zod.Schema> | zod.Schema;\n}\n\nexport interface ITaskCreateInputValidationParams {\n validator: typeof zod;\n}\n\n/** Define a long-running background task with lifecycle hooks. */\nexport const TaskDefinition = createAbstraction<ITaskDefinition>(\"TaskDefinition\");\n\n/**\n * IRunnableTaskDefinition represents a TaskDefinition after decoration/processing.\n * All optional runtime properties are guaranteed to have values (with defaults applied).\n * Used internally by the task runner to ensure consistent behavior.\n */\nexport interface IRunnableTaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> extends ITaskDefinition<I, O> {\n // Override optional properties to be required with guaranteed values\n isPrivate: boolean;\n databaseLogs: boolean;\n maxIterations: number;\n}\n\nexport namespace TaskDefinition {\n export type Interface<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskDefinition<I, O>;\n\n export type TaskInput = ITaskInput;\n\n export type TaskOutput = ITaskOutput;\n\n export type Runnable<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = IRunnableTaskDefinition<I, O>;\n\n export type RunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskRunParams<I, O>;\n\n export type Result<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskResult<I, O>;\n\n export type Task<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n\n export type ResultDone<O extends ITaskOutput = ITaskOutput> = ITaskResultDone<O>;\n export type ResultContinue<I = ITaskInput> = ITaskResultContinue<I>;\n export type ResultError = ITaskResultError;\n export type ResultAborted = ITaskResultAborted;\n export type CreateInputValidationParams = ITaskCreateInputValidationParams;\n export type TaskCreateData<I = ITaskInput> = ITaskCreateData<I>;\n export type BeforeTriggerParams<I = ITaskInput> = ITaskBeforeTriggerParams<I>;\n export type LifecycleHookParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskLifecycleHook<I, O>;\n\n export type SelfCleanupEvent = ISelfCleanupEvent;\n export type SelfCleanup = ISelfCleanup;\n}\n"],"names":["TaskResultStatus","TaskDefinition","createAbstraction"],"mappings":";AAoDO,IAAKA,gCAAgBA,WAAAA,GAAAA,SAAAA,gBAAAA;;;;;;;AA2FrB,MAAMC,iBAAiBC,kBAAmC"}
@@ -1 +1 @@
1
- {"version":3,"file":"features/task/TaskService/abstractions.js","sources":["../../../../src/features/task/TaskService/abstractions.ts"],"sourcesContent":["import { BaseError, createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { type ITaskOutput, TaskDefinition } from \"~/features/task/TaskDefinition/index.js\";\n\n/** Trigger and manage long-running background tasks. */\nexport const TaskService = createAbstraction<ITaskService>(\"TaskService\");\n\nexport namespace TaskService {\n export type Interface = ITaskService;\n /**\n * This is the output of `trigger` and `abort` actions.\n */\n export type GenericOutput = IGenericOutput;\n\n export type TaskInput = TaskDefinition.TaskInput;\n\n export type Task<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n}\n\n// The service info depends on the implementation.\n// We cannot have a more precise type here, since implementation can be anything (AWS, Azure, etc.).\nexport type IServiceInfo = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskAbortParams {\n id: string;\n message?: string;\n}\n\nexport interface ITaskService {\n trigger: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends IGenericOutput = IGenericOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n abort: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends IGenericOutput = IGenericOutput\n >(\n params: ITaskAbortParams\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n fetchServiceInfo: (input: ITask<any, any> | string) => Promise<Result<IServiceInfo, BaseError>>;\n}\n\nexport interface IGenericOutput {\n error?: IResponseError;\n [key: string]:\n | string\n | string[]\n | number\n | boolean\n | undefined\n | Record<string, any>\n | IResponseError;\n}\n\nexport interface ITaskTriggerParams<I = TaskDefinition.TaskInput> {\n parent?: Pick<ITask, \"id\">;\n definition: string;\n name?: string;\n input?: I;\n delay?: number;\n}\n\nexport interface ITaskValues<T = GenericRecord, O extends ITaskOutput = ITaskOutput> {\n startedOn?: string;\n finishedOn?: string;\n eventResponse: GenericRecord | undefined;\n iterations: number;\n parentId?: string;\n name: string;\n taskStatus: TaskDataStatus;\n definitionId: string;\n executionName: string;\n input: T;\n output?: O;\n}\n\nexport interface ITask<T = GenericRecord, O extends ITaskOutput = ITaskOutput> extends ITaskValues<\n T,\n O\n> {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n createdOn: string;\n savedOn: string;\n createdBy: ITaskIdentity;\n}\n\nexport enum TaskDataStatus {\n PENDING = \"pending\",\n RUNNING = \"running\",\n FAILED = \"failed\",\n SUCCESS = \"success\",\n ABORTED = \"aborted\"\n}\n\nexport interface ITaskIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n"],"names":["TaskService","createAbstraction","TaskDataStatus"],"mappings":";AAKO,MAAMA,cAAcC,kBAAgC;AAgGpD,IAAKC,8BAAcA,WAAAA,GAAAA,SAAdA,cAAc;;;;;;WAAdA"}
1
+ {"version":3,"file":"features/task/TaskService/abstractions.js","sources":["../../../../src/features/task/TaskService/abstractions.ts"],"sourcesContent":["import { BaseError, createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { type ITaskOutput, TaskDefinition } from \"~/features/task/TaskDefinition/index.js\";\n\n/** Trigger and manage long-running background tasks. */\nexport const TaskService = createAbstraction<ITaskService>(\"TaskService\");\n\nexport namespace TaskService {\n export type Interface = ITaskService;\n /**\n * This is the output of `trigger` and `abort` actions.\n */\n export type GenericOutput = IGenericOutput;\n\n export type TaskInput = TaskDefinition.TaskInput;\n\n export type Task<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n}\n\n// The service info depends on the implementation.\n// We cannot have a more precise type here, since implementation can be anything (AWS, Azure, etc.).\nexport type IServiceInfo = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskAbortParams {\n id: string;\n message?: string;\n}\n\nexport interface ITaskService {\n trigger: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends IGenericOutput = IGenericOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n abort: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends IGenericOutput = IGenericOutput\n >(\n params: ITaskAbortParams\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n fetchServiceInfo: (input: ITask<any, any> | string) => Promise<Result<IServiceInfo, BaseError>>;\n}\n\nexport interface IGenericOutput {\n error?: IResponseError;\n [key: string]:\n | string\n | string[]\n | number\n | boolean\n | undefined\n | Record<string, any>\n | IResponseError;\n}\n\nexport interface ITaskTriggerParams<I = TaskDefinition.TaskInput> {\n parent?: Pick<ITask, \"id\">;\n definition: string;\n name?: string;\n input?: I;\n delay?: number;\n}\n\nexport interface ITaskValues<T = GenericRecord, O extends ITaskOutput = ITaskOutput> {\n startedOn?: string;\n finishedOn?: string;\n eventResponse: GenericRecord | undefined;\n iterations: number;\n parentId?: string;\n name: string;\n taskStatus: TaskDataStatus;\n definitionId: string;\n executionName: string;\n input: T;\n output?: O;\n}\n\nexport interface ITask<T = GenericRecord, O extends ITaskOutput = ITaskOutput> extends ITaskValues<\n T,\n O\n> {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n createdOn: string;\n savedOn: string;\n createdBy: ITaskIdentity;\n}\n\nexport enum TaskDataStatus {\n PENDING = \"pending\",\n RUNNING = \"running\",\n FAILED = \"failed\",\n SUCCESS = \"success\",\n ABORTED = \"aborted\"\n}\n\nexport interface ITaskIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n"],"names":["TaskService","createAbstraction","TaskDataStatus"],"mappings":";AAKO,MAAMA,cAAcC,kBAAgC;AAgGpD,IAAKC,8BAAcA,WAAAA,GAAAA,SAAAA,cAAAA"}
@@ -1,6 +1,7 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { AdminUsersRepository } from "./shared/AdminUsersRepository.js";
3
3
  import { GetUserFeature } from "./GetUser/feature.js";
4
+ import { GetCurrentUserFeature } from "./GetCurrentUser/feature.js";
4
5
  import { GetIdentityProfileFeature } from "./GetIdentityProfile/feature.js";
5
6
  import { ListUsersFeature } from "./ListUsers/feature.js";
6
7
  import { CreateUserFeature } from "./CreateUser/feature.js";
@@ -15,6 +16,7 @@ const AdminUsersFeature = createFeature({
15
16
  register (container, storageOperations) {
16
17
  container.register(AdminUsersRepository).inSingletonScope();
17
18
  GetUserFeature.register(container);
19
+ GetCurrentUserFeature.register(container);
18
20
  GetIdentityProfileFeature.register(container);
19
21
  ListUsersFeature.register(container);
20
22
  ListUserTeamsFeature.register(container);
@@ -1 +1 @@
1
- {"version":3,"file":"features/users/AdminUsersFeature.js","sources":["../../../src/features/users/AdminUsersFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AdminUsersRepository } from \"./shared/AdminUsersRepository.js\";\nimport { GetUserFeature } from \"./GetUser/feature.js\";\nimport { GetIdentityProfileFeature } from \"./GetIdentityProfile/feature.js\";\nimport { ListUsersFeature } from \"./ListUsers/feature.js\";\nimport { CreateUserFeature } from \"./CreateUser/feature.js\";\nimport { UpdateUserFeature } from \"./UpdateUser/feature.js\";\nimport { DeleteUserFeature } from \"./DeleteUser/feature.js\";\nimport { ListUserTeamsFeature } from \"./ListUserTeams/feature.js\";\nimport { AdminUsersStorageOperations } from \"./shared/storageAbstractions.js\";\nimport { ExternalIdpUserSyncFeature } from \"./ExternalIdpUserSync/index.js\";\nimport { FindUserRecordsFeature } from \"./FindUserRecords/feature.js\";\n\nexport const AdminUsersFeature = createFeature<AdminUsersStorageOperations.Interface>({\n name: \"AdminUsers\",\n register(container, storageOperations) {\n // Register repository in singleton scope\n container.register(AdminUsersRepository).inSingletonScope();\n\n // Register all use cases\n GetUserFeature.register(container);\n GetIdentityProfileFeature.register(container);\n ListUsersFeature.register(container);\n ListUserTeamsFeature.register(container);\n CreateUserFeature.register(container);\n UpdateUserFeature.register(container);\n DeleteUserFeature.register(container);\n ExternalIdpUserSyncFeature.register(container);\n FindUserRecordsFeature.register(container);\n\n // Legacy storage ops\n container.registerInstance(AdminUsersStorageOperations, storageOperations);\n }\n});\n"],"names":["AdminUsersFeature","createFeature","container","storageOperations","AdminUsersRepository","GetUserFeature","GetIdentityProfileFeature","ListUsersFeature","ListUserTeamsFeature","CreateUserFeature","UpdateUserFeature","DeleteUserFeature","ExternalIdpUserSyncFeature","FindUserRecordsFeature","AdminUsersStorageOperations"],"mappings":";;;;;;;;;;;;AAaO,MAAMA,oBAAoBC,cAAqD;IAClF,MAAM;IACN,UAASC,SAAS,EAAEC,iBAAiB;QAEjCD,UAAU,QAAQ,CAACE,sBAAsB,gBAAgB;QAGzDC,eAAe,QAAQ,CAACH;QACxBI,0BAA0B,QAAQ,CAACJ;QACnCK,iBAAiB,QAAQ,CAACL;QAC1BM,qBAAqB,QAAQ,CAACN;QAC9BO,kBAAkB,QAAQ,CAACP;QAC3BQ,kBAAkB,QAAQ,CAACR;QAC3BS,kBAAkB,QAAQ,CAACT;QAC3BU,2BAA2B,QAAQ,CAACV;QACpCW,uBAAuB,QAAQ,CAACX;QAGhCA,UAAU,gBAAgB,CAACY,6BAA6BX;IAC5D;AACJ"}
1
+ {"version":3,"file":"features/users/AdminUsersFeature.js","sources":["../../../src/features/users/AdminUsersFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AdminUsersRepository } from \"./shared/AdminUsersRepository.js\";\nimport { GetUserFeature } from \"./GetUser/feature.js\";\nimport { GetCurrentUserFeature } from \"./GetCurrentUser/feature.js\";\nimport { GetIdentityProfileFeature } from \"./GetIdentityProfile/feature.js\";\nimport { ListUsersFeature } from \"./ListUsers/feature.js\";\nimport { CreateUserFeature } from \"./CreateUser/feature.js\";\nimport { UpdateUserFeature } from \"./UpdateUser/feature.js\";\nimport { DeleteUserFeature } from \"./DeleteUser/feature.js\";\nimport { ListUserTeamsFeature } from \"./ListUserTeams/feature.js\";\nimport { AdminUsersStorageOperations } from \"./shared/storageAbstractions.js\";\nimport { ExternalIdpUserSyncFeature } from \"./ExternalIdpUserSync/index.js\";\nimport { FindUserRecordsFeature } from \"./FindUserRecords/feature.js\";\n\nexport const AdminUsersFeature = createFeature<AdminUsersStorageOperations.Interface>({\n name: \"AdminUsers\",\n register(container, storageOperations) {\n // Register repository in singleton scope\n container.register(AdminUsersRepository).inSingletonScope();\n\n // Register all use cases\n GetUserFeature.register(container);\n GetCurrentUserFeature.register(container);\n GetIdentityProfileFeature.register(container);\n ListUsersFeature.register(container);\n ListUserTeamsFeature.register(container);\n CreateUserFeature.register(container);\n UpdateUserFeature.register(container);\n DeleteUserFeature.register(container);\n ExternalIdpUserSyncFeature.register(container);\n FindUserRecordsFeature.register(container);\n\n // Legacy storage ops\n container.registerInstance(AdminUsersStorageOperations, storageOperations);\n }\n});\n"],"names":["AdminUsersFeature","createFeature","container","storageOperations","AdminUsersRepository","GetUserFeature","GetCurrentUserFeature","GetIdentityProfileFeature","ListUsersFeature","ListUserTeamsFeature","CreateUserFeature","UpdateUserFeature","DeleteUserFeature","ExternalIdpUserSyncFeature","FindUserRecordsFeature","AdminUsersStorageOperations"],"mappings":";;;;;;;;;;;;;AAcO,MAAMA,oBAAoBC,cAAqD;IAClF,MAAM;IACN,UAASC,SAAS,EAAEC,iBAAiB;QAEjCD,UAAU,QAAQ,CAACE,sBAAsB,gBAAgB;QAGzDC,eAAe,QAAQ,CAACH;QACxBI,sBAAsB,QAAQ,CAACJ;QAC/BK,0BAA0B,QAAQ,CAACL;QACnCM,iBAAiB,QAAQ,CAACN;QAC1BO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,kBAAkB,QAAQ,CAACT;QAC3BU,kBAAkB,QAAQ,CAACV;QAC3BW,2BAA2B,QAAQ,CAACX;QACpCY,uBAAuB,QAAQ,CAACZ;QAGhCA,UAAU,gBAAgB,CAACa,6BAA6BZ;IAC5D;AACJ"}
@@ -3,11 +3,15 @@ import { IdentityContext } from "../../../features/security/IdentityContext/inde
3
3
  import { EventPublisher } from "../../../features/eventPublisher/index.js";
4
4
  import { DeleteUserUseCase as UseCaseAbstraction } from "./abstractions.js";
5
5
  import { AdminUsersRepository } from "../../../features/users/shared/abstractions.js";
6
+ import { RolesRepository } from "../../../features/security/roles/shared/abstractions.js";
7
+ import { TeamsRepository } from "../../../features/security/teams/shared/abstractions.js";
6
8
  declare class DeleteUserUseCaseImpl implements UseCaseAbstraction.Interface {
7
9
  private identityContext;
8
10
  private eventPublisher;
9
11
  private repository;
10
- constructor(identityContext: IdentityContext.Interface, eventPublisher: EventPublisher.Interface, repository: AdminUsersRepository.Interface);
12
+ private rolesRepository;
13
+ private teamsRepository;
14
+ constructor(identityContext: IdentityContext.Interface, eventPublisher: EventPublisher.Interface, repository: AdminUsersRepository.Interface, rolesRepository: RolesRepository.Interface, teamsRepository: TeamsRepository.Interface);
11
15
  execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>>;
12
16
  }
13
17
  export declare const DeleteUserUseCase: import("@webiny/di").Implementation<typeof DeleteUserUseCaseImpl>;
@@ -3,14 +3,20 @@ import { IdentityContext } from "../../security/IdentityContext/index.js";
3
3
  import { EventPublisher } from "../../eventPublisher/index.js";
4
4
  import { DeleteUserUseCase } from "./abstractions.js";
5
5
  import { AdminUsersRepository } from "../shared/abstractions.js";
6
+ import { RolesRepository } from "../../security/roles/shared/abstractions.js";
7
+ import { TeamsRepository } from "../../security/teams/shared/abstractions.js";
8
+ import { canAssignRolesAndTeams } from "../../security/utils/canAssignRolesAndTeams.js";
9
+ import { CANNOT_GRANT_PERMISSIONS_MESSAGE } from "../../security/utils/canGrantPermissions.js";
6
10
  import { NotAuthorizedError } from "../shared/errors.js";
7
11
  import { UserAfterDeleteEvent, UserBeforeDeleteEvent } from "./events.js";
8
12
  import { CannotDeleteOwnAccountError } from "./errors.js";
9
13
  class DeleteUserUseCaseImpl {
10
- constructor(identityContext, eventPublisher, repository){
14
+ constructor(identityContext, eventPublisher, repository, rolesRepository, teamsRepository){
11
15
  this.identityContext = identityContext;
12
16
  this.eventPublisher = eventPublisher;
13
17
  this.repository = repository;
18
+ this.rolesRepository = rolesRepository;
19
+ this.teamsRepository = teamsRepository;
14
20
  }
15
21
  async execute(id) {
16
22
  const permission = await this.identityContext.getPermission("adminUsers.user");
@@ -22,6 +28,14 @@ class DeleteUserUseCaseImpl {
22
28
  const user = getUserResult.value;
23
29
  const identity = this.identityContext.getIdentity();
24
30
  if (user.id === identity.id) return Result.fail(new CannotDeleteOwnAccountError());
31
+ const canAssign = await canAssignRolesAndTeams({
32
+ identityContext: this.identityContext,
33
+ rolesRepository: this.rolesRepository,
34
+ teamsRepository: this.teamsRepository,
35
+ roles: user.roles ?? [],
36
+ teams: user.teams ?? []
37
+ });
38
+ if (!canAssign) return Result.fail(new NotAuthorizedError(CANNOT_GRANT_PERMISSIONS_MESSAGE));
25
39
  await this.eventPublisher.publish(new UserBeforeDeleteEvent({
26
40
  user
27
41
  }));
@@ -39,7 +53,9 @@ const DeleteUserUseCase_DeleteUserUseCase = createImplementation({
39
53
  dependencies: [
40
54
  IdentityContext,
41
55
  EventPublisher,
42
- AdminUsersRepository
56
+ AdminUsersRepository,
57
+ RolesRepository,
58
+ TeamsRepository
43
59
  ]
44
60
  });
45
61
  export { DeleteUserUseCase_DeleteUserUseCase as DeleteUserUseCase };
@@ -1 +1 @@
1
- {"version":3,"file":"features/users/DeleteUser/DeleteUserUseCase.js","sources":["../../../../src/features/users/DeleteUser/DeleteUserUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { DeleteUserUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { AdminUsersRepository } from \"~/features/users/shared/abstractions.js\";\nimport { NotAuthorizedError } from \"~/features/users/shared/errors.js\";\nimport { UserBeforeDeleteEvent, UserAfterDeleteEvent } from \"./events.js\";\nimport { CannotDeleteOwnAccountError } from \"./errors.js\";\n\nclass DeleteUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: AdminUsersRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n // 1. Check permission\n const permission = await this.identityContext.getPermission(\"adminUsers.user\");\n if (!permission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n // 2. Get existing user\n const getUserResult = await this.repository.get({ id });\n if (getUserResult.isFail()) {\n return Result.fail(getUserResult.error);\n }\n\n const user = getUserResult.value;\n\n // 3. Check if trying to delete own account\n const identity = this.identityContext.getIdentity();\n if (user.id === identity.id) {\n return Result.fail(new CannotDeleteOwnAccountError());\n }\n\n // 4. Publish before event\n await this.eventPublisher.publish(new UserBeforeDeleteEvent({ user }));\n\n // 5. Delete user via repository\n const result = await this.repository.delete(user);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n // 6. Publish after event\n await this.eventPublisher.publish(new UserAfterDeleteEvent({ user }));\n\n return Result.ok();\n }\n}\n\nexport const DeleteUserUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: DeleteUserUseCaseImpl,\n dependencies: [IdentityContext, EventPublisher, AdminUsersRepository]\n});\n"],"names":["DeleteUserUseCaseImpl","identityContext","eventPublisher","repository","id","permission","Result","NotAuthorizedError","getUserResult","user","identity","CannotDeleteOwnAccountError","UserBeforeDeleteEvent","result","UserAfterDeleteEvent","DeleteUserUseCase","createImplementation","UseCaseAbstraction","IdentityContext","EventPublisher","AdminUsersRepository"],"mappings":";;;;;;;;AAUA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,cAAwC,EACxCC,UAA0C,CACpD;aAHUF,eAAe,GAAfA;aACAC,cAAc,GAAdA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAmD;QAEvE,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC5D,IAAI,CAACA,YACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAI3B,MAAMC,gBAAgB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAEJ;QAAG;QACrD,IAAII,cAAc,MAAM,IACpB,OAAOF,OAAO,IAAI,CAACE,cAAc,KAAK;QAG1C,MAAMC,OAAOD,cAAc,KAAK;QAGhC,MAAME,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAID,KAAK,EAAE,KAAKC,SAAS,EAAE,EACvB,OAAOJ,OAAO,IAAI,CAAC,IAAIK;QAI3B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,sBAAsB;YAAEH;QAAK;QAGnE,MAAMI,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACJ;QAC5C,IAAII,OAAO,MAAM,IACb,OAAOP,OAAO,IAAI,CAACO,OAAO,KAAK;QAInC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,qBAAqB;YAAEL;QAAK;QAElE,OAAOH,OAAO,EAAE;IACpB;AACJ;AAEO,MAAMS,sCAAoBC,qBAAqB;IAClD,aAAaC;IACb,gBAAgBjB;IAChB,cAAc;QAACkB;QAAiBC;QAAgBC;KAAqB;AACzE"}
1
+ {"version":3,"file":"features/users/DeleteUser/DeleteUserUseCase.js","sources":["../../../../src/features/users/DeleteUser/DeleteUserUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { DeleteUserUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { AdminUsersRepository } from \"~/features/users/shared/abstractions.js\";\nimport { RolesRepository } from \"~/features/security/roles/shared/abstractions.js\";\nimport { TeamsRepository } from \"~/features/security/teams/shared/abstractions.js\";\nimport { canAssignRolesAndTeams } from \"~/features/security/utils/canAssignRolesAndTeams.js\";\nimport { CANNOT_GRANT_PERMISSIONS_MESSAGE } from \"~/features/security/utils/canGrantPermissions.js\";\nimport { NotAuthorizedError } from \"~/features/users/shared/errors.js\";\nimport { UserBeforeDeleteEvent, UserAfterDeleteEvent } from \"./events.js\";\nimport { CannotDeleteOwnAccountError } from \"./errors.js\";\n\nclass DeleteUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: AdminUsersRepository.Interface,\n private rolesRepository: RolesRepository.Interface,\n private teamsRepository: TeamsRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n // 1. Check permission\n const permission = await this.identityContext.getPermission(\"adminUsers.user\");\n if (!permission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n // 2. Get existing user\n const getUserResult = await this.repository.get({ id });\n if (getUserResult.isFail()) {\n return Result.fail(getUserResult.error);\n }\n\n const user = getUserResult.value;\n\n // 3. Check if trying to delete own account\n const identity = this.identityContext.getIdentity();\n if (user.id === identity.id) {\n return Result.fail(new CannotDeleteOwnAccountError());\n }\n\n /**\n * Security: the caller may only delete a user whose roles and teams they could assign\n * (same rule as updating a user). Otherwise they could remove a user with more access\n * than they have.\n */\n const canAssign = await canAssignRolesAndTeams({\n identityContext: this.identityContext,\n rolesRepository: this.rolesRepository,\n teamsRepository: this.teamsRepository,\n roles: user.roles ?? [],\n teams: user.teams ?? []\n });\n if (!canAssign) {\n return Result.fail(new NotAuthorizedError(CANNOT_GRANT_PERMISSIONS_MESSAGE));\n }\n\n // 4. Publish before event\n await this.eventPublisher.publish(new UserBeforeDeleteEvent({ user }));\n\n // 5. Delete user via repository\n const result = await this.repository.delete(user);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n // 6. Publish after event\n await this.eventPublisher.publish(new UserAfterDeleteEvent({ user }));\n\n return Result.ok();\n }\n}\n\nexport const DeleteUserUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: DeleteUserUseCaseImpl,\n dependencies: [\n IdentityContext,\n EventPublisher,\n AdminUsersRepository,\n RolesRepository,\n TeamsRepository\n ]\n});\n"],"names":["DeleteUserUseCaseImpl","identityContext","eventPublisher","repository","rolesRepository","teamsRepository","id","permission","Result","NotAuthorizedError","getUserResult","user","identity","CannotDeleteOwnAccountError","canAssign","canAssignRolesAndTeams","CANNOT_GRANT_PERMISSIONS_MESSAGE","UserBeforeDeleteEvent","result","UserAfterDeleteEvent","DeleteUserUseCase","createImplementation","UseCaseAbstraction","IdentityContext","EventPublisher","AdminUsersRepository","RolesRepository","TeamsRepository"],"mappings":";;;;;;;;;;;;AAcA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,cAAwC,EACxCC,UAA0C,EAC1CC,eAA0C,EAC1CC,eAA0C,CACpD;aALUJ,eAAe,GAAfA;aACAC,cAAc,GAAdA;aACAC,UAAU,GAAVA;aACAC,eAAe,GAAfA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAmD;QAEvE,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC5D,IAAI,CAACA,YACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAI3B,MAAMC,gBAAgB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAEJ;QAAG;QACrD,IAAII,cAAc,MAAM,IACpB,OAAOF,OAAO,IAAI,CAACE,cAAc,KAAK;QAG1C,MAAMC,OAAOD,cAAc,KAAK;QAGhC,MAAME,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAID,KAAK,EAAE,KAAKC,SAAS,EAAE,EACvB,OAAOJ,OAAO,IAAI,CAAC,IAAIK;QAQ3B,MAAMC,YAAY,MAAMC,uBAAuB;YAC3C,iBAAiB,IAAI,CAAC,eAAe;YACrC,iBAAiB,IAAI,CAAC,eAAe;YACrC,iBAAiB,IAAI,CAAC,eAAe;YACrC,OAAOJ,KAAK,KAAK,IAAI,EAAE;YACvB,OAAOA,KAAK,KAAK,IAAI,EAAE;QAC3B;QACA,IAAI,CAACG,WACD,OAAON,OAAO,IAAI,CAAC,IAAIC,mBAAmBO;QAI9C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,sBAAsB;YAAEN;QAAK;QAGnE,MAAMO,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACP;QAC5C,IAAIO,OAAO,MAAM,IACb,OAAOV,OAAO,IAAI,CAACU,OAAO,KAAK;QAInC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,qBAAqB;YAAER;QAAK;QAElE,OAAOH,OAAO,EAAE;IACpB;AACJ;AAEO,MAAMY,sCAAoBC,qBAAqB;IAClD,aAAaC;IACb,gBAAgBtB;IAChB,cAAc;QACVuB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,13 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { IdentityContext } from "../../../features/security/IdentityContext/index.js";
3
+ import { GetCurrentUserUseCase as UseCaseAbstraction } from "./abstractions.js";
4
+ import { AdminUsersRepository } from "../../../features/users/shared/abstractions.js";
5
+ import type { AdminUser } from "../../../features/users/shared/types.js";
6
+ declare class GetCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {
7
+ private identityContext;
8
+ private repository;
9
+ constructor(identityContext: IdentityContext.Interface, repository: AdminUsersRepository.Interface);
10
+ execute(): Promise<Result<AdminUser, UseCaseAbstraction.Error>>;
11
+ }
12
+ export declare const GetCurrentUserUseCase: import("@webiny/di").Implementation<typeof GetCurrentUserUseCaseImpl>;
13
+ export {};
@@ -0,0 +1,29 @@
1
+ import { Result, createImplementation } from "@webiny/feature/api";
2
+ import { IdentityContext } from "../../security/IdentityContext/index.js";
3
+ import { GetCurrentUserUseCase } from "./abstractions.js";
4
+ import { AdminUsersRepository } from "../shared/abstractions.js";
5
+ import { NotAuthorizedError } from "../shared/errors.js";
6
+ class GetCurrentUserUseCaseImpl {
7
+ constructor(identityContext, repository){
8
+ this.identityContext = identityContext;
9
+ this.repository = repository;
10
+ }
11
+ async execute() {
12
+ const identity = this.identityContext.getIdentity();
13
+ if (identity.isAnonymous() || !identity.isAdmin()) return Result.fail(new NotAuthorizedError());
14
+ return this.repository.get({
15
+ id: identity.id
16
+ });
17
+ }
18
+ }
19
+ const GetCurrentUserUseCase_GetCurrentUserUseCase = createImplementation({
20
+ abstraction: GetCurrentUserUseCase,
21
+ implementation: GetCurrentUserUseCaseImpl,
22
+ dependencies: [
23
+ IdentityContext,
24
+ AdminUsersRepository
25
+ ]
26
+ });
27
+ export { GetCurrentUserUseCase_GetCurrentUserUseCase as GetCurrentUserUseCase };
28
+
29
+ //# sourceMappingURL=GetCurrentUserUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/users/GetCurrentUser/GetCurrentUserUseCase.js","sources":["../../../../src/features/users/GetCurrentUser/GetCurrentUserUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { GetCurrentUserUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { AdminUsersRepository } from \"~/features/users/shared/abstractions.js\";\nimport { NotAuthorizedError } from \"~/features/users/shared/errors.js\";\nimport type { AdminUser } from \"~/features/users/shared/types.js\";\n\nclass GetCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private repository: AdminUsersRepository.Interface\n ) {}\n\n async execute(): Promise<Result<AdminUser, UseCaseAbstraction.Error>> {\n const identity = this.identityContext.getIdentity();\n if (identity.isAnonymous() || !identity.isAdmin()) {\n return Result.fail(new NotAuthorizedError());\n }\n\n /**\n * An admin may always load their own user record. The `adminUsers.user` permission,\n * which allows loading any user, is not required here.\n */\n return this.repository.get({ id: identity.id });\n }\n}\n\nexport const GetCurrentUserUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: GetCurrentUserUseCaseImpl,\n dependencies: [IdentityContext, AdminUsersRepository]\n});\n"],"names":["GetCurrentUserUseCaseImpl","identityContext","repository","identity","Result","NotAuthorizedError","GetCurrentUserUseCase","createImplementation","UseCaseAbstraction","IdentityContext","AdminUsersRepository"],"mappings":";;;;;AAQA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,UAA0C,CACpD;aAFUD,eAAe,GAAfA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,UAAgE;QAClE,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAIA,SAAS,WAAW,MAAM,CAACA,SAAS,OAAO,IAC3C,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAO3B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,IAAIF,SAAS,EAAE;QAAC;IACjD;AACJ;AAEO,MAAMG,8CAAwBC,qBAAqB;IACtD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAqB;AACzD"}
@@ -0,0 +1,18 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import type { AdminUser } from "../../../features/users/shared/types.js";
3
+ import { AdminUsersRepository } from "../../../features/users/shared/abstractions.js";
4
+ import { NotAuthorizedError } from "../../../features/users/shared/errors.js";
5
+ export interface IGetCurrentUserErrors {
6
+ notAuthorized: NotAuthorizedError;
7
+ }
8
+ type GetCurrentUserError = IGetCurrentUserErrors[keyof IGetCurrentUserErrors] | AdminUsersRepository.Error;
9
+ export interface IGetCurrentUser {
10
+ execute(): Promise<Result<AdminUser, GetCurrentUserError>>;
11
+ }
12
+ /** Retrieve the admin user of the current identity. */
13
+ export declare const GetCurrentUserUseCase: import("@webiny/di").Abstraction<IGetCurrentUser>;
14
+ export declare namespace GetCurrentUserUseCase {
15
+ type Interface = IGetCurrentUser;
16
+ type Error = GetCurrentUserError;
17
+ }
18
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const GetCurrentUserUseCase = createAbstraction("GetCurrentUserUseCase");
3
+ export { GetCurrentUserUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/users/GetCurrentUser/abstractions.js","sources":["../../../../src/features/users/GetCurrentUser/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { AdminUser } from \"~/features/users/shared/types.js\";\nimport { AdminUsersRepository } from \"~/features/users/shared/abstractions.js\";\nimport { NotAuthorizedError } from \"~/features/users/shared/errors.js\";\n\n// Use case specific errors\nexport interface IGetCurrentUserErrors {\n notAuthorized: NotAuthorizedError;\n}\n\n// Combined error type (use case errors + repository errors)\ntype GetCurrentUserError =\n | IGetCurrentUserErrors[keyof IGetCurrentUserErrors]\n | AdminUsersRepository.Error;\n\n// Use case interface\nexport interface IGetCurrentUser {\n execute(): Promise<Result<AdminUser, GetCurrentUserError>>;\n}\n\n/** Retrieve the admin user of the current identity. */\nexport const GetCurrentUserUseCase = createAbstraction<IGetCurrentUser>(\"GetCurrentUserUseCase\");\n\n// Namespace exports\nexport namespace GetCurrentUserUseCase {\n export type Interface = IGetCurrentUser;\n export type Error = GetCurrentUserError;\n}\n"],"names":["GetCurrentUserUseCase","createAbstraction"],"mappings":";AAsBO,MAAMA,wBAAwBC,kBAAmC"}
@@ -0,0 +1,4 @@
1
+ export declare const GetCurrentUserFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { GetCurrentUserUseCase } from "./GetCurrentUserUseCase.js";
3
+ const GetCurrentUserFeature = createFeature({
4
+ name: "GetCurrentUser",
5
+ register (container) {
6
+ container.register(GetCurrentUserUseCase);
7
+ }
8
+ });
9
+ export { GetCurrentUserFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/users/GetCurrentUser/feature.js","sources":["../../../../src/features/users/GetCurrentUser/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetCurrentUserUseCase } from \"./GetCurrentUserUseCase.js\";\n\nexport const GetCurrentUserFeature = createFeature({\n name: \"GetCurrentUser\",\n register(container) {\n container.register(GetCurrentUserUseCase);\n }\n});\n"],"names":["GetCurrentUserFeature","createFeature","container","GetCurrentUserUseCase"],"mappings":";;AAGO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1 @@
1
+ export * from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export * from "./abstractions.js";
@@ -1,7 +1,7 @@
1
1
  import { ErrorResponse, ListErrorResponse, ListResponse, NotFoundResponse, Response } from "@webiny/handler-graphql/responses.js";
2
2
  import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
3
3
  import { GetUserUseCase } from "../../features/users/GetUser/index.js";
4
- import NotAuthorizedResponse from "../security/NotAuthorizedResponse.js";
4
+ import { GetCurrentUserUseCase } from "../../features/users/GetCurrentUser/index.js";
5
5
  import { ListUsersUseCase } from "../../features/users/ListUsers/index.js";
6
6
  const emptyResolver = ()=>({});
7
7
  const createUsersGraphQL = ()=>[
@@ -97,7 +97,8 @@ const createUsersGraphQL = ()=>[
97
97
  }
98
98
  },
99
99
  AdminUsersQuery: {
100
- getUser: async (_, { where }, context)=>{
100
+ getUser: async (_, args, context)=>{
101
+ const where = args.where ?? {};
101
102
  const getUser = context.container.resolve(GetUserUseCase);
102
103
  const userResult = await getUser.execute({
103
104
  id: where.id,
@@ -115,22 +116,18 @@ const createUsersGraphQL = ()=>[
115
116
  return new Response(userResult.value);
116
117
  },
117
118
  getCurrentUser: async (_, __, context)=>{
118
- const identity = context.security.getIdentity();
119
- if (!identity.isAdmin()) throw new NotAuthorizedResponse();
120
- const getUser = context.container.resolve(GetUserUseCase);
121
- const userResponse = await context.security.withoutAuthorization(async ()=>await getUser.execute({
122
- id: identity.id
123
- }));
124
- if (userResponse.isFail()) {
125
- const error = userResponse.error;
126
- if ("AdminUser/NotFound" === error.code) return new NotFoundResponse(`User with ID ${identity.id} was not found!`);
119
+ const getCurrentUser = context.container.resolve(GetCurrentUserUseCase);
120
+ const userResult = await getCurrentUser.execute();
121
+ if (userResult.isFail()) {
122
+ const error = userResult.error;
123
+ if ("AdminUser/NotFound" === error.code) return new NotFoundResponse("Current user was not found!");
127
124
  return new ErrorResponse({
128
125
  message: error.message,
129
126
  code: error.code,
130
127
  data: error.data
131
128
  });
132
129
  }
133
- return new Response(userResponse.value);
130
+ return new Response(userResult.value);
134
131
  },
135
132
  listUsers: async (_, __, context)=>{
136
133
  const listUsers = context.container.resolve(ListUsersUseCase);
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/users/user.gql.js","sources":["../../../src/graphql/users/user.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n NotFoundResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { AdminUser } from \"~/types/users.js\";\nimport { GetUserUseCase } from \"~/features/users/GetUser/index.js\";\nimport NotAuthorizedResponse from \"~/graphql/security/NotAuthorizedResponse.js\";\nimport { ListUsersUseCase } from \"~/features/users/ListUsers/index.js\";\n\nconst emptyResolver = () => ({});\n\nexport const createUsersGraphQL = () => {\n return [\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type AdminUsersQuery {\n _empty: String\n }\n\n type AdminUsersMutation {\n _empty: String\n }\n\n extend type Query {\n adminUsers: AdminUsersQuery\n }\n\n extend type Mutation {\n adminUsers: AdminUsersMutation\n }\n\n type AdminUsersCreatedBy {\n id: ID\n displayName: String\n }\n\n type AdminUsersError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type AdminUsersBooleanResponse {\n data: Boolean\n error: AdminUsersError\n }\n `,\n resolvers: {\n Query: {\n adminUsers: emptyResolver\n },\n Mutation: {\n adminUsers: emptyResolver\n }\n }\n }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type AdminUser {\n id: ID!\n displayName: String!\n email: String!\n\n roles: [SecurityRole]\n firstName: String\n lastName: String\n avatar: JSON\n external: Boolean\n createdOn: DateTime\n }\n\n type AdminUsersResponse {\n data: AdminUser\n error: AdminUsersError\n }\n\n type AdminUsersListResponse {\n data: [AdminUser]\n error: AdminUsersError\n }\n\n input AdminUsersGetUserWhereInput {\n id: ID\n email: String\n }\n\n extend type AdminUsersQuery {\n getUser(where: AdminUsersGetUserWhereInput): AdminUsersResponse\n getCurrentUser: AdminUsersResponse\n listUsers: AdminUsersListResponse\n }\n `,\n resolvers: {\n AdminUser: {\n roles(user: AdminUser, _, context) {\n if (!user.roles) {\n return null;\n }\n\n return context.security.listRoles({ where: { id_in: user.roles } });\n }\n },\n AdminUsersQuery: {\n getUser: async (_, { where }: any, context) => {\n const getUser = context.container.resolve(GetUserUseCase);\n\n const userResult = await getUser.execute({\n id: where.id,\n email: where.email\n });\n\n if (userResult.isFail()) {\n const error = userResult.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\n `User \"${JSON.stringify(where)}\" was not found!`\n );\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResult.value);\n },\n getCurrentUser: async (_, __, context) => {\n const identity = context.security.getIdentity();\n\n if (!identity.isAdmin()) {\n throw new NotAuthorizedResponse();\n }\n\n // Current user might not have permissions to execute `getUser` (this method can load any user in the system),\n // but loading your own user record should be allowed. For that reason, let's temporarily disable authorization.\n\n const getUser = context.container.resolve(GetUserUseCase);\n\n const userResponse = await context.security.withoutAuthorization(\n async () => {\n // Get user record using the identity ID.\n return await getUser.execute({ id: identity.id });\n }\n );\n\n if (userResponse.isFail()) {\n const error = userResponse.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\n `User with ID ${identity.id} was not found!`\n );\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResponse.value);\n },\n listUsers: async (_, __, context) => {\n const listUsers = context.container.resolve(ListUsersUseCase);\n const users = await listUsers.execute();\n\n if (users.isFail()) {\n return new ListErrorResponse(users.error);\n }\n\n return new ListResponse(users.value);\n }\n }\n }\n }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n extend type AdminUser {\n teams: [SecurityTeam]\n }\n `,\n resolvers: {\n AdminUser: {\n teams(user: AdminUser, _, context) {\n const hasTeams = Array.isArray(user.teams) && user.teams.length > 0;\n if (!hasTeams) {\n return [];\n }\n\n return context.security.listTeams({ where: { id_in: user.teams } });\n }\n }\n }\n })\n ].filter(Boolean);\n};\n"],"names":["emptyResolver","createUsersGraphQL","GraphQLSchemaPlugin","user","_","context","where","getUser","GetUserUseCase","userResult","error","NotFoundResponse","JSON","ErrorResponse","Response","__","identity","NotAuthorizedResponse","userResponse","listUsers","ListUsersUseCase","users","ListErrorResponse","ListResponse","hasTeams","Array","Boolean"],"mappings":";;;;;AAcA,MAAMA,gBAAgB,IAAO,EAAC;AAEvB,MAAMC,qBAAqB,IACvB;QACH,IAAIC,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiCzB,CAAC;YACD,WAAW;gBACP,OAAO;oBACH,YAAYF;gBAChB;gBACA,UAAU;oBACN,YAAYA;gBAChB;YACJ;QACJ;QACA,IAAIE,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,IAAI,CAACF,KAAK,KAAK,EACX,OAAO;wBAGX,OAAOE,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;gBACA,iBAAiB;oBACb,SAAS,OAAOC,GAAG,EAAEE,KAAK,EAAO,EAAED;wBAC/B,MAAME,UAAUF,QAAQ,SAAS,CAAC,OAAO,CAACG;wBAE1C,MAAMC,aAAa,MAAMF,QAAQ,OAAO,CAAC;4BACrC,IAAID,MAAM,EAAE;4BACZ,OAAOA,MAAM,KAAK;wBACtB;wBAEA,IAAIG,WAAW,MAAM,IAAI;4BACrB,MAAMC,QAAQD,WAAW,KAAK;4BAC9B,IAAIC,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBACP,CAAC,MAAM,EAAEC,KAAK,SAAS,CAACN,OAAO,gBAAgB,CAAC;4BAIxD,OAAO,IAAIO,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASL,WAAW,KAAK;oBACxC;oBACA,gBAAgB,OAAOL,GAAGW,IAAIV;wBAC1B,MAAMW,WAAWX,QAAQ,QAAQ,CAAC,WAAW;wBAE7C,IAAI,CAACW,SAAS,OAAO,IACjB,MAAM,IAAIC;wBAMd,MAAMV,UAAUF,QAAQ,SAAS,CAAC,OAAO,CAACG;wBAE1C,MAAMU,eAAe,MAAMb,QAAQ,QAAQ,CAAC,oBAAoB,CAC5D,UAEW,MAAME,QAAQ,OAAO,CAAC;gCAAE,IAAIS,SAAS,EAAE;4BAAC;wBAIvD,IAAIE,aAAa,MAAM,IAAI;4BACvB,MAAMR,QAAQQ,aAAa,KAAK;4BAChC,IAAIR,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBACP,CAAC,aAAa,EAAEK,SAAS,EAAE,CAAC,eAAe,CAAC;4BAIpD,OAAO,IAAIH,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASI,aAAa,KAAK;oBAC1C;oBACA,WAAW,OAAOd,GAAGW,IAAIV;wBACrB,MAAMc,YAAYd,QAAQ,SAAS,CAAC,OAAO,CAACe;wBAC5C,MAAMC,QAAQ,MAAMF,UAAU,OAAO;wBAErC,IAAIE,MAAM,MAAM,IACZ,OAAO,IAAIC,kBAAkBD,MAAM,KAAK;wBAG5C,OAAO,IAAIE,aAAaF,MAAM,KAAK;oBACvC;gBACJ;YACJ;QACJ;QACA,IAAInB,oBAAoC;YACpC,UAAwB,CAAC;;;;YAIzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,MAAMmB,WAAWC,MAAM,OAAO,CAACtB,KAAK,KAAK,KAAKA,KAAK,KAAK,CAAC,MAAM,GAAG;wBAClE,IAAI,CAACqB,UACD,OAAO,EAAE;wBAGb,OAAOnB,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;YACJ;QACJ;KACH,CAAC,MAAM,CAACuB"}
1
+ {"version":3,"file":"graphql/users/user.gql.js","sources":["../../../src/graphql/users/user.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n NotFoundResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { AdminUser } from \"~/types/users.js\";\nimport { GetUserUseCase } from \"~/features/users/GetUser/index.js\";\nimport { GetCurrentUserUseCase } from \"~/features/users/GetCurrentUser/index.js\";\nimport { ListUsersUseCase } from \"~/features/users/ListUsers/index.js\";\n\nconst emptyResolver = () => ({});\n\nexport const createUsersGraphQL = () => {\n return [\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type AdminUsersQuery {\n _empty: String\n }\n\n type AdminUsersMutation {\n _empty: String\n }\n\n extend type Query {\n adminUsers: AdminUsersQuery\n }\n\n extend type Mutation {\n adminUsers: AdminUsersMutation\n }\n\n type AdminUsersCreatedBy {\n id: ID\n displayName: String\n }\n\n type AdminUsersError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type AdminUsersBooleanResponse {\n data: Boolean\n error: AdminUsersError\n }\n `,\n resolvers: {\n Query: {\n adminUsers: emptyResolver\n },\n Mutation: {\n adminUsers: emptyResolver\n }\n }\n }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type AdminUser {\n id: ID!\n displayName: String!\n email: String!\n\n roles: [SecurityRole]\n firstName: String\n lastName: String\n avatar: JSON\n external: Boolean\n createdOn: DateTime\n }\n\n type AdminUsersResponse {\n data: AdminUser\n error: AdminUsersError\n }\n\n type AdminUsersListResponse {\n data: [AdminUser]\n error: AdminUsersError\n }\n\n input AdminUsersGetUserWhereInput {\n id: ID\n email: String\n }\n\n extend type AdminUsersQuery {\n getUser(where: AdminUsersGetUserWhereInput): AdminUsersResponse\n getCurrentUser: AdminUsersResponse\n listUsers: AdminUsersListResponse\n }\n `,\n resolvers: {\n AdminUser: {\n roles(user: AdminUser, _, context) {\n if (!user.roles) {\n return null;\n }\n\n return context.security.listRoles({ where: { id_in: user.roles } });\n }\n },\n AdminUsersQuery: {\n getUser: async (_, args: any, context) => {\n // `where` is optional in the schema.\n const where = args.where ?? {};\n const getUser = context.container.resolve(GetUserUseCase);\n\n const userResult = await getUser.execute({\n id: where.id,\n email: where.email\n });\n\n if (userResult.isFail()) {\n const error = userResult.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\n `User \"${JSON.stringify(where)}\" was not found!`\n );\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResult.value);\n },\n getCurrentUser: async (_, __, context) => {\n const getCurrentUser = context.container.resolve(GetCurrentUserUseCase);\n\n const userResult = await getCurrentUser.execute();\n\n if (userResult.isFail()) {\n const error = userResult.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\"Current user was not found!\");\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResult.value);\n },\n listUsers: async (_, __, context) => {\n const listUsers = context.container.resolve(ListUsersUseCase);\n const users = await listUsers.execute();\n\n if (users.isFail()) {\n return new ListErrorResponse(users.error);\n }\n\n return new ListResponse(users.value);\n }\n }\n }\n }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n extend type AdminUser {\n teams: [SecurityTeam]\n }\n `,\n resolvers: {\n AdminUser: {\n teams(user: AdminUser, _, context) {\n const hasTeams = Array.isArray(user.teams) && user.teams.length > 0;\n if (!hasTeams) {\n return [];\n }\n\n return context.security.listTeams({ where: { id_in: user.teams } });\n }\n }\n }\n })\n ].filter(Boolean);\n};\n"],"names":["emptyResolver","createUsersGraphQL","GraphQLSchemaPlugin","user","_","context","args","where","getUser","GetUserUseCase","userResult","error","NotFoundResponse","JSON","ErrorResponse","Response","__","getCurrentUser","GetCurrentUserUseCase","listUsers","ListUsersUseCase","users","ListErrorResponse","ListResponse","hasTeams","Array","Boolean"],"mappings":";;;;;AAcA,MAAMA,gBAAgB,IAAO,EAAC;AAEvB,MAAMC,qBAAqB,IACvB;QACH,IAAIC,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiCzB,CAAC;YACD,WAAW;gBACP,OAAO;oBACH,YAAYF;gBAChB;gBACA,UAAU;oBACN,YAAYA;gBAChB;YACJ;QACJ;QACA,IAAIE,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,IAAI,CAACF,KAAK,KAAK,EACX,OAAO;wBAGX,OAAOE,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;gBACA,iBAAiB;oBACb,SAAS,OAAOC,GAAGE,MAAWD;wBAE1B,MAAME,QAAQD,KAAK,KAAK,IAAI,CAAC;wBAC7B,MAAME,UAAUH,QAAQ,SAAS,CAAC,OAAO,CAACI;wBAE1C,MAAMC,aAAa,MAAMF,QAAQ,OAAO,CAAC;4BACrC,IAAID,MAAM,EAAE;4BACZ,OAAOA,MAAM,KAAK;wBACtB;wBAEA,IAAIG,WAAW,MAAM,IAAI;4BACrB,MAAMC,QAAQD,WAAW,KAAK;4BAC9B,IAAIC,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBACP,CAAC,MAAM,EAAEC,KAAK,SAAS,CAACN,OAAO,gBAAgB,CAAC;4BAIxD,OAAO,IAAIO,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASL,WAAW,KAAK;oBACxC;oBACA,gBAAgB,OAAON,GAAGY,IAAIX;wBAC1B,MAAMY,iBAAiBZ,QAAQ,SAAS,CAAC,OAAO,CAACa;wBAEjD,MAAMR,aAAa,MAAMO,eAAe,OAAO;wBAE/C,IAAIP,WAAW,MAAM,IAAI;4BACrB,MAAMC,QAAQD,WAAW,KAAK;4BAC9B,IAAIC,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBAAiB;4BAGhC,OAAO,IAAIE,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASL,WAAW,KAAK;oBACxC;oBACA,WAAW,OAAON,GAAGY,IAAIX;wBACrB,MAAMc,YAAYd,QAAQ,SAAS,CAAC,OAAO,CAACe;wBAC5C,MAAMC,QAAQ,MAAMF,UAAU,OAAO;wBAErC,IAAIE,MAAM,MAAM,IACZ,OAAO,IAAIC,kBAAkBD,MAAM,KAAK;wBAG5C,OAAO,IAAIE,aAAaF,MAAM,KAAK;oBACvC;gBACJ;YACJ;QACJ;QACA,IAAInB,oBAAoC;YACpC,UAAwB,CAAC;;;;YAIzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,MAAMmB,WAAWC,MAAM,OAAO,CAACtB,KAAK,KAAK,KAAKA,KAAK,KAAK,CAAC,MAAM,GAAG;wBAClE,IAAI,CAACqB,UACD,OAAO,EAAE;wBAGb,OAAOnB,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;YACJ;QACJ;KACH,CAAC,MAAM,CAACuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-core",
3
- "version": "6.5.2-beta.2",
3
+ "version": "6.5.2-beta.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,20 +18,20 @@
18
18
  "@ai-sdk/google": "4.0.114",
19
19
  "@ai-sdk/openai": "4.0.111",
20
20
  "@openrouter/ai-sdk-provider": "3.1.0",
21
- "@webiny/api": "6.5.2-beta.2",
21
+ "@webiny/api": "6.5.2-beta.3",
22
22
  "@webiny/di": "1.1.0",
23
- "@webiny/error": "6.5.2-beta.2",
24
- "@webiny/feature": "6.5.2-beta.2",
25
- "@webiny/feature-flags": "6.5.2-beta.2",
26
- "@webiny/handler": "6.5.2-beta.2",
27
- "@webiny/handler-db": "6.5.2-beta.2",
28
- "@webiny/handler-graphql": "6.5.2-beta.2",
29
- "@webiny/plugins": "6.5.2-beta.2",
30
- "@webiny/utils": "6.5.2-beta.2",
31
- "@webiny/wcp": "6.5.2-beta.2",
23
+ "@webiny/error": "6.5.2-beta.3",
24
+ "@webiny/feature": "6.5.2-beta.3",
25
+ "@webiny/feature-flags": "6.5.2-beta.3",
26
+ "@webiny/handler": "6.5.2-beta.3",
27
+ "@webiny/handler-db": "6.5.2-beta.3",
28
+ "@webiny/handler-graphql": "6.5.2-beta.3",
29
+ "@webiny/plugins": "6.5.2-beta.3",
30
+ "@webiny/utils": "6.5.2-beta.3",
31
+ "@webiny/wcp": "6.5.2-beta.3",
32
32
  "ai": "7.0.166",
33
33
  "dataloader": "2.2.3",
34
- "jose": "6.2.16",
34
+ "jose": "6.2.17",
35
35
  "jsonwebtoken": "9.0.3",
36
36
  "lodash": "4.18.1",
37
37
  "minimatch": "11.0.5",
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jsonwebtoken": "9.0.10",
44
- "@webiny/build-tools": "6.5.2-beta.2",
45
- "@webiny/handler-aws": "6.5.2-beta.2",
46
- "@webiny/project-utils": "6.5.2-beta.2",
44
+ "@webiny/build-tools": "6.5.2-beta.3",
45
+ "@webiny/handler-aws": "6.5.2-beta.3",
46
+ "@webiny/project-utils": "6.5.2-beta.3",
47
47
  "rimraf": "6.1.4",
48
48
  "typescript": "7.0.2",
49
49
  "vitest": "5.1.0"