@webiny/api-record-locking 0.0.0-unstable.e622468070 → 0.0.0-unstable.e6f0dc8ca7

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 (69) hide show
  1. package/features/GetLockRecord/feature.d.ts +4 -1
  2. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +1 -1
  3. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +1 -1
  4. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -1
  5. package/features/GetLockedEntryLockRecord/feature.d.ts +4 -1
  6. package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +1 -1
  7. package/features/IsEntryLocked/IsEntryLockedUseCase.js +1 -1
  8. package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -1
  9. package/features/IsEntryLocked/feature.d.ts +4 -1
  10. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +1 -1
  11. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +1 -1
  12. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -1
  13. package/features/KickOutCurrentUser/feature.d.ts +4 -1
  14. package/features/ListAllLockRecords/feature.d.ts +4 -1
  15. package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +1 -1
  16. package/features/ListLockRecords/ListLockRecordsUseCase.js +1 -1
  17. package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -1
  18. package/features/ListLockRecords/abstractions.js.map +1 -1
  19. package/features/ListLockRecords/feature.d.ts +4 -1
  20. package/features/LockEntry/LockEntryEventsDecorator.d.ts +1 -1
  21. package/features/LockEntry/LockEntryEventsDecorator.js +1 -1
  22. package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -1
  23. package/features/LockEntry/events.d.ts +8 -8
  24. package/features/LockEntry/events.js +7 -7
  25. package/features/LockEntry/events.js.map +1 -1
  26. package/features/LockEntry/feature.d.ts +4 -1
  27. package/features/RecordLockingFeature.d.ts +4 -1
  28. package/features/RecordLockingFeature.js.map +1 -1
  29. package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +1 -1
  30. package/features/UnlockEntry/UnlockEntryEventsDecorator.js +1 -1
  31. package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -1
  32. package/features/UnlockEntry/UnlockEntryUseCase.d.ts +1 -1
  33. package/features/UnlockEntry/UnlockEntryUseCase.js +1 -1
  34. package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -1
  35. package/features/UnlockEntry/events.d.ts +8 -8
  36. package/features/UnlockEntry/events.js +7 -7
  37. package/features/UnlockEntry/events.js.map +1 -1
  38. package/features/UnlockEntry/feature.d.ts +4 -1
  39. package/features/UnlockEntry/hasFullAccessPermission.d.ts +1 -1
  40. package/features/UnlockEntry/hasFullAccessPermission.js +1 -1
  41. package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -1
  42. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +1 -1
  43. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +1 -1
  44. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -1
  45. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +1 -1
  46. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +1 -1
  47. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -1
  48. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +1 -1
  49. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +1 -1
  50. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -1
  51. package/features/UnlockEntryRequest/events.d.ts +8 -8
  52. package/features/UnlockEntryRequest/events.js +7 -7
  53. package/features/UnlockEntryRequest/events.js.map +1 -1
  54. package/features/UnlockEntryRequest/feature.d.ts +4 -1
  55. package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +1 -1
  56. package/features/UpdateEntryLock/UpdateEntryLockRepository.js +1 -1
  57. package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -1
  58. package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +1 -1
  59. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +1 -1
  60. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -1
  61. package/features/UpdateEntryLock/feature.d.ts +4 -1
  62. package/graphql/checkPermissions.js +1 -1
  63. package/graphql/checkPermissions.js.map +1 -1
  64. package/graphql/schema.d.ts +2 -2
  65. package/graphql/schema.js +5 -8
  66. package/graphql/schema.js.map +1 -1
  67. package/index.js +3 -2
  68. package/index.js.map +1 -1
  69. package/package.json +24 -21
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","DomainEvent","EntryBeforeUnlockEvent","eventType","getHandlerAbstraction","EntryBeforeUnlockHandler","EntryAfterUnlockEvent","EntryAfterUnlockHandler","EntryUnlockErrorEvent","EntryUnlockErrorHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport type { IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\n\n// ============================================================================\n// EntryBeforeUnlock Event\n// ============================================================================\n\nexport interface EntryBeforeUnlockPayload {\n id: string;\n type: LockRecordEntryType;\n force?: boolean;\n}\n\nexport class EntryBeforeUnlockEvent extends DomainEvent<EntryBeforeUnlockPayload> {\n eventType = \"RecordLocking/Entry/BeforeUnlock\" as const;\n\n getHandlerAbstraction() {\n return EntryBeforeUnlockHandler;\n }\n}\n\nexport const EntryBeforeUnlockHandler = createAbstraction<IEventHandler<EntryBeforeUnlockEvent>>(\n \"EntryBeforeUnlockHandler\"\n);\n\nexport namespace EntryBeforeUnlockHandler {\n export type Interface = IEventHandler<EntryBeforeUnlockEvent>;\n export type Event = EntryBeforeUnlockEvent;\n}\n\n// ============================================================================\n// EntryAfterUnlock Event\n// ============================================================================\n\nexport interface EntryAfterUnlockPayload {\n id: string;\n type: LockRecordEntryType;\n record: ILockRecord;\n}\n\nexport class EntryAfterUnlockEvent extends DomainEvent<EntryAfterUnlockPayload> {\n eventType = \"RecordLocking/Entry/AfterUnlock\" as const;\n\n getHandlerAbstraction() {\n return EntryAfterUnlockHandler;\n }\n}\n\nexport const EntryAfterUnlockHandler =\n createAbstraction<IEventHandler<EntryAfterUnlockEvent>>(\"EntryAfterUnlockHandler\");\n\nexport namespace EntryAfterUnlockHandler {\n export type Interface = IEventHandler<EntryAfterUnlockEvent>;\n export type Event = EntryAfterUnlockEvent;\n}\n\n// ============================================================================\n// EntryUnlockError Event\n// ============================================================================\n\nexport interface EntryUnlockErrorPayload {\n id: string;\n type: LockRecordEntryType;\n error: Error;\n}\n\nexport class EntryUnlockErrorEvent extends DomainEvent<EntryUnlockErrorPayload> {\n eventType = \"RecordLocking/Entry/UnlockError\" as const;\n\n getHandlerAbstraction() {\n return EntryUnlockErrorHandler;\n }\n}\n\nexport const EntryUnlockErrorHandler =\n createAbstraction<IEventHandler<EntryUnlockErrorEvent>>(\"EntryUnlockErrorHandler\");\n\nexport namespace EntryUnlockErrorHandler {\n export type Interface = IEventHandler<EntryUnlockErrorEvent>;\n export type Event = EntryUnlockErrorEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,0CAA0C;;AAKtE;AACA;AACA;;AAQA,OAAO,MAAMC,sBAAsB,SAASD,WAAW,CAA2B;EAC9EE,SAAS,GAAG,kCAAkC;EAE9CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,wBAAwB;EACnC;AACJ;AAEA,OAAO,MAAMA,wBAAwB,GAAGL,iBAAiB,CACrD,0BACJ,CAAC;;AAOD;AACA;AACA;;AAQA,OAAO,MAAMM,qBAAqB,SAASL,WAAW,CAA0B;EAC5EE,SAAS,GAAG,iCAAiC;EAE7CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,uBAAuB;EAClC;AACJ;AAEA,OAAO,MAAMA,uBAAuB,GAChCP,iBAAiB,CAAuC,yBAAyB,CAAC;;AAOtF;AACA;AACA;;AAQA,OAAO,MAAMQ,qBAAqB,SAASP,WAAW,CAA0B;EAC5EE,SAAS,GAAG,iCAAiC;EAE7CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOK,uBAAuB;EAClC;AACJ;AAEA,OAAO,MAAMA,uBAAuB,GAChCT,iBAAiB,CAAuC,yBAAyB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","DomainEvent","EntryBeforeUnlockEvent","eventType","getHandlerAbstraction","EntryBeforeUnlockEventHandler","EntryAfterUnlockEvent","EntryAfterUnlockEventHandler","EntryUnlockErrorEvent","EntryUnlockErrorEventHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\n\n// ============================================================================\n// EntryBeforeUnlock Event\n// ============================================================================\n\nexport interface EntryBeforeUnlockPayload {\n id: string;\n type: LockRecordEntryType;\n force?: boolean;\n}\n\nexport class EntryBeforeUnlockEvent extends DomainEvent<EntryBeforeUnlockPayload> {\n eventType = \"RecordLocking/Entry/BeforeUnlock\" as const;\n\n getHandlerAbstraction() {\n return EntryBeforeUnlockEventHandler;\n }\n}\n\nexport const EntryBeforeUnlockEventHandler = createAbstraction<\n IEventHandler<EntryBeforeUnlockEvent>\n>(\"EntryBeforeUnlockEventHandler\");\n\nexport namespace EntryBeforeUnlockEventHandler {\n export type Interface = IEventHandler<EntryBeforeUnlockEvent>;\n export type Event = EntryBeforeUnlockEvent;\n}\n\n// ============================================================================\n// EntryAfterUnlock Event\n// ============================================================================\n\nexport interface EntryAfterUnlockPayload {\n id: string;\n type: LockRecordEntryType;\n record: ILockRecord;\n}\n\nexport class EntryAfterUnlockEvent extends DomainEvent<EntryAfterUnlockPayload> {\n eventType = \"RecordLocking/Entry/AfterUnlock\" as const;\n\n getHandlerAbstraction() {\n return EntryAfterUnlockEventHandler;\n }\n}\n\nexport const EntryAfterUnlockEventHandler = createAbstraction<IEventHandler<EntryAfterUnlockEvent>>(\n \"EntryAfterUnlockEventHandler\"\n);\n\nexport namespace EntryAfterUnlockEventHandler {\n export type Interface = IEventHandler<EntryAfterUnlockEvent>;\n export type Event = EntryAfterUnlockEvent;\n}\n\n// ============================================================================\n// EntryUnlockError Event\n// ============================================================================\n\nexport interface EntryUnlockErrorPayload {\n id: string;\n type: LockRecordEntryType;\n error: Error;\n}\n\nexport class EntryUnlockErrorEvent extends DomainEvent<EntryUnlockErrorPayload> {\n eventType = \"RecordLocking/Entry/UnlockError\" as const;\n\n getHandlerAbstraction() {\n return EntryUnlockErrorEventHandler;\n }\n}\n\nexport const EntryUnlockErrorEventHandler = createAbstraction<IEventHandler<EntryUnlockErrorEvent>>(\n \"EntryUnlockErrorEventHandler\"\n);\n\nexport namespace EntryUnlockErrorEventHandler {\n export type Interface = IEventHandler<EntryUnlockErrorEvent>;\n export type Event = EntryUnlockErrorEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,mDAAmD;;AAK/E;AACA;AACA;;AAQA,OAAO,MAAMC,sBAAsB,SAASD,WAAW,CAA2B;EAC9EE,SAAS,GAAG,kCAAkC;EAE9CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,6BAA6B;EACxC;AACJ;AAEA,OAAO,MAAMA,6BAA6B,GAAGL,iBAAiB,CAE5D,+BAA+B,CAAC;;AAOlC;AACA;AACA;;AAQA,OAAO,MAAMM,qBAAqB,SAASL,WAAW,CAA0B;EAC5EE,SAAS,GAAG,iCAAiC;EAE7CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,4BAA4B;EACvC;AACJ;AAEA,OAAO,MAAMA,4BAA4B,GAAGP,iBAAiB,CACzD,8BACJ,CAAC;;AAOD;AACA;AACA;;AAQA,OAAO,MAAMQ,qBAAqB,SAASP,WAAW,CAA0B;EAC5EE,SAAS,GAAG,iCAAiC;EAE7CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOK,4BAA4B;EACvC;AACJ;AAEA,OAAO,MAAMA,4BAA4B,GAAGT,iBAAiB,CACzD,8BACJ,CAAC","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const UnlockEntryFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UnlockEntryFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1,2 +1,2 @@
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
  export declare const hasFullAccessPermission: (identityContext: IdentityContext.Interface) => Promise<boolean>;
@@ -4,7 +4,7 @@ export const hasFullAccessPermission = async identityContext => {
4
4
  return true;
5
5
  }
6
6
  const permission = await identityContext.getPermission("recordLocking");
7
- return permission?.canForceUnlock === "yes";
7
+ return permission?.canForceUnlock === true;
8
8
  };
