@3sixty/api-auth-entity-storage-rest-client 0.20.0-next.0 → 0.20.0-next.1

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.
package/README.md CHANGED
@@ -22,4 +22,4 @@ The changes between each version can be found in [docs/changelog.md](docs/change
22
22
 
23
23
  ## Origin
24
24
 
25
- This package is derived from the original [iotaledger/twin-api](https://github.com/iotaledger/twin-api/tree/next/packages/api-auth-entity-storage-rest-client) repository.
25
+ This package is derived from the original [iotaledger/twin-api-auth](https://github.com/iotaledger/twin-api-auth/tree/next/packages/api-auth-entity-storage-rest-client) repository.
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageAuthenticationAdminRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationAdminRestClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,0CACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,gDAAgE;IAEjG;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,+CAAuD,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0CAA0C,CAAC,UAAU,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAAgD;QACnE,MAAM,CAAC,MAAM,CAAC,0CAA0C,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QACzF,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,gBAErD,IAAI,CAAC,KAAK,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA8C,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE;YACxF,IAA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,EACf,UAAU,CAAC,MAAM,EACjB;YACC,UAAU,EAAE;gBACX,KAAK;aACL;SACD,CACD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,WAAmB,EACnB,eAAwB;QAExB,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChG,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,iBAErD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CACf,wBAAwB,EACxB,UAAU,CAAC,GAAG,EACd;YACC,UAAU,EAAE;gBACX,KAAK;aACL;YACD,IAAI,EAAE;gBACL,WAAW;gBACX,eAAe;aACf;SACD,CACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAdminUserCreateRequest,\n\tIAdminUserGetByIdentityRequest,\n\tIAdminUserGetRequest,\n\tIAdminUserGetResponse,\n\tIAdminUserRemoveRequest,\n\tIAdminUserUpdatePasswordRequest,\n\tIAdminUserUpdateRequest,\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@3sixty/api-models\";\nimport { Guards } from \"@3sixty/core\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { HttpMethod } from \"@3sixty/web\";\n\n/**\n * The client to connect to the authentication admin service.\n */\nexport class EntityStorageAuthenticationAdminRestClient\n\textends BaseRestClient\n\timplements IAuthenticationAdminComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationAdminRestClient>();\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationAdminRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageAuthenticationAdminRestClient>(), config, \"authentication/admin\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationAdminRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a login for the user.\n\t * @param user The user to create.\n\t * @returns Nothing.\n\t */\n\tpublic async create(user: IAuthenticationUser & { password: string }): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(user), user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(user.email),\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserCreateRequest, INoContentResponse>(\"/users\", HttpMethod.POST, {\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Update a login for the user.\n\t * @param user The user to update.\n\t * @returns Nothing.\n\t */\n\tpublic async update(user: Partial<IAuthenticationUser>): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(user), user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(user.email),\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdateRequest, INoContentResponse>(\"/users/:email\", HttpMethod.PUT, {\n\t\t\tpathParams: {\n\t\t\t\temail: user.email\n\t\t\t},\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Get a user by email.\n\t * @param email The email address of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async get(email: string): Promise<IAuthenticationUser> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\n\t\tconst response = await this.fetch<IAdminUserGetRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/:email\",\n\t\t\tHttpMethod.GET,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get a user by identity.\n\t * @param identity The identity of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async getByIdentity(identity: string): Promise<IAuthenticationUser> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(identity),\n\t\t\tidentity\n\t\t);\n\n\t\tconst response = await this.fetch<IAdminUserGetByIdentityRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/identity/:identity\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tidentity\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Remove a user.\n\t * @param email The email address of the user to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(email: string): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\n\t\tawait this.fetch<IAdminUserRemoveRequest, INoContentResponse>(\n\t\t\t\"/users/:email\",\n\t\t\tHttpMethod.DELETE,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param email The email address of the user to update.\n\t * @param newPassword The new password for the user.\n\t * @param currentPassword The current password, optional, if supplied will check against existing.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tnewPassword: string,\n\t\tcurrentPassword?: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(newPassword),\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdatePasswordRequest, INoContentResponse>(\n\t\t\t\"/users/:email/password\",\n\t\t\tHttpMethod.PUT,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t},\n\t\t\t\tbody: {\n\t\t\t\t\tnewPassword,\n\t\t\t\t\tcurrentPassword\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"entityStorageAuthenticationAdminRestClient.js","sources":["../../src/entityStorageAuthenticationAdminRestClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,0CACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,4CAA4C,CAAC;IAEzF;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,4CAA4C,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACrF,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0CAA0C,CAAC,UAAU,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAAgD;QACnE,MAAM,CAAC,MAAM,CAAC,0CAA0C,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACnF,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,EACrD,YAAY,EACZ,IAAI,CAAC,KAAK,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA8C,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE;YACxF,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAAkC;QACrD,MAAM,CAAC,MAAM,CAAC,0CAA0C,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;IACH,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,WAAmB,EACnB,eAAwB;QAExB,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1F,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,EACrD,aAAa,EACb,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CACf,wBAAwB,EACxB,UAAU,CAAC,GAAG,EACd;YACC,UAAU,EAAE;gBACX,KAAK;aACL;YACD,IAAI,EAAE;gBACL,WAAW;gBACX,eAAe;aACf;SACD,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAdminUserCreateRequest,\n\tIAdminUserGetByIdentityRequest,\n\tIAdminUserGetRequest,\n\tIAdminUserGetResponse,\n\tIAdminUserRemoveRequest,\n\tIAdminUserUpdatePasswordRequest,\n\tIAdminUserUpdateRequest,\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@3sixty/api-models\";\nimport { Guards } from \"@3sixty/core\";\n\nimport { HttpMethod } from \"@3sixty/web\";\n\n/**\n * The client to connect to the authentication admin service.\n */\nexport class EntityStorageAuthenticationAdminRestClient\n\textends BaseRestClient\n\timplements IAuthenticationAdminComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"EntityStorageAuthenticationAdminRestClient\";\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationAdminRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(\"EntityStorageAuthenticationAdminRestClient\", config, \"authentication/admin\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationAdminRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a login for the user.\n\t * @param user The user to create.\n\t * @returns Nothing.\n\t */\n\tpublic async create(user: IAuthenticationUser & { password: string }): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, \"user\", user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\t\"user.email\",\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserCreateRequest, INoContentResponse>(\"/users\", HttpMethod.POST, {\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Update a login for the user.\n\t * @param user The user to update.\n\t * @returns Nothing.\n\t */\n\tpublic async update(user: Partial<IAuthenticationUser>): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, \"user\", user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\t\"user.email\",\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdateRequest, INoContentResponse>(\"/users/:email\", HttpMethod.PUT, {\n\t\t\tpathParams: {\n\t\t\t\temail: user.email\n\t\t\t},\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Get a user by email.\n\t * @param email The email address of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async get(email: string): Promise<IAuthenticationUser> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, \"email\", email);\n\n\t\tconst response = await this.fetch<IAdminUserGetRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/:email\",\n\t\t\tHttpMethod.GET,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get a user by identity.\n\t * @param identity The identity of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async getByIdentity(identity: string): Promise<IAuthenticationUser> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\t\"identity\",\n\t\t\tidentity\n\t\t);\n\n\t\tconst response = await this.fetch<IAdminUserGetByIdentityRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/identity/:identity\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tidentity\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Remove a user.\n\t * @param email The email address of the user to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(email: string): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, \"email\", email);\n\n\t\tawait this.fetch<IAdminUserRemoveRequest, INoContentResponse>(\n\t\t\t\"/users/:email\",\n\t\t\tHttpMethod.DELETE,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param email The email address of the user to update.\n\t * @param newPassword The new password for the user.\n\t * @param currentPassword The current password, optional, if supplied will check against existing.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tnewPassword: string,\n\t\tcurrentPassword?: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, \"email\", email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\t\"newPassword\",\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdatePasswordRequest, INoContentResponse>(\n\t\t\t\"/users/:email/password\",\n\t\t\tHttpMethod.PUT,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t},\n\t\t\t\tbody: {\n\t\t\t\t\tnewPassword,\n\t\t\t\t\tcurrentPassword\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
@@ -99,5 +99,13 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
99
99
  }
100
100
  });
