@twin.org/engine-server-types 0.0.3-next.27 → 0.0.3-next.29

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 (43) hide show
  1. package/dist/es/components/authentication.js +2 -1
  2. package/dist/es/components/authentication.js.map +1 -1
  3. package/dist/es/components/authenticationAdmin.js +3 -1
  4. package/dist/es/components/authenticationAdmin.js.map +1 -1
  5. package/dist/es/components/authenticationAudit.js +35 -0
  6. package/dist/es/components/authenticationAudit.js.map +1 -0
  7. package/dist/es/components/authenticationRate.js +37 -0
  8. package/dist/es/components/authenticationRate.js.map +1 -0
  9. package/dist/es/components/restRouteProcessor.js +12 -5
  10. package/dist/es/components/restRouteProcessor.js.map +1 -1
  11. package/dist/es/components/socketRouteProcessor.js +11 -4
  12. package/dist/es/components/socketRouteProcessor.js.map +1 -1
  13. package/dist/es/index.js +6 -0
  14. package/dist/es/index.js.map +1 -1
  15. package/dist/es/models/IEngineServerConfig.js.map +1 -1
  16. package/dist/es/models/config/authenticationAuditComponentConfig.js +2 -0
  17. package/dist/es/models/config/authenticationAuditComponentConfig.js.map +1 -0
  18. package/dist/es/models/config/authenticationRateComponentConfig.js +2 -0
  19. package/dist/es/models/config/authenticationRateComponentConfig.js.map +1 -0
  20. package/dist/es/models/types/authenticationAuditComponentType.js +13 -0
  21. package/dist/es/models/types/authenticationAuditComponentType.js.map +1 -0
  22. package/dist/es/models/types/authenticationRateComponentType.js +13 -0
  23. package/dist/es/models/types/authenticationRateComponentType.js.map +1 -0
  24. package/dist/types/components/authenticationAudit.d.ts +12 -0
  25. package/dist/types/components/authenticationRate.d.ts +12 -0
  26. package/dist/types/index.d.ts +6 -0
  27. package/dist/types/models/IEngineServerConfig.d.ts +10 -0
  28. package/dist/types/models/config/authenticationAuditComponentConfig.d.ts +9 -0
  29. package/dist/types/models/config/authenticationRateComponentConfig.d.ts +9 -0
  30. package/dist/types/models/types/authenticationAuditComponentType.d.ts +13 -0
  31. package/dist/types/models/types/authenticationRateComponentType.d.ts +13 -0
  32. package/docs/changelog.md +30 -0
  33. package/docs/reference/functions/initialiseAuthenticationAuditComponent.md +31 -0
  34. package/docs/reference/functions/initialiseAuthenticationRateComponent.md +31 -0
  35. package/docs/reference/index.md +8 -0
  36. package/docs/reference/interfaces/IEngineServerConfig.md +12 -0
  37. package/docs/reference/type-aliases/AuthenticationAuditComponentConfig.md +17 -0
  38. package/docs/reference/type-aliases/AuthenticationAuditComponentType.md +5 -0
  39. package/docs/reference/type-aliases/AuthenticationRateComponentConfig.md +17 -0
  40. package/docs/reference/type-aliases/AuthenticationRateComponentType.md +5 -0
  41. package/docs/reference/variables/AuthenticationAuditComponentType.md +13 -0
  42. package/docs/reference/variables/AuthenticationRateComponentType.md +13 -0
  43. package/package.json +3 -3
@@ -25,7 +25,8 @@ export function initialiseAuthenticationComponent(engineCore, context, instanceC
25
25
  ]));
26
26
  return new EntityStorageAuthenticationService(EngineTypeHelper.mergeConfig({
27
27
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
28
- authenticationAdminServiceType: engineCore.getRegisteredInstanceType("authenticationAdminComponent")
28
+ authenticationAuditServiceType: engineCore.getRegisteredInstanceTypeOptional("authenticationAuditComponent"),
29
+ authenticationRateServiceType: engineCore.getRegisteredInstanceType("authenticationRateComponent")
29
30
  }, createConfig.options));
30
31
  };
31
32
  instanceTypeName = "entity-storage-authentication-service";
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/components/authentication.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EACN,kCAAkC,EAClC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,g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AgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EntityStorageAuthenticationRestClient } from \"@twin.org/api-auth-entity-storage-rest-client\";\nimport {\n\tEntityStorageAuthenticationService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationComponentConfig } from \"../models/config/authenticationComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationComponentType } from \"../models/types/authenticationComponentType.js\";\n\n/**\n * Initialise the authentication.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\"),\n\t\t\t\t\t\tauthenticationAdminServiceType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"authenticationAdminComponent\"\n\t\t\t\t\t\t)\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationService);\n\t} else if (instanceConfig.type === AuthenticationComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew EntityStorageAuthenticationRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/components/authentication.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EACN,kCAAkC,EAClC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB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CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EntityStorageAuthenticationRestClient } from \"@twin.org/api-auth-entity-storage-rest-client\";\nimport {\n\tEntityStorageAuthenticationService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationComponentConfig } from \"../models/config/authenticationComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationComponentType } from \"../models/types/authenticationComponentType.js\";\n\n/**\n * Initialise the authentication.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\"),\n\t\t\t\t\t\tauthenticationAuditServiceType: engineCore.getRegisteredInstanceTypeOptional(\n\t\t\t\t\t\t\t\"authenticationAuditComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tauthenticationRateServiceType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"authenticationRateComponent\"\n\t\t\t\t\t\t)\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationService);\n\t} else if (instanceConfig.type === AuthenticationComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew EntityStorageAuthenticationRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
@@ -22,7 +22,9 @@ export function initialiseAuthenticationAdminComponent(engineCore, context, inst
22
22
  ContextIdKeys.Node,
23
23
  ContextIdKeys.Tenant
24
24
  ]));
25
- return new EntityStorageAuthenticationAdminService(EngineTypeHelper.mergeConfig(createConfig.options));
25
+ return new EntityStorageAuthenticationAdminService(EngineTypeHelper.mergeConfig({
26
+ authenticationAuditServiceType: engineCore.getRegisteredInstanceTypeOptional("authenticationAuditComponent")
27
+ }, createConfig.options));
26
28
  };
27
29
  instanceTypeName = "entity-storage-authentication-admin-service";
