sst 2.10.4 → 2.11.0

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,4 +14,6 @@ export declare const list: (program: Program) => import("yargs").Argv<{
14
14
  future: boolean | undefined;
15
15
  } & {
16
16
  format: string | undefined;
17
+ } & {
18
+ fallback: boolean | undefined;
17
19
  }>;
@@ -1,11 +1,19 @@
1
- export const list = (program) => program.command("list [format]", "Fetch all the secrets", (yargs) => yargs.positional("format", {
1
+ export const list = (program) => program.command("list [format]", "Fetch all the secrets", (yargs) => yargs
2
+ .positional("format", {
2
3
  type: "string",
3
4
  choices: ["table", "env", "json"],
4
- }), async (args) => {
5
+ })
6
+ .boolean("fallback"), async (args) => {
5
7
  const { Config } = await import("../../../config.js");
6
8
  const { gray } = await import("colorette");
7
9
  const { Colors } = await import("../../colors.js");
8
- const secrets = await Config.secrets();
10
+ const configSecrets = await Config.secrets();
11
+ const secrets = !args.fallback
12
+ ? configSecrets
13
+ : Object.entries(configSecrets).reduce((carry, [key, value]) => ({
14
+ ...carry,
15
+ ...(!value.value && !!value.fallback ? { [key]: value } : {}),
16
+ }), {});
9
17
  if (Object.entries(secrets).length === 0) {
10
18
  Colors.line("No secrets set");
11
19
  return;
@@ -20,7 +28,7 @@ export const list = (program) => program.command("list [format]", "Fetch all the
20
28
  break;
21
29
  case "env":
22
30
  for (const [key, value] of Object.entries(secrets)) {
23
- console.log(`${key}=${value.value || value.fallback}`);
31
+ console.log(`${key}=${value.value || `${value.fallback} #fallback`}`);
24
32
  }
25
33
  break;
26
34
  case "table":
@@ -42,7 +50,8 @@ export const list = (program) => program.command("list [format]", "Fetch all the
42
50
  const value = secrets[key].value
43
51
  ? secrets[key].value
44
52
  : `${secrets[key].fallback} ${gray("(fallback)")}`;
45
- console.log(`│ ${key.padEnd(keyLen)} ${value.padEnd(valueLen)} │`);
53
+ const colourPadding = secrets[key].value ? 0 : gray("").length;
54
+ console.log(`│ ${key.padEnd(keyLen)} │ ${value.padEnd(valueLen + colourPadding)} │`);
46
55
  });
47
56
  console.log("└".padEnd(keyLen + 3, "─") +
48
57
  "┴" +
@@ -1,7 +1,15 @@
1
1
  import { OidcBasicConfig } from "./oidc.js";
2
- type GoogleConfig = OidcBasicConfig & {
2
+ import { OauthBasicConfig } from "./oauth.js";
3
+ type GooglePrompt = "none" | "consent" | "select_account";
4
+ type GoogleAccessType = "offline" | "online";
5
+ type GoogleConfig = (OauthBasicConfig & {
6
+ mode: "oauth";
7
+ prompt?: GooglePrompt;
8
+ accessType?: GoogleAccessType;
9
+ }) | (OidcBasicConfig & {
3
10
  mode: "oidc";
4
- };
11
+ prompt?: GooglePrompt;
12
+ });
5
13
  export declare function GoogleAdapter(config: GoogleConfig): () => Promise<{
6
14
  type: "success";
7
15
  properties: {
@@ -1,7 +1,19 @@
1
1
  import { Issuer } from "openid-client";
2
2
  import { OidcAdapter } from "./oidc.js";
3
+ import { OauthAdapter } from "./oauth.js";
3
4
  const issuer = await Issuer.discover("https://accounts.google.com");
4
5
  export function GoogleAdapter(config) {
6
+ /* @__PURE__ */
7
+ if (config.mode === "oauth") {
8
+ return OauthAdapter({
9
+ issuer,
10
+ ...config,
11
+ params: {
12
+ ...(config.accessType && { access_type: config.accessType }),
13
+ ...config.params,
14
+ },
15
+ });
16
+ }
5
17
  return OidcAdapter({
6
18
  issuer,
7
19
  scope: "openid email profile",
@@ -1,6 +1,7 @@
1
1
  import { OidcBasicConfig } from "./oidc.js";
2
2
  type MicrosoftConfig = OidcBasicConfig & {
3
3
  mode: "oidc";
4
+ prompt?: "login" | "none" | "consent" | "select_account";
4
5
  };
5
6
  export declare function MicrosoftAdapter(config: MicrosoftConfig): () => Promise<{
6
7
  type: "success";
@@ -12,7 +12,14 @@ export interface OauthBasicConfig {
12
12
  * Various scopes requested for the access token
13
13
  */
14
14
  scope: string;
15
+ /**
16
+ * Determines whether users will be prompted for reauthentication and consent
17
+ */
15
18
  prompt?: string;
19
+ /**
20
+ * Additional parameters to be passed to the authorization endpoint
21
+ */
22
+ params?: Record<string, string>;
16
23
  }
17
24
  export interface OauthConfig extends OauthBasicConfig {
18
25
  issuer: Issuer;
@@ -22,6 +22,7 @@ export const OauthAdapter =
22
22
  code_challenge_method: "S256",
23
23
  state,
24
24
  prompt: config.prompt,
25
+ ...config.params,
25
26
  });
26
27
  useResponse().cookies({
27
28
  auth_code_verifier: code_verifier,
@@ -4,6 +4,10 @@ export interface OidcBasicConfig {
4
4
  * The clientID provided by the third party oauth service
5
5
  */
6
6
  clientID: string;
7
+ /**
8
+ * Determines whether users will be prompted for reauthentication and consent
9
+ */
10
+ prompt?: string;
7
11
  }
8
12
  export interface OidcConfig extends OidcBasicConfig {
9
13
  issuer: Issuer;
@@ -17,6 +17,7 @@ export const OidcAdapter = /* @__PURE__ */ (config) => {
17
17
  response_mode: "form_post",
18
18
  nonce,
19
19
  state,
20
+ prompt: config.prompt,
20
21
  });
21
22
  useResponse().cookies({
22
23
  auth_nonce: nonce,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.10.4",
4
+ "version": "2.11.0",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/sst.mjs CHANGED
@@ -7707,12 +7707,19 @@ var list = (program2) => program2.command(
7707
7707
  (yargs2) => yargs2.positional("format", {
7708
7708
  type: "string",
7709
7709
  choices: ["table", "env", "json"]
7710
- }),
7710
+ }).boolean("fallback"),
7711
7711
  async (args) => {
7712
7712
  const { Config: Config2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7713
7713
  const { gray } = await import("colorette");
7714
7714
  const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
7715
- const secrets2 = await Config2.secrets();
7715
+ const configSecrets = await Config2.secrets();
7716
+ const secrets2 = !args.fallback ? configSecrets : Object.entries(configSecrets).reduce(
7717
+ (carry, [key, value]) => ({
7718
+ ...carry,
7719
+ ...!value.value && !!value.fallback ? { [key]: value } : {}
7720
+ }),
7721
+ {}
7722
+ );
7716
7723
  if (Object.entries(secrets2).length === 0) {
7717
7724
  Colors2.line("No secrets set");
7718
7725
  return;
@@ -7729,7 +7736,9 @@ var list = (program2) => program2.command(
7729
7736
  break;
7730
7737
  case "env":
7731
7738
  for (const [key, value] of Object.entries(secrets2)) {
7732
- console.log(`${key}=${value.value || value.fallback}`);
7739
+ console.log(
7740
+ `${key}=${value.value || `${value.fallback} #fallback`}`
7741
+ );
7733
7742
  }
7734
7743
  break;
7735
7744
  case "table":
@@ -7755,8 +7764,11 @@ var list = (program2) => program2.command(
7755
7764
  );
7756
7765
  keys.sort().forEach((key) => {
7757
7766
  const value = secrets2[key].value ? secrets2[key].value : `${secrets2[key].fallback} ${gray("(fallback)")}`;
7767
+ const colourPadding = secrets2[key].value ? 0 : gray("").length;
7758
7768
  console.log(
7759
- `\u2502 ${key.padEnd(keyLen)} \u2502 ${value.padEnd(valueLen)} \u2502`
7769
+ `\u2502 ${key.padEnd(keyLen)} \u2502 ${value.padEnd(
7770
+ valueLen + colourPadding
7771
+ )} \u2502`
7760
7772
  );
7761
7773
  });
7762
7774
  console.log(