@supernovaio/cli 2.0.28 → 2.0.30

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.
@@ -6,18 +6,21 @@ declare const ImportStorybookConfig: z.ZodObject<{
6
6
  from: z.ZodOptional<z.ZodString>;
7
7
  name: z.ZodOptional<z.ZodString>;
8
8
  sourceId: z.ZodOptional<z.ZodString>;
9
+ publicAccess: z.ZodOptional<z.ZodBoolean>;
9
10
  }, "strip", z.ZodTypeAny, {
10
11
  designSystemId?: string | undefined;
11
12
  sourceId?: string | undefined;
12
13
  brandId?: string | undefined;
13
14
  name?: string | undefined;
14
15
  from?: string | undefined;
16
+ publicAccess?: boolean | undefined;
15
17
  }, {
16
18
  designSystemId?: string | undefined;
17
19
  sourceId?: string | undefined;
18
20
  brandId?: string | undefined;
19
21
  name?: string | undefined;
20
22
  from?: string | undefined;
23
+ publicAccess?: boolean | undefined;
21
24
  }>;
22
25
  type ImportStorybookConfig = z.infer<typeof ImportStorybookConfig>;
23
26
  export default class ImportStorybook extends SentryCommand<ImportStorybookConfig> {
@@ -30,6 +33,7 @@ export default class ImportStorybook extends SentryCommand<ImportStorybookConfig
30
33
  from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
34
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
35
  sourceId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ publicAccess: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
37
  };
34
38
  get commandId(): string;
35
39
  get configSchema(): ZodType<ImportStorybookConfig>;
@@ -38,10 +42,11 @@ export default class ImportStorybook extends SentryCommand<ImportStorybookConfig
38
42
  private getDesignSystemId;
39
43
  private getBrandId;
40
44
  private getStorybookDirectory;
45
+ private getIsPublic;
41
46
  private createZipFromDirectory;
42
47
  private getIndexJson;
43
48
  private uploadArchiveToSignedUrl;
44
- private waitForPublishing;
49
+ private publishRemoteSite;
45
50
  private importStorybookStories;
46
51
  private validateStorybookDirectory;
47
52
  private validateZipSize;
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-import.d.ts","sourceRoot":"","sources":["../../src/commands/storybook-import.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAGhC,OAAO,EAAe,aAAa,EAAyC,MAAM,mBAAmB,CAAA;AASrG,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMzB,CAAA;AAEF,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAYlE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC/E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAgD;IAC3E,OAAgB,QAAQ,WAA4D;IACpF,OAAgB,KAAK;;;;;;MAUpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAEjD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAgEnB,gBAAgB;YAwBhB,iBAAiB;YAYjB,UAAU;YAYV,qBAAqB;YAqBrB,sBAAsB;IA0EpC,OAAO,CAAC,YAAY;YAYN,wBAAwB;YAsDxB,iBAAiB;YA2CjB,sBAAsB;IAsDpC,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,eAAe;YAkBT,kBAAkB;CAcjC"}
1
+ {"version":3,"file":"storybook-import.d.ts","sourceRoot":"","sources":["../../src/commands/storybook-import.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAGhC,OAAO,EAAe,aAAa,EAAyC,MAAM,mBAAmB,CAAA;AASrG,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAA;AAEF,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAYlE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC/E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAgD;IAC3E,OAAgB,QAAQ,WAA4D;IACpF,OAAgB,KAAK;;;;;;;MAgBpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAEjD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAmEnB,gBAAgB;YAwBhB,iBAAiB;YAYjB,UAAU;IAYxB,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,WAAW;YAaL,sBAAsB;IA0EpC,OAAO,CAAC,YAAY;YAYN,wBAAwB;YA6CxB,iBAAiB;YA0CjB,sBAAsB;IAsDpC,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,eAAe;YAkBT,kBAAkB;CAcjC"}
@@ -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]="1466cc82-6ec9-54b8-9d89-0a3f6cb158f3")}catch(e){}}();
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]="c5d784d7-ef42-5d2a-a5aa-432179ca71c0")}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);
@@ -32,6 +32,7 @@ const ImportStorybookConfig = z.object({
32
32
  from: z.string().optional(),
33
33
  name: z.string().optional(),
34
34
  sourceId: z.string().optional(),
35
+ publicAccess: z.boolean().optional(),
35
36
  });
36
37
  const storybookEndpoint = (environment, designSystemId, name, format = "html") => {
37
38
  const host = storybookUrlForEnvironment(environment);
@@ -51,6 +52,11 @@ export default class ImportStorybook extends SentryCommand {
51
52
  }),
52
53
  name: Flags.string({ char: "n", description: "Import storybooks with name of" }),
53
54
  sourceId: Flags.string({ char: "s", description: "Import storybooks to source of" }),
55
+ publicAccess: Flags.boolean({
56
+ required: false,
57
+ description: "Allow public access to the published Storybook website. " +
58
+ "Can be used in combination with public documentation.",
59
+ }),
54
60
  };
