@webiny/api-core 6.6.0-alpha.10 → 6.6.0-alpha.11

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 (85) hide show
  1. package/ApiCoreFeature.js +4 -0
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/exports/api.d.ts +1 -0
  4. package/exports/api.js +1 -0
  5. package/features/cdnCache/NullCdnCache.d.ts +8 -0
  6. package/features/cdnCache/NullCdnCache.js +11 -0
  7. package/features/cdnCache/NullCdnCache.js.map +1 -0
  8. package/features/cdnCache/abstractions.d.ts +20 -0
  9. package/features/cdnCache/abstractions.js +5 -0
  10. package/features/cdnCache/abstractions.js.map +1 -0
  11. package/features/cdnCache/feature.d.ts +8 -0
  12. package/features/cdnCache/feature.js +11 -0
  13. package/features/cdnCache/feature.js.map +1 -0
  14. package/features/cdnCache/index.d.ts +2 -0
  15. package/features/cdnCache/index.js +2 -0
  16. package/features/requestStorage/abstractions.d.ts +23 -0
  17. package/features/requestStorage/abstractions.js +5 -0
  18. package/features/requestStorage/abstractions.js.map +1 -0
  19. package/features/requestStorage/index.d.ts +1 -0
  20. package/features/requestStorage/index.js +1 -0
  21. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.d.ts +11 -0
  22. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js +22 -0
  23. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js.map +1 -0
  24. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.d.ts +11 -0
  25. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js +22 -0
  26. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js.map +1 -0
  27. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.d.ts +11 -0
  28. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js +22 -0
  29. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js.map +1 -0
  30. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.d.ts +11 -0
  31. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js +40 -0
  32. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js.map +1 -0
  33. package/features/security/roles/NotifyRoleChange/abstractions.d.ts +21 -0
  34. package/features/security/roles/NotifyRoleChange/abstractions.js +8 -0
  35. package/features/security/roles/NotifyRoleChange/abstractions.js.map +1 -0
  36. package/features/security/roles/NotifyRoleChange/feature.d.ts +5 -0
  37. package/features/security/roles/NotifyRoleChange/feature.js +17 -0
  38. package/features/security/roles/NotifyRoleChange/feature.js.map +1 -0
  39. package/features/security/roles/NotifyRoleChange/index.d.ts +2 -0
  40. package/features/security/roles/NotifyRoleChange/index.js +2 -0
  41. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +2 -1
  42. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  43. package/features/security/roles/feature.js +2 -0
  44. package/features/security/roles/feature.js.map +1 -1
  45. package/features/security/shared/definedOnly.d.ts +1 -0
  46. package/features/security/shared/definedOnly.js +8 -0
  47. package/features/security/shared/definedOnly.js.map +1 -0
  48. package/features/security/shared/index.d.ts +1 -0
  49. package/features/security/shared/index.js +1 -0
  50. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.d.ts +29 -0
  51. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js +58 -0
  52. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js.map +1 -0
  53. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.d.ts +11 -0
  54. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js +40 -0
  55. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js.map +1 -0
  56. package/features/security/teams/NotifyTeamChange/abstractions.d.ts +21 -0
  57. package/features/security/teams/NotifyTeamChange/abstractions.js +8 -0
  58. package/features/security/teams/NotifyTeamChange/abstractions.js.map +1 -0
  59. package/features/security/teams/NotifyTeamChange/feature.d.ts +5 -0
  60. package/features/security/teams/NotifyTeamChange/feature.js +15 -0
  61. package/features/security/teams/NotifyTeamChange/feature.js.map +1 -0
  62. package/features/security/teams/NotifyTeamChange/index.d.ts +2 -0
  63. package/features/security/teams/NotifyTeamChange/index.js +2 -0
  64. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +2 -1
  65. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  66. package/features/security/teams/feature.js +2 -0
  67. package/features/security/teams/feature.js.map +1 -1
  68. package/features/task/TaskService/abstractions.d.ts +7 -0
  69. package/features/task/TaskService/abstractions.js.map +1 -1
  70. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.d.ts +20 -0
  71. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js +24 -0
  72. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js.map +1 -0
  73. package/features/websockets/SendToIdentity/abstractions.d.ts +19 -0
  74. package/features/websockets/SendToIdentity/abstractions.js +5 -0
  75. package/features/websockets/SendToIdentity/abstractions.js.map +1 -0
  76. package/features/websockets/WebsocketServiceError.d.ts +7 -0
  77. package/features/websockets/WebsocketServiceError.js +14 -0
  78. package/features/websockets/WebsocketServiceError.js.map +1 -0
  79. package/features/websockets/index.d.ts +6 -0
  80. package/features/websockets/index.js +3 -0
  81. package/features/websockets/types.d.ts +15 -0
  82. package/features/websockets/types.js +0 -0
  83. package/index.d.ts +1 -0
  84. package/index.js +1 -0
  85. package/package.json +11 -11
package/ApiCoreFeature.js CHANGED
@@ -9,6 +9,7 @@ import { IdpAuthenticatorFeature } from "./idp/feature.js";
9
9
  import { KeyValueStoreFeature } from "./features/keyValueStore/feature.js";
10
10
  import { BuildParamsFeature } from "./features/buildParams/feature.js";
11
11
  import { PublicUrlsFeature } from "./features/publicUrls/feature.js";
12
+ import { CdnCacheFeature } from "./features/cdnCache/feature.js";
12
13
  import { DebuggerFeature } from "./features/debugger/feature.js";
13
14
  import { EncryptionFeature } from "./features/encryption/feature.js";
14
15
  import { HasherFeature } from "./features/hashing/feature.js";
@@ -20,6 +21,7 @@ import { AiFeature } from "./features/ai/feature.js";
20
21
  import { WcpFeature } from "./features/wcp/WcpFeature.js";
21
22
  import { HttpClientFeature } from "./features/httpClient/feature.js";
22
23
  import { NullWebhookDispatcher } from "./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js";
24
+ import { NullSendToIdentityUseCase } from "./features/websockets/index.js";
23
25
  import { WebhookProviderFeature } from "./features/webhooks/index.js";
24
26
  import { RequestContextFeature } from "./features/requestContext/index.js";
25
27
  import { ApiCoreSchemaFactory } from "./graphql/ApiCoreSchemaFactory.js";
