@logto/js 4.0.0-alpha.0 → 4.0.0-alpha.2

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.
@@ -39,6 +39,7 @@ exports.QueryKey = void 0;
39
39
  /** The prompt parameter to be used for the authorization request. */
40
40
  exports.Prompt = void 0;
41
41
  (function (Prompt) {
42
+ Prompt["None"] = "none";
42
43
  /**
43
44
  * The Authorization Server MUST prompt the End-User for consent
44
45
  * before returning information to the Client.
@@ -34,6 +34,7 @@ export declare enum QueryKey {
34
34
  }
35
35
  /** The prompt parameter to be used for the authorization request. */
36
36
  export declare enum Prompt {
37
+ None = "none",
37
38
  /**
38
39
  * The Authorization Server MUST prompt the End-User for consent
39
40
  * before returning information to the Client.
@@ -37,6 +37,7 @@ var QueryKey;
37
37
  /** The prompt parameter to be used for the authorization request. */
38
38
  var Prompt;
39
39
  (function (Prompt) {
40
+ Prompt["None"] = "none";
40
41
  /**
41
42
  * The Authorization Server MUST prompt the End-User for consent
42
43
  * before returning information to the Client.
@@ -8,7 +8,7 @@ const revoke = async (revocationEndpoint, clientId, token, requester) => request
8
8
  body: new URLSearchParams({
9
9
  [index.QueryKey.ClientId]: clientId,
10
10
  [index.QueryKey.Token]: token,
11
- }),
11
+ }).toString(),
12
12
  });
13
13
 
14
14
  exports.revoke = revoke;
@@ -6,7 +6,7 @@ const revoke = async (revocationEndpoint, clientId, token, requester) => request
6
6
  body: new URLSearchParams({
7
7
  [QueryKey.ClientId]: clientId,
8
8
  [QueryKey.Token]: token,
9
- }),
9
+ }).toString(),
10
10
  });
11
11
 
12
12
  export { revoke };
@@ -5,6 +5,12 @@ var scopes = require('../utils/scopes.cjs');
5
5
 
6
6
  const codeChallengeMethod = 'S256';
7
7
  const responseType = 'code';
8
+ const buildPrompt = (prompt) => {
9
+ if (Array.isArray(prompt)) {
10
+ return prompt.join(' ');
11
+ }
12
+ return prompt ?? index.Prompt.Consent;
13
+ };
8
14
  const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, interactionMode, }) => {
9
15
  const urlSearchParameters = new URLSearchParams({
10
16
  [index.QueryKey.ClientId]: clientId,
@@ -13,7 +19,7 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
13
19
  [index.QueryKey.CodeChallengeMethod]: codeChallengeMethod,
14
20
  [index.QueryKey.State]: state,
15
21
  [index.QueryKey.ResponseType]: responseType,
16
- [index.QueryKey.Prompt]: prompt ?? index.Prompt.Consent,
22
+ [index.QueryKey.Prompt]: buildPrompt(prompt),
17
23
  [index.QueryKey.Scope]: scopes.withDefaultScopes(scopes$1),
18
24
  });
19
25
  for (const resource of resources ?? []) {
@@ -8,7 +8,7 @@ export type SignInUriParameters = {
8
8
  state: string;
9
9
  scopes?: string[];
10
10
  resources?: string[];
11
- prompt?: Prompt;
11
+ prompt?: Prompt | Prompt[];
12
12
  interactionMode?: InteractionMode;
13
13
  };
14
14
  export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }: SignInUriParameters) => string;
@@ -3,6 +3,12 @@ import { withDefaultScopes } from '../utils/scopes.js';
3
3
 
4
4
  const codeChallengeMethod = 'S256';
5
5
  const responseType = 'code';
6
+ const buildPrompt = (prompt) => {
7
+ if (Array.isArray(prompt)) {
8
+ return prompt.join(' ');
9
+ }
10
+ return prompt ?? Prompt.Consent;
11
+ };
6
12
  const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }) => {
7
13
  const urlSearchParameters = new URLSearchParams({
8
14
  [QueryKey.ClientId]: clientId,
@@ -11,7 +17,7 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
11
17
  [QueryKey.CodeChallengeMethod]: codeChallengeMethod,
12
18
  [QueryKey.State]: state,
13
19
  [QueryKey.ResponseType]: responseType,
14
- [QueryKey.Prompt]: prompt ?? Prompt.Consent,
20
+ [QueryKey.Prompt]: buildPrompt(prompt),
15
21
  [QueryKey.Scope]: withDefaultScopes(scopes),
16
22
  });
17
23
  for (const resource of resources ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/js",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.2",
4
4
  "type": "module",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./lib/index.js",