@twin.org/api-auth-entity-storage-rest-client 0.0.3-next.1 → 0.0.3-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { BaseRestClient } from "@twin.org/api-core";
2
2
  import { Guards } from "@twin.org/core";
3
+ import { CookieHelper, HeaderTypes } from "@twin.org/web";
3
4
  /**
4
5
  * The client to connect to the authentication service.
5
6
  */
@@ -8,12 +9,24 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
8
9
  * Runtime name for the class.
9
10
  */
10
11
  static CLASS_NAME = "EntityStorageAuthenticationRestClient";
12
+ /**
13
+ * The default name for the access token as a cookie.
14
+ * @internal
15
+ */
16
+ static DEFAULT_COOKIE_NAME = "access_token";
17
+ /**
18
+ * The name of the cookie to use for storing the auth token.
19
+ * @internal
20
+ */
21
+ _cookieName;
11
22
  /**
12
23
  * Create a new instance of EntityStorageAuthenticationRestClient.
13
24
  * @param config The configuration for the client.
14
25
  */
15
26
  constructor(config) {
16
27
  super("EntityStorageAuthenticationRestClient", config, "authentication");
28
+ this._cookieName =
29
+ config.cookieName ?? EntityStorageAuthenticationRestClient.DEFAULT_COOKIE_NAME;
17
30
  }
18
31
  /**
19
32
  * Returns the class name of the component.
@@ -37,7 +50,10 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
37
50
  password
38
51
  }
39
52
  });
40
- return response.body;
53
+ return {
54
+ token: CookieHelper.getCookieFromHeaders(response?.headers?.[HeaderTypes.SetCookie], this._cookieName),
55
+ expiry: response.body.expiry
56
+ };
41
57
  }
42
58
  /**
43
59
  * Logout the current user.
@@ -62,7 +78,10 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
62
78
  token
63
79
  }
64
80
  });
65
- return response.body;
81
+ return {
82
+ token: CookieHelper.getCookieFromHeaders(response?.headers?.[HeaderTypes.SetCookie], this._cookieName),
83
+ expiry: response.body.expiry
84
+ };
66
85
  }
67
86
  /**
68
87
  * Update the user's password.
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageAuthenticationRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC;;GAEG;AACH,MAAM,OAAO,qCACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,2CAA2D;IAE5F;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,0CAAkD,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAClF,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,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,cAEhD,QAAQ,CACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAgC,QAAQ,EAAE,MAAM,EAAE;YAClF,IAAI,EAAE;gBACL,KAAK;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,KAAc;QACjC,MAAM,IAAI,CAAC,KAAK,CAAqC,SAAS,EAAE,KAAK,EAAE;YACtE,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,KAAc;QAIlC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,KAAK,EACL;YACC,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,eAAuB,EACvB,WAAmB;QAEnB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,qBAEhD,eAAe,CACf,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,iBAEhD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,kBAAkB,EAAE,KAAK,EAAE;YACvF,UAAU,EAAE;gBACX,KAAK;aACL;YACD,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 \"@twin.org/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\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 * Create a new instance of EntityStorageAuthenticationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageAuthenticationRestClient>(), config, \"authentication\");\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 response.body;\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 Nothing.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"GET\", {\n\t\t\tquery: {\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\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\ttoken\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 * Update the user's password.\n\t * @param email The email address of the user to update.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tcurrentPassword: string,\n\t\tnewPassword: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\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>(\"/:email/password\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\temail\n\t\t\t},\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","sourceRoot":"","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG1D;;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,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,cAEhD,QAAQ,CACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAgC,QAAQ,EAAE,MAAM,EAAE;YAClF,IAAI,EAAE;gBACL,KAAK;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO;YACN,KAAK,EAAE,YAAY,CAAC,oBAAoB,CACvC,QAAQ,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1C,IAAI,CAAC,WAAW,CAChB;YACD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,KAAc;QACjC,MAAM,IAAI,CAAC,KAAK,CAAqC,SAAS,EAAE,KAAK,EAAE;YACtE,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,KAAc;QAIlC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,KAAK,EACL;YACC,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CACD,CAAC;QAEF,OAAO;YACN,KAAK,EAAE,YAAY,CAAC,oBAAoB,CACvC,QAAQ,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1C,IAAI,CAAC,WAAW,CAChB;YACD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,eAAuB,EACvB,WAAmB;QAEnB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,qBAEhD,eAAe,CACf,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,iBAEhD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,kBAAkB,EAAE,KAAK,EAAE;YACvF,UAAU,EAAE;gBACX,KAAK;aACL;YACD,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 \"@twin.org/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { INoContentResponse } from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { CookieHelper, HeaderTypes } from \"@twin.org/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 Nothing.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"GET\", {\n\t\t\tquery: {\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\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\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 email The email address of the user to update.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tcurrentPassword: string,\n\t\tnewPassword: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\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>(\"/:email/password\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\temail\n\t\t\t},\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"]}
package/dist/es/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  export * from "./entityStorageAuthenticationRestClient.js";
4
+ export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
4
5
  //# 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,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationRestClient.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qEAAqE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationRestClient.js\";\nexport * from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entityStorageAuthenticationRestClientConstructorOptions.js.map
@@ -0,0 +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 \"@twin.org/api-models\";\n\n/**\n * Options for the Entity Storage Authentication REST client constructor.\n */\nexport interface IEntityStorageAuthenticationRestClientConstructorOptions\n\textends 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,6 +1,6 @@
1
1
  import type { IAuthenticationComponent } from "@twin.org/api-auth-entity-storage-models";
