From eaf73f73dcc8b38862cb16860742e5283095a10b Mon Sep 17 00:00:00 2001 From: Mike Wu Date: Thu, 4 Jan 2024 14:49:04 +0900 Subject: [PATCH 1/5] fix: add license to install.sh (#65) * Remove references to Doppler * add license notice --- scripts/install.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 6bb3279..ee64311 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,3 +1,21 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# NOTICE: +# The following was adapted from the original source, and includes modified changes. +# Original source: https://github.com/DopplerHQ/cli/blob/08cd5113f646ed98d4ca806c204428c68a69b8a1/scripts/install.sh +# + #!/usr/bin/env sh set -e @@ -169,7 +187,7 @@ wget_download() { if [ -z "$security_flags" ] && [ "$component" = "Binary" ]; then log_debug "Skipping additional security flags that are unsupported by BusyBox wget" # log to stderr b/c this function's stdout is parsed - log_warning "This system's wget binary is provided by BusyBox. Doppler strongly suggests installing GNU wget, which provides additional security features." + log_warning "This system's wget binary is provided by BusyBox. We strongly suggests installing GNU wget, which provides additional security features." fi # allow wget to fail w/o exiting @@ -223,12 +241,6 @@ check_http_status() { log "" log "$error" - if [ "$status_code" -eq 404 ]; then - log "" - log "Please report this issue:" - log "https://github.com/DopplerHQ/cli/issues/new?template=bug_report.md&title=[BUG]%20Unexpected%20404%20using%20CLI%20install%20script" - fi - clean_exit 1 fi } @@ -265,9 +277,6 @@ case "$uname_os" in *MINGW64*) os="win" ;; *) log "ERROR: Unsupported OS '$uname_os'" - log "" - log "Please report this issue:" - log "https://github.com/DopplerHQ/cli/issues/new?template=bug_report.md&title=[BUG]%20Unsupported%20OS" clean_exit 1 ;; esac @@ -290,9 +299,6 @@ elif [ "$uname_machine" = "arm64" ] || [ "$uname_machine" = "aarch64" ]; then arch="arm64" else log "ERROR: Unsupported architecture '$uname_machine'" - log "" - log "Please report this issue:" - log "https://github.com/DopplerHQ/cli/issues/new?template=bug_report.md&title=[BUG]%20Unsupported%20architecture" clean_exit 1 fi @@ -309,7 +315,6 @@ fi log_debug "Detected format '$format'" url=https://github.com/seamapi/seam-cli/releases/download/v0.0.8/seam-$os -key_url="https://$DOPPLER_DOMAIN/keys/public" set +e From 722b562de090a5c48118ffda10a57148c6946cfa Mon Sep 17 00:00:00 2001 From: Ravi Chodavarapu Date: Thu, 4 Jan 2024 12:26:05 -0500 Subject: [PATCH 2/5] Add support for user_identity_ids and multiple ID params Also minor CJS issue fix --- cli.ts | 2 +- lib/interact-for-open-api-object.ts | 23 +++++++++++++++++++++-- lib/interact-for-user-identity.ts | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cli.ts b/cli.ts index 4f08635..ec00c8a 100644 --- a/cli.ts +++ b/cli.ts @@ -16,7 +16,6 @@ import { getApiDefinitions } from "./lib/get-api-definitions" import commandLineUsage from "command-line-usage" import { ContextHelpers } from "./lib/types" import { version } from "./package.json" -import open from "open" const sections = [ { @@ -185,6 +184,7 @@ async function cli(args: ParsedArgs) { }) if (action) { + const { default: open } = await import("open") await open(url) } } else { diff --git a/lib/interact-for-open-api-object.ts b/lib/interact-for-open-api-object.ts index 60b3f34..742ee2e 100644 --- a/lib/interact-for-open-api-object.ts +++ b/lib/interact-for-open-api-object.ts @@ -128,9 +128,15 @@ export const interactForOpenApiObject = async ( const connected_account_id = await interactForConnectedAccount() args.params[paramToEdit] = connected_account_id return interactForOpenApiObject(args, ctx) - } else if (paramToEdit === "user_identity_id") { + } else if ( + paramToEdit === "user_identity_id" || + paramToEdit === "user_identity_ids" + ) { const user_identity_id = await interactForUserIdentity() - args.params[paramToEdit] = user_identity_id + args.params[paramToEdit] = + paramToEdit === "user_identity_ids" + ? [user_identity_id] + : user_identity_id return interactForOpenApiObject(args, ctx) } else if (paramToEdit.endsWith("acs_system_id")) { args.params[paramToEdit] = await interactForAcsSystem() @@ -208,6 +214,19 @@ export const interactForOpenApiObject = async ( ).value args.params[paramToEdit] = value return interactForOpenApiObject(args, ctx) + } else if ( + prop.type === "array" && + (prop as any)?.items?.type === "string" + ) { + const value = ( + await prompts({ + name: "value", + message: `${paramToEdit}:`, + type: "text", + }) + ).value + args.params[paramToEdit] = [value] + return interactForOpenApiObject(args, ctx) } else if (prop.type === "object") { args.params[paramToEdit] = await interactForOpenApiObject( { diff --git a/lib/interact-for-user-identity.ts b/lib/interact-for-user-identity.ts index 2ebe53a..1657496 100644 --- a/lib/interact-for-user-identity.ts +++ b/lib/interact-for-user-identity.ts @@ -11,7 +11,7 @@ export const interactForUserIdentity = async () => { type: "autocomplete", message: "Select a user_identity:", choices: uis.map((ui) => ({ - title: `${ui.email_address} "${ui.first_name} ${ui.last_name}": ${ui.user_identity_key}`, + title: `${ui.email_address} "${ui.full_name}: ${ui.user_identity_key}`, value: ui.user_identity_id, description: ui.user_identity_id, })), From 4c107eba8129a121c15f6651fb8a564c614d4af2 Mon Sep 17 00:00:00 2001 From: Ravi Chodavarapu Date: Thu, 4 Jan 2024 12:35:05 -0500 Subject: [PATCH 3/5] ESNext module should work --- tsconfig.json | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 190d3c9..020cc2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,9 @@ { "compilerOptions": { - "lib": ["ES2015"], - "module": "ES2015", + "lib": [ + "ES2015" + ], + "module": "ESNext", "target": "ES2015", "moduleResolution": "bundler", "moduleDetection": "force", @@ -19,5 +21,10 @@ "bun-types" // add Bun global ] }, - "include": ["lib/**/*.ts", "cli.ts", "index.ts", "package.json"] -} + "include": [ + "lib/**/*.ts", + "cli.ts", + "index.ts", + "package.json" + ] +} \ No newline at end of file From bf908782cb1a99dfec12078c1ca0f3a5988cfa07 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 4 Jan 2024 17:35:41 +0000 Subject: [PATCH 4/5] ci - format code --- tsconfig.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 020cc2c..adcf04c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,6 @@ { "compilerOptions": { - "lib": [ - "ES2015" - ], + "lib": ["ES2015"], "module": "ESNext", "target": "ES2015", "moduleResolution": "bundler", @@ -21,10 +19,5 @@ "bun-types" // add Bun global ] }, - "include": [ - "lib/**/*.ts", - "cli.ts", - "index.ts", - "package.json" - ] -} \ No newline at end of file + "include": ["lib/**/*.ts", "cli.ts", "index.ts", "package.json"] +} From e5406224ac329001d9f7fb374b96fa1b752a8067 Mon Sep 17 00:00:00 2001 From: seveibar Date: Thu, 4 Jan 2024 20:56:48 -0800 Subject: [PATCH 5/5] v0.0.28 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 57412f4..95eaccd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "seam-cli", "module": "index.ts", "type": "module", - "version": "0.0.27", + "version": "0.0.28", "repository": "git@github.com:seamapi/seam-cli.git", "scripts": { "cli": "tsx ./cli.ts",