55
61
  get commandId() {
56
62
  return ImportStorybook.id;
@@ -63,13 +69,13 @@ export default class ImportStorybook extends SentryCommand {
63
69
  const config = this.configService.get();
64
70
  const storybookConfig = config?.storybook ?? {};
65
71
  const { sourceId } = { ...storybookConfig, ...flags };
66
- const storybookDirectory = await this.getStorybookDirectory(flags, storybookConfig);
72
+ const storybookDirectory = this.getStorybookDirectory(flags, storybookConfig);
67
73
  const storybookName = await this.getStorybookName(flags, storybookConfig);
68
74
  const designSystemId = await this.getDesignSystemId(flags, storybookConfig);
69
75
  const brandPersistentId = await this.getBrandId(flags, storybookConfig, designSystemId);
76
+ const isPublic = this.getIsPublic(flags, storybookConfig);
70
77
  const apiClient = await this.apiClient();
71
- const { designSystems } = apiClient;
72
- const { storybookHosting } = designSystems;
78
+ const { designSystems, storybookSites } = apiClient;
73
79
  await this.validateDatasource(designSystems.sources, sourceId, designSystemId);
74
80
  this.log(`Preparing Storybook files from ${storybookDirectory}...`);
75
81
  const { sizeBytes, zipPath } = await this.createZipFromDirectory(storybookDirectory);
@@ -77,13 +83,15 @@ export default class ImportStorybook extends SentryCommand {
77
83
  if (!sizeValidation.isValid) {
78
84
  this.error(sizeValidation.error);
79
85
  }
80
- const { signedUrl, storybookUploadId } = await storybookHosting.getSignedUploadUrl(designSystemId, {
86
+ const { storybookSiteVersion, uploadUrl } = await storybookSites.uploadInit({
87
+ designSystemId,
88
+ isPublic,
81
89
  name: storybookName,
82
90
  });
83
- await this.uploadArchiveToSignedUrl({ designSystemId, storybookName, signedUrl, storybookUploadId, zipPath });
91
+ await this.uploadArchiveToSignedUrl({ uploadUrl, zipPath });
84
92
  this.log("✅ Upload complete.");
85
93
  action.start("Deploying Storybook to private Supernova hosting service");
86
- await this.waitForPublishing({ apiClient, designSystemId, storybookUploadId });
94
+ await this.publishRemoteSite({ apiClient, storybookSiteVersionId: storybookSiteVersion.id });
87
95
  action.stop("\n✅ Private Storybook deployed successfully!");
88
96
  action.start("Updating Storybook stories");
89
97
  const { sourceId: finalSourceId } = await this.importStorybookStories({
@@ -102,6 +110,7 @@ export default class ImportStorybook extends SentryCommand {
102
110
  name: storybookName,
103
111
  brandId: brandPersistentId,
104
112
  sourceId: finalSourceId,
113
+ publicAccess: isPublic,
105
114
  },
106
115
  });
107
116
  }
@@ -142,7 +151,7 @@ export default class ImportStorybook extends SentryCommand {
142
151
  this.error("Parameter `brandId` is required");
143
152
  return brandId;
144
153
  }
145
- async getStorybookDirectory(flags, config) {
154
+ getStorybookDirectory(flags, config) {
146
155
  const from = flags.from ?? config.from;
147
156
  if (!from)
148
157
  this.error("Parameter `from` is required");
@@ -152,6 +161,9 @@ export default class ImportStorybook extends SentryCommand {
152
161
  }
153
162
  return from;
154
163
  }
164
+ getIsPublic(flags, config) {
165
+ return flags.publicAccess ?? config.publicAccess ?? false;
166
+ }
155
167
  async createZipFromDirectory(directoryPath) {
156
168
  const zip = new AdmZip();
157
169
  let totalFiles = 0;
@@ -216,7 +228,7 @@ export default class ImportStorybook extends SentryCommand {
216
228
  return JSON.parse(fs.readFileSync(indexJsonPath, "utf8"));
217
229
  }
218
230
  async uploadArchiveToSignedUrl(input) {
219
- const { designSystemId, storybookName, signedUrl, storybookUploadId, zipPath } = input;
231
+ const { uploadUrl, zipPath } = input;
220
232
  this.log(`Securely uploading ${zipPath} to Supernova...`);
221
233
  const fileBuffer = fs.readFileSync(zipPath);
222
234
  const fileSize = fileBuffer.byteLength;
@@ -229,13 +241,10 @@ export default class ImportStorybook extends SentryCommand {
229
241
  }, cliProgress.Presets.shades_classic);
230
242
  progressBar.start(fileSizeKB, 0);
231
243
  try {
232
- await axios.put(signedUrl, fileBuffer, {
244
+ await axios.put(uploadUrl, fileBuffer, {
233
245
  headers: {
234
246
  "Content-Length": fileSize,
235
247
  "Content-Type": "application/zip",
236
- designSystemId,
237
- storybookUploadId,
238
- ...(storybookName && { name: storybookName }),
239
248
  },
240
249
  onUploadProgress(progressEvent) {
241
250
  const loaded = progressEvent.loaded || 0;
@@ -251,26 +260,27 @@ export default class ImportStorybook extends SentryCommand {
251
260
  throw error;
252
261
  }
253
262
  }
254
- async waitForPublishing(input) {
255
- const { apiClient, designSystemId, storybookUploadId } = input;
263
+ async publishRemoteSite(input) {
264
+ const { apiClient, storybookSiteVersionId } = input;
256
265
  const getStatus = async () => {
257
- const { status } = await apiClient.designSystems.storybookHosting.getUploadStatus(designSystemId, storybookUploadId);
258
- return status;
266
+ const { storybookSiteVersion } = await apiClient.storybookSites.getVersion(storybookSiteVersionId);
267
+ return storybookSiteVersion.uploadStatus;
259
268
  };
260
- let lastStatus = "Unknown";
261
- let unknownStatusCount = 0;
262
- for (let i = 0; unknownStatusCount < 10 && i < 15 * 60; i++) {
269
+ const { storybookSiteVersion: finalizedVersion } = await apiClient.storybookSites.uploadFinailize(storybookSiteVersionId);
270
+ let lastStatus = finalizedVersion.uploadStatus;
271
+ let inProgressStatusCount = 0;
272
+ for (let i = 0; inProgressStatusCount < 10 && i < 15 * 60; i++) {
263
273
  lastStatus = await getStatus();
264
- if (lastStatus === "Unknown")
265
- unknownStatusCount++;
274
+ if (lastStatus === "InProgress")
275
+ inProgressStatusCount++;
266
276
  else
267
- unknownStatusCount = 0;
277
+ inProgressStatusCount = 0;
268
278
  if (lastStatus === "Completed" || lastStatus === "Failed")
269
279
  break;
270
280
  await sleep(1000);
271
281
  }
272
282
  switch (lastStatus) {
273
- case "Unknown":
283
+ case "Timeout":
274
284
  return this.error("Storybook deployment initialization has timed out");
275
285
  case "Failed":
276
286
  return this.error("Storybook deployment has failed");
@@ -361,4 +371,4 @@ __decorate([
361
371
  __metadata("design:returntype", Promise)
362
372
  ], ImportStorybook.prototype, "run", null);
363
373
  //# sourceMappingURL=storybook-import.js.map
364
- //# debugId=1466cc82-6ec9-54b8-9d89-0a3f6cb158f3
374
+ //# debugId=c5d784d7-ef42-5d2a-a5aa-432179ca71c0
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-import.js","sources":["../../src/commands/storybook-import.ts"],"sourceRoot":"","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport slugify from \"@sindresorhus/slugify\"\nimport { DesignSystemSourcesEndpoint, DTODataSourceStorybook, SupernovaApiClient } from \"@supernova-studio/client\"\nimport AdmZip from \"adm-zip\"\nimport axios from \"axios\"\nimport cliProgress from \"cli-progress\"\nimport inquirer from \"inquirer\"\nimport * as fs from \"node:fs\"\nimport path from \"node:path\"\nimport terminalLink from \"terminal-link\"\nimport { z, ZodType } from \"zod\"\n\nimport { SupernovaConfigStorybook } from \"../types/config.js\"\nimport { commonFlags, SentryCommand, storybookUrlForEnvironment, TargetEnv } from \"../types/index.js\"\nimport { sleep } from \"../utils/common.js\"\n\n// Maximum allowed size for storybook zip file (500MB)\nconst MAX_ZIP_SIZE_BYTES = 500 * 1024 * 1024\n\nconst bytesToKB = (bytes: number) => (bytes / 1024).toFixed(2)\nconst bytesToMB = (bytes: number) => (bytes / (1024 * 1024)).toFixed(2)\n\nconst ImportStorybookConfig = z.object({\n brandId: z.string().optional(),\n designSystemId: z.string().optional(),\n from: z.string().optional(),\n name: z.string().optional(),\n sourceId: z.string().optional(),\n})\n\ntype ImportStorybookConfig = z.infer<typeof ImportStorybookConfig>\n\nconst storybookEndpoint = (\n environment: TargetEnv,\n designSystemId: string,\n name: string,\n format: \"html\" | \"json\" = \"html\",\n): string => {\n const host = storybookUrlForEnvironment(environment)\n return `${host}/design-systems/${designSystemId}/alias/${name}/index.${format}`\n}\n\nexport default class ImportStorybook extends SentryCommand<ImportStorybookConfig> {\n static override args = {}\n static override description = \"Import storybook static export to Supernova\"\n static override examples = [\"<%= config.bin %> <%= command.id %> import-storybook \"]\n static override flags = {\n ...commonFlags,\n brandId: Flags.string({ char: \"b\", description: \"Import storybooks to brand of\" }),\n designSystemId: Flags.string({ char: \"d\", description: \"Import storybooks to design system of\" }),\n from: Flags.string({\n char: \"f\",\n description: \"Directory with storybook static export to import.\",\n }),\n name: Flags.string({ char: \"n\", description: \"Import storybooks with name of\" }),\n sourceId: Flags.string({ char: \"s\", description: \"Import storybooks to source of\" }),\n }\n\n get commandId(): string {\n return ImportStorybook.id\n }\n\n get configSchema(): ZodType<ImportStorybookConfig> {\n return ImportStorybookConfig\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse()\n const config = this.configService.get()\n const storybookConfig = config?.storybook ?? {}\n\n const { sourceId } = { ...storybookConfig, ...flags }\n\n const storybookDirectory = await this.getStorybookDirectory(flags, storybookConfig)\n const storybookName = await this.getStorybookName(flags, storybookConfig)\n const designSystemId = await this.getDesignSystemId(flags, storybookConfig)\n const brandPersistentId = await this.getBrandId(flags, storybookConfig, designSystemId)\n\n const apiClient = await this.apiClient()\n\n const { designSystems } = apiClient\n const { storybookHosting } = designSystems\n\n await this.validateDatasource(designSystems.sources, sourceId, designSystemId)\n\n this.log(`Preparing Storybook files from ${storybookDirectory}...`)\n const { sizeBytes, zipPath } = await this.createZipFromDirectory(storybookDirectory)\n\n const sizeValidation = this.validateZipSize(zipPath, sizeBytes)\n if (!sizeValidation.isValid) {\n this.error(sizeValidation.error!)\n }\n\n const { signedUrl, storybookUploadId } = await storybookHosting.getSignedUploadUrl(designSystemId, {\n name: storybookName,\n })\n\n await this.uploadArchiveToSignedUrl({ designSystemId, storybookName, signedUrl, storybookUploadId, zipPath })\n this.log(\"✅ Upload complete.\")\n\n action.start(\"Deploying Storybook to private Supernova hosting service\")\n await this.waitForPublishing({ apiClient, designSystemId, storybookUploadId })\n action.stop(\"\\n✅ Private Storybook deployed successfully!\")\n\n action.start(\"Updating Storybook stories\")\n const { sourceId: finalSourceId } = await this.importStorybookStories({\n apiClient,\n designSystemId,\n brandPersistentId,\n sourceId,\n storybookDirectory,\n storybookName,\n })\n action.stop(\"\\n✅ Storybook stories have been updated!\")\n\n this.configService.update({\n storybook: {\n designSystemId,\n from: storybookDirectory,\n name: storybookName,\n brandId: brandPersistentId,\n sourceId: finalSourceId,\n },\n })\n }\n\n //\n // Argument parsing\n //\n\n private async getStorybookName(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n let result = flags.name ?? config.name\n\n if (!result) {\n const choice = await inquirer.prompt([\n {\n message: \"Enter name of your storybook instance (it will be part of the URL)\",\n name: \"name\",\n type: \"input\",\n },\n ])\n\n if (typeof choice.name === \"string\") {\n result = choice.name\n }\n }\n\n if (!result) {\n this.error(\"Parameter `name` is required\")\n }\n\n return slugify(result, { lowercase: true })\n }\n\n private async getDesignSystemId(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n let designSystemId = flags.designSystemId ?? config.designSystemId\n\n if (!designSystemId) {\n designSystemId = await this.promptDesignSystemId()\n }\n\n if (!designSystemId) this.error(\"Parameter `designSystemId` is required\")\n\n return designSystemId\n }\n\n private async getBrandId(flags: ImportStorybookConfig, config: SupernovaConfigStorybook, designSystemId: string) {\n let brandId = flags.brandId ?? config.brandId\n\n if (!brandId) {\n brandId = await this.promptBrandId(designSystemId)\n }\n\n if (!brandId) this.error(\"Parameter `brandId` is required\")\n\n return brandId\n }\n\n private async getStorybookDirectory(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n const from = flags.from ?? config.from\n if (!from) this.error(\"Parameter `from` is required\")\n\n const directoryValidation = this.validateStorybookDirectory(from)\n if (!directoryValidation.isValid) {\n this.error(directoryValidation.error)\n }\n\n return from\n }\n\n //\n // Upload to hosting\n //\n\n /**\n * Creates a zip archive from a directory\n * @param directoryPath Path to the directory to zip\n * @returns Path to the created zip file and its size\n */\n private async createZipFromDirectory(directoryPath: string): Promise<{ sizeBytes: number; zipPath: string }> {\n const zip = new AdmZip()\n\n let totalFiles = 0\n let processedFiles = 0\n\n const countFiles = (currentPath: string) => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n\n if (stat.isDirectory()) {\n countFiles(filePath)\n } else {\n totalFiles++\n }\n }\n }\n\n countFiles(directoryPath)\n\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Creating zip [{bar}] {percentage}% | {value}/{total} files | Current: {filename}\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n progressBar.start(totalFiles, 0, {\n filename: \"Initializing...\",\n })\n\n const addFilesToZip = (currentPath: string, relativePath = \"\") => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n const displayPath = path.join(relativePath, file)\n\n if (stat.isDirectory()) {\n addFilesToZip(filePath, displayPath)\n } else {\n // Update the progress bar with the current file\n processedFiles++\n progressBar.update(processedFiles, {\n filename:\n displayPath.length > 40 ? \"...\" + displayPath.slice(Math.max(0, displayPath.length - 37)) : displayPath,\n })\n\n zip.addLocalFile(filePath, relativePath)\n }\n }\n }\n\n try {\n addFilesToZip(directoryPath)\n } finally {\n progressBar.stop()\n }\n\n const zipPath = `${directoryPath}.zip`\n await zip.writeZipPromise(zipPath)\n\n const sizeBytes = fs.statSync(zipPath).size\n\n return { sizeBytes, zipPath }\n }\n\n private getIndexJson(directoryPath: string) {\n const indexJsonPath = path.join(directoryPath, \"index.json\")\n if (!fs.existsSync(indexJsonPath)) {\n return \"{}\"\n }\n\n return JSON.parse(fs.readFileSync(indexJsonPath, \"utf8\"))\n }\n\n /**\n * Uploads the zip archive to the provided signed URL\n */\n private async uploadArchiveToSignedUrl(input: {\n designSystemId: string\n signedUrl: string\n storybookName?: string\n storybookUploadId: string\n zipPath: string\n }): Promise<void> {\n const { designSystemId, storybookName, signedUrl, storybookUploadId, zipPath } = input\n this.log(`Securely uploading ${zipPath} to Supernova...`)\n\n const fileBuffer = fs.readFileSync(zipPath)\n const fileSize = fileBuffer.byteLength\n const fileSizeKB = Number.parseFloat(bytesToKB(fileSize))\n\n // Create a new progress bar\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Uploading |{bar}| {percentage}% || {value}/{total} kB\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n // Start the progress bar\n progressBar.start(fileSizeKB, 0)\n\n try {\n await axios.put(signedUrl, fileBuffer, {\n headers: {\n \"Content-Length\": fileSize,\n \"Content-Type\": \"application/zip\",\n designSystemId,\n storybookUploadId,\n ...(storybookName && { name: storybookName }),\n },\n onUploadProgress(progressEvent) {\n const loaded = progressEvent.loaded || 0\n const loadedKB = Number.parseFloat(bytesToKB(loaded))\n progressBar.update(loadedKB)\n },\n })\n\n // Complete the progress bar\n progressBar.update(fileSizeKB)\n progressBar.stop()\n } catch (error) {\n // Make sure to stop the progress bar if there's an error\n progressBar.stop()\n throw error\n }\n }\n\n private async waitForPublishing(input: {\n apiClient: SupernovaApiClient\n designSystemId: string\n storybookUploadId: string\n }): Promise<void> {\n const { apiClient, designSystemId, storybookUploadId } = input\n\n const getStatus = async () => {\n const { status } = await apiClient.designSystems.storybookHosting.getUploadStatus(\n designSystemId,\n storybookUploadId,\n )\n return status\n }\n\n let lastStatus: Awaited<ReturnType<typeof getStatus>> = \"Unknown\"\n let unknownStatusCount = 0\n\n // Wait for publishing to complete\n // Do 15 * 60 tries roughly correspond to at least 15 minutes\n for (let i = 0; unknownStatusCount < 10 && i < 15 * 60; i++) {\n lastStatus = await getStatus()\n\n // Unknown status means the upload hasn't been picked up yet, we tolerate it for very limited amount of time\n if (lastStatus === \"Unknown\") unknownStatusCount++\n else unknownStatusCount = 0\n\n if (lastStatus === \"Completed\" || lastStatus === \"Failed\") break\n\n await sleep(1000)\n }\n\n // React to publishing status\n switch (lastStatus) {\n case \"Unknown\":\n return this.error(\"Storybook deployment initialization has timed out\")\n case \"Failed\":\n return this.error(\"Storybook deployment has failed\")\n case \"InProgress\":\n return this.error(\"Storybook deployment has timed out\")\n }\n }\n\n private async importStorybookStories(input: {\n apiClient: SupernovaApiClient\n brandPersistentId: string\n designSystemId: string\n sourceId: string | undefined\n storybookDirectory: string\n storybookName: string\n }): Promise<{ sourceId: string }> {\n const { apiClient, brandPersistentId, designSystemId, storybookDirectory, storybookName } = input\n let { sourceId } = input\n\n const sourcesEndpoint = apiClient.designSystems.sources\n const storybookUrl = storybookEndpoint(this.env, designSystemId, storybookName)\n\n try {\n let storiesCount = 0\n if (sourceId) {\n const sourceUpdateResult = await sourcesEndpoint.updateStorybookImport(designSystemId, \"head\", {\n payload: this.getIndexJson(storybookDirectory),\n sourceId,\n })\n storiesCount = sourceUpdateResult.storiesCount\n } else {\n const { source } = await sourcesEndpoint.create(designSystemId, {\n brandPersistentId,\n description: \"CLI\",\n indexUrl: storybookEndpoint(this.env, designSystemId, storybookName, \"json\"),\n payload: this.getIndexJson(storybookDirectory),\n type: \"Storybook\",\n userUrl: storybookUrl,\n fileName: storybookName,\n })\n\n storiesCount = (source as unknown as DTODataSourceStorybook).storybook.storiesCount\n sourceId = source.id\n }\n\n this.log(`✅ Imported ${storiesCount} component stories into Supernova!`)\n const link = terminalLink(\"here\", storybookUrl, { fallback: (_, url) => url })\n this.log(`🔒 Access your Storybook ${link}`)\n\n return { sourceId }\n } catch (error) {\n this.error(\n `Failed to connect Storybook as data source: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n }\n\n /**\n * Validates if a directory is a valid storybook static export\n * @param directoryPath Path to the storybook directory\n * @returns An object indicating if the directory is valid and an error message if not\n */\n private validateStorybookDirectory(directoryPath: string): { error: string; isValid: false } | { isValid: true } {\n if (!fs.existsSync(directoryPath)) {\n return { error: `Directory not found: ${directoryPath}`, isValid: false }\n }\n\n if (!fs.statSync(directoryPath).isDirectory()) {\n return { error: `Not a directory: ${directoryPath}`, isValid: false }\n }\n\n // Check for essential storybook files\n const requiredFiles = [\"index.html\", \"iframe.html\"]\n const missingFiles = requiredFiles.filter(file => !fs.existsSync(path.join(directoryPath, file)))\n\n if (missingFiles.length > 0) {\n return {\n error: `Directory does not appear to be a valid Storybook export. Missing files: ${missingFiles.join(\", \")}`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n /**\n * Validates if a zip file size is within the allowed limits\n * @param zipPath Path to the zip file\n * @param sizeBytes Size of the zip file in bytes\n * @returns An object indicating if the zip is valid and an error message if not\n */\n private validateZipSize(zipPath: string, sizeBytes: number): { error?: string; isValid: boolean } {\n if (sizeBytes > MAX_ZIP_SIZE_BYTES) {\n // Delete the zip file if it's too large\n try {\n fs.unlinkSync(zipPath)\n } catch {\n // Ignore errors during cleanup\n }\n\n return {\n error: `Zip file is too large: ${bytesToMB(sizeBytes)}MB. Maximum allowed size is ${bytesToMB(MAX_ZIP_SIZE_BYTES)}MB`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n private async validateDatasource(\n sourcesEndpoint: DesignSystemSourcesEndpoint,\n sourceId: string | undefined,\n designSystemId: string,\n ) {\n if (sourceId) {\n const storybookDatasource = await sourcesEndpoint.get(designSystemId, sourceId).catch(() => null)\n if (!storybookDatasource) {\n this.error(\n \"This data source was deleted. Remove supernova.config.json and try again to create a new data source.\",\n )\n }\n }\n }\n}\n"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,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;YACjG,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACzB,IAAI,CAAC,KAAK,CACR,uGAAuG,CACxG,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;;AA9aY;IADZ,YAAY,EAAE;;;;0CA2Dd","debug_id":"1466cc82-6ec9-54b8-9d89-0a3f6cb158f3"}
1
+ {"version":3,"file":"storybook-import.js","sources":["../../src/commands/storybook-import.ts"],"sourceRoot":"","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport slugify from \"@sindresorhus/slugify\"\nimport { DesignSystemSourcesEndpoint, DTODataSourceStorybook, SupernovaApiClient } from \"@supernova-studio/client\"\nimport AdmZip from \"adm-zip\"\nimport axios from \"axios\"\nimport cliProgress from \"cli-progress\"\nimport inquirer from \"inquirer\"\nimport * as fs from \"node:fs\"\nimport path from \"node:path\"\nimport terminalLink from \"terminal-link\"\nimport { z, ZodType } from \"zod\"\n\nimport { SupernovaConfigStorybook } from \"../types/config.js\"\nimport { commonFlags, SentryCommand, storybookUrlForEnvironment, TargetEnv } from \"../types/index.js\"\nimport { sleep } from \"../utils/common.js\"\n\n// Maximum allowed size for storybook zip file (500MB)\nconst MAX_ZIP_SIZE_BYTES = 500 * 1024 * 1024\n\nconst bytesToKB = (bytes: number) => (bytes / 1024).toFixed(2)\nconst bytesToMB = (bytes: number) => (bytes / (1024 * 1024)).toFixed(2)\n\nconst ImportStorybookConfig = z.object({\n brandId: z.string().optional(),\n designSystemId: z.string().optional(),\n from: z.string().optional(),\n name: z.string().optional(),\n sourceId: z.string().optional(),\n publicAccess: z.boolean().optional(),\n})\n\ntype ImportStorybookConfig = z.infer<typeof ImportStorybookConfig>\n\nconst storybookEndpoint = (\n environment: TargetEnv,\n designSystemId: string,\n name: string,\n format: \"html\" | \"json\" = \"html\",\n): string => {\n const host = storybookUrlForEnvironment(environment)\n return `${host}/design-systems/${designSystemId}/alias/${name}/index.${format}`\n}\n\nexport default class ImportStorybook extends SentryCommand<ImportStorybookConfig> {\n static override args = {}\n static override description = \"Import storybook static export to Supernova\"\n static override examples = [\"<%= config.bin %> <%= command.id %> import-storybook \"]\n static override flags = {\n ...commonFlags,\n brandId: Flags.string({ char: \"b\", description: \"Import storybooks to brand of\" }),\n designSystemId: Flags.string({ char: \"d\", description: \"Import storybooks to design system of\" }),\n from: Flags.string({\n char: \"f\",\n description: \"Directory with storybook static export to import.\",\n }),\n name: Flags.string({ char: \"n\", description: \"Import storybooks with name of\" }),\n sourceId: Flags.string({ char: \"s\", description: \"Import storybooks to source of\" }),\n publicAccess: Flags.boolean({\n required: false,\n description:\n \"Allow public access to the published Storybook website. \" +\n \"Can be used in combination with public documentation.\",\n }),\n }\n\n get commandId(): string {\n return ImportStorybook.id\n }\n\n get configSchema(): ZodType<ImportStorybookConfig> {\n return ImportStorybookConfig\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse()\n const config = this.configService.get()\n const storybookConfig = config?.storybook ?? {}\n\n const { sourceId } = { ...storybookConfig, ...flags }\n\n const storybookDirectory = this.getStorybookDirectory(flags, storybookConfig)\n const storybookName = await this.getStorybookName(flags, storybookConfig)\n const designSystemId = await this.getDesignSystemId(flags, storybookConfig)\n const brandPersistentId = await this.getBrandId(flags, storybookConfig, designSystemId)\n const isPublic = this.getIsPublic(flags, storybookConfig)\n\n const apiClient = await this.apiClient()\n\n const { designSystems, storybookSites } = apiClient\n\n await this.validateDatasource(designSystems.sources, sourceId, designSystemId)\n\n this.log(`Preparing Storybook files from ${storybookDirectory}...`)\n const { sizeBytes, zipPath } = await this.createZipFromDirectory(storybookDirectory)\n\n const sizeValidation = this.validateZipSize(zipPath, sizeBytes)\n if (!sizeValidation.isValid) {\n this.error(sizeValidation.error!)\n }\n\n const { storybookSiteVersion, uploadUrl } = await storybookSites.uploadInit({\n designSystemId,\n isPublic,\n name: storybookName,\n })\n\n await this.uploadArchiveToSignedUrl({ uploadUrl, zipPath })\n this.log(\"✅ Upload complete.\")\n\n action.start(\"Deploying Storybook to private Supernova hosting service\")\n await this.publishRemoteSite({ apiClient, storybookSiteVersionId: storybookSiteVersion.id })\n action.stop(\"\\n✅ Private Storybook deployed successfully!\")\n\n action.start(\"Updating Storybook stories\")\n const { sourceId: finalSourceId } = await this.importStorybookStories({\n apiClient,\n designSystemId,\n brandPersistentId,\n sourceId,\n storybookDirectory,\n storybookName,\n })\n action.stop(\"\\n✅ Storybook stories have been updated!\")\n\n this.configService.update({\n storybook: {\n designSystemId,\n from: storybookDirectory,\n name: storybookName,\n brandId: brandPersistentId,\n sourceId: finalSourceId,\n publicAccess: isPublic,\n },\n })\n }\n\n //\n // Argument parsing\n //\n\n private async getStorybookName(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n let result = flags.name ?? config.name\n\n if (!result) {\n const choice = await inquirer.prompt([\n {\n message: \"Enter name of your storybook instance (it will be part of the URL)\",\n name: \"name\",\n type: \"input\",\n },\n ])\n\n if (typeof choice.name === \"string\") {\n result = choice.name\n }\n }\n\n if (!result) {\n this.error(\"Parameter `name` is required\")\n }\n\n return slugify(result, { lowercase: true })\n }\n\n private async getDesignSystemId(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n let designSystemId = flags.designSystemId ?? config.designSystemId\n\n if (!designSystemId) {\n designSystemId = await this.promptDesignSystemId()\n }\n\n if (!designSystemId) this.error(\"Parameter `designSystemId` is required\")\n\n return designSystemId\n }\n\n private async getBrandId(flags: ImportStorybookConfig, config: SupernovaConfigStorybook, designSystemId: string) {\n let brandId = flags.brandId ?? config.brandId\n\n if (!brandId) {\n brandId = await this.promptBrandId(designSystemId)\n }\n\n if (!brandId) this.error(\"Parameter `brandId` is required\")\n\n return brandId\n }\n\n private getStorybookDirectory(flags: ImportStorybookConfig, config: SupernovaConfigStorybook) {\n const from = flags.from ?? config.from\n if (!from) this.error(\"Parameter `from` is required\")\n\n const directoryValidation = this.validateStorybookDirectory(from)\n if (!directoryValidation.isValid) {\n this.error(directoryValidation.error)\n }\n\n return from\n }\n\n private getIsPublic(flags: ImportStorybookConfig, config: SupernovaConfigStorybook): boolean {\n return flags.publicAccess ?? config.publicAccess ?? false\n }\n\n //\n // Upload to hosting\n //\n\n /**\n * Creates a zip archive from a directory\n * @param directoryPath Path to the directory to zip\n * @returns Path to the created zip file and its size\n */\n private async createZipFromDirectory(directoryPath: string): Promise<{ sizeBytes: number; zipPath: string }> {\n const zip = new AdmZip()\n\n let totalFiles = 0\n let processedFiles = 0\n\n const countFiles = (currentPath: string) => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n\n if (stat.isDirectory()) {\n countFiles(filePath)\n } else {\n totalFiles++\n }\n }\n }\n\n countFiles(directoryPath)\n\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Creating zip [{bar}] {percentage}% | {value}/{total} files | Current: {filename}\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n progressBar.start(totalFiles, 0, {\n filename: \"Initializing...\",\n })\n\n const addFilesToZip = (currentPath: string, relativePath = \"\") => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n const displayPath = path.join(relativePath, file)\n\n if (stat.isDirectory()) {\n addFilesToZip(filePath, displayPath)\n } else {\n // Update the progress bar with the current file\n processedFiles++\n progressBar.update(processedFiles, {\n filename:\n displayPath.length > 40 ? \"...\" + displayPath.slice(Math.max(0, displayPath.length - 37)) : displayPath,\n })\n\n zip.addLocalFile(filePath, relativePath)\n }\n }\n }\n\n try {\n addFilesToZip(directoryPath)\n } finally {\n progressBar.stop()\n }\n\n const zipPath = `${directoryPath}.zip`\n await zip.writeZipPromise(zipPath)\n\n const sizeBytes = fs.statSync(zipPath).size\n\n return { sizeBytes, zipPath }\n }\n\n private getIndexJson(directoryPath: string) {\n const indexJsonPath = path.join(directoryPath, \"index.json\")\n if (!fs.existsSync(indexJsonPath)) {\n return \"{}\"\n }\n\n return JSON.parse(fs.readFileSync(indexJsonPath, \"utf8\"))\n }\n\n /**\n * Uploads the zip archive to the provided signed URL\n */\n private async uploadArchiveToSignedUrl(input: { uploadUrl: string; zipPath: string }): Promise<void> {\n const { uploadUrl, zipPath } = input\n this.log(`Securely uploading ${zipPath} to Supernova...`)\n\n const fileBuffer = fs.readFileSync(zipPath)\n const fileSize = fileBuffer.byteLength\n const fileSizeKB = Number.parseFloat(bytesToKB(fileSize))\n\n // Create a new progress bar\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Uploading |{bar}| {percentage}% || {value}/{total} kB\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n // Start the progress bar\n progressBar.start(fileSizeKB, 0)\n\n try {\n await axios.put(uploadUrl, fileBuffer, {\n headers: {\n \"Content-Length\": fileSize,\n \"Content-Type\": \"application/zip\",\n },\n onUploadProgress(progressEvent) {\n const loaded = progressEvent.loaded || 0\n const loadedKB = Number.parseFloat(bytesToKB(loaded))\n progressBar.update(loadedKB)\n },\n })\n\n // Complete the progress bar\n progressBar.update(fileSizeKB)\n progressBar.stop()\n } catch (error) {\n // Make sure to stop the progress bar if there's an error\n progressBar.stop()\n throw error\n }\n }\n\n private async publishRemoteSite(input: {\n apiClient: SupernovaApiClient\n storybookSiteVersionId: string\n }): Promise<void> {\n const { apiClient, storybookSiteVersionId } = input\n\n const getStatus = async () => {\n const { storybookSiteVersion } = await apiClient.storybookSites.getVersion(storybookSiteVersionId)\n return storybookSiteVersion.uploadStatus\n }\n\n const { storybookSiteVersion: finalizedVersion } =\n await apiClient.storybookSites.uploadFinailize(storybookSiteVersionId)\n\n let lastStatus = finalizedVersion.uploadStatus\n let inProgressStatusCount = 0\n\n // Wait for publishing to complete\n // Do 15 * 60 tries roughly correspond to at least 15 minutes\n for (let i = 0; inProgressStatusCount < 10 && i < 15 * 60; i++) {\n lastStatus = await getStatus()\n\n // Unknown status means the upload hasn't been picked up yet, we tolerate it for very limited amount of time\n if (lastStatus === \"InProgress\") inProgressStatusCount++\n else inProgressStatusCount = 0\n\n if (lastStatus === \"Completed\" || lastStatus === \"Failed\") break\n\n await sleep(1000)\n }\n\n // React to publishing status\n switch (lastStatus) {\n case \"Timeout\":\n return this.error(\"Storybook deployment initialization has timed out\")\n case \"Failed\":\n return this.error(\"Storybook deployment has failed\")\n case \"InProgress\":\n return this.error(\"Storybook deployment has timed out\")\n }\n }\n\n private async importStorybookStories(input: {\n apiClient: SupernovaApiClient\n brandPersistentId: string\n designSystemId: string\n sourceId: string | undefined\n storybookDirectory: string\n storybookName: string\n }): Promise<{ sourceId: string }> {\n const { apiClient, brandPersistentId, designSystemId, storybookDirectory, storybookName } = input\n let { sourceId } = input\n\n const sourcesEndpoint = apiClient.designSystems.sources\n const storybookUrl = storybookEndpoint(this.env, designSystemId, storybookName)\n\n try {\n let storiesCount = 0\n if (sourceId) {\n const sourceUpdateResult = await sourcesEndpoint.updateStorybookImport(designSystemId, \"head\", {\n payload: this.getIndexJson(storybookDirectory),\n sourceId,\n })\n storiesCount = sourceUpdateResult.storiesCount\n } else {\n const { source } = await sourcesEndpoint.create(designSystemId, {\n brandPersistentId,\n description: \"CLI\",\n indexUrl: storybookEndpoint(this.env, designSystemId, storybookName, \"json\"),\n payload: this.getIndexJson(storybookDirectory),\n type: \"Storybook\",\n userUrl: storybookUrl,\n fileName: storybookName,\n })\n\n storiesCount = (source as unknown as DTODataSourceStorybook).storybook.storiesCount\n sourceId = source.id\n }\n\n this.log(`✅ Imported ${storiesCount} component stories into Supernova!`)\n const link = terminalLink(\"here\", storybookUrl, { fallback: (_, url) => url })\n this.log(`🔒 Access your Storybook ${link}`)\n\n return { sourceId }\n } catch (error) {\n this.error(\n `Failed to connect Storybook as data source: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n }\n\n /**\n * Validates if a directory is a valid storybook static export\n * @param directoryPath Path to the storybook directory\n * @returns An object indicating if the directory is valid and an error message if not\n */\n private validateStorybookDirectory(directoryPath: string): { error: string; isValid: false } | { isValid: true } {\n if (!fs.existsSync(directoryPath)) {\n return { error: `Directory not found: ${directoryPath}`, isValid: false }\n }\n\n if (!fs.statSync(directoryPath).isDirectory()) {\n return { error: `Not a directory: ${directoryPath}`, isValid: false }\n }\n\n // Check for essential storybook files\n const requiredFiles = [\"index.html\", \"iframe.html\"]\n const missingFiles = requiredFiles.filter(file => !fs.existsSync(path.join(directoryPath, file)))\n\n if (missingFiles.length > 0) {\n return {\n error: `Directory does not appear to be a valid Storybook export. Missing files: ${missingFiles.join(\", \")}`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n /**\n * Validates if a zip file size is within the allowed limits\n * @param zipPath Path to the zip file\n * @param sizeBytes Size of the zip file in bytes\n * @returns An object indicating if the zip is valid and an error message if not\n */\n private validateZipSize(zipPath: string, sizeBytes: number): { error?: string; isValid: boolean } {\n if (sizeBytes > MAX_ZIP_SIZE_BYTES) {\n // Delete the zip file if it's too large\n try {\n fs.unlinkSync(zipPath)\n } catch {\n // Ignore errors during cleanup\n }\n\n return {\n error: `Zip file is too large: ${bytesToMB(sizeBytes)}MB. Maximum allowed size is ${bytesToMB(MAX_ZIP_SIZE_BYTES)}MB`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n private async validateDatasource(\n sourcesEndpoint: DesignSystemSourcesEndpoint,\n sourceId: string | undefined,\n designSystemId: string,\n ) {\n if (sourceId) {\n const storybookDatasource = await sourcesEndpoint.get(designSystemId, sourceId).catch(() => null)\n if (!storybookDatasource) {\n this.error(\n \"This data source was deleted. Remove supernova.config.json and try again to create a new data source.\",\n )\n }\n }\n }\n}\n"],"names":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;+BAAqD,CAAC;4BAAkD,CAAC;sCAA4D,CAAC;4CAAmE,CAAC;qCAA2D,CAAC;iCAAuD,CAAC;0BAAiD,CAAC;;;;;;uBAAiU,CAAC;kBAAsC,CAAC;;;CADjo5ne"}
1
+ {"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../src/services/user.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,kBAAkB;IAEvD,KAAK;;;;;;;wBAIwk2ne,CAAC;sBAA4C,CAAC;0BAAgD,CAAC;+BAAmC,CAAC;uCAA6D,CAAC;8CAAoE,CAAC;8BAAoD,CAAC;4BAAoG,CAAC;yBAA+C,CAAC;4BAAkD,CAAC;oCAA+G,CAAC;sCAA4D,CAAC;iDAAuE,CAAC;4BAAmD,CAAC;iDAAuE,CAAC;;qBAA2E,CAAC;mCAAuC,CAAC;+BAAqD,CAAC;4BAAkD,CAAC;sCAA4D,CAAC;4CAAmE,CAAC;qCAA2D,CAAC;iCAAuD,CAAC;0BAAiD,CAAC;;2BAA8M,CAAC;mCAAuC,CAAC;+BAAqD,CAAC;4BAAkD,CAAC;sCAA4D,CAAC;4CAAmE,CAAC;qCAA2D,CAAC;iCAAuD,CAAC;0BAAiD,CAAC;;;;;;uBAAiU,CAAC;kBAAsC,CAAC;;;CADt76ne"}
@@ -5,18 +5,21 @@ export declare const SupernovaConfigStorybook: z.ZodObject<{
5
5
  brandId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
6
6
  name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
7
7
  from: z.ZodCatch<z.ZodOptional<z.ZodString>>;
8
+ publicAccess: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  designSystemId?: string | undefined;
10
11
  sourceId?: string | undefined;
11
12
  brandId?: string | undefined;
12
13
  name?: string | undefined;
13
14
  from?: string | undefined;
15
+ publicAccess?: boolean | undefined;
14
16
  }, {
15
17
  designSystemId?: unknown;
16
18
  sourceId?: unknown;
17
19
  brandId?: unknown;
18
20
  name?: unknown;
19
21
  from?: unknown;
22
+ publicAccess?: unknown;
20
23
  }>;
21
24
  export declare const SupernovaConfig: z.ZodCatch<z.ZodObject<{
22
25
  storybook: z.ZodCatch<z.ZodOptional<z.ZodObject<{
@@ -25,18 +28,21 @@ export declare const SupernovaConfig: z.ZodCatch<z.ZodObject<{
25
28
  brandId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
26
29
  name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
27
30
  from: z.ZodCatch<z.ZodOptional<z.ZodString>>;
31
+ publicAccess: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
28
32
  }, "strip", z.ZodTypeAny, {
29
33
  designSystemId?: string | undefined;
30
34
  sourceId?: string | undefined;
31
35
  brandId?: string | undefined;
32
36
  name?: string | undefined;
33
37
  from?: string | undefined;
38
+ publicAccess?: boolean | undefined;
34
39
  }, {
35
40
  designSystemId?: unknown;
36
41
  sourceId?: unknown;
37
42
  brandId?: unknown;
38
43
  name?: unknown;
39
44
  from?: unknown;
45
+ publicAccess?: unknown;
40
46
  }>>>;
41
47
  }, "strip", z.ZodTypeAny, {
42
48
  storybook?: {
@@ -45,6 +51,7 @@ export declare const SupernovaConfig: z.ZodCatch<z.ZodObject<{
45
51
  brandId?: string | undefined;
46
52
  name?: string | undefined;
47
53
  from?: string | undefined;
54
+ publicAccess?: boolean | undefined;
48
55
  } | undefined;
49
56
  }, {
50
57
  storybook?: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EAMnC,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIhB,CAAA;AAEZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAOnC,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIhB,CAAA;AAEZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -1,13 +1,15 @@
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]="8870c986-d0c9-5d6c-8e83-659e15cf3d5e")}catch(e){}}();
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]="72ec9ebe-7073-517c-8a21-84e291f3268e")}catch(e){}}();
3
3
  import { z } from "zod";
4
4
  const safeString = z.string().optional().catch(undefined);
5
+ const safeBoolean = z.boolean().optional().catch(undefined);
5
6
  export const SupernovaConfigStorybook = z.object({
6
7
  designSystemId: safeString,
7
8
  sourceId: safeString,
8
9
  brandId: safeString,
9
10
  name: safeString,
10
11
  from: safeString,
12
+ publicAccess: safeBoolean,
11
13
  });
12
14
  export const SupernovaConfig = z
13
15
  .object({
@@ -15,4 +17,4 @@ export const SupernovaConfig = z
15
17
  })
16
18
  .catch({});
17
19
  //# sourceMappingURL=config.js.map
18
- //# debugId=8870c986-d0c9-5d6c-8e83-659e15cf3d5e
20
+ //# debugId=72ec9ebe-7073-517c-8a21-84e291f3268e
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../src/types/config.ts"],"sourceRoot":"","sourcesContent":["import { z } from \"zod\"\n\nconst safeString = z.string().optional().catch(undefined)\n\nexport const SupernovaConfigStorybook = z.object({\n designSystemId: safeString,\n sourceId: safeString,\n brandId: safeString,\n name: safeString,\n from: safeString,\n})\n\nexport const SupernovaConfig = z\n .object({\n storybook: SupernovaConfigStorybook.optional().catch(undefined),\n })\n .catch({})\n\nexport type SupernovaConfigStorybook = z.infer<typeof SupernovaConfigStorybook>\nexport type SupernovaConfig = z.infer<typeof SupernovaConfig>\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AAEzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,cAAc,EAAE,UAAU;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,SAAS,EAAE,wBAAwB,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;CAChE,CAAC;KACD,KAAK,CAAC,EAAE,CAAC,CAAA","debug_id":"8870c986-d0c9-5d6c-8e83-659e15cf3d5e"}
1
+ {"version":3,"file":"config.js","sources":["../../src/types/config.ts"],"sourceRoot":"","sourcesContent":["import { z } from \"zod\"\n\nconst safeString = z.string().optional().catch(undefined)\nconst safeBoolean = z.boolean().optional().catch(undefined)\n\nexport const SupernovaConfigStorybook = z.object({\n designSystemId: safeString,\n sourceId: safeString,\n brandId: safeString,\n name: safeString,\n from: safeString,\n publicAccess: safeBoolean,\n})\n\nexport const SupernovaConfig = z\n .object({\n storybook: SupernovaConfigStorybook.optional().catch(undefined),\n })\n .catch({})\n\nexport type SupernovaConfigStorybook = z.infer<typeof SupernovaConfigStorybook>\nexport type SupernovaConfig = z.infer<typeof SupernovaConfig>\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AACzD,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AAE3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,cAAc,EAAE,UAAU;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,WAAW;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,SAAS,EAAE,wBAAwB,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;CAChE,CAAC;KACD,KAAK,CAAC,EAAE,CAAC,CAAA","debug_id":"72ec9ebe-7073-517c-8a21-84e291f3268e"}
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-command.d.ts","sourceRoot":"","sources":["../../src/types/sentry-command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AAa,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM;IAI9C,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;IAgCxD,OAAO;IAEA,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,SAAS,EAChF,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACxB,IAAI,CAAC,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAgClC"}
@@ -1,17 +1,24 @@
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]="5fd0eafb-6347-5ea5-9e64-049c2e4820a4")}catch(e){}}();
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]="c15daad4-d184-594f-9691-fe7a7ee5ed1f")}catch(e){}}();
3
3
  import * as Sentry from "@sentry/node";
4
4
  import { isAxiosError } from "axios";
5
5
  import { BaseCommand } from "./base-command.js";
6
6
  import { NotAuthorizedError } from "./not-authorized.error.js";
7
7
  import { CLIError } from "@oclif/core/errors";
8
+ import { RequestExecutorError } from "@supernova-studio/client";
8
9
  export class SentryCommand extends BaseCommand {
9
10
  constructor(argv, config) {
10
11
  super(argv, config);
11
12
  }
12
13
  async catch(error) {
13
14
  if (!(error instanceof CLIError)) {
14
- this.logToStderr(error.message);
15
+ let message = error.message;
16
+ if (error instanceof RequestExecutorError) {
17
+ message = error.errorCode
18
+ ? `${error.errorCode}: ${error.getDisplayMessage()}`
19
+ : error.getDisplayMessage();
20
+ }
21
+ this.logToStderr(message);
15
22
  }
16
23
  if (error.oclif)
17
24
  throw error;
@@ -63,4 +70,4 @@ export class SentryCommand extends BaseCommand {
63
70
  }
64
71
  }
65
72
  //# sourceMappingURL=sentry-command.js.map
66
- //# debugId=5fd0eafb-6347-5ea5-9e64-049c2e4820a4
73
+ //# debugId=c15daad4-d184-594f-9691-fe7a7ee5ed1f
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-command.js","sources":["../../src/types/sentry-command.ts"],"sourceRoot":"","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\"\nimport { isAxiosError } from \"axios\"\n\nimport { BaseCommand } from \"./base-command.js\"\nimport { NotAuthorizedError } from \"./not-authorized.error.js\"\nimport { CLIError } from \"@oclif/core/errors\"\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 if (!(error instanceof CLIError)) {\n // Invocations of `this.error(...)` from command classes will already be logged, no need to repeat\n this.logToStderr(error.message)\n }\n\n if (error.oclif) throw error\n if (error instanceof NotAuthorizedError) throw error\n\n if (isAxiosError(error)) {\n const captureMetadata = {\n code: error.code,\n message: error.message,\n response: {\n status: error.response?.status,\n data: error.response?.data,\n },\n }\n\n Sentry.captureMessage(`Axios error metadata: ${JSON.stringify(captureMetadata)}`)\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"],"names":[],"mappings":";;AAKA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,OAAgB,aAAgC,SAAQ,WAAc;IAC1E,YAAsB,IAAc,EAAE,MAAc;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAkD;QAC5D,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,EAAE,CAAC;YAEjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjC,CAAC;QAED,IAAI,KAAK,CAAC,KAAK;YAAE,MAAM,KAAK,CAAA;QAC5B,IAAI,KAAK,YAAY,kBAAkB;YAAE,MAAM,KAAK,CAAA;QAEpD,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,eAAe,GAAG;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;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yBAAyB;SACnC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;CACF","debug_id":"5fd0eafb-6347-5ea5-9e64-049c2e4820a4"}
1
+ {"version":3,"file":"sentry-command.js","sources":["../../src/types/sentry-command.ts"],"sourceRoot":"","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\"\nimport { isAxiosError } from \"axios\"\n\nimport { BaseCommand } from \"./base-command.js\"\nimport { NotAuthorizedError } from \"./not-authorized.error.js\"\nimport { CLIError } from \"@oclif/core/errors\"\nimport { RequestExecutorError } from \"@supernova-studio/client\"\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 if (!(error instanceof CLIError)) {\n let message = error.message;\n if (error instanceof RequestExecutorError) {\n message = error.errorCode\n ? `${error.errorCode}: ${error.getDisplayMessage()}`\n : error.getDisplayMessage();\n }\n // Invocations of `this.error(...)` from command classes will already be logged, no need to repeat\n this.logToStderr(message)\n }\n\n if (error.oclif) throw error\n if (error instanceof NotAuthorizedError) throw error\n\n if (isAxiosError(error)) {\n const captureMetadata = {\n code: error.code,\n message: error.message,\n response: {\n status: error.response?.status,\n data: error.response?.data,\n },\n }\n\n Sentry.captureMessage(`Axios error metadata: ${JSON.stringify(captureMetadata)}`)\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"],"names":[],"mappings":";;AAKA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,OAAgB,aAAgC,SAAQ,WAAc;IAC1E,YAAsB,IAAc,EAAE,MAAc;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAkD;QAC5D,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,EAAE,CAAC;YACjC,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC5B,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,OAAO,GAAG,KAAK,CAAC,SAAS;oBACvB,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,iBAAiB,EAAE,EAAE;oBACpD,CAAC,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAChC,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC;QAED,IAAI,KAAK,CAAC,KAAK;YAAE,M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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","debug_id":"c15daad4-d184-594f-9691-fe7a7ee5ed1f"}
@@ -403,6 +403,13 @@
403
403
  "hasDynamicHelp": false,