101
101
  }
102
+ /**
103
+ * Get the password policy used for password validation.
104
+ * @returns The password policy options.
105
+ */
106
+ async passwordPolicy() {
107
+ const response = await this.fetch("/policy", "GET");
108
+ return response.body;
109
+ }
102
110
  }
103
111
  //# sourceMappingURL=entityStorageAuthenticationRestClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageAuthenticationRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAO,qCACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,2CAA2D;IAE5F;;;OAGG;IACI,MAAM,CAAU,mBAAmB,GAAW,cAAc,CAAC;IAEpE;;;OAGG;IACc,WAAW,CAAS;IAErC;;;OAGG;IACH,YAAY,MAAgE;QAC3E,KAAK,0CAAkD,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACjF,IAAI,CAAC,WAAW;YACf,MAAM,CAAC,UAAU,IAAI,qCAAqC,CAAC,mBAAmB,CAAC;IACjF,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qCAAqC,CAAC,UAAU,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CACjB,KAAa,EACb,QAAgB;QAKhB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WA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ACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,WAAW,EAAE,KAAK,EAAE;YAChF,IAAI,EAAE;gBACL,eAAe;gBACf,WAAW;aACX;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationComponent,\n\tILoginRequest,\n\tILoginResponse,\n\tILogoutRequest,\n\tIRefreshTokenRequest,\n\tIRefreshTokenResponse,\n\tIUpdatePasswordRequest\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport type { INoContentResponse } from \"@3sixty/api-models\";\nimport { Guards } from \"@3sixty/core\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { CookieHelper, HeaderTypes } from \"@3sixty/web\";\nimport type { IEntityStorageAuthenticationRestClientConstructorOptions } from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n\n/**\n * The client to connect to the authentication service.\n */\nexport class EntityStorageAuthenticationRestClient\n\textends BaseRestClient\n\timplements IAuthenticationComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationRestClient>();\n\n\t/**\n\t * The default name for the access token as a cookie.\n\t * @internal\n\t */\n\tpublic static readonly DEFAULT_COOKIE_NAME: string = \"access_token\";\n\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @internal\n\t */\n\tprivate readonly _cookieName: string;\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IEntityStorageAuthenticationRestClientConstructorOptions) {\n\t\tsuper(nameof<EntityStorageAuthenticationRestClient>(), config, \"authentication\");\n\t\tthis._cookieName =\n\t\t\tconfig.cookieName ?? EntityStorageAuthenticationRestClient.DEFAULT_COOKIE_NAME;\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Perform a login for the user.\n\t * @param email The email address for the user.\n\t * @param password The password for the user.\n\t * @returns The authentication token for the user, if it uses a mechanism with public access.\n\t */\n\tpublic async login(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(password),\n\t\t\tpassword\n\t\t);\n\n\t\tconst response = await this.fetch<ILoginRequest, ILoginResponse>(\"/login\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\temail,\n\t\t\t\tpassword\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Logout the current user.\n\t * @param token The token to logout, if it uses a mechanism with public access.\n\t * @returns A promise that resolves when the logout request has completed.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\ttoken\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Refresh the token.\n\t * @param token The token to refresh, if it uses a mechanism with public access.\n\t * @returns The refreshed token, if it uses a mechanism with public access.\n\t */\n\tpublic async refresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst response = await this.fetch<IRefreshTokenRequest, IRefreshTokenResponse>(\n\t\t\t\"/refresh\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: {\n\t\t\t\t\ttoken\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns A promise that resolves when the password has been updated on the server.\n\t */\n\tpublic async updatePassword(currentPassword: string, newPassword: string): Promise<void> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(currentPassword),\n\t\t\tcurrentPassword\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(newPassword),\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IUpdatePasswordRequest, INoContentResponse>(\"/password\", \"PUT\", {\n\t\t\tbody: {\n\t\t\t\tcurrentPassword,\n\t\t\t\tnewPassword\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"entityStorageAuthenticationRestClient.js","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAO,qCACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,uCAAuC,CAAC;IAEpF;;;OAGG;IACI,MAAM,CAAU,mBAAmB,GAAW,cAAc,CAAC;IAEpE;;;OAGG;IACc,WAAW,CAAS;IAErC;;;OAGG;IACH,YAAY,MAAgE;QAC3E,KAAK,CAAC,uCAAuC,EAAE,MAAM,EAAE,gBAAgB,CAAC,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EAC1C,IAAI,CAAC,WAAW,CAChB;YACD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,cAAc,CAAC,eAAuB,EAAE,WAAmB;QACvE,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,EAChD,iBAAiB,EACjB,eAAe,CACf,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,EAChD,aAAa,EACb,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,WAAW,EAAE,KAAK,EAAE;YAChF,IAAI,EAAE;gBACL,eAAe;gBACf,WAAW;aACX;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA6C,SAAS,EAAE,KAAK,CAAC,CAAC;QAEhG,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationComponent,\n\tILoginRequest,\n\tILoginResponse,\n\tILogoutRequest,\n\tIPasswordPolicyResponse,\n\tIPasswordOptions,\n\tIRefreshTokenRequest,\n\tIRefreshTokenResponse,\n\tIUpdatePasswordRequest\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport type { INoContentRequest, INoContentResponse } from \"@3sixty/api-models\";\nimport { Guards } from \"@3sixty/core\";\n\nimport { CookieHelper, HeaderTypes } from \"@3sixty/web\";\nimport type { IEntityStorageAuthenticationRestClientConstructorOptions } from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n\n/**\n * The client to connect to the authentication service.\n */\nexport class EntityStorageAuthenticationRestClient\n\textends BaseRestClient\n\timplements IAuthenticationComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"EntityStorageAuthenticationRestClient\";\n\n\t/**\n\t * The default name for the access token as a cookie.\n\t * @internal\n\t */\n\tpublic static readonly DEFAULT_COOKIE_NAME: string = \"access_token\";\n\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @internal\n\t */\n\tprivate readonly _cookieName: string;\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IEntityStorageAuthenticationRestClientConstructorOptions) {\n\t\tsuper(\"EntityStorageAuthenticationRestClient\", config, \"authentication\");\n\t\tthis._cookieName =\n\t\t\tconfig.cookieName ?? EntityStorageAuthenticationRestClient.DEFAULT_COOKIE_NAME;\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Perform a login for the user.\n\t * @param email The email address for the user.\n\t * @param password The password for the user.\n\t * @returns The authentication token for the user, if it uses a mechanism with public access.\n\t */\n\tpublic async login(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, \"email\", email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\t\"password\",\n\t\t\tpassword\n\t\t);\n\n\t\tconst response = await this.fetch<ILoginRequest, ILoginResponse>(\"/login\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\temail,\n\t\t\t\tpassword\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Logout the current user.\n\t * @param token The token to logout, if it uses a mechanism with public access.\n\t * @returns A promise that resolves when the logout request has completed.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\ttoken\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Refresh the token.\n\t * @param token The token to refresh, if it uses a mechanism with public access.\n\t * @returns The refreshed token, if it uses a mechanism with public access.\n\t */\n\tpublic async refresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst response = await this.fetch<IRefreshTokenRequest, IRefreshTokenResponse>(\n\t\t\t\"/refresh\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: {\n\t\t\t\t\ttoken\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns A promise that resolves when the password has been updated on the server.\n\t */\n\tpublic async updatePassword(currentPassword: string, newPassword: string): Promise<void> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\t\"currentPassword\",\n\t\t\tcurrentPassword\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\t\"newPassword\",\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IUpdatePasswordRequest, INoContentResponse>(\"/password\", \"PUT\", {\n\t\t\tbody: {\n\t\t\t\tcurrentPassword,\n\t\t\t\tnewPassword\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the password policy used for password validation.\n\t * @returns The password policy options.\n\t */\n\tpublic async passwordPolicy(): Promise<IPasswordOptions> {\n\t\tconst response = await this.fetch<INoContentRequest, IPasswordPolicyResponse>(\"/policy\", \"GET\");\n\n\t\treturn response.body;\n\t}\n}\n"]}
