From 9c7fc23c20face45c10bc56d84af0e08d5615a8c Mon Sep 17 00:00:00 2001 From: Andrew Glago Date: Tue, 28 May 2024 17:04:09 +0000 Subject: [PATCH 1/3] fix: update protocol checks in redirects --- packages/core/src/core/pantheon-api.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/src/core/pantheon-api.ts b/packages/core/src/core/pantheon-api.ts index ca60e22e..b5723622 100644 --- a/packages/core/src/core/pantheon-api.ts +++ b/packages/core/src/core/pantheon-api.ts @@ -128,9 +128,8 @@ function generateBaseURL(req: ApiRequest) { // If this is a forwarded request, use the protocol and host from the headers. if (req.headers?.["x-forwarded-host"]) { return `${ - req.headers["x-forwarded-proto"] || req.connection?.encrypted - ? "https" - : "http" + req.headers["x-forwarded-proto"] || + (req.connection?.encrypted ? "https" : "http") }://${req.headers["x-forwarded-host"]}`; } From d417956b6a4ea891c12a8847853e55e258692780 Mon Sep 17 00:00:00 2001 From: Andrew Glago Date: Thu, 30 May 2024 11:07:33 +0000 Subject: [PATCH 2/3] chore: fix lint --- packages/core/src/core/pantheon-api.ts | 8 ++--- packages/core/src/types/index.ts | 42 +++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/core/src/core/pantheon-api.ts b/packages/core/src/core/pantheon-api.ts index b5723622..ce922cb8 100644 --- a/packages/core/src/core/pantheon-api.ts +++ b/packages/core/src/core/pantheon-api.ts @@ -199,8 +199,8 @@ export const PantheonAPI = (givenOptions?: PantheonAPIOptions) => { const command = Array.isArray(commandInput) ? commandInput : typeof commandInput === "string" - ? commandInput.split("/") - : [commandInput]; + ? commandInput.split("/") + : [commandInput]; if (pccGrant) { setCookie(headers, `PCC-GRANT=${pccGrant}; Path=/; SameSite=Lax`); @@ -397,8 +397,8 @@ function setCookie(headers: Headers, value: string) { ...(typeof previous === "string" ? [previous] : Array.isArray(previous) - ? previous - : []), + ? previous + : []), value, ].join("; "), ); diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index daaf5a3d..819c7644 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -193,25 +193,25 @@ type InferFieldProps = T extends { ? O extends readonly { value: infer V }[] ? V : O extends readonly string[] - ? O[number] - : unknown + ? O[number] + : unknown : T extends { type: "number" } - ? number - : T extends { type: "boolean" } - ? boolean - : T extends { type: "string" | "file" | "date" } - ? string - : T extends { - type: "object"; - fields: Record; - } - ? T["multiple"] extends true - ? Optional< - { [K in keyof T["fields"]]: InferFieldProps }, - OptionalFields - >[] - : Optional< - { [K in keyof T["fields"]]: InferFieldProps }, - OptionalFields - > - : unknown; + ? number + : T extends { type: "boolean" } + ? boolean + : T extends { type: "string" | "file" | "date" } + ? string + : T extends { + type: "object"; + fields: Record; + } + ? T["multiple"] extends true + ? Optional< + { [K in keyof T["fields"]]: InferFieldProps }, + OptionalFields + >[] + : Optional< + { [K in keyof T["fields"]]: InferFieldProps }, + OptionalFields + > + : unknown; From 8565ba8cb839182332ee0b600bb5548101e984a0 Mon Sep 17 00:00:00 2001 From: Andrew Glago Date: Thu, 30 May 2024 11:15:13 +0000 Subject: [PATCH 3/3] chore: lint --- packages/cli/src/cli/commands/init.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/cli/commands/init.ts b/packages/cli/src/cli/commands/init.ts index ab41b02f..95ef280d 100644 --- a/packages/cli/src/cli/commands/init.ts +++ b/packages/cli/src/cli/commands/init.ts @@ -143,8 +143,8 @@ const init = async ({ template === "gatsby" ? ".env.development" : template === "vue" - ? ".env" - : ".env.local"; + ? ".env" + : ".env.local"; copyFileSync( path.join(absoluteProjectPath, ".env.example"), @@ -181,7 +181,7 @@ const init = async ({ await inquirer.prompt({ type: "list", name: "siteId", - choices: (await AddOnApiHelper.listSites()) + choices: (await AddOnApiHelper.listSites({})) .filter((x) => !x.__isPlayground) .map((x) => `${x.url} (${x.id})`), })