404
404
  "multiple": false,
405
405
  "type": "option"
406
+ },
407
+ "publicAccess": {
408
+ "description": "Allow public access to the published Storybook website. Can be used in combination with public documentation.",
409
+ "name": "publicAccess",
410
+ "required": false,
411
+ "allowNo": false,
412
+ "type": "boolean"
406
413
  }
407
414
  },
408
415
  "hasDynamicHelp": false,
@@ -582,5 +589,5 @@
582
589
  ]
583
590
  }
584
591
  },
585
- "version": "2.0.28"
592
+ "version": "2.0.30"
586
593
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@supernovaio/cli",
3
3
  "description": "Supernova.io Command Line Interface",
4
- "version": "2.0.28",
4
+ "version": "2.0.30",
5
5
  "author": "Supernova.io",
6
6
  "bin": {
7
7
  "supernova": "./bin/run"
@@ -16,7 +16,7 @@
16
16
  "@sentry/node": "^9.9.0",
17
17
  "@sentry/profiling-node": "^9.9.0",
18
18
  "@sindresorhus/slugify": "^2.2.1",
19
- "@supernova-studio/client": "1.66.0",
19
+ "@supernova-studio/client": "1.72.2",
20
20
  "@supernova-studio/pulsar-core": "2.7.10",
21
21
  "@supernova-studio/pulsar-language": "2.7.10",
22
22
  "@supernovaio/code-analyzer": "^1.0.1-alpha.2",