@@ -41,6 +43,7 @@ const ApiCoreFeature = createFeature({
41
43
  EventPublisherFeature.register(container);
42
44
  BuildParamsFeature.register(container);
43
45
  PublicUrlsFeature.register(container);
46
+ CdnCacheFeature.register(container);
44
47
  DebuggerFeature.register(container);
45
48
  EncryptionFeature.register(container);
46
49
  HasherFeature.register(container);
@@ -53,6 +56,7 @@ const ApiCoreFeature = createFeature({
53
56
  IdpAuthenticatorFeature.register(container);
54
57
  RequestContextFeature.register(container);
55
58
  container.register(NullWebhookDispatcher).inSingletonScope();
59
+ container.register(NullSendToIdentityUseCase);
56
60
  WebhookProviderFeature.register(container);
57
61
  container.register(ApiCoreSchemaFactory);
58
62
  container.register(SecuritySchemaFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreConfig } from \"~/types/core.js\";\nimport { ApiCoreStorageOperationsFactory } from \"~/features/storageOperations/abstractions.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { PublicUrlsFeature } from \"~/features/publicUrls/feature.js\";\nimport { DebuggerFeature } from \"~/features/debugger/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { HasherFeature } from \"~/features/hashing/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { StringFormatterFeature } from \"~/features/stringFormatter/feature.js\";\nimport { DateFormatterFeature } from \"~/features/dateFormatter/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { HttpClientFeature } from \"~/features/httpClient/feature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { WebhookProviderFeature } from \"~/features/webhooks/index.js\";\nimport { RequestContextFeature } from \"~/features/requestContext/index.js\";\nimport { ApiCoreSchemaFactory } from \"~/graphql/ApiCoreSchemaFactory.js\";\nimport { SecuritySchemaFactory } from \"~/graphql/security/SecuritySchemaFactory.js\";\nimport { UsersSchemaFactory } from \"~/graphql/users/UsersSchemaFactory.js\";\nimport { SystemSchemaFactory } from \"~/graphql/system/SystemSchemaFactory.js\";\nimport { WcpSchemaFactory } from \"~/graphql/wcp/WcpSchemaFactory.js\";\nimport { FeatureFlagsSchemaFactory } from \"~/graphql/featureFlags/FeatureFlagsSchemaFactory.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreConfig = {}) {\n // Storage operations are built synchronously, here, from the adapter-provided factory —\n // the same way for every event (no out-of-feature construction, no async initializer).\n const storageOperations = container.resolve(ApiCoreStorageOperationsFactory).create();\n\n // Register features\n WcpFeature.register(container, config.wcpLicense);\n MaskerFeature.register(container);\n StringFormatterFeature.register(container);\n DateFormatterFeature.register(container);\n HttpClientFeature.register(container);\n AiFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n PublicUrlsFeature.register(container);\n DebuggerFeature.register(container);\n EncryptionFeature.register(container);\n HasherFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, storageOperations.tenancyStorageOperations);\n SecurityFeature.register(container, storageOperations.securityStorageOperations);\n AdminUsersFeature.register(container, storageOperations.usersStorageOperations);\n KeyValueStoreFeature.register(container, storageOperations.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n RequestContextFeature.register(container);\n container.register(NullWebhookDispatcher).inSingletonScope();\n WebhookProviderFeature.register(container);\n\n // Core API GraphQL schema: a base factory (root types + scalars) plus one\n // CoreGraphQLSchemaFactory per domain.\n container.register(ApiCoreSchemaFactory);\n container.register(SecuritySchemaFactory);\n container.register(UsersSchemaFactory);\n container.register(SystemSchemaFactory);\n container.register(WcpSchemaFactory);\n container.register(FeatureFlagsSchemaFactory);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","storageOperations","ApiCoreStorageOperationsFactory","WcpFeature","MaskerFeature","StringFormatterFeature","DateFormatterFeature","HttpClientFeature","AiFeature","EventPublisherFeature","BuildParamsFeature","PublicUrlsFeature","DebuggerFeature","EncryptionFeature","HasherFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","RequestContextFeature","NullWebhookDispatcher","WebhookProviderFeature","ApiCoreSchemaFactory","SecuritySchemaFactory","UsersSchemaFactory","SystemSchemaFactory","WcpSchemaFactory","FeatureFlagsSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAoB,EAAEC,SAAwB,CAAC,CAAC;QAGrD,MAAMC,oBAAoBF,UAAU,OAAO,CAACG,iCAAiC,MAAM;QAGnFC,WAAW,QAAQ,CAACJ,WAAWC,OAAO,UAAU;QAChDI,cAAc,QAAQ,CAACL;QACvBM,uBAAuB,QAAQ,CAACN;QAChCO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,UAAU,QAAQ,CAACT;QACnBU,sBAAsB,QAAQ,CAACV;QAC/BW,mBAAmB,QAAQ,CAACX;QAC5BY,kBAAkB,QAAQ,CAACZ;QAC3Ba,gBAAgB,QAAQ,CAACb;QACzBc,kBAAkB,QAAQ,CAACd;QAC3Be,cAAc,QAAQ,CAACf;QACvBgB,oBAAoB,QAAQ,CAAChB;QAC7BiB,eAAe,QAAQ,CAACjB,WAAWE,kBAAkB,wBAAwB;QAC7EgB,gBAAgB,QAAQ,CAAClB,WAAWE,kBAAkB,yBAAyB;QAC/EiB,kBAAkB,QAAQ,CAACnB,WAAWE,kBAAkB,sBAAsB;QAC9EkB,qBAAqB,QAAQ,CAACpB,WAAWE,kBAAkB,yBAAyB;QACpFmB,cAAc,QAAQ,CAACrB;QACvBsB,wBAAwB,QAAQ,CAACtB;QACjCuB,sBAAsB,QAAQ,CAACvB;QAC/BA,UAAU,QAAQ,CAACwB,uBAAuB,gBAAgB;QAC1DC,uBAAuB,QAAQ,CAACzB;QAIhCA,UAAU,QAAQ,CAAC0B;QACnB1B,UAAU,QAAQ,CAAC2B;QACnB3B,UAAU,QAAQ,CAAC4B;QACnB5B,UAAU,QAAQ,CAAC6B;QACnB7B,UAAU,QAAQ,CAAC8B;QACnB9B,UAAU,QAAQ,CAAC+B;IACvB;AACJ"}
1
+ {"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreConfig } from \"~/types/core.js\";\nimport { ApiCoreStorageOperationsFactory } from \"~/features/storageOperations/abstractions.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { PublicUrlsFeature } from \"~/features/publicUrls/feature.js\";\nimport { CdnCacheFeature } from \"~/features/cdnCache/feature.js\";\nimport { DebuggerFeature } from \"~/features/debugger/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { HasherFeature } from \"~/features/hashing/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { StringFormatterFeature } from \"~/features/stringFormatter/feature.js\";\nimport { DateFormatterFeature } from \"~/features/dateFormatter/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { HttpClientFeature } from \"~/features/httpClient/feature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { NullSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport { WebhookProviderFeature } from \"~/features/webhooks/index.js\";\nimport { RequestContextFeature } from \"~/features/requestContext/index.js\";\nimport { ApiCoreSchemaFactory } from \"~/graphql/ApiCoreSchemaFactory.js\";\nimport { SecuritySchemaFactory } from \"~/graphql/security/SecuritySchemaFactory.js\";\nimport { UsersSchemaFactory } from \"~/graphql/users/UsersSchemaFactory.js\";\nimport { SystemSchemaFactory } from \"~/graphql/system/SystemSchemaFactory.js\";\nimport { WcpSchemaFactory } from \"~/graphql/wcp/WcpSchemaFactory.js\";\nimport { FeatureFlagsSchemaFactory } from \"~/graphql/featureFlags/FeatureFlagsSchemaFactory.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreConfig = {}) {\n // Storage operations are built synchronously, here, from the adapter-provided factory —\n // the same way for every event (no out-of-feature construction, no async initializer).\n const storageOperations = container.resolve(ApiCoreStorageOperationsFactory).create();\n\n // Register features\n WcpFeature.register(container, config.wcpLicense);\n MaskerFeature.register(container);\n StringFormatterFeature.register(container);\n DateFormatterFeature.register(container);\n HttpClientFeature.register(container);\n AiFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n PublicUrlsFeature.register(container);\n CdnCacheFeature.register(container);\n DebuggerFeature.register(container);\n EncryptionFeature.register(container);\n HasherFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, storageOperations.tenancyStorageOperations);\n SecurityFeature.register(container, storageOperations.securityStorageOperations);\n AdminUsersFeature.register(container, storageOperations.usersStorageOperations);\n KeyValueStoreFeature.register(container, storageOperations.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n RequestContextFeature.register(container);\n container.register(NullWebhookDispatcher).inSingletonScope();\n container.register(NullSendToIdentityUseCase);\n WebhookProviderFeature.register(container);\n\n // Core API GraphQL schema: a base factory (root types + scalars) plus one\n // CoreGraphQLSchemaFactory per domain.\n container.register(ApiCoreSchemaFactory);\n container.register(SecuritySchemaFactory);\n container.register(UsersSchemaFactory);\n container.register(SystemSchemaFactory);\n container.register(WcpSchemaFactory);\n container.register(FeatureFlagsSchemaFactory);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","storageOperations","ApiCoreStorageOperationsFactory","WcpFeature","MaskerFeature","StringFormatterFeature","DateFormatterFeature","HttpClientFeature","AiFeature","EventPublisherFeature","BuildParamsFeature","PublicUrlsFeature","CdnCacheFeature","DebuggerFeature","EncryptionFeature","HasherFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","RequestContextFeature","NullWebhookDispatcher","NullSendToIdentityUseCase","WebhookProviderFeature","ApiCoreSchemaFactory","SecuritySchemaFactory","UsersSchemaFactory","SystemSchemaFactory","WcpSchemaFactory","FeatureFlagsSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAoB,EAAEC,SAAwB,CAAC,CAAC;QAGrD,MAAMC,oBAAoBF,UAAU,OAAO,CAACG,iCAAiC,MAAM;QAGnFC,WAAW,QAAQ,CAACJ,WAAWC,OAAO,UAAU;QAChDI,cAAc,QAAQ,CAACL;QACvBM,uBAAuB,QAAQ,CAACN;QAChCO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,UAAU,QAAQ,CAACT;QACnBU,sBAAsB,QAAQ,CAACV;QAC/BW,mBAAmB,QAAQ,CAACX;QAC5BY,kBAAkB,QAAQ,CAACZ;QAC3Ba,gBAAgB,QAAQ,CAACb;QACzBc,gBAAgB,QAAQ,CAACd;QACzBe,kBAAkB,QAAQ,CAACf;QAC3BgB,cAAc,QAAQ,CAAChB;QACvBiB,oBAAoB,QAAQ,CAACjB;QAC7BkB,eAAe,QAAQ,CAAClB,WAAWE,kBAAkB,wBAAwB;QAC7EiB,gBAAgB,QAAQ,CAACnB,WAAWE,kBAAkB,yBAAyB;QAC/EkB,kBAAkB,QAAQ,CAACpB,WAAWE,kBAAkB,sBAAsB;QAC9EmB,qBAAqB,QAAQ,CAACrB,WAAWE,kBAAkB,yBAAyB;QACpFoB,cAAc,QAAQ,CAACtB;QACvBuB,wBAAwB,QAAQ,CAACvB;QACjCwB,sBAAsB,QAAQ,CAACxB;QAC/BA,UAAU,QAAQ,CAACyB,uBAAuB,gBAAgB;QAC1DzB,UAAU,QAAQ,CAAC0B;QACnBC,uBAAuB,QAAQ,CAAC3B;QAIhCA,UAAU,QAAQ,CAAC4B;QACnB5B,UAAU,QAAQ,CAAC6B;QACnB7B,UAAU,QAAQ,CAAC8B;QACnB9B,UAAU,QAAQ,CAAC+B;QACnB/B,UAAU,QAAQ,CAACgC;QACnBhC,UAAU,QAAQ,CAACiC;IACvB;AACJ"}
package/exports/api.d.ts CHANGED
@@ -6,3 +6,4 @@ export { Hasher } from "../features/hashing/index.js";
6
6
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
7
7
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
8
8
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
9
+ export { WebsocketsSendToIdentityUseCase } from "../features/websockets/index.js";
package/exports/api.js CHANGED
@@ -5,3 +5,4 @@ export { Hasher } from "../features/hashing/index.js";
5
5
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
6
6
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
7
7
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
8
+ export { WebsocketsSendToIdentityUseCase } from "../features/websockets/index.js";
@@ -0,0 +1,8 @@
1
+ import { CdnCache } from "./abstractions.js";
2
+ declare class NullCdnCacheImpl implements CdnCache.Interface {
3
+ invalidate(): Promise<void>;
4
+ }
5
+ export declare const NullCdnCache: typeof NullCdnCacheImpl & {
6
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICdnCache>;
7
+ };
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { CdnCache } from "./abstractions.js";
2
+ class NullCdnCacheImpl {
3
+ async invalidate() {}
4
+ }
5
+ const NullCdnCache = CdnCache.createImplementation({
6
+ implementation: NullCdnCacheImpl,
7
+ dependencies: []
8
+ });
9
+ export { NullCdnCache };
10
+
11
+ //# sourceMappingURL=NullCdnCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/NullCdnCache.js","sources":["../../../src/features/cdnCache/NullCdnCache.ts"],"sourcesContent":["import { CdnCache } from \"./abstractions.js\";\n\n// Default for hosting types (and tests) with no CDN in front of the API.\nclass NullCdnCacheImpl implements CdnCache.Interface {\n async invalidate(): Promise<void> {\n // Nothing to invalidate.\n }\n}\n\nexport const NullCdnCache = CdnCache.createImplementation({\n implementation: NullCdnCacheImpl,\n dependencies: []\n});\n"],"names":["NullCdnCacheImpl","NullCdnCache","CdnCache"],"mappings":";AAGA,MAAMA;IACF,MAAM,aAA4B,CAElC;AACJ;AAEO,MAAMC,eAAeC,SAAS,oBAAoB,CAAC;IACtD,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,20 @@
1
+ export interface ICdnCacheInvalidateParams {
2
+ caller: string;
3
+ paths: string[];
4
+ }
5
+ export interface ICdnCache {
6
+ invalidate(params: ICdnCacheInvalidateParams): Promise<void>;
7
+ }
8
+ /**
9
+ * The CDN cache in front of the API, if the deployment has one. AWS caches API responses in
10
+ * CloudFront, and `@webiny/api-event-handler-aws` supplies the implementation that invalidates them.
11
+ * Standalone has no CDN, so it keeps the default, which has nothing to invalidate.
12
+ *
13
+ * Invalidating is a side effect of a write that has already succeeded, so `invalidate` never
14
+ * rejects: an implementation logs its own failures. Callers await it and carry on.
15
+ */
16
+ export declare const CdnCache: import("@webiny/di").Abstraction<ICdnCache>;
17
+ export declare namespace CdnCache {
18
+ type Interface = ICdnCache;
19
+ type InvalidateParams = ICdnCacheInvalidateParams;
20
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CdnCache = createAbstraction("Core/CdnCache");
3
+ export { CdnCache };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/abstractions.js","sources":["../../../src/features/cdnCache/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ICdnCacheInvalidateParams {\n // Who asked, for the logs, e.g. `wb.redirects`.\n caller: string;\n // API paths to drop from the cache, e.g. `/wb/redirects`.\n paths: string[];\n}\n\nexport interface ICdnCache {\n invalidate(params: ICdnCacheInvalidateParams): Promise<void>;\n}\n\n/**\n * The CDN cache in front of the API, if the deployment has one. AWS caches API responses in\n * CloudFront, and `@webiny/api-event-handler-aws` supplies the implementation that invalidates them.\n * Standalone has no CDN, so it keeps the default, which has nothing to invalidate.\n *\n * Invalidating is a side effect of a write that has already succeeded, so `invalidate` never\n * rejects: an implementation logs its own failures. Callers await it and carry on.\n */\nexport const CdnCache = createAbstraction<ICdnCache>(\"Core/CdnCache\");\n\nexport namespace CdnCache {\n export type Interface = ICdnCache;\n export type InvalidateParams = ICdnCacheInvalidateParams;\n}\n"],"names":["CdnCache","createAbstraction"],"mappings":";AAqBO,MAAMA,WAAWC,kBAA6B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Registers the default, which has nothing to invalidate. A hosting type with a CDN registers its
3
+ * own implementation later in the request stack, which replaces this one.
4
+ */
5
+ export declare const CdnCacheFeature: {
6
+ name: string;
7
+ register(container: import("@webiny/di").Container): void;
8
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { NullCdnCache } from "./NullCdnCache.js";
3
+ const CdnCacheFeature = createFeature({
4
+ name: "CdnCacheFeature",
5
+ register (container) {
6
+ container.register(NullCdnCache);
7
+ }
8
+ });
9
+ export { CdnCacheFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/feature.js","sources":["../../../src/features/cdnCache/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NullCdnCache } from \"./NullCdnCache.js\";\n\n/**\n * Registers the default, which has nothing to invalidate. A hosting type with a CDN registers its\n * own implementation later in the request stack, which replaces this one.\n */\nexport const CdnCacheFeature = createFeature({\n name: \"CdnCacheFeature\",\n register(container) {\n container.register(NullCdnCache);\n }\n});\n"],"names":["CdnCacheFeature","createFeature","container","NullCdnCache"],"mappings":";;AAOO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { CdnCache } from "./abstractions.js";
2
+ export { CdnCacheFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { CdnCache } from "./abstractions.js";
2
+ export { CdnCacheFeature } from "./feature.js";
@@ -0,0 +1,23 @@
1
+ import type { Container } from "@webiny/di";
2
+ export interface IRequestStorage {
3
+ /**
4
+ * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request
5
+ * container. Runs before any domain feature registers, so the features find it there.
6
+ */
7
+ register(container: Container): void | Promise<void>;
8
+ }
9
+ /**
10
+ * The storage a request runs on. A storage registers one implementation per part that owns
11
+ * per-request storage in the root container, once per process; every request container then gets
12
+ * those storages registered first, before the domain features (`registerApiRequestStack`). Several
13
+ * implementations can be registered: each part (the SQL storage, the standalone server's login)
14
+ * brings its own.
15
+ *
16
+ * The root keeps only what outlives a request (the connection, its settings), so a request's
17
+ * storages always come from its own container. A storage that registers its storages in the root
18
+ * instead (the DynamoDB variants) registers none of these.
19
+ */
20
+ export declare const RequestStorage: import("@webiny/di").Abstraction<IRequestStorage>;
21
+ export declare namespace RequestStorage {
22
+ type Interface = IRequestStorage;
23
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const RequestStorage = createAbstraction("Core/RequestStorage");
3
+ export { RequestStorage };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestStorage/abstractions.js","sources":["../../../src/features/requestStorage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\n\nexport interface IRequestStorage {\n /**\n * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request\n * container. Runs before any domain feature registers, so the features find it there.\n */\n register(container: Container): void | Promise<void>;\n}\n\n/**\n * The storage a request runs on. A storage registers one implementation per part that owns\n * per-request storage in the root container, once per process; every request container then gets\n * those storages registered first, before the domain features (`registerApiRequestStack`). Several\n * implementations can be registered: each part (the SQL storage, the standalone server's login)\n * brings its own.\n *\n * The root keeps only what outlives a request (the connection, its settings), so a request's\n * storages always come from its own container. A storage that registers its storages in the root\n * instead (the DynamoDB variants) registers none of these.\n */\nexport const RequestStorage = createAbstraction<IRequestStorage>(\"Core/RequestStorage\");\n\nexport namespace RequestStorage {\n export type Interface = IRequestStorage;\n}\n"],"names":["RequestStorage","createAbstraction"],"mappings":";AAsBO,MAAMA,iBAAiBC,kBAAmC"}
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -0,0 +1,11 @@
1
+ import { RoleAfterCreateEventHandler } from "../../../../features/security/roles/CreateRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ declare class NotifyOnRoleCreatedHandlerImpl implements RoleAfterCreateEventHandler.Interface {
4
+ private notifyRoleChange;
5
+ constructor(notifyRoleChange: NotifyRoleChangeUseCase.Interface);
6
+ handle(event: RoleAfterCreateEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const NotifyOnRoleCreatedHandler: typeof NotifyOnRoleCreatedHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("~/features/security/roles/CreateRole/index.js").RoleAfterCreateEvent>>;
10
+ };
11
+ export {};
@@ -0,0 +1,22 @@
1
+ import { RoleAfterCreateEventHandler } from "../CreateRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ class NotifyOnRoleCreatedHandlerImpl {
4
+ constructor(notifyRoleChange){
5
+ this.notifyRoleChange = notifyRoleChange;
6
+ }
7
+ async handle(event) {
8
+ await this.notifyRoleChange.execute({
9
+ id: event.payload.role.id,
10
+ change: "created"
11
+ });
12
+ }
13
+ }
14
+ const NotifyOnRoleCreatedHandler = RoleAfterCreateEventHandler.createImplementation({
15
+ implementation: NotifyOnRoleCreatedHandlerImpl,
16
+ dependencies: [
17
+ NotifyRoleChangeUseCase
18
+ ]
19
+ });
20
+ export { NotifyOnRoleCreatedHandler };
21
+
22
+ //# sourceMappingURL=NotifyOnRoleCreatedHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.ts"],"sourcesContent":["import { RoleAfterCreateEventHandler } from \"~/features/security/roles/CreateRole/index.js\";\nimport { NotifyRoleChangeUseCase } from \"./abstractions.js\";\n\nclass NotifyOnRoleCreatedHandlerImpl implements RoleAfterCreateEventHandler.Interface {\n constructor(private notifyRoleChange: NotifyRoleChangeUseCase.Interface) {}\n\n async handle(event: RoleAfterCreateEventHandler.Event): Promise<void> {\n await this.notifyRoleChange.execute({ id: event.payload.role.id, change: \"created\" });\n }\n}\n\nexport const NotifyOnRoleCreatedHandler = RoleAfterCreateEventHandler.createImplementation({\n implementation: NotifyOnRoleCreatedHandlerImpl,\n dependencies: [NotifyRoleChangeUseCase]\n});\n"],"names":["NotifyOnRoleCreatedHandlerImpl","notifyRoleChange","event","NotifyOnRoleCreatedHandler","RoleAfterCreateEventHandler","NotifyRoleChangeUseCase"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ;QAAU;IACvF;AACJ;AAEO,MAAMC,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBJ;IAChB,cAAc;QAACK;KAAwB;AAC3C"}
@@ -0,0 +1,11 @@
1
+ import { RoleAfterDeleteEventHandler } from "../../../../features/security/roles/DeleteRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ declare class NotifyOnRoleDeletedHandlerImpl implements RoleAfterDeleteEventHandler.Interface {
4
+ private notifyRoleChange;
5
+ constructor(notifyRoleChange: NotifyRoleChangeUseCase.Interface);
6
+ handle(event: RoleAfterDeleteEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const NotifyOnRoleDeletedHandler: typeof NotifyOnRoleDeletedHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("~/features/security/roles/DeleteRole/index.js").RoleAfterDeleteEvent>>;
10
+ };
11
+ export {};
@@ -0,0 +1,22 @@
1
+ import { RoleAfterDeleteEventHandler } from "../DeleteRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ class NotifyOnRoleDeletedHandlerImpl {
4
+ constructor(notifyRoleChange){
5
+ this.notifyRoleChange = notifyRoleChange;
6
+ }
7
+ async handle(event) {
8
+ await this.notifyRoleChange.execute({
9
+ id: event.payload.role.id,
10
+ change: "deleted"
11
+ });
12
+ }
13
+ }
14
+ const NotifyOnRoleDeletedHandler = RoleAfterDeleteEventHandler.createImplementation({
15
+ implementation: NotifyOnRoleDeletedHandlerImpl,
16
+ dependencies: [
17
+ NotifyRoleChangeUseCase
18
+ ]
19
+ });
20
+ export { NotifyOnRoleDeletedHandler };
21
+
22
+ //# sourceMappingURL=NotifyOnRoleDeletedHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.ts"],"sourcesContent":["import { RoleAfterDeleteEventHandler } from \"~/features/security/roles/DeleteRole/index.js\";\nimport { NotifyRoleChangeUseCase } from \"./abstractions.js\";\n\nclass NotifyOnRoleDeletedHandlerImpl implements RoleAfterDeleteEventHandler.Interface {\n constructor(private notifyRoleChange: NotifyRoleChangeUseCase.Interface) {}\n\n async handle(event: RoleAfterDeleteEventHandler.Event): Promise<void> {\n await this.notifyRoleChange.execute({ id: event.payload.role.id, change: \"deleted\" });\n }\n}\n\nexport const NotifyOnRoleDeletedHandler = RoleAfterDeleteEventHandler.createImplementation({\n implementation: NotifyOnRoleDeletedHandlerImpl,\n dependencies: [NotifyRoleChangeUseCase]\n});\n"],"names":["NotifyOnRoleDeletedHandlerImpl","notifyRoleChange","event","NotifyOnRoleDeletedHandler","RoleAfterDeleteEventHandler","NotifyRoleChangeUseCase"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ;QAAU;IACvF;AACJ;AAEO,MAAMC,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBJ;IAChB,cAAc;QAACK;KAAwB;AAC3C"}
@@ -0,0 +1,11 @@
1
+ import { RoleAfterUpdateEventHandler } from "../../../../features/security/roles/UpdateRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ declare class NotifyOnRoleUpdatedHandlerImpl implements RoleAfterUpdateEventHandler.Interface {
4
+ private notifyRoleChange;
5
+ constructor(notifyRoleChange: NotifyRoleChangeUseCase.Interface);
6
+ handle(event: RoleAfterUpdateEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const NotifyOnRoleUpdatedHandler: typeof NotifyOnRoleUpdatedHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("~/features/security/roles/UpdateRole/index.js").RoleAfterUpdateEvent>>;
10
+ };
11
+ export {};
@@ -0,0 +1,22 @@
1
+ import { RoleAfterUpdateEventHandler } from "../UpdateRole/index.js";
2
+ import { NotifyRoleChangeUseCase } from "./abstractions.js";
3
+ class NotifyOnRoleUpdatedHandlerImpl {
4
+ constructor(notifyRoleChange){
5
+ this.notifyRoleChange = notifyRoleChange;
6
+ }
7
+ async handle(event) {
8
+ await this.notifyRoleChange.execute({
9
+ id: event.payload.updated.id,
10
+ change: "updated"
11
+ });
12
+ }
13
+ }
14
+ const NotifyOnRoleUpdatedHandler = RoleAfterUpdateEventHandler.createImplementation({
15
+ implementation: NotifyOnRoleUpdatedHandlerImpl,
16
+ dependencies: [
17
+ NotifyRoleChangeUseCase
18
+ ]
19
+ });
20
+ export { NotifyOnRoleUpdatedHandler };
21
+
22
+ //# sourceMappingURL=NotifyOnRoleUpdatedHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.ts"],"sourcesContent":["import { RoleAfterUpdateEventHandler } from \"~/features/security/roles/UpdateRole/index.js\";\nimport { NotifyRoleChangeUseCase } from \"./abstractions.js\";\n\nclass NotifyOnRoleUpdatedHandlerImpl implements RoleAfterUpdateEventHandler.Interface {\n constructor(private notifyRoleChange: NotifyRoleChangeUseCase.Interface) {}\n\n async handle(event: RoleAfterUpdateEventHandler.Event): Promise<void> {\n await this.notifyRoleChange.execute({ id: event.payload.updated.id, change: \"updated\" });\n }\n}\n\nexport const NotifyOnRoleUpdatedHandler = RoleAfterUpdateEventHandler.createImplementation({\n implementation: NotifyOnRoleUpdatedHandlerImpl,\n dependencies: [NotifyRoleChangeUseCase]\n});\n"],"names":["NotifyOnRoleUpdatedHandlerImpl","notifyRoleChange","event","NotifyOnRoleUpdatedHandler","RoleAfterUpdateEventHandler","NotifyRoleChangeUseCase"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE;YAAE,QAAQ;QAAU;IAC1F;AACJ;AAEO,MAAMC,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBJ;IAChB,cAAc;QAACK;KAAwB;AAC3C"}
@@ -0,0 +1,11 @@
1
+ import { IdentityContext } from "../../../../features/security/IdentityContext/abstractions.js";
2
+ import { WebsocketsSendToIdentityUseCase } from "../../../../features/websockets/index.js";
3
+ import { NotifyRoleChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
4
+ declare class NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private identityContext;
6
+ private sendToIdentity;
7
+ constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
8
+ execute({ id, change }: UseCaseAbstraction.Params): Promise<void>;
9
+ }
10
+ export declare const NotifyRoleChangeUseCase: import("@webiny/di").Implementation<typeof NotifyRoleChangeUseCaseImpl>;
11
+ export {};
@@ -0,0 +1,40 @@
1
+ import { createImplementation } from "@webiny/di";
2
+ import { IdentityContext } from "../../IdentityContext/abstractions.js";
3
+ import { WebsocketsSendToIdentityUseCase } from "../../../websockets/index.js";
4
+ import { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
5
+ const ACTIONS = {
6
+ created: ROLE_CREATED_WEBSOCKET_ACTION,
7
+ updated: ROLE_UPDATED_WEBSOCKET_ACTION,
8
+ deleted: ROLE_DELETED_WEBSOCKET_ACTION
9
+ };
10
+ class NotifyRoleChangeUseCaseImpl {
11
+ constructor(identityContext, sendToIdentity){
12
+ this.identityContext = identityContext;
13
+ this.sendToIdentity = sendToIdentity;
14
+ }
15
+ async execute({ id, change }) {
16
+ const recipient = this.identityContext.getIdentity()?.id;
17
+ if (!recipient) return;
18
+ try {
19
+ await this.sendToIdentity.execute({
20
+ id: recipient
21
+ }, {
22
+ action: ACTIONS[change],
23
+ data: {
24
+ id
25
+ }
26
+ });
27
+ } catch {}
28
+ }
29
+ }
30
+ const NotifyRoleChangeUseCase_NotifyRoleChangeUseCase = createImplementation({
31
+ abstraction: NotifyRoleChangeUseCase,
32
+ implementation: NotifyRoleChangeUseCaseImpl,
33
+ dependencies: [
34
+ IdentityContext,
35
+ WebsocketsSendToIdentityUseCase
36
+ ]
37
+ });
38
+ export { NotifyRoleChangeUseCase_NotifyRoleChangeUseCase as NotifyRoleChangeUseCase };
39
+
40
+ //# sourceMappingURL=NotifyRoleChangeUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport { ROLE_CREATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_DELETED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_UPDATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { NotifyRoleChangeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: ROLE_CREATED_WEBSOCKET_ACTION,\n updated: ROLE_UPDATED_WEBSOCKET_ACTION,\n deleted: ROLE_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n } catch {\n // See above.\n }\n }\n}\n\nexport const NotifyRoleChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyRoleChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCaseImpl","identityContext","sendToIdentity","id","change","recipient","NotifyRoleChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAQA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AASA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAA6B,EAAiB;QACpE,MAAMC,YAAY,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACtD,IAAI,CAACA,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQT,OAAO,CAACQ,OAAO;gBAAE,MAAM;oBAAED;gBAAG;YAAE;QAEhD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,qBAAqB;IACxD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAgC;AACpE"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a
3
+ * change made on the server (by the assistant's role tools, for one) never passes through it, so
4
+ * without these the Roles view shows the old list until a reload. Each carries the role id only; the
5
+ * admin reads the role back, or drops it for `deleted`.
6
+ */
7
+ export declare const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
8
+ export declare const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
9
+ export declare const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
10
+ export interface NotifyRoleChangeParams {
11
+ id: string;
12
+ change: "created" | "updated" | "deleted";
13
+ }
14
+ export interface INotifyRoleChangeUseCase {
15
+ execute(params: NotifyRoleChangeParams): Promise<void>;
16
+ }
17
+ export declare const NotifyRoleChangeUseCase: import("@webiny/di").Abstraction<INotifyRoleChangeUseCase>;
18
+ export declare namespace NotifyRoleChangeUseCase {
19
+ type Interface = INotifyRoleChangeUseCase;
20
+ type Params = NotifyRoleChangeParams;
21
+ }
@@ -0,0 +1,8 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
3
+ const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
4
+ const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
5
+ const NotifyRoleChangeUseCase = createAbstraction("Security/NotifyRoleChangeUseCase");
6
+ export { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION };
7
+
8
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/abstractions.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a\n * change made on the server (by the assistant's role tools, for one) never passes through it, so\n * without these the Roles view shows the old list until a reload. Each carries the role id only; the\n * admin reads the role back, or drops it for `deleted`.\n */\nexport const ROLE_CREATED_WEBSOCKET_ACTION = \"security.role.created\";\nexport const ROLE_UPDATED_WEBSOCKET_ACTION = \"security.role.updated\";\nexport const ROLE_DELETED_WEBSOCKET_ACTION = \"security.role.deleted\";\n\nexport interface NotifyRoleChangeParams {\n id: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyRoleChangeUseCase {\n execute(params: NotifyRoleChangeParams): Promise<void>;\n}\n\nexport const NotifyRoleChangeUseCase = createAbstraction<INotifyRoleChangeUseCase>(\n \"Security/NotifyRoleChangeUseCase\"\n);\n\nexport namespace NotifyRoleChangeUseCase {\n export type Interface = INotifyRoleChangeUseCase;\n export type Params = NotifyRoleChangeParams;\n}\n"],"names":["ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCase","createAbstraction"],"mappings":";AAQO,MAAMA,gCAAgC;AACtC,MAAMC,gCAAgC;AACtC,MAAMC,gCAAgC;AAWtC,MAAMC,0BAA0BC,kBACnC"}
@@ -0,0 +1,5 @@
1
+ /** Tells the user's open admin tabs when a role is created, updated or deleted. */
2
+ export declare const NotifyRoleChangeFeature: {
3
+ name: string;
4
+ register(container: import("@webiny/di").Container): void;
5
+ };
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { NotifyRoleChangeUseCase } from "./NotifyRoleChangeUseCase.js";
3
+ import { NotifyOnRoleCreatedHandler } from "./NotifyOnRoleCreatedHandler.js";
4
+ import { NotifyOnRoleUpdatedHandler } from "./NotifyOnRoleUpdatedHandler.js";
5
+ import { NotifyOnRoleDeletedHandler } from "./NotifyOnRoleDeletedHandler.js";
6
+ const NotifyRoleChangeFeature = createFeature({
7
+ name: "NotifyRoleChange",
8
+ register (container) {
9
+ container.register(NotifyRoleChangeUseCase);
10
+ container.register(NotifyOnRoleCreatedHandler);
11
+ container.register(NotifyOnRoleUpdatedHandler);
12
+ container.register(NotifyOnRoleDeletedHandler);
13
+ }
14
+ });
15
+ export { NotifyRoleChangeFeature };
16
+
17
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/roles/NotifyRoleChange/feature.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NotifyRoleChangeUseCase } from \"./NotifyRoleChangeUseCase.js\";\nimport { NotifyOnRoleCreatedHandler } from \"./NotifyOnRoleCreatedHandler.js\";\nimport { NotifyOnRoleUpdatedHandler } from \"./NotifyOnRoleUpdatedHandler.js\";\nimport { NotifyOnRoleDeletedHandler } from \"./NotifyOnRoleDeletedHandler.js\";\n\n/** Tells the user's open admin tabs when a role is created, updated or deleted. */\nexport const NotifyRoleChangeFeature = createFeature({\n name: \"NotifyRoleChange\",\n register(container) {\n container.register(NotifyRoleChangeUseCase);\n container.register(NotifyOnRoleCreatedHandler);\n container.register(NotifyOnRoleUpdatedHandler);\n container.register(NotifyOnRoleDeletedHandler);\n }\n});\n"],"names":["NotifyRoleChangeFeature","createFeature","container","NotifyRoleChangeUseCase","NotifyOnRoleCreatedHandler","NotifyOnRoleUpdatedHandler","NotifyOnRoleDeletedHandler"],"mappings":";;;;;AAOO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { NotifyRoleChangeFeature } from "./feature.js";
2
+ export { ROLE_CREATED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION } from "./abstractions.js";
@@ -0,0 +1,2 @@
1
+ export { NotifyRoleChangeFeature } from "./feature.js";
2
+ export { ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
@@ -6,6 +6,7 @@ import { EventPublisher } from "../../../eventPublisher/index.js";
6
6
  import { updateRoleValidation } from "./schema.js";
7
7
  import { RoleAfterUpdateEvent, RoleBeforeUpdateEvent } from "./events.js";
8
8
  import { descriptionOnUpdate } from "../../shared/description.js";
9
+ import { definedOnly } from "../../shared/definedOnly.js";
9
10
  import { CannotUpdatePluginRolesError, NotAuthorizedError, RoleValidationError } from "../shared/errors.js";
10
11
  class UpdateRoleUseCaseImpl {
11
12
  constructor(repository, identityContext, eventPublisher){
@@ -26,7 +27,7 @@ class UpdateRoleUseCaseImpl {
26
27
  if (existingRole.plugin) return Result.fail(new CannotUpdatePluginRolesError());
27
28
  const { description, ...rest } = validation.data;
28
29
  const changes = {
29
- ...rest,
30
+ ...definedOnly(rest),
30
31
  ...descriptionOnUpdate(description)
31
32
  };
32
33
  const updatedRole = {
@@ -1 +1 @@
1
- {"version":3,"file":"features/security/roles/UpdateRole/UpdateRoleUseCase.js","sources":["../../../../../src/features/security/roles/UpdateRole/UpdateRoleUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateRoleUseCase as UseCase } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateRoleValidation } from \"./schema.js\";\nimport { RoleBeforeUpdateEvent, RoleAfterUpdateEvent } from \"./events.js\";\nimport type { Role, UpdateRoleInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginRolesError,\n RoleValidationError\n} from \"../shared/errors.js\";\n\nclass UpdateRoleUseCaseImpl implements UseCase.Interface {\n private repository: RolesRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n\n constructor(\n repository: RolesRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n }\n\n async execute(id: string, input: UpdateRoleInput): Promise<Result<Role, UseCase.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingRole = existingResult.value;\n\n // Check if role is created via plugin\n if (existingRole.plugin) {\n return Result.fail(new CannotUpdatePluginRolesError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateRoleInput = {\n ...rest,\n ...descriptionOnUpdate(description)\n };\n\n const updatedRole: Role = {\n ...existingRole,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new RoleBeforeUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedRole);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new RoleAfterUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n return Result.ok(updatedRole);\n }\n}\n\nexport const UpdateRoleUseCase = UseCase.createImplementation({\n implementation: UpdateRoleUseCaseImpl,\n dependencies: [RolesRepository, IdentityContext, EventPublisher]\n});\n"],"names":["UpdateRoleUseCaseImpl","repository","identityContext","eventPublisher","id","input","hasPermission","Result","NotAuthorizedError","validation","updateRoleValidation","RoleValidationError","existingResult","existingRole","CannotUpdatePluginRolesError","description","rest","changes","descriptionOnUpdate","updatedRole","RoleBeforeUpdateEvent","result","RoleAfterUpdateEvent","UpdateRoleUseCase","UseCase","RolesRepository","IdentityContext","EventPublisher"],"mappings":";;;;;;;;;AAeA,MAAMA;IAKF,YACIC,UAAqC,EACrCC,eAA0C,EAC1CC,cAAwC,CAC1C;QACE,IAAI,CAAC,UAAU,GAAGF;QAClB,IAAI,CAAC,eAAe,GAAGC;QACvB,IAAI,CAAC,cAAc,GAAGC;IAC1B;IAEA,MAAM,QAAQC,EAAU,EAAEC,KAAsB,EAAwC;QACpF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC/D,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,aAAaC,qBAAqB,SAAS,CAACL;QAClD,IAAI,CAACI,WAAW,OAAO,EACnB,OAAOF,OAAO,IAAI,CAAC,IAAII,oBAAoBF,WAAW,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO;QAGjF,MAAMG,iBAAiB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAER;QAAG;QACtD,IAAIQ,eAAe,MAAM,IACrB,OAAOL,OAAO,IAAI,CAACK,eAAe,KAAK;QAG3C,MAAMC,eAAeD,eAAe,KAAK;QAGzC,IAAIC,aAAa,MAAM,EACnB,OAAON,OAAO,IAAI,CAAC,IAAIO;QAM3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGP,WAAW,IAAI;QAEhD,MAAMQ,UAA2B;YAC7B,GAAGD,IAAI;YACP,GAAGE,oBAAoBH,YAAY;QACvC;QAEA,MAAMI,cAAoB;YACtB,GAAGN,YAAY;YACf,GAAGI,OAAO;QACd;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIG,sBAAsB;YACtB,UAAUP;YACV,SAASM;YACT,OAAOF;QACX;QAGJ,MAAMI,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACF;QAE5C,IAAIE,OAAO,MAAM,IACb,OAAOd,OAAO,IAAI,CAACc,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIC,qBAAqB;YACrB,UAAUT;YACV,SAASM;YACT,OAAOF;QACX;QAGJ,OAAOV,OAAO,EAAE,CAACY;IACrB;AACJ;AAEO,MAAMI,sCAAoBC,kBAAAA,oBAA4B,CAAC;IAC1D,gBAAgBxB;IAChB,cAAc;QAACyB;QAAiBC;QAAiBC;KAAe;AACpE"}
1
+ {"version":3,"file":"features/security/roles/UpdateRole/UpdateRoleUseCase.js","sources":["../../../../../src/features/security/roles/UpdateRole/UpdateRoleUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateRoleUseCase as UseCase } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateRoleValidation } from \"./schema.js\";\nimport { RoleBeforeUpdateEvent, RoleAfterUpdateEvent } from \"./events.js\";\nimport type { Role, UpdateRoleInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport { definedOnly } from \"../../shared/definedOnly.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginRolesError,\n RoleValidationError\n} from \"../shared/errors.js\";\n\nclass UpdateRoleUseCaseImpl implements UseCase.Interface {\n private repository: RolesRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n\n constructor(\n repository: RolesRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n }\n\n async execute(id: string, input: UpdateRoleInput): Promise<Result<Role, UseCase.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingRole = existingResult.value;\n\n // Check if role is created via plugin\n if (existingRole.plugin) {\n return Result.fail(new CannotUpdatePluginRolesError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateRoleInput = {\n ...definedOnly(rest),\n ...descriptionOnUpdate(description)\n };\n\n const updatedRole: Role = {\n ...existingRole,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new RoleBeforeUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedRole);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new RoleAfterUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n return Result.ok(updatedRole);\n }\n}\n\nexport const UpdateRoleUseCase = UseCase.createImplementation({\n implementation: UpdateRoleUseCaseImpl,\n dependencies: [RolesRepository, IdentityContext, EventPublisher]\n});\n"],"names":["UpdateRoleUseCaseImpl","repository","identityContext","eventPublisher","id","input","hasPermission","Result","NotAuthorizedError","validation","updateRoleValidation","RoleValidationError","existingResult","existingRole","CannotUpdatePluginRolesError","description","rest","changes","definedOnly","descriptionOnUpdate","updatedRole","RoleBeforeUpdateEvent","result","RoleAfterUpdateEvent","UpdateRoleUseCase","UseCase","RolesRepository","IdentityContext","EventPublisher"],"mappings":";;;;;;;;;;AAgBA,MAAMA;IAKF,YACIC,UAAqC,EACrCC,eAA0C,EAC1CC,cAAwC,CAC1C;QACE,IAAI,CAAC,UAAU,GAAGF;QAClB,IAAI,CAAC,eAAe,GAAGC;QACvB,IAAI,CAAC,cAAc,GAAGC;IAC1B;IAEA,MAAM,QAAQC,EAAU,EAAEC,KAAsB,EAAwC;QACpF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC/D,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,aAAaC,qBAAqB,SAAS,CAACL;QAClD,IAAI,CAACI,WAAW,OAAO,EACnB,OAAOF,OAAO,IAAI,CAAC,IAAII,oBAAoBF,WAAW,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO;QAGjF,MAAMG,iBAAiB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAER;QAAG;QACtD,IAAIQ,eAAe,MAAM,IACrB,OAAOL,OAAO,IAAI,CAACK,eAAe,KAAK;QAG3C,MAAMC,eAAeD,eAAe,KAAK;QAGzC,IAAIC,aAAa,MAAM,EACnB,OAAON,OAAO,IAAI,CAAC,IAAIO;QAM3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGP,WAAW,IAAI;QAEhD,MAAMQ,UAA2B;YAC7B,GAAGC,YAAYF,KAAK;YACpB,GAAGG,oBAAoBJ,YAAY;QACvC;QAEA,MAAMK,cAAoB;YACtB,GAAGP,YAAY;YACf,GAAGI,OAAO;QACd;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAII,sBAAsB;YACtB,UAAUR;YACV,SAASO;YACT,OAAOH;QACX;QAGJ,MAAMK,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACF;QAE5C,IAAIE,OAAO,MAAM,IACb,OAAOf,OAAO,IAAI,CAACe,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIC,qBAAqB;YACrB,UAAUV;YACV,SAASO;YACT,OAAOH;QACX;QAGJ,OAAOV,OAAO,EAAE,CAACa;IACrB;AACJ;AAEO,MAAMI,sCAAoBC,kBAAAA,oBAA4B,CAAC;IAC1D,gBAAgBzB;IAChB,cAAc;QAAC0B;QAAiBC;QAAiBC;KAAe;AACpE"}
@@ -7,6 +7,7 @@ import { ListRolesFeature } from "./ListRoles/feature.js";
7
7
  import { CreateRoleFeature } from "./CreateRole/feature.js";
8
8
  import { UpdateRoleFeature } from "./UpdateRole/feature.js";
9
9
  import { DeleteRoleFeature } from "./DeleteRole/feature.js";
10
+ import { NotifyRoleChangeFeature } from "./NotifyRoleChange/index.js";
10
11
  import { RoleInstaller } from "./Installer/RolesInstaller.js";
11
12
  const RolesFeature = createFeature({
12
13
  name: "Roles",
@@ -19,6 +20,7 @@ const RolesFeature = createFeature({
19
20
  CreateRoleFeature.register(container);
20
21
  UpdateRoleFeature.register(container);
21
22
  DeleteRoleFeature.register(container);
23
+ NotifyRoleChangeFeature.register(container);
22
24
  container.register(RoleInstaller);
23
25
  }
24
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/security/roles/feature.js","sources":["../../../../src/features/security/roles/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesRepository } from \"./shared/RolesRepository.js\";\nimport { RoleProvider } from \"./shared/RoleProvider.js\";\nimport { RolesRepositoryCachingDecorator } from \"./shared/decorators/RolesRepositoryCachingDecorator.js\";\nimport { GetRoleFeature } from \"./GetRole/feature.js\";\nimport { ListRolesFeature } from \"./ListRoles/feature.js\";\nimport { CreateRoleFeature } from \"./CreateRole/feature.js\";\nimport { UpdateRoleFeature } from \"./UpdateRole/feature.js\";\nimport { DeleteRoleFeature } from \"./DeleteRole/feature.js\";\nimport { RoleInstaller } from \"~/features/security/roles/Installer/RolesInstaller.js\";\n\nexport const RolesFeature = createFeature({\n name: \"Roles\",\n register(container) {\n // Register repository in singleton scope\n container.register(RolesRepository).inSingletonScope();\n container.register(RoleProvider).inSingletonScope();\n\n // Register caching decorator\n container.registerDecorator(RolesRepositoryCachingDecorator);\n\n // Register all use cases\n GetRoleFeature.register(container);\n ListRolesFeature.register(container);\n CreateRoleFeature.register(container);\n UpdateRoleFeature.register(container);\n DeleteRoleFeature.register(container);\n\n container.register(RoleInstaller);\n }\n});\n"],"names":["RolesFeature","createFeature","container","RolesRepository","RoleProvider","RolesRepositoryCachingDecorator","GetRoleFeature","ListRolesFeature","CreateRoleFeature","UpdateRoleFeature","DeleteRoleFeature","RoleInstaller"],"mappings":";;;;;;;;;;AAWO,MAAMA,eAAeC,cAAc;IACtC,MAAM;IACN,UAASC,SAAS;QAEdA,UAAU,QAAQ,CAACC,iBAAiB,gBAAgB;QACpDD,UAAU,QAAQ,CAACE,cAAc,gBAAgB;QAGjDF,UAAU,iBAAiB,CAACG;QAG5BC,eAAe,QAAQ,CAACJ;QACxBK,iBAAiB,QAAQ,CAACL;QAC1BM,kBAAkB,QAAQ,CAACN;QAC3BO,kBAAkB,QAAQ,CAACP;QAC3BQ,kBAAkB,QAAQ,CAACR;QAE3BA,UAAU,QAAQ,CAACS;IACvB;AACJ"}
1
+ {"version":3,"file":"features/security/roles/feature.js","sources":["../../../../src/features/security/roles/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesRepository } from \"./shared/RolesRepository.js\";\nimport { RoleProvider } from \"./shared/RoleProvider.js\";\nimport { RolesRepositoryCachingDecorator } from \"./shared/decorators/RolesRepositoryCachingDecorator.js\";\nimport { GetRoleFeature } from \"./GetRole/feature.js\";\nimport { ListRolesFeature } from \"./ListRoles/feature.js\";\nimport { CreateRoleFeature } from \"./CreateRole/feature.js\";\nimport { UpdateRoleFeature } from \"./UpdateRole/feature.js\";\nimport { DeleteRoleFeature } from \"./DeleteRole/feature.js\";\nimport { NotifyRoleChangeFeature } from \"./NotifyRoleChange/index.js\";\nimport { RoleInstaller } from \"~/features/security/roles/Installer/RolesInstaller.js\";\n\nexport const RolesFeature = createFeature({\n name: \"Roles\",\n register(container) {\n // Register repository in singleton scope\n container.register(RolesRepository).inSingletonScope();\n container.register(RoleProvider).inSingletonScope();\n\n // Register caching decorator\n container.registerDecorator(RolesRepositoryCachingDecorator);\n\n // Register all use cases\n GetRoleFeature.register(container);\n ListRolesFeature.register(container);\n CreateRoleFeature.register(container);\n UpdateRoleFeature.register(container);\n DeleteRoleFeature.register(container);\n NotifyRoleChangeFeature.register(container);\n\n container.register(RoleInstaller);\n }\n});\n"],"names":["RolesFeature","createFeature","container","RolesRepository","RoleProvider","RolesRepositoryCachingDecorator","GetRoleFeature","ListRolesFeature","CreateRoleFeature","UpdateRoleFeature","DeleteRoleFeature","NotifyRoleChangeFeature","RoleInstaller"],"mappings":";;;;;;;;;;;AAYO,MAAMA,eAAeC,cAAc;IACtC,MAAM;IACN,UAASC,SAAS;QAEdA,UAAU,QAAQ,CAACC,iBAAiB,gBAAgB;QACpDD,UAAU,QAAQ,CAACE,cAAc,gBAAgB;QAGjDF,UAAU,iBAAiB,CAACG;QAG5BC,eAAe,QAAQ,CAACJ;QACxBK,iBAAiB,QAAQ,CAACL;QAC1BM,kBAAkB,QAAQ,CAACN;QAC3BO,kBAAkB,QAAQ,CAACP;QAC3BQ,kBAAkB,QAAQ,CAACR;QAC3BS,wBAAwB,QAAQ,CAACT;QAEjCA,UAAU,QAAQ,CAACU;IACvB;AACJ"}
@@ -0,0 +1 @@
1
+ export declare const definedOnly: <T extends object>(value: T) => Partial<T>;
@@ -0,0 +1,8 @@
1
+ const definedOnly = (value)=>{
2
+ const defined = {};
3
+ for (const key of Object.keys(value))if (void 0 !== value[key]) defined[key] = value[key];
4
+ return defined;
5
+ };
6
+ export { definedOnly };
7
+
8
+ //# sourceMappingURL=definedOnly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/shared/definedOnly.js","sources":["../../../../src/features/security/shared/definedOnly.ts"],"sourcesContent":["// Drops keys whose value is `undefined`. Zod copies a key the caller sent as `undefined` into the\n// parsed output, so spreading a parsed update onto a stored entity would overwrite that field with\n// `undefined`. To an update, an absent key and an `undefined` one both mean \"leave the field alone\".\nexport const definedOnly = <T extends object>(value: T): Partial<T> => {\n const defined: Partial<T> = {};\n\n // `Object.keys` types its result as `string[]`; these are the keys of `value`.\n for (const key of Object.keys(value) as Array<keyof T>) {\n if (value[key] !== undefined) {\n defined[key] = value[key];\n }\n }\n\n return defined;\n};\n"],"names":["definedOnly","value","defined","key","Object","undefined"],"mappings":"AAGO,MAAMA,cAAc,CAAmBC;IAC1C,MAAMC,UAAsB,CAAC;IAG7B,KAAK,MAAMC,OAAOC,OAAO,IAAI,CAACH,OAC1B,IAAIA,AAAeI,WAAfJ,KAAK,CAACE,IAAI,EACVD,OAAO,CAACC,IAAI,GAAGF,KAAK,CAACE,IAAI;IAIjC,OAAOD;AACX"}
@@ -1,3 +1,4 @@
1
1
  export * from "./abstractions.js";
2
+ export * from "./definedOnly.js";
2
3
  export * from "./description.js";
3
4
  export * from "./errors.js";