28
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"authenticationAdmin.js","sourceRoot":"","sources":["../../../src/components/authenticationAdmin.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,uCAAuC,EACvC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACrD,UAA4C,EAC5C,OAAgD,EAChD,cAAkD;IAElD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,aAAa,EAAE,CAAC;QAC5E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,2BAA2B,EAAE,CAAC;YAC9B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,qBAAqB,wBAE3C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,OAAO,IAAI,uCAAuC,CACjD,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,gDAA2D,CAAC;IAC7E,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tEntityStorageAuthenticationAdminService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationAdminComponentConfig } from \"../models/config/authenticationAdminComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationAdminComponentType } from \"../models/types/authenticationAdminComponentType.js\";\n\n/**\n * Initialise the authentication admin.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationAdminComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationAdminComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationAdminComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationAdminComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationAdminService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationAdminService);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
1
+ {"version":3,"file":"authenticationAdmin.js","sourceRoot":"","sources":["../../../src/components/authenticationAdmin.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,uCAAuC,EACvC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACrD,UAA4C,EAC5C,OAAgD,EAChD,cAAkD;IAElD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,aAAa,EAAE,CAAC;QAC5E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,2BAA2B,EAAE,CAAC;YAC9B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,qBAAqB,wBAE3C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,OAAO,IAAI,uCAAuC,CACjD,gBAAgB,CAAC,WAAW,CAC3B;gBACC,8BAA8B,EAAE,UAAU,CAAC,iCAAiC,CAC3E,8BAA8B,CAC9B;aACD,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,gDAA2D,CAAC;IAC7E,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tEntityStorageAuthenticationAdminService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationAdminComponentConfig } from \"../models/config/authenticationAdminComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationAdminComponentType } from \"../models/types/authenticationAdminComponentType.js\";\n\n/**\n * Initialise the authentication admin.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationAdminComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationAdminComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationAdminComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationAdminComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationAdminService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tauthenticationAuditServiceType: engineCore.getRegisteredInstanceTypeOptional(\n\t\t\t\t\t\t\t\"authenticationAuditComponent\"\n\t\t\t\t\t\t)\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationAdminService);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
@@ -0,0 +1,35 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { EntityStorageAuthenticationAuditService, initSchema as initSchemaAuthEntityStorage } from "@twin.org/api-auth-entity-storage-service";
4
+ import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
5
+ import { ComponentFactory } from "@twin.org/core";
6
+ import { EngineTypeHelper, initialiseEntityStorageConnector } from "@twin.org/engine-types";
7
+ import { AuthenticationAuditComponentType } from "../models/types/authenticationAuditComponentType.js";
8
+ /**
9
+ * Initialise the authentication audit.
10
+ * @param engineCore The engine core.
11
+ * @param context The context for the engine.
12
+ * @param instanceConfig The instance config.
13
+ * @returns The instance created and the factory for it.
14
+ */
15
+ export function initialiseAuthenticationAuditComponent(engineCore, context, instanceConfig) {
16
+ let createComponent;
17
+ let instanceTypeName;
18
+ if (instanceConfig.type === AuthenticationAuditComponentType.EntityStorage) {
19
+ createComponent = (createConfig) => {
20
+ initSchemaAuthEntityStorage();
21
+ initialiseEntityStorageConnector(engineCore, context, createConfig.options?.authenticationAuditEntryStorageType, "AuthenticationAuditEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
22
+ ContextIdKeys.Node,
23
+ ContextIdKeys.Tenant
24
+ ]));
25
+ return new EntityStorageAuthenticationAuditService(EngineTypeHelper.mergeConfig(createConfig.options));
26
+ };
27
+ instanceTypeName = "entity-storage-authentication-audit-service";
28
+ }
29
+ return {
30
+ createComponent: createComponent,
31
+ instanceTypeName,
32
+ factory: ComponentFactory
33
+ };
34
+ }
35
+ //# sourceMappingURL=authenticationAudit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationAudit.js","sourceRoot":"","sources":["../../../src/components/authenticationAudit.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,uCAAuC,EACvC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACrD,UAA4C,EAC5C,OAAgD,EAChD,cAAkD;IAElD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,aAAa,EAAE,CAAC;QAC5E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,2BAA2B,EAAE,CAAC;YAC9B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,mCAAmC,8BAEzD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,OAAO,IAAI,uCAAuC,CACjD,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,gDAA2D,CAAC;IAC7E,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tEntityStorageAuthenticationAuditService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationAuditEntry\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationAuditComponentConfig } from \"../models/config/authenticationAuditComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationAuditComponentType } from \"../models/types/authenticationAuditComponentType.js\";\n\n/**\n * Initialise the authentication audit.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationAuditComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationAuditComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationAuditComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationAuditComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.authenticationAuditEntryStorageType,\n\t\t\t\tnameof<AuthenticationAuditEntry>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationAuditService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationAuditService);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
@@ -0,0 +1,37 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { EntityStorageAuthenticationRateService, initSchema as initSchemaAuthEntityStorage } from "@twin.org/api-auth-entity-storage-service";
4
+ import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
5
+ import { ComponentFactory } from "@twin.org/core";
6
+ import { EngineTypeHelper, initialiseEntityStorageConnector } from "@twin.org/engine-types";
7
+ import { AuthenticationRateComponentType } from "../models/types/authenticationRateComponentType.js";
8
+ /**
9
+ * Initialise the authentication rate.
10
+ * @param engineCore The engine core.
11
+ * @param context The context for the engine.
12
+ * @param instanceConfig The instance config.
13
+ * @returns The instance created and the factory for it.
14
+ */
15
+ export function initialiseAuthenticationRateComponent(engineCore, context, instanceConfig) {
16
+ let createComponent;
17
+ let instanceTypeName;
18
+ if (instanceConfig.type === AuthenticationRateComponentType.EntityStorage) {
19
+ createComponent = (createConfig) => {
20
+ initSchemaAuthEntityStorage();
21
+ initialiseEntityStorageConnector(engineCore, context, createConfig.options?.authenticationRateEntryStorageType, "AuthenticationRateEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
22
+ ContextIdKeys.Node,
23
+ ContextIdKeys.Tenant
24
+ ]));
25
+ return new EntityStorageAuthenticationRateService(EngineTypeHelper.mergeConfig({
26
+ taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent")
27
+ }, createConfig.options));
28
+ };
29
+ instanceTypeName = "entity-storage-authentication-rate-service";
30
+ }
31
+ return {
32
+ createComponent: createComponent,
33
+ instanceTypeName,
34
+ factory: ComponentFactory
35
+ };
36
+ }
37
+ //# sourceMappingURL=authenticationRate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationRate.js","sourceRoot":"","sources":["../../../src/components/authenticationRate.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,sCAAsC,EACtC,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACpD,UAA4C,EAC5C,OAAgD,EAChD,cAAiD;IAEjD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,aAAa,EAAE,CAAC;QAC3E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,2BAA2B,EAAE,CAAC;YAC9B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,kCAAkC,6BAExD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,OAAO,IAAI,sCAAsC,CAChD,gBAAgB,CAAC,WAAW,CAC3B;gBACC,0BAA0B,EACzB,UAAU,CAAC,yBAAyB,CAAC,wBAAwB,CAAC;aAC/D,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,+CAA0D,CAAC;IAC5E,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tEntityStorageAuthenticationRateService,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationRateEntry\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AuthenticationRateComponentConfig } from \"../models/config/authenticationRateComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { AuthenticationRateComponentType } from \"../models/types/authenticationRateComponentType.js\";\n\n/**\n * Initialise the authentication rate.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuthenticationRateComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: AuthenticationRateComponentConfig\n): EngineTypeInitialiserReturn<AuthenticationRateComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuthenticationRateComponentType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.authenticationRateEntryStorageType,\n\t\t\t\tnameof<AuthenticationRateEntry>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageAuthenticationRateService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\ttaskSchedulerComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceType(\"taskSchedulerComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(EntityStorageAuthenticationRateService);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
- import { AuthHeaderProcessor } from "@twin.org/api-auth-entity-storage-service";
3
+ import { AuthHeaderProcessor, initSchema as initSchemaAuthEntityStorage } from "@twin.org/api-auth-entity-storage-service";
4
4
  import { RestRouteProcessorFactory } from "@twin.org/api-models";