9
9
 
10
10
  //# sourceMappingURL=hasFullAccessPermission.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hasFullAccessPermission","identityContext","hasFullAccess","permission","getPermission","canForceUnlock"],"sources":["hasFullAccessPermission.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\ninterface RecordLockingSecurityPermission extends SecurityPermission {\n canForceUnlock?: string;\n}\n\nexport const hasFullAccessPermission = async (\n identityContext: IdentityContext.Interface\n): Promise<boolean> => {\n const hasFullAccess = await identityContext.hasFullAccess();\n if (hasFullAccess) {\n return true;\n }\n\n const permission =\n await identityContext.getPermission<RecordLockingSecurityPermission>(\"recordLocking\");\n return permission?.canForceUnlock === \"yes\";\n};\n"],"mappings":"AAOA,OAAO,MAAMA,uBAAuB,GAAG,MACnCC,eAA0C,IACvB;EACnB,MAAMC,aAAa,GAAG,MAAMD,eAAe,CAACC,aAAa,CAAC,CAAC;EAC3D,IAAIA,aAAa,EAAE;IACf,OAAO,IAAI;EACf;EAEA,MAAMC,UAAU,GACZ,MAAMF,eAAe,CAACG,aAAa,CAAkC,eAAe,CAAC;EACzF,OAAOD,UAAU,EAAEE,cAAc,KAAK,KAAK;AAC/C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["hasFullAccessPermission","identityContext","hasFullAccess","permission","getPermission","canForceUnlock"],"sources":["hasFullAccessPermission.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\ninterface RecordLockingSecurityPermission extends SecurityPermission {\n canForceUnlock?: boolean;\n}\n\nexport const hasFullAccessPermission = async (\n identityContext: IdentityContext.Interface\n): Promise<boolean> => {\n const hasFullAccess = await identityContext.hasFullAccess();\n if (hasFullAccess) {\n return true;\n }\n\n const permission =\n await identityContext.getPermission<RecordLockingSecurityPermission>(\"recordLocking\");\n return permission?.canForceUnlock === true;\n};\n"],"mappings":"AAOA,OAAO,MAAMA,uBAAuB,GAAG,MACnCC,eAA0C,IACvB;EACnB,MAAMC,aAAa,GAAG,MAAMD,eAAe,CAACC,aAAa,CAAC,CAAC;EAC3D,IAAIA,aAAa,EAAE;IACf,OAAO,IAAI;EACf;EAEA,MAAMC,UAAU,GACZ,MAAMF,eAAe,CAACG,aAAa,CAAkC,eAAe,CAAC;EACzF,OAAOD,UAAU,EAAEE,cAAc,KAAK,IAAI;AAC9C,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { type UnlockEntryRequestInput, UnlockEntryRequestUseCase as UseCaseAbstraction, UnlockEntryRequestUseCase } from "./abstractions.js";
2
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { ILockRecord } from "../../domain/index.js";
4
4
  import { Result } from "@webiny/feature/api/index.js";
