@twin.org/api-auth-entity-storage-rest-client 0.0.3-next.7 → 0.0.3-next.9

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,50 @@
1
1
  # @twin.org/api-auth-entity-storage-rest-client - Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
9
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
10
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
11
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
12
+ * modify authHeaderProcessor to retain token in response body ([#53](https://github.com/twinfoundation/api/issues/53)) ([5d9ae76](https://github.com/twinfoundation/api/commit/5d9ae76b5b52a8e10dac391b2d5784638a186583))
13
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
14
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
15
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
16
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * use correct format for log messaging ([44bc2a4](https://github.com/twinfoundation/api/commit/44bc2a4f7cf1f9c38a7e8c6f90ccb2424c958de9))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
29
+ * @twin.org/api-core bumped from 0.0.3-next.8 to 0.0.3-next.9
30
+ * @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
31
+
32
+ ## [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)
33
+
34
+
35
+ ### Miscellaneous Chores
36
+
37
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
38
+
39
+
40
+ ### Dependencies
41
+
42
+ * The following workspace dependencies were updated
43
+ * dependencies
44
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
45
+ * @twin.org/api-core bumped from 0.0.3-next.7 to 0.0.3-next.8
46
+ * @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
47
+
3
48
  ## [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)
4
49
 
5
50
 
@@ -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.7",
3
+ "version": "0.0.3-next.9",
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.7",
18
- "@twin.org/api-core": "0.0.3-next.7",
19
- "@twin.org/api-models": "0.0.3-next.7",
17
+ "@twin.org/api-auth-entity-storage-models": "0.0.3-next.9",
18
+ "@twin.org/api-core": "0.0.3-next.9",
19
+ "@twin.org/api-models": "0.0.3-next.9",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"