5
- import { LoggingProcessor, ContextIdProcessor, RestRouteProcessor, StaticContextIdProcessor } from "@twin.org/api-processors";
5
+ import { ContextIdProcessor, LoggingProcessor, RestRouteProcessor, StaticContextIdProcessor } from "@twin.org/api-processors";
6
6
  import { initSchema as initSchemaTenantProcessor, TenantProcessor } from "@twin.org/api-tenant-processor";
7
7
  import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
8
8
  import { EngineTypeHelper, initialiseEntityStorageConnector } from "@twin.org/engine-types";
@@ -18,9 +18,16 @@ export function initialiseRestRouteProcessorComponent(engineCore, context, insta
18
18
  let createComponent;
19
19
  let instanceTypeName;
20
20
  if (instanceConfig.type === RestRouteProcessorType.AuthHeader) {
21
- createComponent = (createConfig) => new AuthHeaderProcessor(EngineTypeHelper.mergeConfig({
22
- vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector")
23
- }, createConfig.options));
21
+ createComponent = (createConfig) => {
22
+ initSchemaAuthEntityStorage();
23
+ initialiseEntityStorageConnector(engineCore, context, createConfig.options?.userEntityStorageType, "AuthenticationUser", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
24
+ ContextIdKeys.Node,
25
+ ContextIdKeys.Tenant
26
+ ]));
27
+ return new AuthHeaderProcessor(EngineTypeHelper.mergeConfig({
28
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector")
29
+ }, createConfig.options));
30
+ };
24
31
  instanceTypeName = "auth-header-processor";
25
32
  }