package/dist/es/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  export * from "./entityStorageAuthenticationAdminRestClient.js";
4
- export * from "./entityStorageAuthenticationAuditRestClient.js";
5
4
  export * from "./entityStorageAuthenticationRestClient.js";
6
5
  export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qEAAqE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationAdminRestClient.js\";\nexport * from \"./entityStorageAuthenticationAuditRestClient.js\";\nexport * from \"./entityStorageAuthenticationRestClient.js\";\nexport * from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n"]}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qEAAqE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationAdminRestClient.js\";\nexport * from \"./entityStorageAuthenticationRestClient.js\";\nexport * from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageAuthenticationRestClientConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/entityStorageAuthenticationRestClientConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRestClientConfig } from \"@3sixty/api-models\";\n\n/**\n * Options for the Entity Storage Authentication REST client constructor.\n */\nexport interface IEntityStorageAuthenticationRestClientConstructorOptions extends IBaseRestClientConfig {\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @default access_token\n\t */\n\tcookieName?: string;\n}\n"]}
1
+ {"version":3,"file":"entityStorageAuthenticationRestClientConstructorOptions.js","sources":["../../../src/models/entityStorageAuthenticationRestClientConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRestClientConfig } from \"@3sixty/api-models\";\n\n/**\n * Options for the Entity Storage Authentication REST client constructor.\n */\nexport interface IEntityStorageAuthenticationRestClientConstructorOptions extends IBaseRestClientConfig {\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @default access_token\n\t */\n\tcookieName?: string;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IAuthenticationComponent } from "@3sixty/api-auth-entity-storage-models";
1
+ import type { IAuthenticationComponent, IPasswordOptions } from "@3sixty/api-auth-entity-storage-models";
2
2
  import { BaseRestClient } from "@3sixty/api-core";
3
3
  import type { IEntityStorageAuthenticationRestClientConstructorOptions } from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
4
4
  /**
@@ -51,4 +51,9 @@ export declare class EntityStorageAuthenticationRestClient extends BaseRestClien
51
51
  * @returns A promise that resolves when the password has been updated on the server.
52
52
  */
53
53
  updatePassword(currentPassword: string, newPassword: string): Promise<void>;
54
+ /**
55
+ * Get the password policy used for password validation.
56
+ * @returns The password policy options.
57
+ */
58
+ passwordPolicy(): Promise<IPasswordOptions>;
54
59
  }
@@ -1,4 +1,3 @@
1
1
  export * from "./entityStorageAuthenticationAdminRestClient.js";
2
- export * from "./entityStorageAuthenticationAuditRestClient.js";
3
2
  export * from "./entityStorageAuthenticationRestClient.js";
4
3
  export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
package/docs/changelog.md CHANGED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## [0.20.0-next.1](https://github.com/3sixtyglobal/api-auth/compare/api-auth-entity-storage-rest-client-v0.20.0-next.0...api-auth-entity-storage-rest-client-v0.20.0-next.1) (2026-10-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * authorization ([#3](https://github.com/3sixtyglobal/api-auth/issues/3)) ([5688693](https://github.com/3sixtyglobal/api-auth/commit/568869364065b9d2c82c5c17c81f07cbdc64ec8b))
9
+ * initial commit ([b9112fb](https://github.com/3sixtyglobal/api-auth/commit/b9112fb6994758b43effdde1b9e41435ff50fe50))
10
+ * publish packages under the [@3sixty](https://github.com/3sixty) namespace ([6c22482](https://github.com/3sixtyglobal/api-auth/commit/6c2248295620000807ff91087c3b1dfc9b018b31))
11
+ * updated ts compile ([83c72bd](https://github.com/3sixtyglobal/api-auth/commit/83c72bd5d2e9d81208b7a2755450d96fbbb04004))
12
+
13
+
14
+ ### Dependencies
15
+
16
+ * The following workspace dependencies were updated
17
+ * dependencies
18
+ * @3sixty/api-auth-entity-storage-models bumped from 0.20.0-next.0 to 0.20.0-next.1
package/docs/examples.md CHANGED
@@ -18,14 +18,12 @@ await adminClient.create({
18
18
  email: 'ops@example.org',
19
19
  password: 'StrongPassword123',
20
20
  userIdentity: 'did:example:ops',
21
- organizationIdentity: 'did:example:core',
22
- scope: ['admin']
21
+ organizationIdentity: 'did:example:core'
23
22
  });
24
23
 
25
24
  await adminClient.update({
26
25
  email: 'ops@example.org',
27
- userIdentity: 'did:example:ops:team',
28
- scope: ['admin', 'support']
26
+ userIdentity: 'did:example:ops:team'
29
27
  });
30
28
 
31
29
  await adminClient.updatePassword('ops@example.org', 'StrongPassword124', 'StrongPassword123');
@@ -42,7 +40,7 @@ const adminClient = new EntityStorageAuthenticationAdminRestClient({
42
40
  });
43
41
 
44
42
  const byEmail = await adminClient.get('ops@example.org');
45
- const byIdentity = await adminClient.getByIdentity('ops-team@example.org');
43
+ const byIdentity = await adminClient.getByIdentity('did:example:ops:team');
46
44
  await adminClient.remove('ops@example.org');
47
45
 
48
46
  console.log(byEmail.email); // ops@example.org
@@ -62,6 +60,9 @@ const authClient = new EntityStorageAuthenticationRestClient({
62
60
 
63
61
  console.log(authClient.className()); // EntityStorageAuthenticationRestClient
64
62
 
63
+ const policy = await authClient.passwordPolicy();
64
+ console.log(policy.minPasswordLength); // 8
65
+
65
66
  const loginResponse = await authClient.login('alice@example.org', 'correct-horse-battery-staple');
66
67
 
67
68
  await authClient.updatePassword('correct-horse-battery-staple', 'correct-horse-battery-staple-2');
@@ -71,41 +72,3 @@ const refreshResponse = await authClient.refresh(loginResponse.token);
71
72
  await authClient.logout(refreshResponse.token);
72
73
  console.log(refreshResponse.expiry > 0); // true
73
74
  ```
74
-
75
- ## EntityStorageAuthenticationAuditRestClient
76
-
77
- ```typescript
78
- import { EntityStorageAuthenticationAuditRestClient } from '@3sixty/api-auth-entity-storage-rest-client';
79
-
80
- const auditClient = new EntityStorageAuthenticationAuditRestClient({
81
- endpoint: 'https://api.example.org',
82
- pathPrefix: 'v1'
83
- });
84
-
85
- console.log(auditClient.className()); // EntityStorageAuthenticationAuditRestClient
86
-
87
- const auditEntryId = await auditClient.create({
88
- event: 'login-success',
89
- actorId: 'did:example:user:alice',
90
- organizationId: 'did:example:org:core',
91
- tenantId: 'did:example:tenant:alpha',
92
- data: {
93
- channel: 'web'
94
- }
95
- });
96
-
97
- const auditResult = await auditClient.query(
98
- {
99
- actorId: 'did:example:user:alice',
100
- event: 'login-success',
101
- startDate: '2026-04-01T00:00:00.000Z',
102
- endDate: '2026-04-30T23:59:59.999Z'
103
- },
104
- undefined,
105
- 25
106
- );
107
-
108
- console.log(auditEntryId); // /authentication/audit/018f2f67bb9d4a0caad8386f56df85ce
109
- console.log(auditResult.entries.length); // 1
110
- console.log(auditResult.cursor); // eyJpZCI6IjAxOGYyZjY3YmI5ZDRhMGNhYWQ4Mzg2ZjU2ZGY4NWNlIn0=
111
- ```
@@ -227,97 +227,3 @@ Nothing.
227
227
  #### Implementation of
228
228
 
229
229
  `IAuthenticationAdminComponent.updatePassword`
230
-
231
- ***
232
-
233
- ### getEndpointWithPrefix() {#getendpointwithprefix}
234
-
235
- > **getEndpointWithPrefix**(): `string`
236
-
237
- Get the endpoint with the prefix for the namespace.
238
-
239
- #### Returns
240
-
241
- `string`
242
-
243
- The endpoint with namespace prefix attached.
244
-
245
- #### Inherited from
246
-
247
- `BaseRestClient.getEndpointWithPrefix`
248
-
249
- ***
250
-
251
- ### getPathPrefix() {#getpathprefix}
252
-
253
- > **getPathPrefix**(): `string`
254
-
255
- Get the path prefix as a URL path string provided in the constructor.
256
-
257
- #### Returns
258
-
259
- `string`
260
-
261
- The path prefix.
262
-
263
- #### Inherited from
264
-
265
- `BaseRestClient.getPathPrefix`
266
-
267
- ***
268
-
269
- ### fetch() {#fetch}
270
-
271
- > **fetch**\<`T`, `U`\>(`route`, `method`, `request?`, `options?`): `Promise`\<`U`\>
272
-
273
- Perform a request in json format.
274
-
275
- #### Type Parameters
276
-
277
- ##### T
278
-
279
- `T` *extends* `IHttpRequest`\<`any`\>
280
-
281
- ##### U
282
-
283
- `U` *extends* `IHttpResponse`\<`any`\>
284
-
285
- #### Parameters
286
-
287
- ##### route
288
-
289
- `string`
290
-
291
- The route of the request.
292
-
293
- ##### method
294
-
295
- `HttpMethod`
296
-
297
- The http method.
298
-
299
- ##### request?
300
-
301
- `T`
302
-
303
- Request to send to the endpoint.
304
-
305
- ##### options?
306
-
307
- Optional override options for the request.
308
-
309
- ###### overridePrefix?
310
-
311
- `string`
312
-
313
- Optional override prefix to use for this request instead of the default prefix.
314
-
315
- #### Returns
316
-
317
- `Promise`\<`U`\>
318
-
319
- The response.
320
-
321
- #### Inherited from
322
-
323
- `BaseRestClient.fetch`
@@ -178,94 +178,18 @@ A promise that resolves when the password has been updated on the server.
178
178
 
179
179
  ***
180
180
 
181
- ### getEndpointWithPrefix() {#getendpointwithprefix}
181
+ ### passwordPolicy() {#passwordpolicy}
182
182
 
183
- > **getEndpointWithPrefix**(): `string`
183
+ > **passwordPolicy**(): `Promise`\<`IPasswordOptions`\>
184
184
 
185
- Get the endpoint with the prefix for the namespace.
185
+ Get the password policy used for password validation.
186
186
 
187
187
  #### Returns
188
188
 
189
- `string`
190
-
191
- The endpoint with namespace prefix attached.
192
-
193
- #### Inherited from
194
-
195
- `BaseRestClient.getEndpointWithPrefix`
196
-
197
- ***
198
-
199
- ### getPathPrefix() {#getpathprefix}
200
-
201
- > **getPathPrefix**(): `string`
202
-
203
- Get the path prefix as a URL path string provided in the constructor.
204
-
205
- #### Returns
206
-
207
- `string`
208
-
209
- The path prefix.
210
-
211
- #### Inherited from
212
-
213
- `BaseRestClient.getPathPrefix`
214
-
215
- ***
216
-
217
- ### fetch() {#fetch}
218
-
219
- > **fetch**\<`T`, `U`\>(`route`, `method`, `request?`, `options?`): `Promise`\<`U`\>
220
-
221
- Perform a request in json format.
222
-
223
- #### Type Parameters
224
-
225
- ##### T
226
-
227
- `T` *extends* `IHttpRequest`\<`any`\>
189
+ `Promise`\<`IPasswordOptions`\>
228
190
 
229
- ##### U
191
+ The password policy options.
230
192
 
231
- `U` *extends* `IHttpResponse`\<`any`\>
232
-
233
- #### Parameters
234
-
235
- ##### route
236
-
237
- `string`
238
-
239
- The route of the request.
240
-
241
- ##### method
242
-
243
- `HttpMethod`
244
-
245
- The http method.
246
-
247
- ##### request?
248
-
249
- `T`
250
-
251
- Request to send to the endpoint.
252
-
253
- ##### options?
254
-
255
- Optional override options for the request.
256
-
257
- ###### overridePrefix?
258
-
259
- `string`
260
-
261
- Optional override prefix to use for this request instead of the default prefix.
262
-
263
- #### Returns
264
-
265
- `Promise`\<`U`\>
266
-
267
- The response.
268
-
269
- #### Inherited from
193
+ #### Implementation of
270
194
 
271
- `BaseRestClient.fetch`
195
+ `IAuthenticationComponent.passwordPolicy`
@@ -3,7 +3,6 @@
3
3
  ## Classes
4
4
 
5
5
  - [EntityStorageAuthenticationAdminRestClient](classes/EntityStorageAuthenticationAdminRestClient.md)
6
- - [EntityStorageAuthenticationAuditRestClient](classes/EntityStorageAuthenticationAuditRestClient.md)
7
6
  - [EntityStorageAuthenticationRestClient](classes/EntityStorageAuthenticationRestClient.md)
8
7
 
9
8
  ## Interfaces
@@ -19,135 +19,3 @@ The name of the cookie to use for storing the auth token.
19
19
  ```ts
20
20
  access_token
21
21
  ```
22
-
23
- ***
24
-
25
- ### endpoint {#endpoint}
26
-
27
- > **endpoint**: `string`
28
-
29
- The endpoint where the api is hosted.
30
-
31
- #### Inherited from
32
-
33
- `IBaseRestClientConfig.endpoint`
34
-
35
- ***
36
-
37
- ### pathPrefix? {#pathprefix}
38
-
39
- > `optional` **pathPrefix?**: `string`
40
-
41
- The prefix to the routes.
42
-
43
- #### Inherited from
44
-
45
- `IBaseRestClientConfig.pathPrefix`
46
-
47
- ***
48
-
49
- ### headers? {#headers}
50
-
51
- > `optional` **headers?**: `IHttpHeaders`
52
-
53
- The headers to include in requests.
54
-
55
- #### Inherited from
56
-
57
- `IBaseRestClientConfig.headers`
58
-
59
- ***
60
-
61
- ### timeout? {#timeout}
62
-
63
- > `optional` **timeout?**: `number`
64
-
65
- Timeout for requests in ms.
66
-
67
- #### Inherited from
68
-
69
- `IBaseRestClientConfig.timeout`
70
-
71
- ***
72
-
73
- ### includeCredentials? {#includecredentials}
74
-
75
- > `optional` **includeCredentials?**: `boolean`
76
-
77
- Include credentials in the request, defaults to true.
78
-
79
- #### Inherited from
80
-
81
- `IBaseRestClientConfig.includeCredentials`
82
-
83
- ***
84
-
85
- ### processorTypes? {#processortypes}
86
-
87
- > `optional` **processorTypes?**: `string`[]
88
-
89
- The types of the processors to run around each request, resolved from the `RestClientProcessorFactory`.
90
-
91
- #### Inherited from
92
-
93
- `IBaseRestClientConfig.processorTypes`
94
-
95
- ***
96
-
97
- ### customHeaders? {#customheaders}
98
-
99
- > `optional` **customHeaders?**: () => `Promise`\<`IHttpHeaders`\>
100
-
101
- Hook to provide headers asynchronously.
102
-
103
- #### Returns
104
-
105
- `Promise`\<`IHttpHeaders`\>
106
-
107
- A promise that resolves to the headers.
108
-
109
- #### Inherited from
110
-
111
- `IBaseRestClientConfig.customHeaders`
112
-
113
- ***
114
-
115
- ### customAuthHeader? {#customauthheader}
116
-
117
- > `optional` **customAuthHeader?**: () => `Promise`\<`string`\>
118
-
119
- Hook to provide an authorization header value asynchronously.
120
-
121
- #### Returns
122
-
123
- `Promise`\<`string`\>
124
-
125
- A promise that resolves to the authorization header value.
126
-
127
- #### Inherited from
128
-
129
- `IBaseRestClientConfig.customAuthHeader`
130
-
131
- ***
132
-
133
- ### onAuthFailure? {#onauthfailure}
134
-
135
- > `optional` **onAuthFailure?**: (`err`) => `Promise`\<`void`\>
136
-
137
- Hook to handle authorization failures asynchronously.
138
-
139
- #### Parameters
140
-
141
- ##### err
142
-
143
- `IError`
144
-
145
- #### Returns
146
-
147
- `Promise`\<`void`\>
148
-
149
- A promise that resolves when the auth failure handling is complete.
150
-
151
- #### Inherited from
152
-
153
- `IBaseRestClientConfig.onAuthFailure`
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@3sixty/api-auth-entity-storage-rest-client",
3
- "version": "0.20.0-next.0",
3
+ "version": "0.20.0-next.1",
4
4
  "description": "REST clients for authentication and admin operations against entity storage endpoints.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/3sixtyglobal/api.git",
7
+ "url": "git+https://github.com/3sixtyglobal/api-auth.git",
8
8
  "directory": "packages/api-auth-entity-storage-rest-client"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -14,9 +14,9 @@
14
14
  "node": ">=24.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@3sixty/api-auth-entity-storage-models": "0.20.0-next.0",
18
- "@3sixty/api-core": "0.20.0-next.0",
19
- "@3sixty/api-models": "0.20.0-next.0",
17
+ "@3sixty/api-auth-entity-storage-models": "0.20.0-next.1",
18
+ "@3sixty/api-core": "next",
19
+ "@3sixty/api-models": "next",
20
20
  "@3sixty/core": "next",
21
21
  "@3sixty/nameof": "next",
22
22
  "@3sixty/web": "next"
@@ -49,7 +49,7 @@
49
49
  "database"
50
50
  ],
51
51
  "bugs": {
52
- "url": "git+https://github.com/3sixtyglobal/api/issues"
52
+ "url": "git+https://github.com/3sixtyglobal/api-auth/issues"
53
53
  },
54
54
  "homepage": "https://3sixty.global"
55
55
  }
@@ -1,111 +0,0 @@
1
- import { BaseRestClient } from "@3sixty/api-core";
2
- import { HttpHeaderHelper } from "@3sixty/api-models";
3
- import { Coerce, Guards } from "@3sixty/core";
4
- import { HttpMethod } from "@3sixty/web";
5
- /**
6
- * The client to connect to the authentication audit service.
7
- */
8
- export class EntityStorageAuthenticationAuditRestClient extends BaseRestClient {
9
- /**
10
- * Runtime name for the class.
11
- */
12
- static CLASS_NAME = "EntityStorageAuthenticationAuditRestClient";
13
- /**
14
- * Create a new instance of EntityStorageAuthenticationAuditRestClient.
15
- * @param config The configuration for the client.
16
- */
17
- constructor(config) {
18
- super("EntityStorageAuthenticationAuditRestClient", config, "authentication/audit");
19
- }
20
- /**
21
- * Returns the class name of the component.
22
- * @returns The class name of the component.
23
- */
24
- className() {
25
- return EntityStorageAuthenticationAuditRestClient.CLASS_NAME;
26
- }
27
- /**
28
- * Create a new audit entry.
29
- * @param entry The audit entry to be logged.
30
- * @returns The unique identifier of the created audit entry.
31
- */
32
- async create(entry) {
33
- Guards.object(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "entry", entry);
34
- Guards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "entry.event", entry.event);
35
- const response = await this.fetch("/", "POST", {
36
- body: entry
37
- });
38
- return HttpHeaderHelper.extractId(response.headers, `${this.getPathPrefix()}/:id`);
39
- }
40
- /**
41
- * Get an audit entry by id.
42
- * @param id The unique identifier of the audit entry.
43
- * @returns The audit entry.
44
- */
45
- async get(id) {
46
- Guards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "id", id);
47
- const response = await this.fetch("/:id", HttpMethod.GET, {
48
- pathParams: { id }
49
- });
50
- return response.body;
51
- }
52
- /**
53
- * Update an audit entry.
54
- * @param id The unique identifier of the audit entry to update.
55
- * @param entry The fields to update on the audit entry.
56
- * @returns A promise that resolves when the audit entry has been updated.
57
- */
58
- async update(id, entry) {
59
- Guards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "id", id);
60
- Guards.object(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "entry", entry);
61
- await this.fetch("/:id", HttpMethod.PUT, {
62
- pathParams: { id },
63
- body: entry
64
- });
65
- }
66
- /**
67
- * Remove an audit entry.
68
- * @param id The unique identifier of the audit entry to remove.
69
- * @returns A promise that resolves when the audit entry has been removed.
70
- */
71
- async remove(id) {
72
- Guards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, "id", id);
73
- await this.fetch("/:id", HttpMethod.DELETE, {
74
- pathParams: { id }
75
- });
76
- }
77
- /**
78
- * Query the audit entries.
79
- * @param options The query options.
80
- * @param options.actorId The actor identifier to filter the audit entries, optional.
81
- * @param options.organizationId The organization identifier to filter the audit entries, optional.
82
- * @param options.tenantId The tenant identifier to filter the audit entries, optional.
83
- * @param options.nodeId The node identifier to filter the audit entries, optional.
84
- * @param options.event The audit event to filter the audit entries, optional.
85
- * @param options.startDate The start date to filter the audit entries, optional.
86
- * @param options.endDate The end date to filter the audit entries, optional.
87
- * @param cursor The cursor for pagination.
88
- * @param limit The maximum number of entries to return.
89
- * @returns The audit entries.
90
- */
91
- async query(options, cursor, limit) {
92
- const response = await this.fetch("/", "GET", {
93
- query: {
94
- actorId: options?.actorId,
95
- organizationId: options?.organizationId,
96
- tenantId: options?.tenantId,
97
- nodeId: options?.nodeId,
98
- event: options?.event,
99
- startDate: options?.startDate,
100
- endDate: options?.endDate,
101
- cursor,
102
- limit: Coerce.string(limit)
103
- }
104
- });
105
- return {
106
- entries: response.body.entries,
107
- cursor: response.body.cursor
108
- };
109
- }
110
- }
111
- //# sourceMappingURL=entityStorageAuthenticationAuditRestClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entityStorageAuthenticationAuditRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationAuditRestClient.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,0CACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,gDAAgE;IAEjG;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,+CAAuD,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0CAA0C,CAAC,UAAU,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAClB,KAA4D;QAE5D,MAAM,CAAC,MAAM,CAAC,0CAA0C,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,iBAErD,KAAK,CAAC,KAAK,CACX,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAwC,GAAG,EAAE,MAAM,EAAE;YACrF,IAAI,EAAE,KAAK;SACX,CAAC,CAAC;QAEH,OAAO,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AK,EAAE;YACtF,KAAK,EAAE;gBACN,OAAO,EAAE,OAAO,EAAE,OAAO;gBACzB,cAAc,EAAE,OAAO,EAAE,cAAc;gBACvC,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,KAAK,EAAE,OAAO,EAAE,KAAK;gBACrB,SAAS,EAAE,OAAO,EAAE,SAAS;gBAC7B,OAAO,EAAE,OAAO,EAAE,OAAO;gBACzB,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO;YACN,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO;YAC9B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tAuthAuditEvent,\n\tIAuditCreateRequest,\n\tIAuditGetRequest,\n\tIAuditGetResponse,\n\tIAuditQueryRequest,\n\tIAuditQueryResponse,\n\tIAuditRemoveRequest,\n\tIAuditUpdateRequest,\n\tIAuthenticationAuditComponent,\n\tIAuthenticationAuditEntry\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport { HttpHeaderHelper } from \"@3sixty/api-models\";\nimport type {\n\tIBaseRestClientConfig,\n\tICreatedResponse,\n\tINoContentResponse\n} from \"@3sixty/api-models\";\nimport { Coerce, Guards } from \"@3sixty/core\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { HttpMethod } from \"@3sixty/web\";\n\n/**\n * The client to connect to the authentication audit service.\n */\nexport class EntityStorageAuthenticationAuditRestClient\n\textends BaseRestClient\n\timplements IAuthenticationAuditComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationAuditRestClient>();\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationAuditRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageAuthenticationAuditRestClient>(), config, \"authentication/audit\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationAuditRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new audit entry.\n\t * @param entry The audit entry to be logged.\n\t * @returns The unique identifier of the created audit entry.\n\t */\n\tpublic async create(\n\t\tentry: Omit<IAuthenticationAuditEntry, \"id\" | \"dateCreated\">\n\t): Promise<string> {\n\t\tGuards.object(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, nameof(entry), entry);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAuditRestClient.CLASS_NAME,\n\t\t\tnameof(entry.event),\n\t\t\tentry.event\n\t\t);\n\n\t\tconst response = await this.fetch<IAuditCreateRequest, ICreatedResponse>(\"/\", \"POST\", {\n\t\t\tbody: entry\n\t\t});\n\n\t\treturn HttpHeaderHelper.extractId(response.headers, `${this.getPathPrefix()}/:id`);\n\t}\n\n\t/**\n\t * Get an audit entry by id.\n\t * @param id The unique identifier of the audit entry.\n\t * @returns The audit entry.\n\t */\n\tpublic async get(id: string): Promise<IAuthenticationAuditEntry> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IAuditGetRequest, IAuditGetResponse>(\"/:id\", HttpMethod.GET, {\n\t\t\tpathParams: { id }\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update an audit entry.\n\t * @param id The unique identifier of the audit entry to update.\n\t * @param entry The fields to update on the audit entry.\n\t * @returns A promise that resolves when the audit entry has been updated.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tentry: Partial<Omit<IAuthenticationAuditEntry, \"id\" | \"dateCreated\">>\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, nameof(entry), entry);\n\n\t\tawait this.fetch<IAuditUpdateRequest, INoContentResponse>(\"/:id\", HttpMethod.PUT, {\n\t\t\tpathParams: { id },\n\t\t\tbody: entry\n\t\t});\n\t}\n\n\t/**\n\t * Remove an audit entry.\n\t * @param id The unique identifier of the audit entry to remove.\n\t * @returns A promise that resolves when the audit entry has been removed.\n\t */\n\tpublic async remove(id: string): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAuditRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IAuditRemoveRequest, INoContentResponse>(\"/:id\", HttpMethod.DELETE, {\n\t\t\tpathParams: { id }\n\t\t});\n\t}\n\n\t/**\n\t * Query the audit entries.\n\t * @param options The query options.\n\t * @param options.actorId The actor identifier to filter the audit entries, optional.\n\t * @param options.organizationId The organization identifier to filter the audit entries, optional.\n\t * @param options.tenantId The tenant identifier to filter the audit entries, optional.\n\t * @param options.nodeId The node identifier to filter the audit entries, optional.\n\t * @param options.event The audit event to filter the audit entries, optional.\n\t * @param options.startDate The start date to filter the audit entries, optional.\n\t * @param options.endDate The end date to filter the audit entries, optional.\n\t * @param cursor The cursor for pagination.\n\t * @param limit The maximum number of entries to return.\n\t * @returns The audit entries.\n\t */\n\tpublic async query(\n\t\toptions?: {\n\t\t\tactorId?: string;\n\t\t\torganizationId?: string;\n\t\t\ttenantId?: string;\n\t\t\tnodeId?: string;\n\t\t\tevent?: AuthAuditEvent | string;\n\t\t\tstartDate?: string;\n\t\t\tendDate?: string;\n\t\t},\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentries: IAuthenticationAuditEntry[];\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<IAuditQueryRequest, IAuditQueryResponse>(\"/\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\tactorId: options?.actorId,\n\t\t\t\torganizationId: options?.organizationId,\n\t\t\t\ttenantId: options?.tenantId,\n\t\t\t\tnodeId: options?.nodeId,\n\t\t\t\tevent: options?.event,\n\t\t\t\tstartDate: options?.startDate,\n\t\t\t\tendDate: options?.endDate,\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tentries: response.body.entries,\n\t\t\tcursor: response.body.cursor\n\t\t};\n\t}\n}\n"]}
@@ -1,73 +0,0 @@
1
- import type { AuthAuditEvent, IAuthenticationAuditComponent, IAuthenticationAuditEntry } from "@3sixty/api-auth-entity-storage-models";
2
- import { BaseRestClient } from "@3sixty/api-core";
3
- import type { IBaseRestClientConfig } from "@3sixty/api-models";
4
- /**
5
- * The client to connect to the authentication audit service.
6
- */
7
- export declare class EntityStorageAuthenticationAuditRestClient extends BaseRestClient implements IAuthenticationAuditComponent {
8
- /**
9
- * Runtime name for the class.
10
- */
11
- static readonly CLASS_NAME: string;
12
- /**
13
- * Create a new instance of EntityStorageAuthenticationAuditRestClient.
14
- * @param config The configuration for the client.
15
- */
16
- constructor(config: IBaseRestClientConfig);
17
- /**
18
- * Returns the class name of the component.
19
- * @returns The class name of the component.
20
- */
21
- className(): string;
22
- /**
23
- * Create a new audit entry.
24
- * @param entry The audit entry to be logged.
25
- * @returns The unique identifier of the created audit entry.
26
- */
27
- create(entry: Omit<IAuthenticationAuditEntry, "id" | "dateCreated">): Promise<string>;
28
- /**
29
- * Get an audit entry by id.
30
- * @param id The unique identifier of the audit entry.
31
- * @returns The audit entry.
32
- */
33
- get(id: string): Promise<IAuthenticationAuditEntry>;
34
- /**
35
- * Update an audit entry.
36
- * @param id The unique identifier of the audit entry to update.
37
- * @param entry The fields to update on the audit entry.
38
- * @returns A promise that resolves when the audit entry has been updated.
39
- */
40
- update(id: string, entry: Partial<Omit<IAuthenticationAuditEntry, "id" | "dateCreated">>): Promise<void>;
41
- /**
42
- * Remove an audit entry.
43
- * @param id The unique identifier of the audit entry to remove.
44
- * @returns A promise that resolves when the audit entry has been removed.
45
- */
46
- remove(id: string): Promise<void>;
47
- /**
48
- * Query the audit entries.
49
- * @param options The query options.
50
- * @param options.actorId The actor identifier to filter the audit entries, optional.
51
- * @param options.organizationId The organization identifier to filter the audit entries, optional.
52
- * @param options.tenantId The tenant identifier to filter the audit entries, optional.
53
- * @param options.nodeId The node identifier to filter the audit entries, optional.
54
- * @param options.event The audit event to filter the audit entries, optional.
55
- * @param options.startDate The start date to filter the audit entries, optional.
56
- * @param options.endDate The end date to filter the audit entries, optional.
57
- * @param cursor The cursor for pagination.
58
- * @param limit The maximum number of entries to return.
59
- * @returns The audit entries.
60
- */
61
- query(options?: {
62
- actorId?: string;
63
- organizationId?: string;
64
- tenantId?: string;
65
- nodeId?: string;
66
- event?: AuthAuditEvent | string;
67
- startDate?: string;
68
- endDate?: string;
69
- }, cursor?: string, limit?: number): Promise<{
70
- entries: IAuthenticationAuditEntry[];
71
- cursor?: string;
72
- }>;
73
- }
@@ -1,343 +0,0 @@
1
- # Class: EntityStorageAuthenticationAuditRestClient
2
-
3
- The client to connect to the authentication audit service.
4
-
5
- ## Extends
6
-
7
- - `BaseRestClient`
8
-
9
- ## Implements
10
-
11
- - `IAuthenticationAuditComponent`
12
-
13
- ## Constructors
14
-
15
- ### Constructor
16
-
17
- > **new EntityStorageAuthenticationAuditRestClient**(`config`): `EntityStorageAuthenticationAuditRestClient`
18
-
19
- Create a new instance of EntityStorageAuthenticationAuditRestClient.
20
-
21
- #### Parameters
22
-
23
- ##### config
24
-
25
- `IBaseRestClientConfig`
26
-
27
- The configuration for the client.
28
-
29
- #### Returns
30
-
31
- `EntityStorageAuthenticationAuditRestClient`
32
-
33
- #### Overrides
34
-
35
- `BaseRestClient.constructor`
36
-
37
- ## Properties
38
-
39
- ### CLASS\_NAME {#class_name}
40
-
41
- > `readonly` `static` **CLASS\_NAME**: `string`
42
-
43
- Runtime name for the class.
44
-
45
- ## Methods
46
-
47
- ### className() {#classname}
48
-
49
- > **className**(): `string`
50
-
51
- Returns the class name of the component.
52
-
53
- #### Returns
54
-
55
- `string`
56
-
57
- The class name of the component.
58
-
59
- #### Implementation of
60
-
61
- `IAuthenticationAuditComponent.className`
62
-
63
- ***
64
-
65
- ### create() {#create}
66
-
67
- > **create**(`entry`): `Promise`\<`string`\>
68
-
69
- Create a new audit entry.
70
-
71
- #### Parameters
72
-
73
- ##### entry
74
-
75
- `Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>
76
-
77
- The audit entry to be logged.
78
-
79
- #### Returns
80
-
81
- `Promise`\<`string`\>
82
-
83
- The unique identifier of the created audit entry.
84
-
85
- #### Implementation of
86
-
87
- `IAuthenticationAuditComponent.create`
88
-
89
- ***
90
-
91
- ### get() {#get}
92
-
93
- > **get**(`id`): `Promise`\<`IAuthenticationAuditEntry`\>
94
-
95
- Get an audit entry by id.
96
-
97
- #### Parameters
98
-
99
- ##### id
100
-
101
- `string`
102
-
103
- The unique identifier of the audit entry.
104
-
105
- #### Returns
106
-
107
- `Promise`\<`IAuthenticationAuditEntry`\>
108
-
109
- The audit entry.
110
-
111
- #### Implementation of
112
-
113
- `IAuthenticationAuditComponent.get`
114
-
115
- ***
116
-
117
- ### update() {#update}
118
-
119
- > **update**(`id`, `entry`): `Promise`\<`void`\>
120
-
121
- Update an audit entry.
122
-
123
- #### Parameters
124
-
125
- ##### id
126
-
127
- `string`
128
-
129
- The unique identifier of the audit entry to update.
130
-
131
- ##### entry
132
-
133
- `Partial`\<`Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>\>
134
-
135
- The fields to update on the audit entry.
136
-
137
- #### Returns
138
-
139
- `Promise`\<`void`\>
140
-
141
- A promise that resolves when the audit entry has been updated.
142
-
143
- #### Implementation of
144
-
145
- `IAuthenticationAuditComponent.update`
146
-
147
- ***
148
-
149
- ### remove() {#remove}
150
-
151
- > **remove**(`id`): `Promise`\<`void`\>
152
-
153
- Remove an audit entry.
154
-
155
- #### Parameters
156
-
157
- ##### id
158
-
159
- `string`
160
-
161
- The unique identifier of the audit entry to remove.
162
-
163
- #### Returns
164
-
165
- `Promise`\<`void`\>
166
-
167
- A promise that resolves when the audit entry has been removed.
168
-
169
- #### Implementation of
170
-
171
- `IAuthenticationAuditComponent.remove`
172
-
173
- ***
174
-
175
- ### query() {#query}
176
-
177
- > **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
178
-
179
- Query the audit entries.
180
-
181
- #### Parameters
182
-
183
- ##### options?
184
-
185
- The query options.
186
-
187
- ###### actorId?
188
-
189
- `string`
190
-
191
- The actor identifier to filter the audit entries, optional.
192
-
193
- ###### organizationId?
194
-
195
- `string`
196
-
197
- The organization identifier to filter the audit entries, optional.
198
-
199
- ###### tenantId?
200
-
201
- `string`
202
-
203
- The tenant identifier to filter the audit entries, optional.
204
-
205
- ###### nodeId?
206
-
207
- `string`
208
-
209
- The node identifier to filter the audit entries, optional.
210
-
211
- ###### event?
212
-
213
- `string`
214
-
215
- The audit event to filter the audit entries, optional.
216
-
217
- ###### startDate?
218
-
219
- `string`
220
-
221
- The start date to filter the audit entries, optional.
222
-
223
- ###### endDate?
224
-
225
- `string`
226
-
227
- The end date to filter the audit entries, optional.
228
-
229
- ##### cursor?
230
-
231
- `string`
232
-
233
- The cursor for pagination.
234
-
235
- ##### limit?
236
-
237
- `number`
238
-
239
- The maximum number of entries to return.
240
-
241
- #### Returns
242
-
243
- `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
244
-
245
- The audit entries.
246
-
247
- #### Implementation of
248
-
249
- `IAuthenticationAuditComponent.query`
250
-
251
- ***
252
-
253
- ### getEndpointWithPrefix() {#getendpointwithprefix}
254
-
255
- > **getEndpointWithPrefix**(): `string`
256
-
257
- Get the endpoint with the prefix for the namespace.
258
-
259
- #### Returns
260
-
261
- `string`
262
-
263
- The endpoint with namespace prefix attached.
264
-
265
- #### Inherited from
266
-
267
- `BaseRestClient.getEndpointWithPrefix`
268
-
269
- ***
270
-
271
- ### getPathPrefix() {#getpathprefix}
272
-
273
- > **getPathPrefix**(): `string`
274
-
275
- Get the path prefix as a URL path string provided in the constructor.
276
-
277
- #### Returns
278
-
279
- `string`
280
-
281
- The path prefix.
282
-
283
- #### Inherited from
284
-
285
- `BaseRestClient.getPathPrefix`
286
-
287
- ***
288
-
289
- ### fetch() {#fetch}
290
-
291
- > **fetch**\<`T`, `U`\>(`route`, `method`, `request?`, `options?`): `Promise`\<`U`\>
292
-
293
- Perform a request in json format.
294
-
295
- #### Type Parameters
296
-
297
- ##### T
298
-
299
- `T` *extends* `IHttpRequest`\<`any`\>
300
-
301
- ##### U
302
-
303
- `U` *extends* `IHttpResponse`\<`any`\>
304
-
305
- #### Parameters
306
-
307
- ##### route
308
-
309
- `string`
310
-
311
- The route of the request.
312
-
313
- ##### method
314
-
315
- `HttpMethod`
316
-
317
- The http method.
318
-
319
- ##### request?
320
-
321
- `T`
322
-
323
- Request to send to the endpoint.
324
-
325
- ##### options?
326
-
327
- Optional override options for the request.
328
-
329
- ###### overridePrefix?
330
-
331
- `string`
332
-
333
- Optional override prefix to use for this request instead of the default prefix.
334
-
335
- #### Returns
336
-
337
- `Promise`\<`U`\>
338
-
339
- The response.
340
-
341
- #### Inherited from
342
-
343
- `BaseRestClient.fetch`