@logto/browser 0.1.7 → 0.1.14

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/lib/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { IdTokenClaims, Requester, UserInfoResponse } from '@logto/js';
2
2
  import { Nullable } from '@silverhand/essentials';
3
3
  import { Infer } from 'superstruct';
4
- export type { IdTokenClaims, UserInfoResponse } from '@logto/js';
4
+ export type { IdTokenClaims, UserInfoResponse, LogtoErrorCode } from '@logto/js';
5
+ export { LogtoError, OidcError } from '@logto/js';
5
6
  export * from './errors';
6
7
  export declare type LogtoConfig = {
7
8
  endpoint: string;
package/lib/index.js CHANGED
@@ -13,13 +13,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.LogtoSignInSessionItemSchema = void 0;
16
+ exports.LogtoSignInSessionItemSchema = exports.OidcError = exports.LogtoError = void 0;
17
17
  const js_1 = require("@logto/js");
18
18
  const jose_1 = require("jose");
19
19
  const lodash_once_1 = __importDefault(require("lodash.once"));
20
20
  const superstruct_1 = require("superstruct");
21
21
  const errors_1 = require("./errors");
22
22
  const utils_1 = require("./utils");
23
+ var js_2 = require("@logto/js");
24
+ Object.defineProperty(exports, "LogtoError", { enumerable: true, get: function () { return js_2.LogtoError; } });
25
+ Object.defineProperty(exports, "OidcError", { enumerable: true, get: function () { return js_2.OidcError; } });
23
26
  __exportStar(require("./errors"), exports);
24
27
  exports.LogtoSignInSessionItemSchema = (0, superstruct_1.type)({
25
28
  redirectUri: (0, superstruct_1.string)(),
@@ -212,9 +215,10 @@ class LogtoClient {
212
215
  }
213
216
  try {
214
217
  const accessTokenKey = (0, utils_1.buildAccessTokenKey)(resource);
215
- const { appId: clientId } = this.logtoConfig;
218
+ const { appId: clientId, scopes: customScopes } = this.logtoConfig;
216
219
  const { tokenEndpoint } = await this.getOidcConfig();
217
- const { accessToken, refreshToken, idToken, scope, expiresIn } = await (0, js_1.fetchTokenByRefreshToken)({ clientId, tokenEndpoint, refreshToken: this.refreshToken, resource }, this.requester);
220
+ const scopes = (0, js_1.withReservedScopes)(customScopes).split(' ');
221
+ const { accessToken, refreshToken, idToken, scope, expiresIn } = await (0, js_1.fetchTokenByRefreshToken)({ clientId, tokenEndpoint, refreshToken: this.refreshToken, resource, scopes }, this.requester);
218
222
  this.accessTokenMap.set(accessTokenKey, {
219
223
  token: accessToken,
220
224
  scope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/browser",
3
- "version": "0.1.7",
3
+ "version": "0.1.14",
4
4
  "main": "./lib/index.js",
5
5
  "exports": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "prepack": "pnpm test"
25
25
  },
26
26
  "dependencies": {
27
- "@logto/js": "^0.1.7",
27
+ "@logto/js": "^0.1.14",
28
28
  "@silverhand/essentials": "^1.1.6",
29
29
  "jose": "^4.5.0",
30
30
  "lodash.get": "^4.4.2",
@@ -42,7 +42,7 @@
42
42
  "jest": "^27.5.1",
43
43
  "jest-location-mock": "^1.0.9",
44
44
  "jest-matcher-specific-error": "^1.0.0",
45
- "lint-staged": "^12.3.3",
45
+ "lint-staged": "^13.0.0",
46
46
  "prettier": "^2.3.2",
47
47
  "text-encoder": "^0.0.4",
48
48
  "ts-jest": "^27.0.4",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "45f2ad06fa069eac66016696703b1a37e1509ffb"
58
+ "gitHead": "5d05c6bd23dc35d7217031edccc01db2bae33b7b"
59
59
  }