26
33
  else if (instanceConfig.type === RestRouteProcessorType.Logging) {
@@ -1 +1 @@
1
- {"version":3,"file":"restRouteProcessor.js","sourceRoot":"","sources":["../../../src/components/restRouteProcessor.ts"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F,gBAAgB,qBAAmC,CAAC;IACrD,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,yBAAyB;KAClC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { AuthHeaderProcessor } from \"@twin.org/api-auth-entity-storage-service\";\nimport { RestRouteProcessorFactory } from \"@twin.org/api-models\";\nimport {\n\tLoggingProcessor,\n\tContextIdProcessor,\n\tRestRouteProcessor,\n\tStaticContextIdProcessor\n} from \"@twin.org/api-processors\";\nimport {\n\tinitSchema as initSchemaTenantProcessor,\n\ttype Tenant,\n\tTenantProcessor\n} from \"@twin.org/api-tenant-processor\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { RestRouteProcessorConfig } from \"../models/config/restRouteProcessorConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { RestRouteProcessorType } from \"../models/types/restRouteProcessorType.js\";\n\n/**\n * Initialise the rest route processor.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseRestRouteProcessorComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: RestRouteProcessorConfig\n): EngineTypeInitialiserReturn<RestRouteProcessorConfig, typeof RestRouteProcessorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === RestRouteProcessorType.AuthHeader) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AuthHeaderProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AuthHeaderProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.Logging) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.ContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(ContextIdProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.StaticContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew StaticContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(StaticContextIdProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.RestRoute) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew RestRouteProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(RestRouteProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.Tenant) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaTenantProcessor();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.tenantEntityStorageType,\n\t\t\t\tnameof<Tenant>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new TenantProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(TenantProcessor);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: RestRouteProcessorFactory\n\t};\n}\n"]}
1
+ {"version":3,"file":"restRouteProcessor.js","sourceRoot":"","sources":["../../../src/components/restRouteProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EACnB,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,UAAU,IAAI,yBAAyB,EACvC,eAAe,EAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,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.\nimport {\n\tAuthHeaderProcessor,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { RestRouteProcessorFactory } from \"@twin.org/api-models\";\nimport {\n\tContextIdProcessor,\n\tLoggingProcessor,\n\tRestRouteProcessor,\n\tStaticContextIdProcessor\n} from \"@twin.org/api-processors\";\nimport {\n\tinitSchema as initSchemaTenantProcessor,\n\tTenantProcessor,\n\ttype Tenant\n} from \"@twin.org/api-tenant-processor\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { RestRouteProcessorConfig } from \"../models/config/restRouteProcessorConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { RestRouteProcessorType } from \"../models/types/restRouteProcessorType.js\";\n\n/**\n * Initialise the rest route processor.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseRestRouteProcessorComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: RestRouteProcessorConfig\n): EngineTypeInitialiserReturn<RestRouteProcessorConfig, typeof RestRouteProcessorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === RestRouteProcessorType.AuthHeader) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\n\t\t\treturn new AuthHeaderProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(AuthHeaderProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.Logging) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.ContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(ContextIdProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.StaticContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew StaticContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(StaticContextIdProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.RestRoute) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew RestRouteProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(RestRouteProcessor);\n\t} else if (instanceConfig.type === RestRouteProcessorType.Tenant) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaTenantProcessor();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.tenantEntityStorageType,\n\t\t\t\tnameof<Tenant>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new TenantProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(TenantProcessor);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: RestRouteProcessorFactory\n\t};\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
- import { AuthHeaderProcessor } from "@twin.org/api-auth-entity-storage-service";
3
+ import { AuthHeaderProcessor, initSchema as initSchemaAuthEntityStorage } from "@twin.org/api-auth-entity-storage-service";
4
4
  import { SocketRouteProcessorFactory } from "@twin.org/api-models";
5
5
  import { LoggingProcessor, ContextIdProcessor, SocketRouteProcessor, StaticContextIdProcessor } from "@twin.org/api-processors";
6
6
  import { initSchema as initSchemaTenantProcessor, TenantProcessor } from "@twin.org/api-tenant-processor";
@@ -18,9 +18,16 @@ export function initialiseSocketRouteProcessorComponent(engineCore, context, ins
18
18
  let createComponent;
19
19
  let instanceTypeName;
20
20
  if (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {
21
- createComponent = (createConfig) => new AuthHeaderProcessor(EngineTypeHelper.mergeConfig({
22
- vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector")
23
- }, createConfig.options));
21
+ createComponent = (createConfig) => {
22
+ initSchemaAuthEntityStorage();
23
+ initialiseEntityStorageConnector(engineCore, context, createConfig.options?.userEntityStorageType, "AuthenticationUser", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
24
+ ContextIdKeys.Node,
25
+ ContextIdKeys.Tenant
26
+ ]));
27
+ return new AuthHeaderProcessor(EngineTypeHelper.mergeConfig({
28
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector")
29
+ }, createConfig.options));
30
+ };
24
31
  instanceTypeName = "auth-header-processor";
25
32
  }
26
33
  else if (instanceConfig.type === SocketRouteProcessorType.Logging) {
@@ -1 +1 @@
1
- {"version":3,"file":"socketRouteProcessor.js","sourceRoot":"","sources":["../../../src/components/socketRouteProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,UAAU,IAAI,yBAAyB,EAEvC,eAAe,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;;;;;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AAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,WAAW,EAAE,CAAC;QACzE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,oBAAoB,CACvB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,2BAAwC,CAAC;IAC1D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,MAAM,EAAE,CAAC;QACpE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,yBAAyB,EAAE,CAAC;YAC5B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,uBAAuB,YAE7C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAC1F,CAAC;YACF,OAAO,IAAI,eAAe,CACzB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,qBAAmC,CAAC;IACrD,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,2BAA2B;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { AuthHeaderProcessor } from \"@twin.org/api-auth-entity-storage-service\";\nimport { SocketRouteProcessorFactory } from \"@twin.org/api-models\";\nimport {\n\tLoggingProcessor,\n\tContextIdProcessor,\n\tSocketRouteProcessor,\n\tStaticContextIdProcessor\n} from \"@twin.org/api-processors\";\nimport {\n\tinitSchema as initSchemaTenantProcessor,\n\ttype Tenant,\n\tTenantProcessor\n} from \"@twin.org/api-tenant-processor\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { SocketRouteProcessorConfig } from \"../models/config/socketRouteProcessorConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { SocketRouteProcessorType } from \"../models/types/socketRouteProcessorType.js\";\n\n/**\n * Initialise the socket route processor.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseSocketRouteProcessorComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: SocketRouteProcessorConfig\n): EngineTypeInitialiserReturn<SocketRouteProcessorConfig, typeof SocketRouteProcessorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AuthHeaderProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AuthHeaderProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.Logging) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.ContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(ContextIdProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.StaticContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew StaticContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(StaticContextIdProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.SocketRoute) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew SocketRouteProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(SocketRouteProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.Tenant) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaTenantProcessor();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.tenantEntityStorageType,\n\t\t\t\tnameof<Tenant>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t\t);\n\t\t\treturn new TenantProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(TenantProcessor);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: SocketRouteProcessorFactory\n\t};\n}\n"]}
1
+ {"version":3,"file":"socketRouteProcessor.js","sourceRoot":"","sources":["../../../src/components/socketRouteProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EACnB,UAAU,IAAI,2BAA2B,EAEzC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,UAAU,IAAI,yBAAyB,EAEvC,eAAe,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOnE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;;;;;GAMG;AACH,MAAM,UAAU,uCAAuC,CACtD,UAA4C,EAC5C,OAAgD,EAChD,cAA0C;IAE1C,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,UAAU,EAAE,CAAC;QACjE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,2BAA2B,EAAE,CAAC;YAC9B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,qBAAqB,wBAE3C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YAEF,OAAO,IAAI,mBAAmB,CAC7B,gB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;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,MAAM,EAAE,CAAC;QACpE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,yBAAyB,EAAE,CAAC;YAC5B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,uBAAuB,YAE7C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAC1F,CAAC;YACF,OAAO,IAAI,eAAe,CACzB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,qBAAmC,CAAC;IACrD,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,2BAA2B;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tAuthHeaderProcessor,\n\tinitSchema as initSchemaAuthEntityStorage,\n\ttype AuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-service\";\nimport { SocketRouteProcessorFactory } from \"@twin.org/api-models\";\nimport {\n\tLoggingProcessor,\n\tContextIdProcessor,\n\tSocketRouteProcessor,\n\tStaticContextIdProcessor\n} from \"@twin.org/api-processors\";\nimport {\n\tinitSchema as initSchemaTenantProcessor,\n\ttype Tenant,\n\tTenantProcessor\n} from \"@twin.org/api-tenant-processor\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { EngineTypeHelper, initialiseEntityStorageConnector } from \"@twin.org/engine-types\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { SocketRouteProcessorConfig } from \"../models/config/socketRouteProcessorConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { SocketRouteProcessorType } from \"../models/types/socketRouteProcessorType.js\";\n\n/**\n * Initialise the socket route processor.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseSocketRouteProcessorComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: SocketRouteProcessorConfig\n): EngineTypeInitialiserReturn<SocketRouteProcessorConfig, typeof SocketRouteProcessorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuthEntityStorage();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.userEntityStorageType,\n\t\t\t\tnameof<AuthenticationUser>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\n\t\t\treturn new AuthHeaderProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(AuthHeaderProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.Logging) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.ContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(ContextIdProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.StaticContextId) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew StaticContextIdProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(StaticContextIdProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.SocketRoute) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew SocketRouteProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(SocketRouteProcessor);\n\t} else if (instanceConfig.type === SocketRouteProcessorType.Tenant) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaTenantProcessor();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.tenantEntityStorageType,\n\t\t\t\tnameof<Tenant>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t\t);\n\t\t\treturn new TenantProcessor(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(TenantProcessor);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: SocketRouteProcessorFactory\n\t};\n}\n"]}
package/dist/es/index.js CHANGED
@@ -2,13 +2,17 @@
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  export * from "./components/authentication.js";
4
4
  export * from "./components/authenticationAdmin.js";
5
+ export * from "./components/authenticationAudit.js";
6
+ export * from "./components/authenticationRate.js";
5
7
  export * from "./components/hosting.js";
6
8
  export * from "./components/information.js";
7
9
  export * from "./components/mimeTypeProcessor.js";
8
10
  export * from "./components/restRouteProcessor.js";
9
11
  export * from "./components/socketRouteProcessor.js";
10
12
  export * from "./models/config/authenticationAdminComponentConfig.js";
13
+ export * from "./models/config/authenticationAuditComponentConfig.js";
11
14
  export * from "./models/config/authenticationComponentConfig.js";
15
+ export * from "./models/config/authenticationRateComponentConfig.js";
12
16
  export * from "./models/config/hostingComponentConfig.js";
13
17
  export * from "./models/config/informationComponentConfig.js";
14
18
  export * from "./models/config/mimeTypeProcessorConfig.js";
@@ -16,7 +20,9 @@ export * from "./models/config/restRouteProcessorConfig.js";
16
20
  export * from "./models/config/socketRouteProcessorConfig.js";
17
21
  export * from "./models/IEngineServerConfig.js";
18
22
  export * from "./models/types/authenticationAdminComponentType.js";
23
+ export * from "./models/types/authenticationAuditComponentType.js";
19
24
  export * from "./models/types/authenticationComponentType.js";
25
+ export * from "./models/types/authenticationRateComponentType.js";
20
26
  export * from "./models/types/hostingComponentType.js";
21
27
  export * from "./models/types/informationComponentType.js";
22
28
  export * from "./models/types/mimeTypeProcessorType.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./components/authentication.js\";\nexport * from \"./components/authenticationAdmin.js\";\nexport * from \"./components/hosting.js\";\nexport * from \"./components/information.js\";\nexport * from \"./components/mimeTypeProcessor.js\";\nexport * from \"./components/restRouteProcessor.js\";\nexport * from \"./components/socketRouteProcessor.js\";\nexport * from \"./models/config/authenticationAdminComponentConfig.js\";\nexport * from \"./models/config/authenticationComponentConfig.js\";\nexport * from \"./models/config/hostingComponentConfig.js\";\nexport * from \"./models/config/informationComponentConfig.js\";\nexport * from \"./models/config/mimeTypeProcessorConfig.js\";\nexport * from \"./models/config/restRouteProcessorConfig.js\";\nexport * from \"./models/config/socketRouteProcessorConfig.js\";\nexport * from \"./models/IEngineServerConfig.js\";\nexport * from \"./models/types/authenticationAdminComponentType.js\";\nexport * from \"./models/types/authenticationComponentType.js\";\nexport * from \"./models/types/hostingComponentType.js\";\nexport * from \"./models/types/informationComponentType.js\";\nexport * from \"./models/types/mimeTypeProcessorType.js\";\nexport * from \"./models/types/restRouteProcessorType.js\";\nexport * from \"./models/types/socketRouteProcessorType.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./components/authentication.js\";\nexport * from \"./components/authenticationAdmin.js\";\nexport * from \"./components/authenticationAudit.js\";\nexport * from \"./components/authenticationRate.js\";\nexport * from \"./components/hosting.js\";\nexport * from \"./components/information.js\";\nexport * from \"./components/mimeTypeProcessor.js\";\nexport * from \"./components/restRouteProcessor.js\";\nexport * from \"./components/socketRouteProcessor.js\";\nexport * from \"./models/config/authenticationAdminComponentConfig.js\";\nexport * from \"./models/config/authenticationAuditComponentConfig.js\";\nexport * from \"./models/config/authenticationComponentConfig.js\";\nexport * from \"./models/config/authenticationRateComponentConfig.js\";\nexport * from \"./models/config/hostingComponentConfig.js\";\nexport * from \"./models/config/informationComponentConfig.js\";\nexport * from \"./models/config/mimeTypeProcessorConfig.js\";\nexport * from \"./models/config/restRouteProcessorConfig.js\";\nexport * from \"./models/config/socketRouteProcessorConfig.js\";\nexport * from \"./models/IEngineServerConfig.js\";\nexport * from \"./models/types/authenticationAdminComponentType.js\";\nexport * from \"./models/types/authenticationAuditComponentType.js\";\nexport * from \"./models/types/authenticationComponentType.js\";\nexport * from \"./models/types/authenticationRateComponentType.js\";\nexport * from \"./models/types/hostingComponentType.js\";\nexport * from \"./models/types/informationComponentType.js\";\nexport * from \"./models/types/mimeTypeProcessorType.js\";\nexport * from \"./models/types/restRouteProcessorType.js\";\nexport * from \"./models/types/socketRouteProcessorType.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IEngineServerConfig.js","sourceRoot":"","sources":["../../../src/models/IEngineServerConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IWebServerOptions } from \"@twin.org/api-models\";\nimport type { IEngineCoreTypeConfig } from \"@twin.org/engine-models\";\nimport type { IEngineConfig } from \"@twin.org/engine-types\";\nimport type { AuthenticationAdminComponentConfig } from \"./config/authenticationAdminComponentConfig.js\";\nimport type { AuthenticationComponentConfig } from \"./config/authenticationComponentConfig.js\";\nimport type { HostingComponentConfig } from \"./config/hostingComponentConfig.js\";\nimport type { InformationComponentConfig } from \"./config/informationComponentConfig.js\";\nimport type { MimeTypeProcessorConfig } from \"./config/mimeTypeProcessorConfig.js\";\nimport type { RestRouteProcessorConfig } from \"./config/restRouteProcessorConfig.js\";\nimport type { SocketRouteProcessorConfig } from \"./config/socketRouteProcessorConfig.js\";\n\n/**\n * Extended engine server config with known types.\n */\nexport interface IEngineServerConfig extends IEngineConfig {\n\t/**\n\t * Configuration for the web server.\n\t */\n\tweb?: IWebServerOptions;\n\n\t/**\n\t * The types to initialise in the engine.\n\t */\n\ttypes: IEngineConfig[\"types\"] & {\n\t\t[type: string]: IEngineCoreTypeConfig[] | undefined;\n\n\t\t/**\n\t\t * Information component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tinformationComponent?: IEngineCoreTypeConfig<InformationComponentConfig>[];\n\n\t\t/**\n\t\t * Hosting component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\thostingComponent?: IEngineCoreTypeConfig<HostingComponentConfig>[];\n\n\t\t/**\n\t\t * REST route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\trestRouteProcessor?: IEngineCoreTypeConfig<RestRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Socket route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tsocketRouteProcessor?: IEngineCoreTypeConfig<SocketRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Mime type processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tmimeTypeProcessor?: IEngineCoreTypeConfig<MimeTypeProcessorConfig>[];\n\n\t\t/**\n\t\t * Authentication component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationComponent?: IEngineCoreTypeConfig<AuthenticationComponentConfig>[];\n\n\t\t/**\n\t\t * Authentication admin component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationAdminComponent?: IEngineCoreTypeConfig<AuthenticationAdminComponentConfig>[];\n\t};\n}\n"]}
1
+ {"version":3,"file":"IEngineServerConfig.js","sourceRoot":"","sources":["../../../src/models/IEngineServerConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IWebServerOptions } from \"@twin.org/api-models\";\nimport type { IEngineCoreTypeConfig } from \"@twin.org/engine-models\";\nimport type { IEngineConfig } from \"@twin.org/engine-types\";\nimport type { AuthenticationAdminComponentConfig } from \"./config/authenticationAdminComponentConfig.js\";\nimport type { AuthenticationAuditComponentConfig } from \"./config/authenticationAuditComponentConfig.js\";\nimport type { AuthenticationComponentConfig } from \"./config/authenticationComponentConfig.js\";\nimport type { AuthenticationRateComponentConfig } from \"./config/authenticationRateComponentConfig.js\";\nimport type { HostingComponentConfig } from \"./config/hostingComponentConfig.js\";\nimport type { InformationComponentConfig } from \"./config/informationComponentConfig.js\";\nimport type { MimeTypeProcessorConfig } from \"./config/mimeTypeProcessorConfig.js\";\nimport type { RestRouteProcessorConfig } from \"./config/restRouteProcessorConfig.js\";\nimport type { SocketRouteProcessorConfig } from \"./config/socketRouteProcessorConfig.js\";\n\n/**\n * Extended engine server config with known types.\n */\nexport interface IEngineServerConfig extends IEngineConfig {\n\t/**\n\t * Configuration for the web server.\n\t */\n\tweb?: IWebServerOptions;\n\n\t/**\n\t * The types to initialise in the engine.\n\t */\n\ttypes: IEngineConfig[\"types\"] & {\n\t\t[type: string]: IEngineCoreTypeConfig[] | undefined;\n\n\t\t/**\n\t\t * Information component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tinformationComponent?: IEngineCoreTypeConfig<InformationComponentConfig>[];\n\n\t\t/**\n\t\t * Hosting component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\thostingComponent?: IEngineCoreTypeConfig<HostingComponentConfig>[];\n\n\t\t/**\n\t\t * REST route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\trestRouteProcessor?: IEngineCoreTypeConfig<RestRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Socket route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tsocketRouteProcessor?: IEngineCoreTypeConfig<SocketRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Mime type processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tmimeTypeProcessor?: IEngineCoreTypeConfig<MimeTypeProcessorConfig>[];\n\n\t\t/**\n\t\t * Authentication audit component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationAuditComponent?: IEngineCoreTypeConfig<AuthenticationAuditComponentConfig>[];\n\n\t\t/**\n\t\t * Authentication rate component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationRateComponent?: IEngineCoreTypeConfig<AuthenticationRateComponentConfig>[];\n\n\t\t/**\n\t\t * Authentication component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationComponent?: IEngineCoreTypeConfig<AuthenticationComponentConfig>[];\n\n\t\t/**\n\t\t * Authentication admin component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationAdminComponent?: IEngineCoreTypeConfig<AuthenticationAdminComponentConfig>[];\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authenticationAuditComponentConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationAuditComponentConfig.js","sourceRoot":"","sources":["../../../../src/models/config/authenticationAuditComponentConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntityStorageAuthenticationAuditServiceConstructorOptions } from \"@twin.org/api-auth-entity-storage-service\";\nimport type { AuthenticationAuditComponentType } from \"../types/authenticationAuditComponentType.js\";\n\n/**\n * Authentication audit component config types.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type AuthenticationAuditComponentConfig = {\n\ttype: typeof AuthenticationAuditComponentType.EntityStorage;\n\toptions?: IEntityStorageAuthenticationAuditServiceConstructorOptions;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authenticationRateComponentConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationRateComponentConfig.js","sourceRoot":"","sources":["../../../../src/models/config/authenticationRateComponentConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntityStorageAuthenticationRateServiceConstructorOptions } from \"@twin.org/api-auth-entity-storage-service\";\nimport type { AuthenticationRateComponentType } from \"../types/authenticationRateComponentType.js\";\n\n/**\n * Authentication rate component config types.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type AuthenticationRateComponentConfig = {\n\ttype: typeof AuthenticationRateComponentType.EntityStorage;\n\toptions?: IEntityStorageAuthenticationRateServiceConstructorOptions;\n};\n"]}
@@ -0,0 +1,13 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Authentication audit component types.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const AuthenticationAuditComponentType = {
8
+ /**
9
+ * Entity storage.
10
+ */
11
+ EntityStorage: "entity-storage"
12
+ };
13
+ //# sourceMappingURL=authenticationAuditComponentType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationAuditComponentType.js","sourceRoot":"","sources":["../../../../src/models/types/authenticationAuditComponentType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C;;OAEG;IACH,aAAa,EAAE,gBAAgB;CACtB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Authentication audit component types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AuthenticationAuditComponentType = {\n\t/**\n\t * Entity storage.\n\t */\n\tEntityStorage: \"entity-storage\"\n} as const;\n\n/**\n * Authentication audit component types.\n */\nexport type AuthenticationAuditComponentType =\n\t(typeof AuthenticationAuditComponentType)[keyof typeof AuthenticationAuditComponentType];\n"]}
@@ -0,0 +1,13 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Authentication rate component types.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const AuthenticationRateComponentType = {
8
+ /**
9
+ * Entity storage.
10
+ */
11
+ EntityStorage: "entity-storage"
12
+ };
13
+ //# sourceMappingURL=authenticationRateComponentType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationRateComponentType.js","sourceRoot":"","sources":["../../../../src/models/types/authenticationRateComponentType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C;;OAEG;IACH,aAAa,EAAE,gBAAgB;CACtB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Authentication rate component types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AuthenticationRateComponentType = {\n\t/**\n\t * Entity storage.\n\t */\n\tEntityStorage: \"entity-storage\"\n} as const;\n\n/**\n * Authentication rate component types.\n */\nexport type AuthenticationRateComponentType =\n\t(typeof AuthenticationRateComponentType)[keyof typeof AuthenticationRateComponentType];\n"]}
@@ -0,0 +1,12 @@
1
+ import { ComponentFactory } from "@twin.org/core";
2
+ import type { EngineTypeInitialiserReturn, IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
3
+ import type { AuthenticationAuditComponentConfig } from "../models/config/authenticationAuditComponentConfig.js";
4
+ import type { IEngineServerConfig } from "../models/IEngineServerConfig.js";
5
+ /**
6
+ * Initialise the authentication audit.
7
+ * @param engineCore The engine core.
8
+ * @param context The context for the engine.
9
+ * @param instanceConfig The instance config.
10
+ * @returns The instance created and the factory for it.
11
+ */
12
+ export declare function initialiseAuthenticationAuditComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationAuditComponentConfig): EngineTypeInitialiserReturn<AuthenticationAuditComponentConfig, typeof ComponentFactory>;
@@ -0,0 +1,12 @@
1
+ import { ComponentFactory } from "@twin.org/core";
2
+ import type { EngineTypeInitialiserReturn, IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
3
+ import type { AuthenticationRateComponentConfig } from "../models/config/authenticationRateComponentConfig.js";
4
+ import type { IEngineServerConfig } from "../models/IEngineServerConfig.js";
5
+ /**
6
+ * Initialise the authentication rate.
7
+ * @param engineCore The engine core.
8
+ * @param context The context for the engine.
9
+ * @param instanceConfig The instance config.
10
+ * @returns The instance created and the factory for it.
11
+ */
12
+ export declare function initialiseAuthenticationRateComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationRateComponentConfig): EngineTypeInitialiserReturn<AuthenticationRateComponentConfig, typeof ComponentFactory>;
@@ -1,12 +1,16 @@
1
1
  export * from "./components/authentication.js";
2
2
  export * from "./components/authenticationAdmin.js";
3
+ export * from "./components/authenticationAudit.js";
4
+ export * from "./components/authenticationRate.js";
3
5
  export * from "./components/hosting.js";
4
6
  export * from "./components/information.js";
5
7
  export * from "./components/mimeTypeProcessor.js";
6
8
  export * from "./components/restRouteProcessor.js";
7
9
  export * from "./components/socketRouteProcessor.js";
8
10
  export * from "./models/config/authenticationAdminComponentConfig.js";
11
+ export * from "./models/config/authenticationAuditComponentConfig.js";
9
12
  export * from "./models/config/authenticationComponentConfig.js";
13
+ export * from "./models/config/authenticationRateComponentConfig.js";
10
14
  export * from "./models/config/hostingComponentConfig.js";
11
15
  export * from "./models/config/informationComponentConfig.js";
12
16
  export * from "./models/config/mimeTypeProcessorConfig.js";
@@ -14,7 +18,9 @@ export * from "./models/config/restRouteProcessorConfig.js";
14
18
  export * from "./models/config/socketRouteProcessorConfig.js";
15
19
  export * from "./models/IEngineServerConfig.js";
16
20
  export * from "./models/types/authenticationAdminComponentType.js";
21
+ export * from "./models/types/authenticationAuditComponentType.js";
17
22
  export * from "./models/types/authenticationComponentType.js";
23
+ export * from "./models/types/authenticationRateComponentType.js";
18
24
  export * from "./models/types/hostingComponentType.js";
19
25
  export * from "./models/types/informationComponentType.js";
20
26
  export * from "./models/types/mimeTypeProcessorType.js";
@@ -2,7 +2,9 @@ import type { IWebServerOptions } from "@twin.org/api-models";
2
2
  import type { IEngineCoreTypeConfig } from "@twin.org/engine-models";
3
3
  import type { IEngineConfig } from "@twin.org/engine-types";
4
4
  import type { AuthenticationAdminComponentConfig } from "./config/authenticationAdminComponentConfig.js";
5
+ import type { AuthenticationAuditComponentConfig } from "./config/authenticationAuditComponentConfig.js";
5
6
  import type { AuthenticationComponentConfig } from "./config/authenticationComponentConfig.js";
7
+ import type { AuthenticationRateComponentConfig } from "./config/authenticationRateComponentConfig.js";
6
8
  import type { HostingComponentConfig } from "./config/hostingComponentConfig.js";
7
9
  import type { InformationComponentConfig } from "./config/informationComponentConfig.js";
8
10
  import type { MimeTypeProcessorConfig } from "./config/mimeTypeProcessorConfig.js";
@@ -41,6 +43,14 @@ export interface IEngineServerConfig extends IEngineConfig {
41
43
  * Mime type processors options which can be overridden by individual components by specifying types other than default.
42
44
  */
43
45
  mimeTypeProcessor?: IEngineCoreTypeConfig<MimeTypeProcessorConfig>[];
46
+ /**
47
+ * Authentication audit component options which can be overridden by individual components by specifying types other than default.
48
+ */
49
+ authenticationAuditComponent?: IEngineCoreTypeConfig<AuthenticationAuditComponentConfig>[];
50
+ /**
51
+ * Authentication rate component options which can be overridden by individual components by specifying types other than default.
52
+ */
53
+ authenticationRateComponent?: IEngineCoreTypeConfig<AuthenticationRateComponentConfig>[];
44
54
  /**
45
55
  * Authentication component options which can be overridden by individual components by specifying types other than default.
46
56
  */
@@ -0,0 +1,9 @@
1
+ import type { IEntityStorageAuthenticationAuditServiceConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
2
+ import type { AuthenticationAuditComponentType } from "../types/authenticationAuditComponentType.js";
3
+ /**
4
+ * Authentication audit component config types.
5
+ */
6
+ export type AuthenticationAuditComponentConfig = {
7
+ type: typeof AuthenticationAuditComponentType.EntityStorage;
8
+ options?: IEntityStorageAuthenticationAuditServiceConstructorOptions;
9
+ };
@@ -0,0 +1,9 @@
1
+ import type { IEntityStorageAuthenticationRateServiceConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
2
+ import type { AuthenticationRateComponentType } from "../types/authenticationRateComponentType.js";
3
+ /**
4
+ * Authentication rate component config types.
5
+ */
6
+ export type AuthenticationRateComponentConfig = {
7
+ type: typeof AuthenticationRateComponentType.EntityStorage;
8
+ options?: IEntityStorageAuthenticationRateServiceConstructorOptions;
9
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Authentication audit component types.
3
+ */
4
+ export declare const AuthenticationAuditComponentType: {
5
+ /**
6
+ * Entity storage.
7
+ */
8
+ readonly EntityStorage: "entity-storage";
9
+ };
10
+ /**
11
+ * Authentication audit component types.
12
+ */
13
+ export type AuthenticationAuditComponentType = (typeof AuthenticationAuditComponentType)[keyof typeof AuthenticationAuditComponentType];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Authentication rate component types.
3
+ */
4
+ export declare const AuthenticationRateComponentType: {
5
+ /**
6
+ * Entity storage.
7
+ */
8
+ readonly EntityStorage: "entity-storage";
9
+ };
10
+ /**
11
+ * Authentication rate component types.
12
+ */
13
+ export type AuthenticationRateComponentType = (typeof AuthenticationRateComponentType)[keyof typeof AuthenticationRateComponentType];
package/docs/changelog.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.29](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.28...engine-server-types-v0.0.3-next.29) (2026-04-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * add authentication rate and audit services ([#95](https://github.com/twinfoundation/engine/issues/95)) ([55e2b08](https://github.com/twinfoundation/engine/commit/55e2b089661529e0556115817cc435cc6e4292cc))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/engine-models bumped from 0.0.3-next.28 to 0.0.3-next.29
16
+ * @twin.org/engine-types bumped from 0.0.3-next.28 to 0.0.3-next.29
17
+
18
+ ## [0.0.3-next.28](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.27...engine-server-types-v0.0.3-next.28) (2026-04-10)
19
+
20
+
21
+ ### Miscellaneous Chores
22
+
23
+ * **engine-server-types:** Synchronize repo versions
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @twin.org/engine-models bumped from 0.0.3-next.27 to 0.0.3-next.28
31
+ * @twin.org/engine-types bumped from 0.0.3-next.27 to 0.0.3-next.28
32
+
3
33
  ## [0.0.3-next.27](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.26...engine-server-types-v0.0.3-next.27) (2026-03-20)
4
34
 
5
35
 
@@ -0,0 +1,31 @@
1
+ # Function: initialiseAuthenticationAuditComponent()
2
+
3
+ > **initialiseAuthenticationAuditComponent**(`engineCore`, `context`, `instanceConfig`): `EngineTypeInitialiserReturn`\<[`AuthenticationAuditComponentConfig`](../type-aliases/AuthenticationAuditComponentConfig.md), `Factory`\<`IComponent`\>\>
4
+
5
+ Initialise the authentication audit.
6
+
7
+ ## Parameters
8
+
9
+ ### engineCore
10
+
11
+ `IEngineCore`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
12
+
13
+ The engine core.
14
+
15
+ ### context
16
+
17
+ `IEngineCoreContext`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
18
+
19
+ The context for the engine.
20
+
21
+ ### instanceConfig
22
+
23
+ [`AuthenticationAuditComponentConfig`](../type-aliases/AuthenticationAuditComponentConfig.md)
24
+
25
+ The instance config.
26
+
27
+ ## Returns
28
+
29
+ `EngineTypeInitialiserReturn`\<[`AuthenticationAuditComponentConfig`](../type-aliases/AuthenticationAuditComponentConfig.md), `Factory`\<`IComponent`\>\>
30
+
31
+ The instance created and the factory for it.
@@ -0,0 +1,31 @@
1
+ # Function: initialiseAuthenticationRateComponent()
2
+
3
+ > **initialiseAuthenticationRateComponent**(`engineCore`, `context`, `instanceConfig`): `EngineTypeInitialiserReturn`\<[`AuthenticationRateComponentConfig`](../type-aliases/AuthenticationRateComponentConfig.md), `Factory`\<`IComponent`\>\>
4
+
5
+ Initialise the authentication rate.
6
+
7
+ ## Parameters
8
+
9
+ ### engineCore
10
+
11
+ `IEngineCore`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
12
+
13
+ The engine core.
14
+
15
+ ### context
16
+
17
+ `IEngineCoreContext`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
18
+
19
+ The context for the engine.
20
+
21
+ ### instanceConfig
22
+
23
+ [`AuthenticationRateComponentConfig`](../type-aliases/AuthenticationRateComponentConfig.md)
24
+
25
+ The instance config.
26
+
27
+ ## Returns
28
+
29
+ `EngineTypeInitialiserReturn`\<[`AuthenticationRateComponentConfig`](../type-aliases/AuthenticationRateComponentConfig.md), `Factory`\<`IComponent`\>\>
30
+
31
+ The instance created and the factory for it.
@@ -7,14 +7,18 @@
7
7
  ## Type Aliases
8
8
 
9
9
  - [AuthenticationAdminComponentConfig](type-aliases/AuthenticationAdminComponentConfig.md)
10
+ - [AuthenticationAuditComponentConfig](type-aliases/AuthenticationAuditComponentConfig.md)
10
11
  - [AuthenticationComponentConfig](type-aliases/AuthenticationComponentConfig.md)
12
+ - [AuthenticationRateComponentConfig](type-aliases/AuthenticationRateComponentConfig.md)
11
13
  - [HostingComponentConfig](type-aliases/HostingComponentConfig.md)
12
14
  - [InformationComponentConfig](type-aliases/InformationComponentConfig.md)
13
15
  - [MimeTypeProcessorConfig](type-aliases/MimeTypeProcessorConfig.md)
14
16
  - [RestRouteProcessorConfig](type-aliases/RestRouteProcessorConfig.md)
15
17
  - [SocketRouteProcessorConfig](type-aliases/SocketRouteProcessorConfig.md)
16
18
  - [AuthenticationAdminComponentType](type-aliases/AuthenticationAdminComponentType.md)
19
+ - [AuthenticationAuditComponentType](type-aliases/AuthenticationAuditComponentType.md)
17
20
  - [AuthenticationComponentType](type-aliases/AuthenticationComponentType.md)
21
+ - [AuthenticationRateComponentType](type-aliases/AuthenticationRateComponentType.md)
18
22
  - [HostingComponentType](type-aliases/HostingComponentType.md)
19
23
  - [InformationComponentType](type-aliases/InformationComponentType.md)
20
24
  - [MimeTypeProcessorType](type-aliases/MimeTypeProcessorType.md)
@@ -24,7 +28,9 @@
24
28
  ## Variables
25
29
 
26
30
  - [AuthenticationAdminComponentType](variables/AuthenticationAdminComponentType.md)
31
+ - [AuthenticationAuditComponentType](variables/AuthenticationAuditComponentType.md)
27
32
  - [AuthenticationComponentType](variables/AuthenticationComponentType.md)
33
+ - [AuthenticationRateComponentType](variables/AuthenticationRateComponentType.md)
28
34
  - [HostingComponentType](variables/HostingComponentType.md)
29
35
  - [InformationComponentType](variables/InformationComponentType.md)
30
36
  - [MimeTypeProcessorType](variables/MimeTypeProcessorType.md)
@@ -35,6 +41,8 @@
35
41
 
36
42
  - [initialiseAuthenticationComponent](functions/initialiseAuthenticationComponent.md)
37
43
  - [initialiseAuthenticationAdminComponent](functions/initialiseAuthenticationAdminComponent.md)
44
+ - [initialiseAuthenticationAuditComponent](functions/initialiseAuthenticationAuditComponent.md)
45
+ - [initialiseAuthenticationRateComponent](functions/initialiseAuthenticationRateComponent.md)
38
46
  - [initialiseHostingComponent](functions/initialiseHostingComponent.md)
39
47
  - [initialiseInformationComponent](functions/initialiseInformationComponent.md)
40
48
  - [initialiseMimeTypeProcessorComponent](functions/initialiseMimeTypeProcessorComponent.md)
@@ -482,6 +482,18 @@ Socket route processors options which can be overridden by individual components
482
482
 
483
483
  Mime type processors options which can be overridden by individual components by specifying types other than default.
484
484
 
485
+ ##### authenticationAuditComponent?
486
+
487
+ > `optional` **authenticationAuditComponent?**: `IEngineCoreTypeConfig`\<[`AuthenticationAuditComponentConfig`](../type-aliases/AuthenticationAuditComponentConfig.md)\>[]
488
+
489
+ Authentication audit component options which can be overridden by individual components by specifying types other than default.
490
+
491
+ ##### authenticationRateComponent?
492
+
493
+ > `optional` **authenticationRateComponent?**: `IEngineCoreTypeConfig`\<[`AuthenticationRateComponentConfig`](../type-aliases/AuthenticationRateComponentConfig.md)\>[]
494
+
495
+ Authentication rate component options which can be overridden by individual components by specifying types other than default.
496
+
485
497
  ##### authenticationComponent?
486
498
 
487
499
  > `optional` **authenticationComponent?**: `IEngineCoreTypeConfig`\<[`AuthenticationComponentConfig`](../type-aliases/AuthenticationComponentConfig.md)\>[]
@@ -0,0 +1,17 @@
1
+ # Type Alias: AuthenticationAuditComponentConfig
2
+
3
+ > **AuthenticationAuditComponentConfig** = `object`
4
+
5
+ Authentication audit component config types.
6
+
7
+ ## Properties
8
+
9
+ ### type {#type}
10
+
11
+ > **type**: *typeof* [`EntityStorage`](../variables/AuthenticationAuditComponentType.md#entitystorage)
12
+
13
+ ***
14
+
15
+ ### options? {#options}
16
+
17
+ > `optional` **options?**: `IEntityStorageAuthenticationAuditServiceConstructorOptions`
@@ -0,0 +1,5 @@
1
+ # Type Alias: AuthenticationAuditComponentType
2
+
3
+ > **AuthenticationAuditComponentType** = *typeof* [`AuthenticationAuditComponentType`](../variables/AuthenticationAuditComponentType.md)\[keyof *typeof* [`AuthenticationAuditComponentType`](../variables/AuthenticationAuditComponentType.md)\]
4
+
5
+ Authentication audit component types.
@@ -0,0 +1,17 @@
1
+ # Type Alias: AuthenticationRateComponentConfig
2
+
3
+ > **AuthenticationRateComponentConfig** = `object`
4
+
5
+ Authentication rate component config types.
6
+
7
+ ## Properties
8
+
9
+ ### type {#type}
10
+
11
+ > **type**: *typeof* [`EntityStorage`](../variables/AuthenticationRateComponentType.md#entitystorage)
12
+
13
+ ***
14
+
15
+ ### options? {#options}
16
+
17
+ > `optional` **options?**: `IEntityStorageAuthenticationRateServiceConstructorOptions`
@@ -0,0 +1,5 @@
1
+ # Type Alias: AuthenticationRateComponentType
2
+
3
+ > **AuthenticationRateComponentType** = *typeof* [`AuthenticationRateComponentType`](../variables/AuthenticationRateComponentType.md)\[keyof *typeof* [`AuthenticationRateComponentType`](../variables/AuthenticationRateComponentType.md)\]
4
+
5
+ Authentication rate component types.
@@ -0,0 +1,13 @@
1
+ # Variable: AuthenticationAuditComponentType
2
+
3
+ > `const` **AuthenticationAuditComponentType**: `object`
4
+
5
+ Authentication audit component types.
6
+
7
+ ## Type Declaration
8
+
9
+ ### EntityStorage {#entitystorage}
10
+
11
+ > `readonly` **EntityStorage**: `"entity-storage"` = `"entity-storage"`
12
+
13
+ Entity storage.
@@ -0,0 +1,13 @@
1
+ # Variable: AuthenticationRateComponentType
2
+
3
+ > `const` **AuthenticationRateComponentType**: `object`
4
+
5
+ Authentication rate component types.
6
+
7
+ ## Type Declaration
8
+
9
+ ### EntityStorage {#entitystorage}
10
+
11
+ > `readonly` **EntityStorage**: `"entity-storage"` = `"entity-storage"`
12
+
13
+ Entity storage.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-server-types",
3
- "version": "0.0.3-next.27",
3
+ "version": "0.0.3-next.29",
4
4
  "description": "Server-focused component types and configuration models for API routing and hosting.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,8 +25,8 @@
25
25
  "@twin.org/api-tenant-processor": "next",
26
26
  "@twin.org/context": "next",
27
27
  "@twin.org/core": "next",
28
- "@twin.org/engine-models": "0.0.3-next.27",
29
- "@twin.org/engine-types": "0.0.3-next.27",
28
+ "@twin.org/engine-models": "0.0.3-next.29",
29
+ "@twin.org/engine-types": "0.0.3-next.29",
30
30
  "@twin.org/entity": "next",
31
31
  "@twin.org/nameof": "next"
32
32
  },