@supernovaio/cli 2.0.4 → 2.0.5
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="47029cd5-2eda-57f8-8c1e-9890f00748f4")}catch(e){}}();
|
|
3
3
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
4
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
5
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -91,7 +91,7 @@ export default class TemplateUpload extends SentryCommand {
|
|
|
91
91
|
missing.push(name);
|
|
92
92
|
}
|
|
93
93
|
}));
|
|
94
|
-
if (missing.length
|
|
94
|
+
if (missing.length > 0) {
|
|
95
95
|
this.error(`Some dependencies were not found in current node modules: [${missing.join(", ")}]`);
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
@@ -154,4 +154,4 @@ __decorate([
|
|
|
154
154
|
__metadata("design:returntype", Promise)
|
|
155
155
|
], TemplateUpload.prototype, "run", null);
|
|
156
156
|
//# sourceMappingURL=template-upload.js.map
|
|
157
|
-
//# debugId=
|
|
157
|
+
//# debugId=47029cd5-2eda-57f8-8c1e-9890f00748f4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-upload.js","sources":["../../src/commands/template-upload.ts"],"sourceRoot":"","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport fetch from \"node-fetch\"\nimport { exec as execCallback } from \"node:child_process\"\nimport { createHash, randomUUID } from \"node:crypto\"\nimport { createReadStream } from \"node:fs\"\nimport * as fs from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { promisify } from \"node:util\"\nimport { z, ZodType } from \"zod\"\n\nimport { commonFlags, SentryCommand } from \"../types/index.js\"\n\nconst exec = promisify(execCallback)\n\nconst TemplateUploadConfig = z.object({})\n\ntype TemplateUploadConfig = z.infer<typeof TemplateUploadConfig>\n\nasync function fileExists(p: string) {\n try {\n await fs.access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function computeChecksum(filePath: string) {\n return new Promise<string>((resolve, reject) => {\n const hash = createHash(\"sha256\")\n const stream = createReadStream(filePath)\n\n stream.on(\"error\", reject)\n hash.on(\"error\", reject)\n\n stream.on(\"data\", chunk => hash.update(chunk))\n stream.on(\"end\", () => {\n const digest = hash.digest(\"hex\")\n resolve(digest)\n })\n })\n}\n\nexport default class TemplateUpload extends SentryCommand<TemplateUploadConfig> {\n static override args = {}\n static override description = \"Upload custom prototype app sandbox template\"\n static override examples = [\"<%= config.bin %> <%= command.id %> TemplateUpload \"]\n static override hidden: boolean = true\n static override flags = {\n ...commonFlags,\n workspaceId: Flags.string({ char: \"w\", description: \"Workspace ID to upload the template to\", required: true }),\n }\n\n get commandId(): string {\n return TemplateUpload.id\n }\n\n get configSchema(): ZodType<TemplateUploadConfig> {\n return TemplateUploadConfig\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const apiClient = await this.apiClient()\n const { flags } = await this.parse()\n\n const cwd = process.cwd()\n const pkgPath = path.join(cwd, \"package.json\")\n const modulesPath = path.join(cwd, \"node_modules\")\n const zipPath = path.join(cwd, \".supernova-upload.zip\")\n\n // Validate package json\n if (!(await fileExists(pkgPath))) this.error(\"package.json not found in current directory.\")\n\n // Validate node modules\n if (!(await fileExists(modulesPath)) || !(await fs.stat(modulesPath)).isDirectory()) {\n this.error(`node_modules directory not found in the current directory`)\n }\n\n // Read package json\n let pkg\n try {\n const raw = await fs.readFile(pkgPath, \"utf8\")\n pkg = JSON.parse(raw) as { dependencies: Record<string, string> }\n } catch (error) {\n if (error instanceof Error) this.error(`Failed to read or parse package.json: ${error.message}`)\n else throw error\n }\n\n // Validate dependencies are present\n const depNames = Object.keys(pkg.dependencies)\n const missing: string[] = []\n\n await Promise.all(\n depNames.map(async name => {\n const depDir = path.join(modulesPath, ...name.split(\"/\"))\n if (!(await fileExists(depDir))) {\n missing.push(name)\n }\n }),\n )\n\n if (missing.length === 0) {\n this.error(`Some dependencies were not found in current node modules: [${missing.join(\", \")}]`)\n }\n\n // 6) Create ZIP of current directory\n try {\n await exec(`zip -r \"${zipPath}\" . -x \"*.zip\"`)\n } catch (error) {\n if (error instanceof Error) this.error(`Failed to create zip archive: ${error.message}`)\n else throw error\n }\n\n if (!(await fileExists(zipPath))) this.error(`Upload zip was not produced`)\n\n const stat = await fs.stat(zipPath)\n const checksum = await computeChecksum(zipPath)\n\n action.start(`Uploading ${(stat.size / 1000 / 1000).toFixed(2)}MB`)\n\n const uploadResponse = await apiClient.files.upload({\n ownerType: \"Workspace\",\n workspaceId: flags.workspaceId,\n files: [{ checksum, name: `${randomUUID()}.zip`, size: stat.size }],\n })\n\n if (uploadResponse.files.length === 0) this.error(`Upload endpoint returned no files`)\n\n let file = uploadResponse.files[0]\n if (file.pendingUpload) {\n const [uploadUrl] = uploadResponse.uploadUrls\n if (!uploadUrl) this.error(`File is pending upload, but no upload URL was provided`)\n\n const s3UploadResponse = await fetch(uploadUrl.uploadUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"contentType\",\n \"Content-Length\": stat.size.toString(),\n },\n body: createReadStream(zipPath),\n })\n\n if (!s3UploadResponse.ok) {\n const text = await s3UploadResponse.text()\n throw new Error(`Upload failed with status ${s3UploadResponse.status}: ${text}`)\n }\n\n const finalizeResponse = await apiClient.files.finalizeUpload({\n ownerType: \"Workspace\",\n workspaceId: flags.workspaceId,\n fileIds: [uploadResponse.files[0].id],\n })\n\n file = finalizeResponse.files[0]\n } else {\n this.log(`Already uploaded, skipping upload...`)\n }\n\n await fs.unlink(zipPath)\n\n action.stop(\"done\")\n this.log(`✅ Template has been uploaded, checksum: ${file.deduplicationKey}`)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;AAEpC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAIzC,KAAK,UAAU,UAAU,CAAC,CAAS;IACjC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;I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BAC9B,OAAO,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACtC,CAAC,CAAA;YAEF,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAClC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;QAClD,CAAC;QAED,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAExB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnB,IAAI,CAAC,GAAG,CAAC,2CAA2C,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC9E,CAAC;;AArGY;IADZ,YAAY,EAAE;;;;yCAsGd","debug_id":"0c169645-f039-51ba-ba92-f4476aa311e3"}
|
|
1
|
+
{"version":3,"file":"template-upload.js","sources":["../../src/commands/template-upload.ts"],"sourceRoot":"","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport fetch from \"node-fetch\"\nimport { exec as execCallback } from \"node:child_process\"\nimport { createHash, randomUUID } from \"node:crypto\"\nimport { createReadStream } from \"node:fs\"\nimport * as fs from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { promisify } from \"node:util\"\nimport { z, ZodType } from \"zod\"\n\nimport { commonFlags, SentryCommand } from \"../types/index.js\"\n\nconst exec = promisify(execCallback)\n\nconst TemplateUploadConfig = z.object({})\n\ntype TemplateUploadConfig = z.infer<typeof TemplateUploadConfig>\n\nasync function fileExists(p: string) {\n try {\n await fs.access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function computeChecksum(filePath: string) {\n return new Promise<string>((resolve, reject) => {\n const hash = createHash(\"sha256\")\n const stream = createReadStream(filePath)\n\n stream.on(\"error\", reject)\n hash.on(\"error\", reject)\n\n stream.on(\"data\", chunk => hash.update(chunk))\n stream.on(\"end\", () => {\n const digest = hash.digest(\"hex\")\n resolve(digest)\n })\n })\n}\n\nexport default class TemplateUpload extends SentryCommand<TemplateUploadConfig> {\n static override args = {}\n static override description = \"Upload custom prototype app sandbox template\"\n static override examples = [\"<%= config.bin %> <%= command.id %> TemplateUpload \"]\n static override hidden: boolean = true\n static override flags = {\n ...commonFlags,\n workspaceId: Flags.string({ char: \"w\", description: \"Workspace ID to upload the template to\", required: true }),\n }\n\n get commandId(): string {\n return TemplateUpload.id\n }\n\n get configSchema(): ZodType<TemplateUploadConfig> {\n return TemplateUploadConfig\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const apiClient = await this.apiClient()\n const { flags } = await this.parse()\n\n const cwd = process.cwd()\n const pkgPath = path.join(cwd, \"package.json\")\n const modulesPath = path.join(cwd, \"node_modules\")\n const zipPath = path.join(cwd, \".supernova-upload.zip\")\n\n // Validate package json\n if (!(await fileExists(pkgPath))) this.error(\"package.json not found in current directory.\")\n\n // Validate node modules\n if (!(await fileExists(modulesPath)) || !(await fs.stat(modulesPath)).isDirectory()) {\n this.error(`node_modules directory not found in the current directory`)\n }\n\n // Read package json\n let pkg\n try {\n const raw = await fs.readFile(pkgPath, \"utf8\")\n pkg = JSON.parse(raw) as { dependencies: Record<string, string> }\n } catch (error) {\n if (error instanceof Error) this.error(`Failed to read or parse package.json: ${error.message}`)\n else throw error\n }\n\n // Validate dependencies are present\n const depNames = Object.keys(pkg.dependencies)\n const missing: string[] = []\n\n await Promise.all(\n depNames.map(async name => {\n const depDir = path.join(modulesPath, ...name.split(\"/\"))\n if (!(await fileExists(depDir))) {\n missing.push(name)\n }\n }),\n )\n\n if (missing.length > 0) {\n this.error(`Some dependencies were not found in current node modules: [${missing.join(\", \")}]`)\n }\n\n // 6) Create ZIP of current directory\n try {\n await exec(`zip -r \"${zipPath}\" . -x \"*.zip\"`)\n } catch (error) {\n if (error instanceof Error) this.error(`Failed to create zip archive: ${error.message}`)\n else throw error\n }\n\n if (!(await fileExists(zipPath))) this.error(`Upload zip was not produced`)\n\n const stat = await fs.stat(zipPath)\n const checksum = await computeChecksum(zipPath)\n\n action.start(`Uploading ${(stat.size / 1000 / 1000).toFixed(2)}MB`)\n\n const uploadResponse = await apiClient.files.upload({\n ownerType: \"Workspace\",\n workspaceId: flags.workspaceId,\n files: [{ checksum, name: `${randomUUID()}.zip`, size: stat.size }],\n })\n\n if (uploadResponse.files.length === 0) this.error(`Upload endpoint returned no files`)\n\n let file = uploadResponse.files[0]\n if (file.pendingUpload) {\n const [uploadUrl] = uploadResponse.uploadUrls\n if (!uploadUrl) this.error(`File is pending upload, but no upload URL was provided`)\n\n const s3UploadResponse = await fetch(uploadUrl.uploadUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"contentType\",\n \"Content-Length\": stat.size.toString(),\n },\n body: createReadStream(zipPath),\n })\n\n if (!s3UploadResponse.ok) {\n const text = await s3UploadResponse.text()\n throw new Error(`Upload failed with status ${s3UploadResponse.status}: ${text}`)\n }\n\n const finalizeResponse = await apiClient.files.finalizeUpload({\n ownerType: \"Workspace\",\n workspaceId: flags.workspaceId,\n fileIds: [uploadResponse.files[0].id],\n })\n\n file = finalizeResponse.files[0]\n } else {\n this.log(`Already uploaded, skipping upload...`)\n }\n\n await fs.unlink(zipPath)\n\n action.stop(\"done\")\n this.log(`✅ Template has been uploaded, checksum: ${file.deduplicationKey}`)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAA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