@supernovaio/cli-next 2.0.2 → 2.0.4
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.
- package/bin/run +13 -13
- package/dist/types/sentry-command.js +1 -1
- package/dist/types/sentry-command.js.map +1 -1
- package/dist/utils/api-client.d.ts +1 -1
- package/dist/utils/api-client.d.ts.map +1 -1
- package/dist/utils/api-client.js +1 -1
- package/dist/utils/api-client.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/bin/run
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {execute, handle} from
|
|
4
|
-
import * as Sentry from
|
|
5
|
-
import {nodeProfilingIntegration} from
|
|
6
|
-
import dotenv from
|
|
3
|
+
import { execute, handle } from "@oclif/core"
|
|
4
|
+
import * as Sentry from "@sentry/node"
|
|
5
|
+
import { nodeProfilingIntegration } from "@sentry/profiling-node"
|
|
6
|
+
import dotenv from "dotenv"
|
|
7
7
|
|
|
8
8
|
// Load environment variables from .env file
|
|
9
9
|
dotenv.config()
|
|
10
10
|
|
|
11
|
-
const SENSITIVE_KEYS = new Set([
|
|
11
|
+
const SENSITIVE_KEYS = new Set(["password", "secret", "token"])
|
|
12
12
|
|
|
13
|
-
const sanitizeEvent =
|
|
13
|
+
const sanitizeEvent = event => {
|
|
14
14
|
if (event.request?.data) {
|
|
15
15
|
event.request.data = maskValues(event.request.data)
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ const sanitizeEvent = (event) => {
|
|
|
18
18
|
return event
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const sanitizeBreadcrumb =
|
|
21
|
+
const sanitizeBreadcrumb = breadcrumb => {
|
|
22
22
|
if (breadcrumb.data) {
|
|
23
23
|
breadcrumb.data = maskValues(breadcrumb.data)
|
|
24
24
|
}
|
|
@@ -27,9 +27,9 @@ const sanitizeBreadcrumb = (breadcrumb) => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
30
|
-
const maskValues =
|
|
30
|
+
const maskValues = obj =>
|
|
31
31
|
Object.keys(obj).reduce((acc, key) => {
|
|
32
|
-
acc[key] = SENSITIVE_KEYS.has(key) ?
|
|
32
|
+
acc[key] = SENSITIVE_KEYS.has(key) ? "[REDACTED]" : obj[key]
|
|
33
33
|
return acc
|
|
34
34
|
}, {})
|
|
35
35
|
|
|
@@ -44,14 +44,14 @@ Sentry.init({
|
|
|
44
44
|
return sanitizeEvent(transaction)
|
|
45
45
|
},
|
|
46
46
|
debug: false,
|
|
47
|
-
dsn:
|
|
48
|
-
ignoreErrors: [
|
|
47
|
+
dsn: "https://9d6591df6378a22920996bd4d12722e3@o337704.ingest.us.sentry.io/4508840260730880",
|
|
48
|
+
ignoreErrors: ["NotAuthorizedError"],
|
|
49
49
|
integrations: [nodeProfilingIntegration()],
|
|
50
50
|
profilesSampleRate: 1,
|
|
51
51
|
tracesSampleRate: 1,
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
await Sentry.startSpan({name:
|
|
55
|
-
execute({dir: import.meta.url}).catch(
|
|
54
|
+
await Sentry.startSpan({ name: "cli", forceTransaction: true }, () =>
|
|
55
|
+
execute({ dir: import.meta.url }).catch(err => handle(err)),
|
|
56
56
|
)
|
|
57
57
|
await Sentry.flush(1000)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-command.js","sourceRoot":"","sources":["../../src/types/sentry-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,OAAgB,aAAgC,SAAQ,WAAc;IAC1E,YAAsB,IAAc,EAAE,MAAc;QAClD,KAAK,CAAC,IAAI,EAAE,M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a,EAAE,CAAA;QACnC,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,aAAa,CAAC;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC9B,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc;gBAC3C,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAChC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW;aACtC,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,CAAC,aAAa,CAAC;YACnB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE;gBACJ,MAAM,EAAE,SAAS;aAClB;YACD,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,yBAAyB;SACnC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { Config } from \"@oclif/core/config\"\nimport { CommandError, Input, ParserOutput } from \"@oclif/core/interfaces\"\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-expect-error\nimport { ArgOutput, FlagOutput } from \"@oclif/core/lib/interfaces/parser.js\"\nimport * as Sentry from \"@sentry/node\"\n\nimport { BaseCommand } from \"./base-command.js\"\nimport { NotAuthorizedError } from \"./not-authorized.error.js\"\n\nexport abstract class SentryCommand<T extends object> extends BaseCommand<T> {\n protected constructor(argv: string[], config: Config) {\n super(argv, config)\n }\n\n async catch(error: CommandError & { oclif?: { exit: number } }) {\n this.logToStderr(error.message)\n if (error.oclif) {\n throw error\n }\n\n if (error instanceof NotAuthorizedError) {\n throw error\n }\n\n Sentry.captureException(error)\n this.logToStderr(`Something went wrong. Please try again later.`)\n }\n\n async finally() {}\n\n public async parse<F extends FlagOutput, B extends FlagOutput, A extends ArgOutput>(\n options?: Input<F, B, A>,\n argv?: string[],\n ): Promise<ParserOutput<F, B, A>> {\n Sentry.addBreadcrumb({\n category: \"command\",\n data: {\n commandName: this.id,\n },\n level: \"debug\",\n message: \"Starting command parse\",\n })\n\n const parsed = await super.parse(options, argv)\n const span = Sentry.getActiveSpan()\n if (span) {\n span.setAttributes({\n args: Object.keys(parsed.args),\n designSystemId: parsed.flags.designSystemId,\n flags: Object.keys(parsed.flags),\n workspaceId: parsed.flags.workspaceId,\n })\n }\n\n Sentry.addBreadcrumb({\n category: \"command\",\n data: {\n result: \"success\",\n },\n level: \"debug\",\n message: \"Command parse completed\",\n })\n\n return parsed\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SupernovaApiClient } from "@supernova-studio/client";
|
|
2
|
-
import { TargetEnv } from "../types/
|
|
2
|
+
import { TargetEnv } from "../types/login.js";
|
|
3
3
|
export declare const getClient: (env?: TargetEnv, version?: string) => Promise<SupernovaApiClient>;
|
|
4
4
|
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/utils/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAG7D,OAAO,
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/utils/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAG7D,OAAO,EAAoB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAM/D,eAAO,MAAM,SAAS,GAAU,MAAK,SAA4B,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,kBAAkB,CAI/G,CAAA"}
|
package/dist/utils/api-client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SupernovaApiClient } from "@supernova-studio/client";
|
|
2
2
|
import { VaultService } from "../services/index.js";
|
|
3
|
-
import { defaultTargetEnv } from "../types/
|
|
3
|
+
import { defaultTargetEnv } from "../types/login.js";
|
|
4
4
|
import { environmentAPI } from "./network.js";
|
|
5
5
|
const vaultService = new VaultService();
|
|
6
6
|
export const getClient = async (env = defaultTargetEnv, version) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/utils/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/utils/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAa,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;AAEvC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,MAAiB,gBAAgB,EAAE,OAAgB,EAA+B,EAAE;IAClH,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAClE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,GAAkB,EAAE,OAAO,CAAC,CAAC,CAAA;IACpE,OAAO,IAAI,kBAAkB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AACpE,CAAC,CAAA","sourcesContent":["import { SupernovaApiClient } from \"@supernova-studio/client\"\n\nimport { VaultService } from \"../services/index.js\"\nimport { defaultTargetEnv, TargetEnv } from \"../types/login.js\"\nimport { Environment } from \"../types/types.js\"\nimport { environmentAPI } from \"./network.js\"\n\nconst vaultService = new VaultService()\n\nexport const getClient = async (env: TargetEnv = defaultTargetEnv, version?: string): Promise<SupernovaApiClient> => {\n const { accessToken } = await vaultService.getTokensFromVault(env)\n const hostUrl = new URL(environmentAPI(env as Environment, version))\n return new SupernovaApiClient({ accessToken, host: hostUrl.host })\n}\n"]}
|
package/oclif.manifest.json
CHANGED