5
5
  declare class UnlockEntryRequestEventsDecoratorImpl implements UnlockEntryRequestUseCase.Interface {
@@ -1,5 +1,5 @@
1
1
  import { UnlockEntryRequestUseCase } from "./abstractions.js";
2
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
2
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import { EntryAfterUnlockRequestEvent, EntryBeforeUnlockRequestEvent, EntryUnlockRequestErrorEvent } from "./events.js";
4
4
  class UnlockEntryRequestEventsDecoratorImpl {
5
5
  constructor(eventPublisher, decoratee) {
@@ -1 +1 @@
1
- {"version":3,"names":["UnlockEntryRequestUseCase","EventPublisher","EntryAfterUnlockRequestEvent","EntryBeforeUnlockRequestEvent","EntryUnlockRequestErrorEvent","UnlockEntryRequestEventsDecoratorImpl","constructor","eventPublisher","decoratee","execute","input","publish","id","type","result","isFail","error","record","value","UnlockEntryRequestEventsDecorator","createDecorator","decorator","dependencies"],"sources":["UnlockEntryRequestEventsDecorator.ts"],"sourcesContent":["import {\n type UnlockEntryRequestInput,\n UnlockEntryRequestUseCase as UseCaseAbstraction,\n UnlockEntryRequestUseCase\n} from \"./abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/EventPublisher\";\nimport type { ILockRecord } from \"~/domain/index.js\";\nimport { Result } from \"@webiny/feature/api/index.js\";\nimport {\n EntryAfterUnlockRequestEvent,\n EntryBeforeUnlockRequestEvent,\n EntryUnlockRequestErrorEvent\n} from \"./events.js\";\n\nclass UnlockEntryRequestEventsDecoratorImpl implements UnlockEntryRequestUseCase.Interface {\n constructor(\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly decoratee: UnlockEntryRequestUseCase.Interface\n ) {}\n\n async execute(\n input: UnlockEntryRequestInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Publish before event\n await this.eventPublisher.publish(\n new EntryBeforeUnlockRequestEvent({\n id: input.id,\n type: input.type\n })\n );\n\n const result = await this.decoratee.execute(input);\n\n if (result.isFail()) {\n const error = result.error;\n\n await this.eventPublisher.publish(\n new EntryUnlockRequestErrorEvent({\n id: input.id,\n type: input.type,\n error\n })\n );\n\n return result;\n }\n\n // Publish after event\n await this.eventPublisher.publish(\n new EntryAfterUnlockRequestEvent({\n id: input.id,\n type: input.type,\n record: result.value\n })\n );\n\n return result;\n }\n}\n\nexport const UnlockEntryRequestEventsDecorator = UnlockEntryRequestUseCase.createDecorator({\n decorator: UnlockEntryRequestEventsDecoratorImpl,\n dependencies: [EventPublisher]\n});\n"],"mappings":"AAAA,SAGIA,yBAAyB;AAE7B,SAASC,cAAc,QAAQ,0CAA0C;AAGzE,SACIC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,4BAA4B;AAGhC,MAAMC,qCAAqC,CAAgD;EACvFC,WAAWA,CACUC,cAAwC,EACxCC,SAA8C,EACjE;IAAA,KAFmBD,cAAwC,GAAxCA,cAAwC;IAAA,KACxCC,SAA8C,GAA9CA,SAA8C;EAChE;EAEH,MAAMC,OAAOA,CACTC,KAA8B,EACwB;IACtD;IACA,MAAM,IAAI,CAACH,cAAc,CAACI,OAAO,CAC7B,IAAIR,6BAA6B,CAAC;MAC9BS,EAAE,EAAEF,KAAK,CAACE,EAAE;MACZC,IAAI,EAAEH,KAAK,CAACG;IAChB,CAAC,CACL,CAAC;IAED,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACN,SAAS,CAACC,OAAO,CAACC,KAAK,CAAC;IAElD,IAAII,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,MAAMC,KAAK,GAAGF,MAAM,CAACE,KAAK;MAE1B,MAAM,IAAI,CAACT,cAAc,CAACI,OAAO,CAC7B,IAAIP,4BAA4B,CAAC;QAC7BQ,EAAE,EAAEF,KAAK,CAACE,EAAE;QACZC,IAAI,EAAEH,KAAK,CAACG,IAAI;QAChBG;MACJ,CAAC,CACL,CAAC;MAED,OAAOF,MAAM;IACjB;;IAEA;IACA,MAAM,IAAI,CAACP,cAAc,CAACI,OAAO,CAC7B,IAAIT,4BAA4B,CAAC;MAC7BU,EAAE,EAAEF,KAAK,CAACE,EAAE;MACZC,IAAI,EAAEH,KAAK,CAACG,IAAI;MAChBI,MAAM,EAAEH,MAAM,CAACI;IACnB,CAAC,CACL,CAAC;IAED,OAAOJ,MAAM;EACjB;AACJ;AAEA,OAAO,MAAMK,iCAAiC,GAAGnB,yBAAyB,CAACoB,eAAe,CAAC;EACvFC,SAAS,EAAEhB,qCAAqC;EAChDiB,YAAY,EAAE,CAACrB,cAAc;AACjC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnlockEntryRequestUseCase","EventPublisher","EntryAfterUnlockRequestEvent","EntryBeforeUnlockRequestEvent","EntryUnlockRequestErrorEvent","UnlockEntryRequestEventsDecoratorImpl","constructor","eventPublisher","decoratee","execute","input","publish","id","type","result","isFail","error","record","value","UnlockEntryRequestEventsDecorator","createDecorator","decorator","dependencies"],"sources":["UnlockEntryRequestEventsDecorator.ts"],"sourcesContent":["import {\n type UnlockEntryRequestInput,\n UnlockEntryRequestUseCase as UseCaseAbstraction,\n UnlockEntryRequestUseCase\n} from \"./abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { ILockRecord } from \"~/domain/index.js\";\nimport { Result } from \"@webiny/feature/api/index.js\";\nimport {\n EntryAfterUnlockRequestEvent,\n EntryBeforeUnlockRequestEvent,\n EntryUnlockRequestErrorEvent\n} from \"./events.js\";\n\nclass UnlockEntryRequestEventsDecoratorImpl implements UnlockEntryRequestUseCase.Interface {\n constructor(\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly decoratee: UnlockEntryRequestUseCase.Interface\n ) {}\n\n async execute(\n input: UnlockEntryRequestInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Publish before event\n await this.eventPublisher.publish(\n new EntryBeforeUnlockRequestEvent({\n id: input.id,\n type: input.type\n })\n );\n\n const result = await this.decoratee.execute(input);\n\n if (result.isFail()) {\n const error = result.error;\n\n await this.eventPublisher.publish(\n new EntryUnlockRequestErrorEvent({\n id: input.id,\n type: input.type,\n error\n })\n );\n\n return result;\n }\n\n // Publish after event\n await this.eventPublisher.publish(\n new EntryAfterUnlockRequestEvent({\n id: input.id,\n type: input.type,\n record: result.value\n })\n );\n\n return result;\n }\n}\n\nexport const UnlockEntryRequestEventsDecorator = UnlockEntryRequestUseCase.createDecorator({\n decorator: UnlockEntryRequestEventsDecoratorImpl,\n dependencies: [EventPublisher]\n});\n"],"mappings":"AAAA,SAGIA,yBAAyB;AAE7B,SAASC,cAAc,QAAQ,mDAAmD;AAGlF,SACIC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,4BAA4B;AAGhC,MAAMC,qCAAqC,CAAgD;EACvFC,WAAWA,CACUC,cAAwC,EACxCC,SAA8C,EACjE;IAAA,KAFmBD,cAAwC,GAAxCA,cAAwC;IAAA,KACxCC,SAA8C,GAA9CA,SAA8C;EAChE;EAEH,MAAMC,OAAOA,CACTC,KAA8B,EACwB;IACtD;IACA,MAAM,IAAI,CAACH,cAAc,CAACI,OAAO,CAC7B,IAAIR,6BAA6B,CAAC;MAC9BS,EAAE,EAAEF,KAAK,CAACE,EAAE;MACZC,IAAI,EAAEH,KAAK,CAACG;IAChB,CAAC,CACL,CAAC;IAED,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACN,SAAS,CAACC,OAAO,CAACC,KAAK,CAAC;IAElD,IAAII,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,MAAMC,KAAK,GAAGF,MAAM,CAACE,KAAK;MAE1B,MAAM,IAAI,CAACT,cAAc,CAACI,OAAO,CAC7B,IAAIP,4BAA4B,CAAC;QAC7BQ,EAAE,EAAEF,KAAK,CAACE,EAAE;QACZC,IAAI,EAAEH,KAAK,CAACG,IAAI;QAChBG;MACJ,CAAC,CACL,CAAC;MAED,OAAOF,MAAM;IACjB;;IAEA;IACA,MAAM,IAAI,CAACP,cAAc,CAACI,OAAO,CAC7B,IAAIT,4BAA4B,CAAC;MAC7BU,EAAE,EAAEF,KAAK,CAACE,EAAE;MACZC,IAAI,EAAEH,KAAK,CAACG,IAAI;MAChBI,MAAM,EAAEH,MAAM,CAACI;IACnB,CAAC,CACL,CAAC;IAED,OAAOJ,MAAM;EACjB;AACJ;AAEA,OAAO,MAAMK,iCAAiC,GAAGnB,yBAAyB,CAACoB,eAAe,CAAC;EACvFC,SAAS,EAAEhB,qCAAqC;EAChDiB,YAAY,EAAE,CAACrB,cAAc;AACjC,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UnlockEntryRequestRepository as RepositoryAbstraction } from "./abstractions.js";
3
3
  import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
4
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
4
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
5
5
  import type { ILockRecord } from "../../domain/LockRecord.js";
6
6
  import type { CmsModel } from "@webiny/api-headless-cms/types";
7
7
  declare class UnlockEntryRequestRepositoryImpl implements RepositoryAbstraction.Interface {
@@ -1,7 +1,7 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UnlockEntryRequestRepository as RepositoryAbstraction } from "./abstractions.js";
3
3
  import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
4
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
4
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
5
5
  import { RecordLockingModel } from "../../domain/abstractions.js";
6
6
  import { UnlockEntryRequestError } from "../../domain/errors.js";
7
7
  import { createLockRecordDatabaseId } from "../../utils/lockRecordDatabaseId.js";
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UnlockEntryRequestRepository","RepositoryAbstraction","UpdateEntryUseCase","IdentityContext","RecordLockingModel","UnlockEntryRequestError","createLockRecordDatabaseId","createIdentifier","UnlockEntryRequestRepositoryImpl","constructor","updateEntry","identityContext","model","update","record","entryId","id","version","recordValues","toObject","result","withoutAuthorization","execute","values","isFail","fail","error","ok","createImplementation","implementation","dependencies"],"sources":["UnlockEntryRequestRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UnlockEntryRequestRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport { RecordLockingModel } from \"~/domain/abstractions.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { UnlockEntryRequestError } from \"~/domain/errors.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\nimport { createIdentifier } from \"@webiny/utils\";\n\nclass UnlockEntryRequestRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private updateEntry: UpdateEntryUseCase.Interface,\n private identityContext: IdentityContext.Interface,\n private model: CmsModel\n ) {}\n\n async update(record: ILockRecord): Promise<Result<ILockRecord, RepositoryAbstraction.Error>> {\n try {\n const entryId = createLockRecordDatabaseId(record.id);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n\n const recordValues = record.toObject();\n const result = await this.identityContext.withoutAuthorization(async () => {\n return await this.updateEntry.execute(this.model, id, {\n ...recordValues,\n values: recordValues\n });\n });\n\n if (result.isFail()) {\n return Result.fail(new UnlockEntryRequestError(result.error));\n }\n\n return Result.ok(record);\n } catch (error) {\n return Result.fail(new UnlockEntryRequestError(error as Error));\n }\n }\n}\n\nexport const UnlockEntryRequestRepository = RepositoryAbstraction.createImplementation({\n implementation: UnlockEntryRequestRepositoryImpl,\n dependencies: [UpdateEntryUseCase, IdentityContext, RecordLockingModel]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,4BAA4B,IAAIC,qBAAqB;AAC9D,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,kBAAkB;AAG3B,SAASC,uBAAuB;AAChC,SAASC,0BAA0B;AACnC,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,MAAMC,gCAAgC,CAA4C;EAC9EC,WAAWA,CACCC,WAAyC,EACzCC,eAA0C,EAC1CC,KAAe,EACzB;IAAA,KAHUF,WAAyC,GAAzCA,WAAyC;IAAA,KACzCC,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,KAAe,GAAfA,KAAe;EACxB;EAEH,MAAMC,MAAMA,CAACC,MAAmB,EAA6D;IACzF,IAAI;MACA,MAAMC,OAAO,GAAGT,0BAA0B,CAACQ,MAAM,CAACE,EAAE,CAAC;MACrD,MAAMA,EAAE,GAAGT,gBAAgB,CAAC;QACxBS,EAAE,EAAED,OAAO;QACXE,OAAO,EAAE;MACb,CAAC,CAAC;MAEF,MAAMC,YAAY,GAAGJ,MAAM,CAACK,QAAQ,CAAC,CAAC;MACtC,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACT,eAAe,CAACU,oBAAoB,CAAC,YAAY;QACvE,OAAO,MAAM,IAAI,CAACX,WAAW,CAACY,OAAO,CAAC,IAAI,CAACV,KAAK,EAAEI,EAAE,EAAE;UAClD,GAAGE,YAAY;UACfK,MAAM,EAAEL;QACZ,CAAC,CAAC;MACN,CAAC,CAAC;MAEF,IAAIE,MAAM,CAACI,MAAM,CAAC,CAAC,EAAE;QACjB,OAAOzB,MAAM,CAAC0B,IAAI,CAAC,IAAIpB,uBAAuB,CAACe,MAAM,CAACM,KAAK,CAAC,CAAC;MACjE;MAEA,OAAO3B,MAAM,CAAC4B,EAAE,CAACb,MAAM,CAAC;IAC5B,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,OAAO3B,MAAM,CAAC0B,IAAI,CAAC,IAAIpB,uBAAuB,CAACqB,KAAc,CAAC,CAAC;IACnE;EACJ;AACJ;AAEA,OAAO,MAAM1B,4BAA4B,GAAGC,qBAAqB,CAAC2B,oBAAoB,CAAC;EACnFC,cAAc,EAAErB,gCAAgC;EAChDsB,YAAY,EAAE,CAAC5B,kBAAkB,EAAEC,eAAe,EAAEC,kBAAkB;AAC1E,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","UnlockEntryRequestRepository","RepositoryAbstraction","UpdateEntryUseCase","IdentityContext","RecordLockingModel","UnlockEntryRequestError","createLockRecordDatabaseId","createIdentifier","UnlockEntryRequestRepositoryImpl","constructor","updateEntry","identityContext","model","update","record","entryId","id","version","recordValues","toObject","result","withoutAuthorization","execute","values","isFail","fail","error","ok","createImplementation","implementation","dependencies"],"sources":["UnlockEntryRequestRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UnlockEntryRequestRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { RecordLockingModel } from \"~/domain/abstractions.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { UnlockEntryRequestError } from \"~/domain/errors.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\nimport { createIdentifier } from \"@webiny/utils\";\n\nclass UnlockEntryRequestRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private updateEntry: UpdateEntryUseCase.Interface,\n private identityContext: IdentityContext.Interface,\n private model: CmsModel\n ) {}\n\n async update(record: ILockRecord): Promise<Result<ILockRecord, RepositoryAbstraction.Error>> {\n try {\n const entryId = createLockRecordDatabaseId(record.id);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n\n const recordValues = record.toObject();\n const result = await this.identityContext.withoutAuthorization(async () => {\n return await this.updateEntry.execute(this.model, id, {\n ...recordValues,\n values: recordValues\n });\n });\n\n if (result.isFail()) {\n return Result.fail(new UnlockEntryRequestError(result.error));\n }\n\n return Result.ok(record);\n } catch (error) {\n return Result.fail(new UnlockEntryRequestError(error as Error));\n }\n }\n}\n\nexport const UnlockEntryRequestRepository = RepositoryAbstraction.createImplementation({\n implementation: UnlockEntryRequestRepositoryImpl,\n dependencies: [UpdateEntryUseCase, IdentityContext, RecordLockingModel]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,4BAA4B,IAAIC,qBAAqB;AAC9D,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,kBAAkB;AAG3B,SAASC,uBAAuB;AAChC,SAASC,0BAA0B;AACnC,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,MAAMC,gCAAgC,CAA4C;EAC9EC,WAAWA,CACCC,WAAyC,EACzCC,eAA0C,EAC1CC,KAAe,EACzB;IAAA,KAHUF,WAAyC,GAAzCA,WAAyC;IAAA,KACzCC,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,KAAe,GAAfA,KAAe;EACxB;EAEH,MAAMC,MAAMA,CAACC,MAAmB,EAA6D;IACzF,IAAI;MACA,MAAMC,OAAO,GAAGT,0BAA0B,CAACQ,MAAM,CAACE,EAAE,CAAC;MACrD,MAAMA,EAAE,GAAGT,gBAAgB,CAAC;QACxBS,EAAE,EAAED,OAAO;QACXE,OAAO,EAAE;MACb,CAAC,CAAC;MAEF,MAAMC,YAAY,GAAGJ,MAAM,CAACK,QAAQ,CAAC,CAAC;MACtC,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACT,eAAe,CAACU,oBAAoB,CAAC,YAAY;QACvE,OAAO,MAAM,IAAI,CAACX,WAAW,CAACY,OAAO,CAAC,IAAI,CAACV,KAAK,EAAEI,EAAE,EAAE;UAClD,GAAGE,YAAY;UACfK,MAAM,EAAEL;QACZ,CAAC,CAAC;MACN,CAAC,CAAC;MAEF,IAAIE,MAAM,CAACI,MAAM,CAAC,CAAC,EAAE;QACjB,OAAOzB,MAAM,CAAC0B,IAAI,CAAC,IAAIpB,uBAAuB,CAACe,MAAM,CAACM,KAAK,CAAC,CAAC;MACjE;MAEA,OAAO3B,MAAM,CAAC4B,EAAE,CAACb,MAAM,CAAC;IAC5B,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,OAAO3B,MAAM,CAAC0B,IAAI,CAAC,IAAIpB,uBAAuB,CAACqB,KAAc,CAAC,CAAC;IACnE;EACJ;AACJ;AAEA,OAAO,MAAM1B,4BAA4B,GAAGC,qBAAqB,CAAC2B,oBAAoB,CAAC;EACnFC,cAAc,EAAErB,gCAAgC;EAChDsB,YAAY,EAAE,CAAC5B,kBAAkB,EAAEC,eAAe,EAAEC,kBAAkB;AAC1E,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UnlockEntryRequestUseCase as UseCaseAbstraction, UnlockEntryRequestRepository, UnlockEntryRequestInput } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
4
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
5
5
  import type { ILockRecord } from "../../domain/LockRecord.js";
6
6
  declare class UnlockEntryRequestUseCaseImpl implements UseCaseAbstraction.Interface {
7
7
  private getLockRecord;
@@ -1,7 +1,7 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UnlockEntryRequestUseCase as UseCaseAbstraction, UnlockEntryRequestRepository } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
4
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
5
5
  import { EntryNotLockedError, UnlockRequestAlreadySentError, LockRecordNotFoundError, LockRecordPersistenceError } from "../../domain/errors.js";
6
6
  import { RecordLockingLockRecordActionType } from "../../domain/types.js";
7
7
  class UnlockEntryRequestUseCaseImpl {
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UnlockEntryRequestUseCase","UseCaseAbstraction","UnlockEntryRequestRepository","GetLockRecordUseCase","IdentityContext","EntryNotLockedError","UnlockRequestAlreadySentError","LockRecordNotFoundError","LockRecordPersistenceError","RecordLockingLockRecordActionType","UnlockEntryRequestUseCaseImpl","constructor","getLockRecord","repository","identityContext","execute","input","recordResult","isFail","error","id","type","fail","record","value","isExpired","unlockRequested","getUnlockRequested","currentIdentity","getIdentity","createdBy","identityId","approved","getUnlockApproved","denied","getUnlockDenied","ok","identity","addAction","requested","createdOn","Date","updateResult","update","createImplementation","implementation","dependencies"],"sources":["UnlockEntryRequestUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UnlockEntryRequestUseCase as UseCaseAbstraction,\n UnlockEntryRequestRepository,\n UnlockEntryRequestInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n EntryNotLockedError,\n UnlockRequestAlreadySentError,\n LockRecordNotFoundError,\n LockRecordPersistenceError\n} from \"~/domain/errors.js\";\nimport { RecordLockingLockRecordActionType } from \"~/domain/types.js\";\n\nclass UnlockEntryRequestUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private repository: UnlockEntryRequestRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UnlockEntryRequestInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Get the lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If not found, it means entry is not locked\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n // Other errors\n return Result.fail(new LockRecordPersistenceError(recordResult.error));\n }\n\n const record = recordResult.value;\n\n // If expired, entry is not locked\n if (record.isExpired()) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n\n // Check if unlock request already exists\n const unlockRequested = record.getUnlockRequested();\n if (unlockRequested) {\n const currentIdentity = this.identityContext.getIdentity();\n\n // If a different user already requested unlock, deny\n if (unlockRequested.createdBy.id !== currentIdentity.id) {\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // If same user but already approved or denied, return the record\n const approved = record.getUnlockApproved();\n const denied = record.getUnlockDenied();\n if (approved || denied) {\n return Result.ok(record);\n }\n\n // If same user and pending, treat as duplicate\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // Add unlock request action\n const identity = this.identityContext.getIdentity();\n record.addAction({\n type: RecordLockingLockRecordActionType.requested,\n createdOn: new Date(),\n createdBy: identity\n });\n\n // Update the record\n const updateResult = await this.repository.update(record);\n\n if (updateResult.isFail()) {\n return Result.fail(updateResult.error);\n }\n\n return Result.ok(record);\n }\n}\n\nexport const UnlockEntryRequestUseCase = UseCaseAbstraction.createImplementation({\n implementation: UnlockEntryRequestUseCaseImpl,\n dependencies: [GetLockRecordUseCase, UnlockEntryRequestRepository, IdentityContext]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AA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AAM,IAAI,CAAC7B,UAAU,CAAC8B,MAAM,CAACpB,MAAM,CAAC;IAEzD,IAAImB,YAAY,CAACxB,MAAM,CAAC,CAAC,EAAE;MACvB,OAAOnB,MAAM,CAACuB,IAAI,CAACoB,YAAY,CAACvB,KAAK,CAAC;IAC1C;IAEA,OAAOpB,MAAM,CAACqC,EAAE,CAACb,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMvB,yBAAyB,GAAGC,kBAAkB,CAAC2C,oBAAoB,CAAC;EAC7EC,cAAc,EAAEnC,6BAA6B;EAC7CoC,YAAY,EAAE,CAAC3C,oBAAoB,EAAED,4BAA4B,EAAEE,eAAe;AACtF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","UnlockEntryRequestUseCase","UseCaseAbstraction","UnlockEntryRequestRepository","GetLockRecordUseCase","IdentityContext","EntryNotLockedError","UnlockRequestAlreadySentError","LockRecordNotFoundError","LockRecordPersistenceError","RecordLockingLockRecordActionType","UnlockEntryRequestUseCaseImpl","constructor","getLockRecord","repository","identityContext","execute","input","recordResult","isFail","error","id","type","fail","record","value","isExpired","unlockRequested","getUnlockRequested","currentIdentity","getIdentity","createdBy","identityId","approved","getUnlockApproved","denied","getUnlockDenied","ok","identity","addAction","requested","createdOn","Date","updateResult","update","createImplementation","implementation","dependencies"],"sources":["UnlockEntryRequestUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UnlockEntryRequestUseCase as UseCaseAbstraction,\n UnlockEntryRequestRepository,\n UnlockEntryRequestInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n EntryNotLockedError,\n UnlockRequestAlreadySentError,\n LockRecordNotFoundError,\n LockRecordPersistenceError\n} from \"~/domain/errors.js\";\nimport { RecordLockingLockRecordActionType } from \"~/domain/types.js\";\n\nclass UnlockEntryRequestUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private repository: UnlockEntryRequestRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UnlockEntryRequestInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Get the lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If not found, it means entry is not locked\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n // Other errors\n return Result.fail(new LockRecordPersistenceError(recordResult.error));\n }\n\n const record = recordResult.value;\n\n // If expired, entry is not locked\n if (record.isExpired()) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n\n // Check if unlock request already exists\n const unlockRequested = record.getUnlockRequested();\n if (unlockRequested) {\n const currentIdentity = this.identityContext.getIdentity();\n\n // If a different user already requested unlock, deny\n if (unlockRequested.createdBy.id !== currentIdentity.id) {\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // If same user but already approved or denied, return the record\n const approved = record.getUnlockApproved();\n const denied = record.getUnlockDenied();\n if (approved || denied) {\n return Result.ok(record);\n }\n\n // If same user and pending, treat as duplicate\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // Add unlock request action\n const identity = this.identityContext.getIdentity();\n record.addAction({\n type: RecordLockingLockRecordActionType.requested,\n createdOn: new Date(),\n createdBy: identity\n });\n\n // Update the record\n const updateResult = await this.repository.update(record);\n\n if (updateResult.isFail()) {\n return Result.fail(updateResult.error);\n }\n\n return Result.ok(record);\n }\n}\n\nexport const UnlockEntryRequestUseCase = UseCaseAbstraction.createImplementation({\n implementation: UnlockEntryRequestUseCaseImpl,\n dependencies: [GetLockRecordUseCase, UnlockEntryRequestRepository, IdentityContext]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,yBAAyB,IAAIC,kBAAkB,EAC/CC,4BAA4B;AAGhC,SAASC,oBAAoB;AAC7B,SAASC,eAAe,QAAQ,6DAA6D;AAE7F,SACIC,mBAAmB,EACnBC,6BAA6B,EAC7BC,uBAAuB,EACvBC,0BAA0B;AAE9B,SAASC,iCAAiC;AAE1C,MAAMC,6BAA6B,CAAyC;EACxEC,WAAWA,CACCC,aAA6C,EAC7CC,UAAkD,EAClDC,eAA0C,EACpD;IAAA,KAHUF,aAA6C,GAA7CA,aAA6C;IAAA,KAC7CC,UAAkD,GAAlDA,UAAkD;IAAA,KAClDC,eAA0C,GAA1CA,eAA0C;EACnD;EAEH,MAAMC,OAAOA,CACTC,KAA8B,EACwB;IACtD;IACA,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACL,aAAa,CAACG,OAAO,CAACC,KAAK,CAAC;;IAE5D;IACA,IAAIC,YAAY,CAACC,MAAM,CAAC,CAAC,EAAE;MACvB,IAAID,YAAY,CAACE,KAAK,YAAYZ,uBAAuB,EAAE;QACvD,MAAMY,KAAK,GAAG,IAAId,mBAAmB,CAAC;UAAEe,EAAE,EAAEJ,KAAK,CAACI,EAAE;UAAEC,IAAI,EAAEL,KAAK,CAACK;QAAK,CAAC,CAAC;QACzE,OAAOtB,MAAM,CAACuB,IAAI,CAACH,KAAK,CAAC;MAC7B;MACA;MACA,OAAOpB,MAAM,CAACuB,IAAI,CAAC,IAAId,0BAA0B,CAACS,YAAY,CAACE,KAAK,CAAC,CAAC;IAC1E;IAEA,MAAMI,MAAM,GAAGN,YAAY,CAACO,KAAK;;IAEjC;IACA,IAAID,MAAM,CAACE,SAAS,CAAC,CAAC,EAAE;MACpB,MAAMN,KAAK,GAAG,IAAId,mBAAmB,CAAC;QAAEe,EAAE,EAAEJ,KAAK,CA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AS;MACjDC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MACrBX,SAAS,EAAEO;IACf,CAAC,CAAC;;IAEF;IACA,MAAMK,YAAY,GAAG,MAAM,IAAI,CAAC7B,UAAU,CAAC8B,MAAM,CAACpB,MAAM,CAAC;IAEzD,IAAImB,YAAY,CAACxB,MAAM,CAAC,CAAC,EAAE;MACvB,OAAOnB,MAAM,CAACuB,IAAI,CAACoB,YAAY,CAACvB,KAAK,CAAC;IAC1C;IAEA,OAAOpB,MAAM,CAACqC,EAAE,CAACb,MAAM,CAAC;EAC5B;AACJ;AAEA,OAAO,MAAMvB,yBAAyB,GAAGC,kBAAkB,CAAC2C,oBAAoB,CAAC;EAC7EC,cAAc,EAAEnC,6BAA6B;EAC7CoC,YAAY,EAAE,CAAC3C,oBAAoB,EAAED,4BAA4B,EAAEE,eAAe;AACtF,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
2
- import type { IEventHandler } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
+ import type { IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { ILockRecord } from "../../domain/LockRecord.js";
4
4
  import type { LockRecordEntryType } from "../../domain/types.js";
5
5
  export interface EntryBeforeUnlockRequestPayload {
@@ -10,8 +10,8 @@ export declare class EntryBeforeUnlockRequestEvent extends DomainEvent<EntryBefo
10
10
  eventType: "RecordLocking/Entry/BeforeUnlockRequest";
11
11
  getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<EntryBeforeUnlockRequestEvent>>;
12
12
  }
13
- export declare const EntryBeforeUnlockRequestHandler: import("@webiny/di").Abstraction<IEventHandler<EntryBeforeUnlockRequestEvent>>;
14
- export declare namespace EntryBeforeUnlockRequestHandler {
13
+ export declare const EntryBeforeUnlockRequestEventHandler: import("@webiny/di").Abstraction<IEventHandler<EntryBeforeUnlockRequestEvent>>;
14
+ export declare namespace EntryBeforeUnlockRequestEventHandler {
15
15
  type Interface = IEventHandler<EntryBeforeUnlockRequestEvent>;
16
16
  type Event = EntryBeforeUnlockRequestEvent;
17
17
  }
@@ -24,8 +24,8 @@ export declare class EntryAfterUnlockRequestEvent extends DomainEvent<EntryAfter
24
24
  eventType: "RecordLocking/Entry/AfterUnlockRequest";
25
25
  getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<EntryAfterUnlockRequestEvent>>;
26
26
  }
27
- export declare const EntryAfterUnlockRequestHandler: import("@webiny/di").Abstraction<IEventHandler<EntryAfterUnlockRequestEvent>>;
28
- export declare namespace EntryAfterUnlockRequestHandler {
27
+ export declare const EntryAfterUnlockRequestEventHandler: import("@webiny/di").Abstraction<IEventHandler<EntryAfterUnlockRequestEvent>>;
28
+ export declare namespace EntryAfterUnlockRequestEventHandler {
29
29
  type Interface = IEventHandler<EntryAfterUnlockRequestEvent>;
30
30
  type Event = EntryAfterUnlockRequestEvent;
31
31
  }
@@ -38,8 +38,8 @@ export declare class EntryUnlockRequestErrorEvent extends DomainEvent<EntryUnloc
38
38
  eventType: "RecordLocking/Entry/UnlockRequestError";
39
39
  getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<EntryUnlockRequestErrorEvent>>;
40
40
  }
41
- export declare const EntryUnlockRequestErrorHandler: import("@webiny/di").Abstraction<IEventHandler<EntryUnlockRequestErrorEvent>>;
42
- export declare namespace EntryUnlockRequestErrorHandler {
41
+ export declare const EntryUnlockRequestErrorEventHandler: import("@webiny/di").Abstraction<IEventHandler<EntryUnlockRequestErrorEvent>>;
42
+ export declare namespace EntryUnlockRequestErrorEventHandler {
43
43
  type Interface = IEventHandler<EntryUnlockRequestErrorEvent>;
44
44
  type Event = EntryUnlockRequestErrorEvent;
45
45
  }
@@ -1,5 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
2
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
 
4
4
  // ============================================================================
5
5
  // EntryBeforeUnlockRequest Event
@@ -8,10 +8,10 @@ import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
8
8
  export class EntryBeforeUnlockRequestEvent extends DomainEvent {
9
9
  eventType = "RecordLocking/Entry/BeforeUnlockRequest";
10
10
  getHandlerAbstraction() {
11
- return EntryBeforeUnlockRequestHandler;
11
+ return EntryBeforeUnlockRequestEventHandler;
12
12
  }
13
13
  }
14
- export const EntryBeforeUnlockRequestHandler = createAbstraction("EntryBeforeUnlockRequestHandler");
14
+ export const EntryBeforeUnlockRequestEventHandler = createAbstraction("EntryBeforeUnlockRequestEventHandler");
15
15
 
16
16
  // ============================================================================
17
17
  // EntryAfterUnlockRequest Event
@@ -20,10 +20,10 @@ export const EntryBeforeUnlockRequestHandler = createAbstraction("EntryBeforeUnl
20
20
  export class EntryAfterUnlockRequestEvent extends DomainEvent {
21
21
  eventType = "RecordLocking/Entry/AfterUnlockRequest";
22
22
  getHandlerAbstraction() {
23
- return EntryAfterUnlockRequestHandler;
23
+ return EntryAfterUnlockRequestEventHandler;
24
24
  }
25
25
  }
26
- export const EntryAfterUnlockRequestHandler = createAbstraction("EntryAfterUnlockRequestHandler");
26
+ export const EntryAfterUnlockRequestEventHandler = createAbstraction("EntryAfterUnlockRequestEventHandler");
27
27
 
28
28
  // ============================================================================
29
29
  // EntryUnlockRequestError Event
@@ -32,9 +32,9 @@ export const EntryAfterUnlockRequestHandler = createAbstraction("EntryAfterUnloc
32
32
  export class EntryUnlockRequestErrorEvent extends DomainEvent {
33
33
  eventType = "RecordLocking/Entry/UnlockRequestError";
34
34
  getHandlerAbstraction() {
35
- return EntryUnlockRequestErrorHandler;
35
+ return EntryUnlockRequestErrorEventHandler;
36
36
  }
37
37
  }
38
- export const EntryUnlockRequestErrorHandler = createAbstraction("EntryUnlockRequestErrorHandler");
38
+ export const EntryUnlockRequestErrorEventHandler = createAbstraction("EntryUnlockRequestErrorEventHandler");
39
39
 
40
40
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","DomainEvent","EntryBeforeUnlockRequestEvent","eventType","getHandlerAbstraction","EntryBeforeUnlockRequestHandler","EntryAfterUnlockRequestEvent","EntryAfterUnlockRequestHandler","EntryUnlockRequestErrorEvent","EntryUnlockRequestErrorHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport type { IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\n\n// ============================================================================\n// EntryBeforeUnlockRequest Event\n// ============================================================================\n\nexport interface EntryBeforeUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n}\n\nexport class EntryBeforeUnlockRequestEvent extends DomainEvent<EntryBeforeUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/BeforeUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryBeforeUnlockRequestHandler;\n }\n}\n\nexport const EntryBeforeUnlockRequestHandler = createAbstraction<\n IEventHandler<EntryBeforeUnlockRequestEvent>\n>(\"EntryBeforeUnlockRequestHandler\");\n\nexport namespace EntryBeforeUnlockRequestHandler {\n export type Interface = IEventHandler<EntryBeforeUnlockRequestEvent>;\n export type Event = EntryBeforeUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryAfterUnlockRequest Event\n// ============================================================================\n\nexport interface EntryAfterUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n record: ILockRecord;\n}\n\nexport class EntryAfterUnlockRequestEvent extends DomainEvent<EntryAfterUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/AfterUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryAfterUnlockRequestHandler;\n }\n}\n\nexport const EntryAfterUnlockRequestHandler = createAbstraction<\n IEventHandler<EntryAfterUnlockRequestEvent>\n>(\"EntryAfterUnlockRequestHandler\");\n\nexport namespace EntryAfterUnlockRequestHandler {\n export type Interface = IEventHandler<EntryAfterUnlockRequestEvent>;\n export type Event = EntryAfterUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryUnlockRequestError Event\n// ============================================================================\n\nexport interface EntryUnlockRequestErrorPayload {\n id: string;\n type: LockRecordEntryType;\n error: Error;\n}\n\nexport class EntryUnlockRequestErrorEvent extends DomainEvent<EntryUnlockRequestErrorPayload> {\n eventType = \"RecordLocking/Entry/UnlockRequestError\" as const;\n\n getHandlerAbstraction() {\n return EntryUnlockRequestErrorHandler;\n }\n}\n\nexport const EntryUnlockRequestErrorHandler = createAbstraction<\n IEventHandler<EntryUnlockRequestErrorEvent>\n>(\"EntryUnlockRequestErrorHandler\");\n\nexport namespace EntryUnlockRequestErrorHandler {\n export type Interface = IEventHandler<EntryUnlockRequestErrorEvent>;\n export type Event = EntryUnlockRequestErrorEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,0CAA0C;;AAKtE;AACA;AACA;;AAOA,OAAO,MAAMC,6BAA6B,SAASD,WAAW,CAAkC;EAC5FE,SAAS,GAAG,yCAAyC;EAErDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,+BAA+B;EAC1C;AACJ;AAEA,OAAO,MAAMA,+BAA+B,GAAGL,iBAAiB,CAE9D,iCAAiC,CAAC;;AAOpC;AACA;AACA;;AAQA,OAAO,MAAMM,4BAA4B,SAASL,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,8BAA8B;EACzC;AACJ;AAEA,OAAO,MAAMA,8BAA8B,GAAGP,iBAAiB,CAE7D,gCAAgC,CAAC;;AAOnC;AACA;AACA;;AAQA,OAAO,MAAMQ,4BAA4B,SAASP,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOK,8BAA8B;EACzC;AACJ;AAEA,OAAO,MAAMA,8BAA8B,GAAGT,iBAAiB,CAE7D,gCAAgC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","DomainEvent","EntryBeforeUnlockRequestEvent","eventType","getHandlerAbstraction","EntryBeforeUnlockRequestEventHandler","EntryAfterUnlockRequestEvent","EntryAfterUnlockRequestEventHandler","EntryUnlockRequestErrorEvent","EntryUnlockRequestErrorEventHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\n\n// ============================================================================\n// EntryBeforeUnlockRequest Event\n// ============================================================================\n\nexport interface EntryBeforeUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n}\n\nexport class EntryBeforeUnlockRequestEvent extends DomainEvent<EntryBeforeUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/BeforeUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryBeforeUnlockRequestEventHandler;\n }\n}\n\nexport const EntryBeforeUnlockRequestEventHandler = createAbstraction<\n IEventHandler<EntryBeforeUnlockRequestEvent>\n>(\"EntryBeforeUnlockRequestEventHandler\");\n\nexport namespace EntryBeforeUnlockRequestEventHandler {\n export type Interface = IEventHandler<EntryBeforeUnlockRequestEvent>;\n export type Event = EntryBeforeUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryAfterUnlockRequest Event\n// ============================================================================\n\nexport interface EntryAfterUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n record: ILockRecord;\n}\n\nexport class EntryAfterUnlockRequestEvent extends DomainEvent<EntryAfterUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/AfterUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryAfterUnlockRequestEventHandler;\n }\n}\n\nexport const EntryAfterUnlockRequestEventHandler = createAbstraction<\n IEventHandler<EntryAfterUnlockRequestEvent>\n>(\"EntryAfterUnlockRequestEventHandler\");\n\nexport namespace EntryAfterUnlockRequestEventHandler {\n export type Interface = IEventHandler<EntryAfterUnlockRequestEvent>;\n export type Event = EntryAfterUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryUnlockRequestError Event\n// ============================================================================\n\nexport interface EntryUnlockRequestErrorPayload {\n id: string;\n type: LockRecordEntryType;\n error: Error;\n}\n\nexport class EntryUnlockRequestErrorEvent extends DomainEvent<EntryUnlockRequestErrorPayload> {\n eventType = \"RecordLocking/Entry/UnlockRequestError\" as const;\n\n getHandlerAbstraction() {\n return EntryUnlockRequestErrorEventHandler;\n }\n}\n\nexport const EntryUnlockRequestErrorEventHandler = createAbstraction<\n IEventHandler<EntryUnlockRequestErrorEvent>\n>(\"EntryUnlockRequestErrorEventHandler\");\n\nexport namespace EntryUnlockRequestErrorEventHandler {\n export type Interface = IEventHandler<EntryUnlockRequestErrorEvent>;\n export type Event = EntryUnlockRequestErrorEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,mDAAmD;;AAK/E;AACA;AACA;;AAOA,OAAO,MAAMC,6BAA6B,SAASD,WAAW,CAAkC;EAC5FE,SAAS,GAAG,yCAAyC;EAErDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,oCAAoC;EAC/C;AACJ;AAEA,OAAO,MAAMA,oCAAoC,GAAGL,iBAAiB,CAEnE,sCAAsC,CAAC;;AAOzC;AACA;AACA;;AAQA,OAAO,MAAMM,4BAA4B,SAASL,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,mCAAmC;EAC9C;AACJ;AAEA,OAAO,MAAMA,mCAAmC,GAAGP,iBAAiB,CAElE,qCAAqC,CAAC;;AAOxC;AACA;AACA;;AAQA,OAAO,MAAMQ,4BAA4B,SAASP,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOK,mCAAmC;EAC9C;AACJ;AAEA,OAAO,MAAMA,mCAAmC,GAAGT,iBAAiB,CAElE,qCAAqC,CAAC","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const UnlockEntryRequestFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UnlockEntryRequestFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -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 { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
3
3
  import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
4
4
  import { Result } from "@webiny/feature/api";
@@ -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 { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
3
3
  import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
4
4
  import { Result } from "@webiny/feature/api";
@@ -1 +1 @@
1
- {"version":3,"names":["IdentityContext","UpdateEntryUseCase","GetEntryByIdUseCase","Result","createIdentifier","UpdateEntryLockRepository","RepositoryAbstraction","RecordLockingConfig","RecordLockingModel","LockRecord","LockRecordPersistenceError","createLockRecordDatabaseId","UpdateEntryLockRepositoryImpl","constructor","model","config","identityContext","updateEntry","getEntryById","update","lockRecordId","updateOwner","entryId","id","version","identity","getIdentity","now","Date","toISOString","updateData","savedOn","createdOn","createdBy","savedBy","result","execute","isFail","fail","error","getResult","entry","value","lockRecord","timeout","ok","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockRepository.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById\";\nimport { Result } from \"@webiny/feature/api\";\nimport { createIdentifier } from \"@webiny/utils\";\nimport { UpdateEntryLockRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { RecordLockingConfig, RecordLockingModel } from \"~/domain/abstractions.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport { LockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordValues } from \"~/domain/types.js\";\nimport { LockRecordPersistenceError } from \"~/domain/errors.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\nclass UpdateEntryLockRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private model: RecordLockingModel.Interface,\n private config: RecordLockingConfig.Interface,\n private identityContext: IdentityContext.Interface,\n private updateEntry: UpdateEntryUseCase.Interface,\n private getEntryById: GetEntryByIdUseCase.Interface\n ) {}\n\n async update(\n lockRecordId: string,\n updateOwner: boolean\n ): Promise<Result<ILockRecord, RepositoryAbstraction.Error>> {\n try {\n const entryId = createLockRecordDatabaseId(lockRecordId);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n\n const identity = this.identityContext.getIdentity();\n const now = new Date().toISOString();\n\n // Build update data\n const updateData: any = {\n savedOn: now\n };\n\n // If updating owner (expired lock), also update created fields\n if (updateOwner) {\n updateData.createdOn = now;\n updateData.createdBy = identity;\n updateData.savedBy = identity;\n }\n\n const result = await this.updateEntry.execute(this.model, id, updateData);\n\n if (result.isFail()) {\n return Result.fail(new LockRecordPersistenceError(result.error));\n }\n\n // Fetch the updated entry to return full lock record\n const getResult = await this.getEntryById.execute<LockRecordValues>(this.model, id);\n\n if (getResult.isFail()) {\n return Result.fail(new LockRecordPersistenceError(getResult.error));\n }\n\n const entry = getResult.value;\n const lockRecord = new LockRecord(entry, this.config.timeout);\n\n return Result.ok(lockRecord);\n } catch (error) {\n return Result.fail(new LockRecordPersistenceError(error as Error));\n }\n }\n}\n\nexport const UpdateEntryLockRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateEntryLockRepositoryImpl,\n dependencies: [\n RecordLockingModel,\n RecordLockingConfig,\n IdentityContext,\n UpdateEntryUseCase,\n GetEntryByIdUseCase\n ]\n});\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,mBAAmB,QAAQ,6DAA6D;AACjG,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,yBAAyB,IAAIC,qBAAqB;AAC3D,SAASC,mBAAmB,EAAEC,kBAAkB;AAEhD,SAASC,UAAU;AAEnB,SAASC,0BAA0B;AACnC,SAASC,0BAA0B;AAEnC,MAAMC,6BAA6B,CAA4C;EAC3EC,WAAWA,CACCC,KAAmC,EACnCC,MAAqC,EACrCC,eAA0C,EAC1CC,WAAyC,EACzCC,YAA2C,EACrD;IAAA,KALUJ,KAAmC,GAAnCA,KAAmC;IAAA,KACnCC,MAAqC,GAArCA,MAAqC;IAAA,KACrCC,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,WAAyC,GAAzCA,WAAyC;IAAA,KACzCC,YAA2C,GAA3CA,YAA2C;EACpD;EAEH,MAAMC,MAAMA,CACRC,YAAoB,EACpBC,WAAoB,EACqC;IACzD,IAAI;MACA,MAAMC,OAAO,GAAGX,0BAA0B,CAACS,YAAY,CAAC;MACxD,MAAMG,EAAE,GAAGnB,gBAAgB,CAAC;QACxBmB,EAAE,EAAED,OAAO;QACXE,OAAO,E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AAC,CAAC;IACtE;EACJ;AACJ;AAEA,OAAO,MAAMlC,yBAAyB,GAAGC,qBAAqB,CAACwC,oBAAoB,CAAC;EAChFC,cAAc,EAAEnC,6BAA6B;EAC7CoC,YAAY,EAAE,CACVxC,kBAAkB,EAClBD,mBAAmB,EACnBP,eAAe,EACfC,kBAAkB,EAClBC,mBAAmB;AAE3B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["IdentityContext","UpdateEntryUseCase","GetEntryByIdUseCase","Result","createIdentifier","UpdateEntryLockRepository","RepositoryAbstraction","RecordLockingConfig","RecordLockingModel","LockRecord","LockRecordPersistenceError","createLockRecordDatabaseId","UpdateEntryLockRepositoryImpl","constructor","model","config","identityContext","updateEntry","getEntryById","update","lockRecordId","updateOwner","entryId","id","version","identity","getIdentity","now","Date","toISOString","updateData","savedOn","createdOn","createdBy","savedBy","result","execute","isFail","fail","error","getResult","entry","value","lockRecord","timeout","ok","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockRepository.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById\";\nimport { Result } from \"@webiny/feature/api\";\nimport { createIdentifier } from \"@webiny/utils\";\nimport { UpdateEntryLockRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { RecordLockingConfig, RecordLockingModel } from \"~/domain/abstractions.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport { LockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordValues } from \"~/domain/types.js\";\nimport { LockRecordPersistenceError } from \"~/domain/errors.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\nclass UpdateEntryLockRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private model: RecordLockingModel.Interface,\n private config: RecordLockingConfig.Interface,\n private identityContext: IdentityContext.Interface,\n private updateEntry: UpdateEntryUseCase.Interface,\n private getEntryById: GetEntryByIdUseCase.Interface\n ) {}\n\n async update(\n lockRecordId: string,\n updateOwner: boolean\n ): Promise<Result<ILockRecord, RepositoryAbstraction.Error>> {\n try {\n const entryId = createLockRecordDatabaseId(lockRecordId);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n\n const identity = this.identityContext.getIdentity();\n const now = new Date().toISOString();\n\n // Build update data\n const updateData: any = {\n savedOn: now\n };\n\n // If updating owner (expired lock), also update created fields\n if (updateOwner) {\n updateData.createdOn = now;\n updateData.createdBy = identity;\n updateData.savedBy = identity;\n }\n\n const result = await this.updateEntry.execute(this.model, id, updateData);\n\n if (result.isFail()) {\n return Result.fail(new LockRecordPersistenceError(result.error));\n }\n\n // Fetch the updated entry to return full lock record\n const getResult = await this.getEntryById.execute<LockRecordValues>(this.model, id);\n\n if (getResult.isFail()) {\n return Result.fail(new LockRecordPersistenceError(getResult.error));\n }\n\n const entry = getResult.value;\n const lockRecord = new LockRecord(entry, this.config.timeout);\n\n return Result.ok(lockRecord);\n } catch (error) {\n return Result.fail(new LockRecordPersistenceError(error as Error));\n }\n }\n}\n\nexport const UpdateEntryLockRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateEntryLockRepositoryImpl,\n dependencies: [\n RecordLockingModel,\n RecordLockingConfig,\n IdentityContext,\n UpdateEntryUseCase,\n GetEntryByIdUseCase\n ]\n});\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,mBAAmB,QAAQ,6DAA6D;AACjG,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,yBAAyB,IAAIC,qBAAqB;AAC3D,SAASC,mBAAmB,EAAEC,kBAAkB;AAEhD,SAASC,UAAU;AAEnB,SAASC,0BAA0B;AACnC,SAASC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CAACkB,OAAO,CAAmB,IAAI,CAACtB,KAAK,EAAES,EAAE,CAAC;MAEnF,IAAIiB,SAAS,CAACH,MAAM,CAAC,CAAC,EAAE;QACpB,OAAOlC,MAAM,CAACmC,IAAI,CAAC,IAAI5B,0BAA0B,CAAC8B,SAAS,CAACD,KAAK,CAAC,CAAC;MACvE;MAEA,MAAME,KAAK,GAAGD,SAAS,CAACE,KAAK;MAC7B,MAAMC,UAAU,GAAG,IAAIlC,UAAU,CAACgC,KAAK,EAAE,IAAI,CAAC1B,MAAM,CAAC6B,OAAO,CAAC;MAE7D,OAAOzC,MAAM,CAAC0C,EAAE,CAACF,UAAU,CAAC;IAChC,CAAC,CAAC,OAAOJ,KAAK,EAAE;MACZ,OAAOpC,MAAM,CAACmC,IAAI,CAAC,IAAI5B,0BAA0B,CAAC6B,KAAc,CAAC,CAAC;IACtE;EACJ;AACJ;AAEA,OAAO,MAAMlC,yBAAyB,GAAGC,qBAAqB,CAACwC,oBAAoB,CAAC;EAChFC,cAAc,EAAEnC,6BAA6B;EAC7CoC,YAAY,EAAE,CACVxC,kBAAkB,EAClBD,mBAAmB,EACnBP,eAAe,EACfC,kBAAkB,EAClBC,mBAAmB;AAE3B,CAAC,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@ import { Result } from "@webiny/feature/api";
2
2
  import { UpdateEntryLockUseCase as UseCaseAbstraction, UpdateEntryLockRepository, UpdateEntryLockInput } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
4
  import { LockEntryUseCase } from "../LockEntry/abstractions.js";
5
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
5
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
6
6
  import type { ILockRecord } from "../../domain/LockRecord.js";
7
7
  declare class UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {
8
8
  private getLockRecord;
@@ -2,7 +2,7 @@ import { Result } from "@webiny/feature/api";
2
2
  import { UpdateEntryLockUseCase as UseCaseAbstraction, UpdateEntryLockRepository } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
4
  import { LockEntryUseCase } from "../LockEntry/abstractions.js";
5
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
5
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
6
6
  import { LockRecordNotFoundError, IdentityMismatchError, UpdateEntryLockError } from "../../domain/errors.js";
7
7
  class UpdateEntryLockUseCaseImpl {
8
8
  constructor(getLockRecord, lockEntry, repository, identityContext) {
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UpdateEntryLockUseCase","UseCaseAbstraction","UpdateEntryLockRepository","GetLockRecordUseCase","LockEntryUseCase","IdentityContext","LockRecordNotFoundError","IdentityMismatchError","UpdateEntryLockError","UpdateEntryLockUseCaseImpl","constructor","getLockRecord","lockEntry","repository","identityContext","execute","input","recordResult","isFail","error","lockResult","fail","ok","value","record","isExpired","updateResult","update","id","identity","getIdentity","lockedBy","currentId","targetId","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateEntryLockUseCase as UseCaseAbstraction,\n UpdateEntryLockRepository,\n UpdateEntryLockInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { LockEntryUseCase } from \"../LockEntry/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n LockRecordNotFoundError,\n IdentityMismatchError,\n UpdateEntryLockError\n} from \"~/domain/errors.js\";\n\nclass UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private lockEntry: LockEntryUseCase.Interface,\n private repository: UpdateEntryLockRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UpdateEntryLockInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Try to get existing lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If doesn't exist, create a new lock\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const lockResult = await this.lockEntry.execute(input);\n if (lockResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(lockResult.error));\n }\n return Result.ok(lockResult.value);\n }\n return Result.fail(recordResult.error);\n }\n\n const record = recordResult.value;\n\n // If expired, update with current user as new owner\n if (record.isExpired()) {\n const updateResult = await this.repository.update(record.id, true);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n return Result.ok(updateResult.value);\n }\n\n // If not expired, validate same owner\n const identity = this.identityContext.getIdentity();\n if (record.lockedBy.id !== identity.id) {\n return Result.fail(\n new IdentityMismatchError({\n currentId: identity.id,\n targetId: record.lockedBy.id\n })\n );\n }\n\n // Update timestamp only\n const updateResult = await this.repository.update(record.id, false);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n\n return Result.ok(updateResult.value);\n }\n}\n\nexport const UpdateEntryLockUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateEntryLockUseCaseImpl,\n dependencies: [\n GetLockRecordUseCase,\n LockEntryUseCase,\n UpdateEntryLockRepository,\n IdentityContext\n ]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,sBAAsB,IAAIC,kBAAkB,EAC5CC,yBAAyB;AAG7B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,eAAe,QAAQ,2CAA2C;AAE3E,SACIC,uBAAuB,EACvBC,qBAAqB,EACrBC,oBAAoB;AAGxB,MAAMC,0BAA0B,CAAyC;EACrEC,WAAWA,CACCC,aAA6C,EAC7CC,SAAqC,EACrCC,UAA+C,EAC/CC,eAA0C,EACpD;IAAA,KAJUH,aAA6C,GAA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IN,MAAM,CAACO,QAAQ,CAACH,EAAE,KAAKC,QAAQ,CAACD,EAAE,EAAE;MACpC,OAAO7B,MAAM,CAACsB,IAAI,CACd,IAAId,qBAAqB,CAAC;QACtByB,SAAS,EAAEH,QAAQ,CAACD,EAAE;QACtBK,QAAQ,EAAET,MAAM,CAACO,QAAQ,CAACH;MAC9B,CAAC,CACL,CAAC;IACL;;IAEA;IACA,MAAMF,YAAY,GAAG,MAAM,IAAI,CAACb,UAAU,CAACc,MAAM,CAACH,MAAM,CAACI,EAAE,EAAE,KAAK,CAAC;IACnE,IAAIF,YAAY,CAACR,MAAM,CAAC,CAAC,EAAE;MACvB,OAAOnB,MAAM,CAACsB,IAAI,CAAC,IAAIb,oBAAoB,CAACkB,YAAY,CAACP,KAAK,CAAC,CAAC;IACpE;IAEA,OAAOpB,MAAM,CAACuB,EAAE,CAACI,YAAY,CAACH,KAAK,CAAC;EACxC;AACJ;AAEA,OAAO,MAAMvB,sBAAsB,GAAGC,kBAAkB,CAACiC,oBAAoB,CAAC;EAC1EC,cAAc,EAAE1B,0BAA0B;EAC1C2B,YAAY,EAAE,CACVjC,oBAAoB,EACpBC,gBAAgB,EAChBF,yBAAyB,EACzBG,eAAe;AAEvB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","UpdateEntryLockUseCase","UseCaseAbstraction","UpdateEntryLockRepository","GetLockRecordUseCase","LockEntryUseCase","IdentityContext","LockRecordNotFoundError","IdentityMismatchError","UpdateEntryLockError","UpdateEntryLockUseCaseImpl","constructor","getLockRecord","lockEntry","repository","identityContext","execute","input","recordResult","isFail","error","lockResult","fail","ok","value","record","isExpired","updateResult","update","id","identity","getIdentity","lockedBy","currentId","targetId","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateEntryLockUseCase as UseCaseAbstraction,\n UpdateEntryLockRepository,\n UpdateEntryLockInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { LockEntryUseCase } from \"../LockEntry/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n LockRecordNotFoundError,\n IdentityMismatchError,\n UpdateEntryLockError\n} from \"~/domain/errors.js\";\n\nclass UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private lockEntry: LockEntryUseCase.Interface,\n private repository: UpdateEntryLockRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UpdateEntryLockInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Try to get existing lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If doesn't exist, create a new lock\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const lockResult = await this.lockEntry.execute(input);\n if (lockResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(lockResult.error));\n }\n return Result.ok(lockResult.value);\n }\n return Result.fail(recordResult.error);\n }\n\n const record = recordResult.value;\n\n // If expired, update with current user as new owner\n if (record.isExpired()) {\n const updateResult = await this.repository.update(record.id, true);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n return Result.ok(updateResult.value);\n }\n\n // If not expired, validate same owner\n const identity = this.identityContext.getIdentity();\n if (record.lockedBy.id !== identity.id) {\n return Result.fail(\n new IdentityMismatchError({\n currentId: identity.id,\n targetId: record.lockedBy.id\n })\n );\n }\n\n // Update timestamp only\n const updateResult = await this.repository.update(record.id, false);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n\n return Result.ok(updateResult.value);\n }\n}\n\nexport const UpdateEntryLockUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateEntryLockUseCaseImpl,\n dependencies: [\n GetLockRecord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dateEntryLockFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UpdateEntryLockFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -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 { NotAuthorizedError } from "@webiny/api-core/features/security/shared";
3
3
  /**
4
4
  * Simple permission check. Only authenticated users can access the websockets API via GraphQL
@@ -1 +1 @@
1
- {"version":3,"names":["IdentityContext","NotAuthorizedError","checkPermissions","context","identityContext","container","resolve","identity","getIdentity","isAnonymous"],"sources":["checkPermissions.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\n\n/**\n * Simple permission check. Only authenticated users can access the websockets API via GraphQL\n */\nexport const checkPermissions = async (context: ApiCoreContext): Promise<void> => {\n const identityContext = context.container.resolve(IdentityContext);\n const identity = identityContext.getIdentity();\n\n if (identity.isAnonymous()) {\n throw new NotAuthorizedError();\n }\n};\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,kBAAkB,QAAQ,2CAA2C;AAG9E;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAOC,OAAuB,IAAoB;EAC9E,MAAMC,eAAe,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACN,eAAe,CAAC;EAClE,MAAMO,QAAQ,GAAGH,eAAe,CAACI,WAAW,CAAC,CAAC;EAE9C,IAAID,QAAQ,CAACE,WAAW,CAAC,CAAC,EAAE;IACxB,MAAM,IAAIR,kBAAkB,CAAC,CAAC;EAClC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["IdentityContext","NotAuthorizedError","checkPermissions","context","identityContext","container","resolve","identity","getIdentity","isAnonymous"],"sources":["checkPermissions.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\n\n/**\n * Simple permission check. Only authenticated users can access the websockets API via GraphQL\n */\nexport const checkPermissions = async (context: ApiCoreContext): Promise<void> => {\n const identityContext = context.container.resolve(IdentityContext);\n const identity = identityContext.getIdentity();\n\n if (identity.isAnonymous()) {\n throw new NotAuthorizedError();\n }\n};\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,kBAAkB,QAAQ,2CAA2C;AAG9E;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAOC,OAAuB,IAAoB;EAC9E,MAAMC,eAAe,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACN,eAAe,CAAC;EAClE,MAAMO,QAAQ,GAAGH,eAAe,CAACI,WAAW,CAAC,CAAC;EAE9C,IAAID,QAAQ,CAACE,WAAW,CAAC,CAAC,EAAE;IACxB,MAAM,IAAIR,kBAAkB,CAAC,CAAC;EAClC;AACJ,CAAC","ignoreList":[]}
@@ -1,11 +1,11 @@
1
1
  import type { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
2
  import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
3
3
  import { CmsModel } from "@webiny/api-headless-cms/types/model.js";
4
- import type { CmsFieldTypePlugins } from "@webiny/api-headless-cms/types/index.js";
4
+ import type { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
5
5
  interface Params {
6
6
  model: CmsModel;
7
7
  models: CmsModel[];
8
- fieldTypePlugins: CmsFieldTypePlugins;
8
+ fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
9
9
  }
10
10
  export declare const createGraphQLSchema: (params: Params) => Promise<IGraphQLSchemaPlugin<ApiCoreContext>>;
11
11
  export {};
package/graphql/schema.js CHANGED
@@ -14,33 +14,30 @@ import { UpdateEntryLockUseCase } from "../features/UpdateEntryLock/abstractions
14
14
  import { UnlockEntryUseCase } from "../features/UnlockEntry/abstractions.js";
15
15
  import { UnlockEntryRequestUseCase } from "../features/UnlockEntryRequest/abstractions.js";
16
16
  export const createGraphQLSchema = async params => {
17
- // Record locking model
18
17
  const model = params.model;
19
-
20
- // Other public models that have at least one field
21
18
  const models = params.models.filter(model => {
22
19
  return model.fields.length > 0;
23
20
  });
24
- const fieldTypePlugins = params.fieldTypePlugins;
21
+ const fieldRegistry = params.fieldRegistry;
25
22
  const recordLockingFields = renderFields({
26
23
  models,
27
24
  model,
28
25
  fields: model.fields,
29
26
  type: "manage",
30
- fieldTypePlugins
27
+ fieldRegistry
31
28
  });
32
29
  const listFilterFieldsRender = renderListFilterFields({
33
30
  model,
34
31
  fields: model.fields,
35
32
  type: "manage",
36
- fieldTypePlugins,
33
+ fieldRegistry,
37
34
  excludeFields: ["entryId"]
38
35
  });
39
36
  const sortEnumRender = renderSortEnum({
40
37
  model,
41
38
  fields: model.fields,
42
- fieldTypePlugins,
43
- sorterPlugins: []
39
+ fieldRegistry,
40
+ sorters: []
44
41
  });
45
42
  const plugin = createGraphQLSchemaPlugin({
46
43
  typeDefs: /* GraphQL */`