2
2
  import { BaseRestClient } from "@twin.org/api-core";
3
- import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
+ import type { IEntityStorageAuthenticationRestClientConstructorOptions } from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
4
4
  /**
5
5
  * The client to connect to the authentication service.
6
6
  */
@@ -13,7 +13,7 @@ export declare class EntityStorageAuthenticationRestClient extends BaseRestClien
13
13
  * Create a new instance of EntityStorageAuthenticationRestClient.
14
14
  * @param config The configuration for the client.
15
15
  */
16
- constructor(config: IBaseRestClientConfig);
16
+ constructor(config: IEntityStorageAuthenticationRestClientConstructorOptions);
17
17
  /**
18
18
  * Returns the class name of the component.
19
19
  * @returns The class name of the component.
@@ -1 +1,2 @@
1
1
  export * from "./entityStorageAuthenticationRestClient.js";
2
+ export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
@@ -0,0 +1,11 @@
1
+ import type { IBaseRestClientConfig } from "@twin.org/api-models";
2
+ /**
3
+ * Options for the Entity Storage Authentication REST client constructor.
4
+ */
5
+ export interface IEntityStorageAuthenticationRestClientConstructorOptions extends IBaseRestClientConfig {
6
+ /**
7
+ * The name of the cookie to use for storing the auth token.
8
+ * @default access_token
9
+ */
10
+ cookieName?: string;
11
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,190 @@
1
1
  # @twin.org/api-auth-entity-storage-rest-client - Changelog
2
2
 
3
+ ## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.10...api-auth-entity-storage-rest-client-v0.0.3-next.11) (2026-01-08)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.10 to 0.0.3-next.11
16
+ * @twin.org/api-core bumped from 0.0.3-next.10 to 0.0.3-next.11
17
+ * @twin.org/api-models bumped from 0.0.3-next.10 to 0.0.3-next.11
18
+
19
+ ## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.9...api-auth-entity-storage-rest-client-v0.0.3-next.10) (2026-01-05)
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
32
+ * @twin.org/api-core bumped from 0.0.3-next.9 to 0.0.3-next.10
33
+ * @twin.org/api-models bumped from 0.0.3-next.9 to 0.0.3-next.10
34
+
35
+ ## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.8...api-auth-entity-storage-rest-client-v0.0.3-next.9) (2026-01-05)
36
+
37
+
38
+ ### Features
39
+
40
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
41
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
42
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
43
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
44
+ * modify authHeaderProcessor to retain token in response body ([#53](https://github.com/twinfoundation/api/issues/53)) ([5d9ae76](https://github.com/twinfoundation/api/commit/5d9ae76b5b52a8e10dac391b2d5784638a186583))
45
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
46
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
47
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
48
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * use correct format for log messaging ([44bc2a4](https://github.com/twinfoundation/api/commit/44bc2a4f7cf1f9c38a7e8c6f90ccb2424c958de9))
54
+
55
+
56
+ ### Dependencies
57
+
58
+ * The following workspace dependencies were updated
59
+ * dependencies
60
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
61
+ * @twin.org/api-core bumped from 0.0.3-next.8 to 0.0.3-next.9
62
+ * @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
63
+
64
+ ## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.7...api-auth-entity-storage-rest-client-v0.0.3-next.8) (2025-12-17)
65
+
66
+
67
+ ### Miscellaneous Chores
68
+
69
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
70
+
71
+
72
+ ### Dependencies
73
+
74
+ * The following workspace dependencies were updated
75
+ * dependencies
76
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
77
+ * @twin.org/api-core bumped from 0.0.3-next.7 to 0.0.3-next.8
78
+ * @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
79
+
80
+ ## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.6...api-auth-entity-storage-rest-client-v0.0.3-next.7) (2025-11-26)
81
+
82
+
83
+ ### Miscellaneous Chores
84
+
85
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
86
+
87
+
88
+ ### Dependencies
89
+
90
+ * The following workspace dependencies were updated
91
+ * dependencies
92
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
93
+ * @twin.org/api-core bumped from 0.0.3-next.6 to 0.0.3-next.7
94
+ * @twin.org/api-models bumped from 0.0.3-next.6 to 0.0.3-next.7
95
+
96
+ ## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.5...api-auth-entity-storage-rest-client-v0.0.3-next.6) (2025-11-20)
97
+
98
+
99
+ ### Miscellaneous Chores
100
+
101
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
102
+
103
+
104
+ ### Dependencies
105
+
106
+ * The following workspace dependencies were updated
107
+ * dependencies
108
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
109
+ * @twin.org/api-core bumped from 0.0.3-next.5 to 0.0.3-next.6
110
+ * @twin.org/api-models bumped from 0.0.3-next.5 to 0.0.3-next.6
111
+
112
+ ## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.4...api-auth-entity-storage-rest-client-v0.0.3-next.5) (2025-11-14)
113
+
114
+
115
+ ### Miscellaneous Chores
116
+
117
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
118
+
119
+
120
+ ### Dependencies
121
+
122
+ * The following workspace dependencies were updated
123
+ * dependencies
124
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
125
+ * @twin.org/api-core bumped from 0.0.3-next.4 to 0.0.3-next.5
126
+ * @twin.org/api-models bumped from 0.0.3-next.4 to 0.0.3-next.5
127
+
128
+ ## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.3...api-auth-entity-storage-rest-client-v0.0.3-next.4) (2025-11-14)
129
+
130
+
131
+ ### Features
132
+
133
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
134
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
135
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
136
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
137
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
138
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
139
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
140
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * use correct format for log messaging ([44bc2a4](https://github.com/twinfoundation/api/commit/44bc2a4f7cf1f9c38a7e8c6f90ccb2424c958de9))
146
+
147
+
148
+ ### Dependencies
149
+
150
+ * The following workspace dependencies were updated
151
+ * dependencies
152
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
153
+ * @twin.org/api-core bumped from 0.0.3-next.3 to 0.0.3-next.4
154
+ * @twin.org/api-models bumped from 0.0.3-next.3 to 0.0.3-next.4
155
+
156
+ ## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.2...api-auth-entity-storage-rest-client-v0.0.3-next.3) (2025-11-14)
157
+
158
+
159
+ ### Miscellaneous Chores
160
+
161
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
162
+
163
+
164
+ ### Dependencies
165
+
166
+ * The following workspace dependencies were updated
167
+ * dependencies
168
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
169
+ * @twin.org/api-core bumped from 0.0.3-next.2 to 0.0.3-next.3
170
+ * @twin.org/api-models bumped from 0.0.3-next.2 to 0.0.3-next.3
171
+
172
+ ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.1...api-auth-entity-storage-rest-client-v0.0.3-next.2) (2025-11-12)
173
+
174
+
175
+ ### Miscellaneous Chores
176
+
177
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
178
+
179
+
180
+ ### Dependencies
181
+
182
+ * The following workspace dependencies were updated
183
+ * dependencies
184
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.1 to 0.0.3-next.2
185
+ * @twin.org/api-core bumped from 0.0.3-next.1 to 0.0.3-next.2
186
+ * @twin.org/api-models bumped from 0.0.3-next.1 to 0.0.3-next.2
187
+
3
188
  ## [0.0.3-next.1](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.0...api-auth-entity-storage-rest-client-v0.0.3-next.1) (2025-11-10)
4
189
 
5
190
 
@@ -22,7 +22,7 @@ Create a new instance of EntityStorageAuthenticationRestClient.
22
22
 
23
23
  ##### config
24
24
 
25
- `IBaseRestClientConfig`
25
+ [`IEntityStorageAuthenticationRestClientConstructorOptions`](../interfaces/IEntityStorageAuthenticationRestClientConstructorOptions.md)
26
26
 
27
27
  The configuration for the client.
28
28
 
@@ -3,3 +3,7 @@
3
3
  ## Classes
4
4
 
5
5
  - [EntityStorageAuthenticationRestClient](classes/EntityStorageAuthenticationRestClient.md)
6
+
7
+ ## Interfaces
8
+
9
+ - [IEntityStorageAuthenticationRestClientConstructorOptions](interfaces/IEntityStorageAuthenticationRestClientConstructorOptions.md)
@@ -0,0 +1,21 @@
1
+ # Interface: IEntityStorageAuthenticationRestClientConstructorOptions
2
+
3
+ Options for the Entity Storage Authentication REST client constructor.
4
+
5
+ ## Extends
6
+
7
+ - `IBaseRestClientConfig`
8
+
9
+ ## Properties
10
+
11
+ ### cookieName?
12
+
13
+ > `optional` **cookieName**: `string`
14
+
15
+ The name of the cookie to use for storing the auth token.
16
+
17
+ #### Default
18
+
19
+ ```ts
20
+ access_token
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-auth-entity-storage-rest-client",
3
- "version": "0.0.3-next.1",
3
+ "version": "0.0.3-next.11",
4
4
  "description": "Perform REST authentication using entity storage.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,9 +14,9 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-auth-entity-storage-models": "0.0.3-next.1",
18
- "@twin.org/api-core": "0.0.3-next.1",
19
- "@twin.org/api-models": "0.0.3-next.1",
17
+ "@twin.org/api-auth-entity-storage-models": "0.0.3-next.11",
18
+ "@twin.org/api-core": "0.0.3-next.11",
19
+ "@twin.org/api-models": "0.0.3-next.11",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"