@logto/node 2.1.2 → 2.2.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.
@@ -14,12 +14,12 @@ class LogtoClient extends client.default {
14
14
  requester: BaseClient.createRequester(config.appSecret
15
15
  ? async (...args) => {
16
16
  const [input, init] = args;
17
+ // Encode to base64 using btoa
18
+ const base64Credentials = btoa(`${config.appId}:${config.appSecret ?? ''}`);
17
19
  return fetch(input, {
18
20
  ...init,
19
21
  headers: {
20
- Authorization: `Basic ${Buffer.from(
21
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
22
- `${config.appId}:${config.appSecret}`, 'utf8').toString('base64')}`,
22
+ Authorization: `Basic ${base64Credentials}`,
23
23
  ...init?.headers,
24
24
  },
25
25
  });
package/lib/edge/index.js CHANGED
@@ -11,12 +11,12 @@ class LogtoClient extends LogtoNodeBaseClient {
11
11
  requester: createRequester(config.appSecret
12
12
  ? async (...args) => {
13
13
  const [input, init] = args;
14
+ // Encode to base64 using btoa
15
+ const base64Credentials = btoa(`${config.appId}:${config.appSecret ?? ''}`);
14
16
  return fetch(input, {
15
17
  ...init,
16
18
  headers: {
17
- Authorization: `Basic ${Buffer.from(
18
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
19
- `${config.appId}:${config.appSecret}`, 'utf8').toString('base64')}`,
19
+ Authorization: `Basic ${base64Credentials}`,
20
20
  ...init?.headers,
21
21
  },
22
22
  });
package/lib/src/index.cjs CHANGED
@@ -60,6 +60,10 @@ Object.defineProperty(exports, 'Prompt', {
60
60
  enumerable: true,
61
61
  get: function () { return BaseClient.Prompt; }
62
62
  });
63
+ Object.defineProperty(exports, 'ReservedResource', {
64
+ enumerable: true,
65
+ get: function () { return BaseClient.ReservedResource; }
66
+ });
63
67
  Object.defineProperty(exports, 'ReservedScope', {
64
68
  enumerable: true,
65
69
  get: function () { return BaseClient.ReservedScope; }
@@ -68,4 +72,16 @@ Object.defineProperty(exports, 'UserScope', {
68
72
  enumerable: true,
69
73
  get: function () { return BaseClient.UserScope; }
70
74
  });
75
+ Object.defineProperty(exports, 'buildOrganizationUrn', {
76
+ enumerable: true,
77
+ get: function () { return BaseClient.buildOrganizationUrn; }
78
+ });
79
+ Object.defineProperty(exports, 'getOrganizationIdFromUrn', {
80
+ enumerable: true,
81
+ get: function () { return BaseClient.getOrganizationIdFromUrn; }
82
+ });
83
+ Object.defineProperty(exports, 'organizationUrnPrefix', {
84
+ enumerable: true,
85
+ get: function () { return BaseClient.organizationUrnPrefix; }
86
+ });
71
87
  exports.default = LogtoClient;
@@ -2,7 +2,7 @@ import type { LogtoConfig, ClientAdapter } from '@logto/client';
2
2
  import BaseClient from './client.js';
3
3
  export type { LogtoContext, GetContextParameters } from './types.js';
4
4
  export type { IdTokenClaims, LogtoErrorCode, LogtoConfig, LogtoClientErrorCode, Storage, StorageKey, InteractionMode, } from '@logto/client';
5
- export { LogtoError, LogtoRequestError, LogtoClientError, OidcError, Prompt, ReservedScope, UserScope, PersistKey, } from '@logto/client';
5
+ export { LogtoError, LogtoRequestError, LogtoClientError, OidcError, Prompt, ReservedScope, ReservedResource, UserScope, organizationUrnPrefix, buildOrganizationUrn, getOrganizationIdFromUrn, PersistKey, } from '@logto/client';
6
6
  export default class LogtoClient extends BaseClient {
7
7
  constructor(config: LogtoConfig, adapter: Pick<ClientAdapter, 'navigate' | 'storage'>);
8
8
  }
package/lib/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequester } from '@logto/client';
2
- export { LogtoClientError, LogtoError, LogtoRequestError, OidcError, PersistKey, Prompt, ReservedScope, UserScope } from '@logto/client';
2
+ export { LogtoClientError, LogtoError, LogtoRequestError, OidcError, PersistKey, Prompt, ReservedResource, ReservedScope, UserScope, buildOrganizationUrn, getOrganizationIdFromUrn, organizationUrnPrefix } from '@logto/client';
3
3
  import fetch from 'node-fetch';
4
4
  import LogtoNodeBaseClient from './client.js';
5
5
  import { generateCodeChallenge, generateCodeVerifier, generateState } from './utils/generators.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/node",
3
- "version": "2.1.2",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "main": "./lib/src/index.cjs",
6
6
  "module": "./lib/src/index.js",
@@ -27,7 +27,7 @@
27
27
  "directory": "packages/node"
28
28
  },
29
29
  "dependencies": {
30
- "@logto/client": "^2.2.3",
30
+ "@logto/client": "^2.3.0",
31
31
  "@silverhand/essentials": "^2.6.2",
32
32
  "js-base64": "^3.7.4",
33
33
  "node-fetch": "^2.6.7"
@@ -43,7 +43,7 @@
43
43
  "jest": "^29.5.0",
44
44
  "jest-location-mock": "^2.0.0",
45
45
  "jest-matcher-specific-error": "^1.0.0",
46
- "lint-staged": "^14.0.0",
46
+ "lint-staged": "^15.0.0",
47
47
  "prettier": "^3.0.0",
48
48
  "typescript": "^5.0.0"
49
49
  },