New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@settlemint/btp-sdk-cli

Package Overview
Dependencies
Maintainers
0
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@settlemint/btp-sdk-cli - npm Package Compare versions

Comparing version 0.3.2-pr52fd2d2 to 0.3.2-pr59cdf19

118

dist/index.js

@@ -74,3 +74,3 @@ #!/usr/bin/env node

"graphql-request": "7.1.0",
"openapi-fetch": "0.10.4"
"openapi-fetch": "0.10.5"
},

@@ -117,5 +117,12 @@ peerDependencies: {

s.start(options.startMessage);
const result = await options.task();
s.stop(options.stopMessage);
return result;
try {
const result = await options.task();
s.stop(options.stopMessage);
return result;
} catch (error) {
s.stop(redBright(`${options.startMessage} --> Error!`));
printNote(`${error.message}
${error.stack}`, redBright("Error"));
process.exit(1);
}
};

@@ -164,7 +171,9 @@ var promptSelect = async (options) => {

BTP_PAT_TOKEN: z.string(),
NEXT_PUBLIC_BTP_APP_URL: z.string().url().optional()
NEXT_PUBLIC_BTP_APP_URL: z.string().url().optional(),
BTP_HASURA_GQL_ADMIN_SECRET: z.string().optional()
});
var ConfigEnvSchema = ConfigSchema.extend({
pat: z.string(),
appUrl: z.string().url().optional()
appUrl: z.string().url().optional(),
hasuraAdminSecret: z.string().optional()
});

@@ -179,3 +188,4 @@ async function config() {

pat: process.env.BTP_PAT_TOKEN,
appUrl: process.env.NEXT_PUBLIC_BTP_APP_URL
appUrl: process.env.NEXT_PUBLIC_BTP_APP_URL,
hasuraAdminSecret: process.env.BTP_HASURA_GQL_ADMIN_SECRET
});

@@ -249,2 +259,3 @@ }

"x-auth-token": process.env.BTP_PAT_TOKEN,
${type === "hasura" ? '"x-hasura-admin-secret": process.env.BTP_HASURA_GQL_ADMIN_SECRET,' : ""}
},

@@ -264,2 +275,3 @@ });`

"x-auth-token": "${personalAccessToken}",
${type === "hasura" ? `"x-hasura-admin-secret": "${options.hasuraAdminSecret}",` : ""}
},

@@ -282,3 +294,4 @@ },

headers: {
"x-auth-token": personalAccessToken
"x-auth-token": personalAccessToken,
...type === "hasura" ? { "x-hasura-admin-secret": options.hasuraAdminSecret } : {}
}

@@ -397,3 +410,3 @@ }

}
const { portalRest, portal } = environmentConfig;
const { portalRest, portal, graph, hasura } = environmentConfig;
let usageMessage = "";

@@ -412,4 +425,2 @@ if (portalRest) {

${greenBright("import { portal } from './.btp/portal/rest'")}
${greenBright("// leverage typescript autocomplete for other methods and params")}
${greenBright("const pendingTransactions = await portal.get('/transactions/pending')")}
`;

@@ -433,7 +444,49 @@ }

${greenBright("import { portal } from './.btp/portal/gql/portal'")}
${greenBright("// leverage typescript autocomplete for other methods and params")}
${greenBright("const pendingTransactions = await portal.get('/transactions/pending')")}
${greenBright("import { portal } from './.btp/portal/gql'")}
`;
}
if (graph) {
await printSpinner({
startMessage: "Generating the The Graph GQL client",
task: async () => {
await createGqlClient({
framework: cfg.framework,
type: "thegraph",
gqlUrl: graph,
personalAccessToken: pat
});
},
stopMessage: "The Graph GQL client generated"
});
usageMessage += `
To use the The Graph GQL client:
${greenBright("import { thegraph } from './.btp/thegraph/gql'")}
`;
}
if (hasura) {
const adminSecret = cfg.hasuraAdminSecret;
if (!adminSecret) {
printCancel("No Hasura Admin Secret found");
process.exit(1);
}
await printSpinner({
startMessage: "Generating the Hasura GQL client",
task: async () => {
await createGqlClient({
framework: cfg.framework,
type: "hasura",
gqlUrl: hasura,
personalAccessToken: pat,
hasuraAdminSecret: adminSecret
});
},
stopMessage: "Hasura GQL client generated"
});
usageMessage += `
To use the Hasura GQL client:
${greenBright("import { hasura } from './.btp/hasura/gql'")}
`;
}
printNote(usageMessage, "Usage hints");

@@ -806,12 +859,13 @@ printOutro("Code generation complete");

});
const hasuras = selectedApplication.hasuras.map((hasura2) => ({
value: { gqlUrl: hasura2.gqlUrl, adminSecret: hasura2.adminSecret },
label: `${hasura2.name} (${hasura2.uniqueName})`
}));
const hasuraUrl = await coerceSelect({
options: selectedApplication.hasuras.map((hasura2) => ({
value: hasura2.gqlUrl,
label: `${hasura2.name} (${hasura2.uniqueName})`
})),
options: hasuras,
noneOption: { value: void 0, label: "None" },
envValue: process.env.BTP_HASURA_GQL_URL,
cliParamValue: hasura,
configValue: cfg?.environments?.[currentEnvironment]?.hasura,
validate: (value) => !!new URL(value ?? "").toString(),
envValue: hasuras.find((h) => h.value.gqlUrl === process.env.BTP_HASURA_GQL_URL)?.value,
cliParamValue: hasuras.find((h) => h.value.gqlUrl === hasura)?.value,
configValue: hasuras.find((h) => h.value.gqlUrl === cfg?.environments?.[currentEnvironment]?.hasura)?.value,
validate: (value) => !!new URL(value?.gqlUrl ?? "").toString(),
promptMessage: "Select your Hasura instance",

@@ -833,9 +887,2 @@ existingMessage: "A valid Hasura URL is already provided. Do you want to change it?"

});
await printSpinner({
startMessage: "Creating or updating the .env.local file",
task: async () => {
await createEnv({ BTP_PAT_TOKEN: personalAccessToken, NEXT_PUBLIC_BTP_APP_URL: selectedAppUrl });
},
stopMessage: ".env.local file created or updated"
});
const defaultEnvironment = await coerceSelect({

@@ -856,2 +903,13 @@ options: possibleEnvironments.map((penv) => ({

await printSpinner({
startMessage: "Creating or updating the .env.local file",
task: async () => {
await createEnv({
BTP_PAT_TOKEN: personalAccessToken,
NEXT_PUBLIC_BTP_APP_URL: selectedAppUrl,
BTP_HASURA_GQL_ADMIN_SECRET: hasuraUrl?.adminSecret
});
},
stopMessage: ".env.local file created or updated"
});
await printSpinner({
startMessage: "Creating or updating the .btprc.json config file",

@@ -871,3 +929,3 @@ task: async () => {

graph: thegraphGqlUrl,
hasura: hasuraUrl,
hasura: hasuraUrl?.gqlUrl,
node: nodeUrl

@@ -874,0 +932,0 @@ }

{
"name": "@settlemint/btp-sdk-cli",
"version": "0.3.2-pr52fd2d2",
"version": "0.3.2-pr59cdf19",
"main": "./dist/index.js",

@@ -59,3 +59,3 @@ "module": "./dist/index.js",

"graphql-request": "7.1.0",
"openapi-fetch": "0.10.4"
"openapi-fetch": "0.10.5"
},

@@ -62,0 +62,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc