@supernovaio/cli-next 2.3.0 → 2.3.2
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/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/types/base-command.d.ts +1 -0
- package/dist/types/base-command.d.ts.map +1 -1
- package/dist/types/base-command.js +4 -0
- package/dist/types/base-command.js.map +1 -1
- package/dist/types/not-authorized.error.js +2 -2
- package/dist/types/not-authorized.error.js.map +1 -1
- package/dist/types/sentry-command.d.ts.map +1 -1
- package/dist/types/sentry-command.js +1 -0
- package/dist/types/sentry-command.js.map +1 -1
- package/dist/utils/figma-tokens-data-loader.d.ts +1 -1
- package/dist/utils/figma-tokens-data-loader.js +45 -45
- package/dist/utils/figma-tokens-data-loader.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/services/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./auth.service.js";
|
|
2
|
+
export * from "./vault.service.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/services/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./auth.service.js";
|
|
2
|
+
export * from "./vault.service.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA","sourcesContent":["export * from
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA","sourcesContent":["export * from \"./auth.service.js\"\nexport * from \"./vault.service.js\"\n"]}
|
|
@@ -10,6 +10,7 @@ export declare abstract class BaseCommand<T extends object> extends Command {
|
|
|
10
10
|
abstract get commandId(): string;
|
|
11
11
|
abstract get configSchema(): z.ZodType<T>;
|
|
12
12
|
protected apiClient(): Promise<SupernovaApiClient>;
|
|
13
|
+
protected init(): Promise<void>;
|
|
13
14
|
protected promptBrandId(designSystemId: string, versionId?: string): Promise<string>;
|
|
14
15
|
protected promptDesignSystemId(): Promise<string>;
|
|
15
16
|
protected getVersionId(designSystemId: string, versionId?: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/types/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAmB,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAgB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAK1D,8BAAsB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,OAAO;IACjE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAiB;IACzC,SAAS,CAAC,aAAa,yBAAuC;IAC9D,OAAO,CAAC,UAAU,CAAgC;IAElD,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAA;IAChC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;cAEzB,SAAS;cAQT,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAY1E,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;cAwCvC,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAqBzE,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAyBvD,MAAM;CAYrB"}
|
|
1
|
+
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/types/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAmB,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAgB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAK1D,8BAAsB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,OAAO;IACjE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAiB;IACzC,SAAS,CAAC,aAAa,yBAAuC;IAC9D,OAAO,CAAC,UAAU,CAAgC;IAElD,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAA;IAChC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;cAEzB,SAAS;cAQT,IAAI;cAKJ,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAY1E,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;cAwCvC,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAqBzE,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAyBvD,MAAM;CAYrB"}
|
|
@@ -15,6 +15,10 @@ export class BaseCommand extends Command {
|
|
|
15
15
|
this._apiClient = apiClient;
|
|
16
16
|
return apiClient;
|
|
17
17
|
}
|
|
18
|
+
async init() {
|
|
19
|
+
await super.init();
|
|
20
|
+
this.log(`Using ${this.env} environment`);
|
|
21
|
+
}
|
|
18
22
|
async promptBrandId(designSystemId, versionId) {
|
|
19
23
|
const client = await this.apiClient();
|
|
20
24
|
const brandsEndpoint = client.designSystems.versions.brands;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../src/types/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,YAAY,EAAa,MAAM,kBAAkB,CAAA;AAE1D,MAAM,SAAS,GAAG,CAAC,IAA8B,EAAE,EAAE,CACnD,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAErE,MAAM,OAAgB,WAA8B,SAAQ,OAAO;IACvD,GAAG,GAAc,YAAY,EAAE,CAAA;IAC/B,aAAa,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAA;IACtD,UAAU,CAAgC;IAKxC,KAAK,CAAC,SAAS;QACvB,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC,UAAU,CAAA;QAE3C,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,OAAO,SAAS,CAAA;IAClB,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,cAAsB,EAAE,SAAkB;QACtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS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I,EAAE,CAAC,CACrB,CAAA;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QACnB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAChB,qBAAqB,EACrB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,EAAE;SACd,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,OAA0C;QAC9E,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACnC;gBACE,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;gBACtD,OAAO;gBACP,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAA;QAEF,OAAO,MAAM,CAAC,QAAkB,CAAA;IAClC,CAAC;CACF","sourcesContent":["import { Command } from \"@oclif/core\"\nimport { DTODesignSystem, SupernovaApiClient } from \"@supernova-studio/client\"\nimport inquirer from \"inquirer\"\nimport { z } from \"zod\"\n\nimport { getApiClient } from \"../utils/api-client.js\"\nimport { SupernovaConfigService } from \"../utils/config.service.js\"\nimport { getTargetEnv, TargetEnv } from \"./environment.js\"\n\nconst hasAccess = (role?: DTODesignSystem[\"role\"]) =>\n role && [\"Admin\", \"Contributor\", \"Creator\", \"Owner\"].includes(role)\n\nexport abstract class BaseCommand<T extends object> extends Command {\n protected env: TargetEnv = getTargetEnv()\n protected configService = SupernovaConfigService.getInstance()\n private _apiClient: SupernovaApiClient | undefined\n\n abstract get commandId(): string\n abstract get configSchema(): z.ZodType<T>\n\n protected async apiClient() {\n if (this._apiClient) return this._apiClient\n\n const apiClient = await getApiClient(this.env)\n this._apiClient = apiClient\n return apiClient\n }\n\n protected async promptBrandId(designSystemId: string, versionId?: string): Promise<string> {\n const client = await this.apiClient()\n const brandsEndpoint = client.designSystems.versions.brands\n\n const { brands } = await brandsEndpoint.list(designSystemId, versionId ?? \"head\")\n\n const options = brands.map(b => ({ name: b.meta.name, value: b.persistentId }))\n if (options.length === 1) return options[0].value\n\n return this.prompt(\"Select a brand:\", options)\n }\n\n protected async promptDesignSystemId(): Promise<string> {\n const { designSystems: client } = await this.apiClient()\n const { designSystems, workspaces } = await client.listUserDesignSystems()\n const workspaceById = new Map(workspaces.map(ws => [ws.id, ws]))\n const dsNameCount = designSystems.reduce((acc, { meta: { name }, role }) => {\n if (hasAccess(role)) acc.set(name, (acc.get(name) ?? 0) + 1)\n\n return acc\n }, new Map<string, number>())\n\n if (designSystems.length === 0) {\n this.error(\"You don't have any design system.\")\n }\n\n const dsIds = designSystems\n .sort(({ meta: { name: a } }, { meta: { name: b } }) => a.localeCompare(b))\n .map(({ id, meta: { name }, role, workspaceId }) => ({\n id,\n name: (dsNameCount.get(name) ?? 0) > 1 ? `${name} (${workspaceById.get(workspaceId)?.profile?.name})` : name,\n role,\n }))\n .filter(({ role }) => hasAccess(role))\n\n if (dsIds.length === 0) {\n this.error(\"You don't have access to any design system.\")\n }\n\n if (dsIds.length === 1) {\n return dsIds[0].id\n }\n\n return this.prompt(\n \"Select a design system:\",\n dsIds.map(({ id, name }) => ({\n name,\n value: id,\n })),\n )\n }\n\n protected async getVersionId(designSystemId: string, versionId?: string): Promise<string> {\n if (versionId) return versionId\n const { versions } = (await this.apiClient()).designSystems\n const verIds = (await versions.list(designSystemId)).designSystemVersions.map(({ id, meta: { name } }) => ({\n id,\n name,\n }))\n\n if (verIds.length === 1) {\n return verIds[0].id\n }\n\n return this.prompt(\n \"Select a version:\",\n verIds.map(wrk => ({\n name: wrk.name,\n value: wrk.id,\n })),\n )\n }\n\n protected async getWorkspaceId(workspaceId?: string): Promise<string> {\n if (workspaceId) return workspaceId\n const { workspaces } = await this.apiClient()\n const wrks = (await workspaces.list()).membership.map(\n ({\n workspace: {\n id,\n profile: { name },\n },\n }) => ({ id, name }),\n )\n\n if (wrks.length === 1) {\n return wrks[0].id\n }\n\n return this.prompt(\n \"Select a workspace:\",\n wrks.map(wrk => ({\n name: wrk.name,\n value: wrk.id,\n })),\n )\n }\n\n private async prompt(message: string, choices: { name: string; value: string }[]) {\n const choice = await inquirer.prompt([\n {\n choices: [...choices, { name: \"Exit\", value: \"exit\" }],\n message,\n name: \"selected\",\n type: \"list\",\n },\n ])\n\n return choice.selected as string\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../src/types/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,YAAY,EAAa,MAAM,kBAAkB,CAAA;AAE1D,MAAM,SAAS,GAAG,CAAC,IAA8B,EAAE,EAAE,CACnD,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAErE,MAAM,OAAgB,WAA8B,SAAQ,OAAO;IACvD,GAAG,GAAc,YAAY,EAAE,CAAA;IAC/B,aAAa,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAA;IACtD,UAAU,CAAgC;IAKxC,KAAK,CAAC,SAAS;QACvB,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC,UAAU,CAAA;QAE3C,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,OAAO,SAAS,C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AAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QAC7C,MAAM,IAAI,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CACnD,CAAC,EACC,SAAS,EAAE,EACT,EAAE,EACF,OAAO,EAAE,EAAE,IAAI,EAAE,GAClB,GACF,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CACrB,CAAA;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QACnB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAChB,qBAAqB,EACrB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,EAAE;SACd,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,OAA0C;QAC9E,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACnC;gBACE,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;gBACtD,OAAO;gBACP,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAA;QAEF,OAAO,MAAM,CAAC,QAAkB,CAAA;IAClC,CAAC;CACF","sourcesContent":["import { Command } from \"@oclif/core\"\nimport { DTODesignSystem, SupernovaApiClient } from \"@supernova-studio/client\"\nimport inquirer from \"inquirer\"\nimport { z } from \"zod\"\n\nimport { getApiClient } from \"../utils/api-client.js\"\nimport { SupernovaConfigService } from \"../utils/config.service.js\"\nimport { getTargetEnv, TargetEnv } from \"./environment.js\"\n\nconst hasAccess = (role?: DTODesignSystem[\"role\"]) =>\n role && [\"Admin\", \"Contributor\", \"Creator\", \"Owner\"].includes(role)\n\nexport abstract class BaseCommand<T extends object> extends Command {\n protected env: TargetEnv = getTargetEnv()\n protected configService = SupernovaConfigService.getInstance()\n private _apiClient: SupernovaApiClient | undefined\n\n abstract get commandId(): string\n abstract get configSchema(): z.ZodType<T>\n\n protected async apiClient() {\n if (this._apiClient) return this._apiClient\n\n const apiClient = await getApiClient(this.env)\n this._apiClient = apiClient\n return apiClient\n }\n\n protected async init() {\n await super.init()\n this.log(`Using ${this.env} environment`)\n }\n\n protected async promptBrandId(designSystemId: string, versionId?: string): Promise<string> {\n const client = await this.apiClient()\n const brandsEndpoint = client.designSystems.versions.brands\n\n const { brands } = await brandsEndpoint.list(designSystemId, versionId ?? \"head\")\n\n const options = brands.map(b => ({ name: b.meta.name, value: b.persistentId }))\n if (options.length === 1) return options[0].value\n\n return this.prompt(\"Select a brand:\", options)\n }\n\n protected async promptDesignSystemId(): Promise<string> {\n const { designSystems: client } = await this.apiClient()\n const { designSystems, workspaces } = await client.listUserDesignSystems()\n const workspaceById = new Map(workspaces.map(ws => [ws.id, ws]))\n const dsNameCount = designSystems.reduce((acc, { meta: { name }, role }) => {\n if (hasAccess(role)) acc.set(name, (acc.get(name) ?? 0) + 1)\n\n return acc\n }, new Map<string, number>())\n\n if (designSystems.length === 0) {\n this.error(\"You don't have any design system.\")\n }\n\n const dsIds = designSystems\n .sort(({ meta: { name: a } }, { meta: { name: b } }) => a.localeCompare(b))\n .map(({ id, meta: { name }, role, workspaceId }) => ({\n id,\n name: (dsNameCount.get(name) ?? 0) > 1 ? `${name} (${workspaceById.get(workspaceId)?.profile?.name})` : name,\n role,\n }))\n .filter(({ role }) => hasAccess(role))\n\n if (dsIds.length === 0) {\n this.error(\"You don't have access to any design system.\")\n }\n\n if (dsIds.length === 1) {\n return dsIds[0].id\n }\n\n return this.prompt(\n \"Select a design system:\",\n dsIds.map(({ id, name }) => ({\n name,\n value: id,\n })),\n )\n }\n\n protected async getVersionId(designSystemId: string, versionId?: string): Promise<string> {\n if (versionId) return versionId\n const { versions } = (await this.apiClient()).designSystems\n const verIds = (await versions.list(designSystemId)).designSystemVersions.map(({ id, meta: { name } }) => ({\n id,\n name,\n }))\n\n if (verIds.length === 1) {\n return verIds[0].id\n }\n\n return this.prompt(\n \"Select a version:\",\n verIds.map(wrk => ({\n name: wrk.name,\n value: wrk.id,\n })),\n )\n }\n\n protected async getWorkspaceId(workspaceId?: string): Promise<string> {\n if (workspaceId) return workspaceId\n const { workspaces } = await this.apiClient()\n const wrks = (await workspaces.list()).membership.map(\n ({\n workspace: {\n id,\n profile: { name },\n },\n }) => ({ id, name }),\n )\n\n if (wrks.length === 1) {\n return wrks[0].id\n }\n\n return this.prompt(\n \"Select a workspace:\",\n wrks.map(wrk => ({\n name: wrk.name,\n value: wrk.id,\n })),\n )\n }\n\n private async prompt(message: string, choices: { name: string; value: string }[]) {\n const choice = await inquirer.prompt([\n {\n choices: [...choices, { name: \"Exit\", value: \"exit\" }],\n message,\n name: \"selected\",\n type: \"list\",\n },\n ])\n\n return choice.selected as string\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class NotAuthorizedError extends Error {
|
|
2
2
|
code;
|
|
3
|
-
constructor(message =
|
|
3
|
+
constructor(message = "Not authorized. Login first, please.", code = "NOT_AUTHORIZED") {
|
|
4
4
|
super(message);
|
|
5
|
-
this.name =
|
|
5
|
+
this.name = "NotAuthorizedError";
|
|
6
6
|
this.code = code;
|
|
7
7
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-authorized.error.js","sourceRoot":"","sources":["../../src/types/not-authorized.error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3B,IAAI,CAAQ;IAE5B,YAAY,UAAkB,sCAAsC,EAAE,OAAe,gBAAgB;QACnG,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;IACzC,CAAC;CACF","sourcesContent":["export class NotAuthorizedError extends Error {\n public readonly code: string\n\n constructor(message: string =
|
|
1
|
+
{"version":3,"file":"not-authorized.error.js","sourceRoot":"","sources":["../../src/types/not-authorized.error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3B,IAAI,CAAQ;IAE5B,YAAY,UAAkB,sCAAsC,EAAE,OAAe,gBAAgB;QACnG,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;IACzC,CAAC;CACF","sourcesContent":["export class NotAuthorizedError extends Error {\n public readonly code: string\n\n constructor(message: string = \"Not authorized. Login first, please.\", code: string = \"NOT_AUTHORIZED\") {\n super(message)\n this.name = \"NotAuthorizedError\"\n this.code = code\n\n Object.setPrototypeOf(this, new.target.prototype)\n }\n\n public getFormattedMessage(): string {\n return `[${this.code}] ${this.message}`\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-command.d.ts","sourceRoot":"","sources":["../../src/types/sentry-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,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a,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 if (error.oclif) throw error\n if (error instanceof NotAuthorizedError) throw error\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
|
+
{"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,MAAM,CAAC,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAkD;QAC5D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,KAAK,CAAC,KAAK;YAAE,MAAM,KAAK,CAAA;QAC5B,IAAI,KAAK,YAAY,kBAAkB;YAAE,MAAM,KAAK,CAAA;QAEpD,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC,CAAA;IACnE,CAAC;IAED,KAAK,CAAC,OAAO,KAAI,CAAC;IAEX,KAAK,CAAC,KAAK,CAChB,OAAwB,EACxB,IAAe;QAEf,MAAM,CAAC,aAAa,CAAC;YACnB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE;gBACJ,WAAW,EAAE,IAAI,CAAC,EAAE;aACrB;YACD,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,wBAAwB;SAClC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,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) throw error\n if (error instanceof NotAuthorizedError) throw error\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,5 +1,5 @@
|
|
|
1
|
-
import * as sdk from
|
|
2
|
-
import * as fs from
|
|
1
|
+
import * as sdk from "@supernovaio/sdk";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
3
|
export class FigmaTokensDataLoader {
|
|
4
4
|
loadConfigFromPath(pathToFile) {
|
|
5
5
|
try {
|
|
@@ -8,7 +8,7 @@ export class FigmaTokensDataLoader {
|
|
|
8
8
|
return this.processFileToMapping(parsedDefinition);
|
|
9
9
|
}
|
|
10
10
|
catch (error) {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error("Unable to load JSON definition file: " + error);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
loadConfigFromPathAsIs(pathToFile) {
|
|
@@ -16,12 +16,12 @@ export class FigmaTokensDataLoader {
|
|
|
16
16
|
if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {
|
|
17
17
|
throw new Error(`Provided configuration file directory ${pathToFile} is not a file or doesn't exist`);
|
|
18
18
|
}
|
|
19
|
-
const definition = fs.readFileSync(pathToFile,
|
|
19
|
+
const definition = fs.readFileSync(pathToFile, "utf8");
|
|
20
20
|
const parsedDefinition = this.parseDefinition(definition);
|
|
21
21
|
return parsedDefinition;
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error("Unable to load JSON definition file: " + error);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
async loadTokensFromDirectory(pathToDirectory, settingsPath) {
|
|
@@ -32,20 +32,20 @@ export class FigmaTokensDataLoader {
|
|
|
32
32
|
}
|
|
33
33
|
const jsonPaths = this.getAllJSONFiles(pathToDirectory);
|
|
34
34
|
for (const path of jsonPaths) {
|
|
35
|
-
if (path.endsWith(
|
|
35
|
+
if (path.endsWith("json") && path !== settingsPath && !path.includes("$")) {
|
|
36
36
|
const result = await this.loadObjectFile(path);
|
|
37
|
-
if (typeof result ===
|
|
37
|
+
if (typeof result === "object") {
|
|
38
38
|
const name = this.getSetKey(path, pathToDirectory);
|
|
39
39
|
fullStructuredObject[name] = result;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
const themePath = pathToDirectory +
|
|
43
|
+
const themePath = pathToDirectory + "/" + "$themes.json";
|
|
44
44
|
if (fs.existsSync(themePath)) {
|
|
45
45
|
const themes = await this.loadObjectFile(themePath);
|
|
46
46
|
fullStructuredObject.$themes = themes;
|
|
47
47
|
}
|
|
48
|
-
const metadataPath = pathToDirectory +
|
|
48
|
+
const metadataPath = pathToDirectory + "/" + "$metadata.json";
|
|
49
49
|
if (fs.existsSync(metadataPath)) {
|
|
50
50
|
const metadata = await this.loadObjectFile(metadataPath);
|
|
51
51
|
fullStructuredObject.$metadata = metadata;
|
|
@@ -53,7 +53,7 @@ export class FigmaTokensDataLoader {
|
|
|
53
53
|
return fullStructuredObject;
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
|
-
throw new Error(
|
|
56
|
+
throw new Error("Unable to load JSON definition file: " + error);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
async loadTokensFromPath(pathToFile) {
|
|
@@ -61,12 +61,12 @@ export class FigmaTokensDataLoader {
|
|
|
61
61
|
if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {
|
|
62
62
|
throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`);
|
|
63
63
|
}
|
|
64
|
-
const definition = fs.readFileSync(pathToFile,
|
|
64
|
+
const definition = fs.readFileSync(pathToFile, "utf8");
|
|
65
65
|
const parsedDefinition = this.parseDefinition(definition);
|
|
66
66
|
return parsedDefinition;
|
|
67
67
|
}
|
|
68
68
|
catch (error) {
|
|
69
|
-
throw new Error(
|
|
69
|
+
throw new Error("Unable to load JSON definition file: " + error);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
getAllJSONFiles(dir) {
|
|
@@ -78,7 +78,7 @@ export class FigmaTokensDataLoader {
|
|
|
78
78
|
if (fileStat.isDirectory()) {
|
|
79
79
|
jsonFiles.push(...this.getAllJSONFiles(filePath));
|
|
80
80
|
}
|
|
81
|
-
else if (fileStat.isFile() && filePath.endsWith(
|
|
81
|
+
else if (fileStat.isFile() && filePath.endsWith(".json")) {
|
|
82
82
|
jsonFiles.push(filePath);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -92,24 +92,24 @@ export class FigmaTokensDataLoader {
|
|
|
92
92
|
if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {
|
|
93
93
|
throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`);
|
|
94
94
|
}
|
|
95
|
-
const definition = fs.readFileSync(pathToFile,
|
|
95
|
+
const definition = fs.readFileSync(pathToFile, "utf8");
|
|
96
96
|
const parsedDefinition = this.parseDefinition(definition);
|
|
97
97
|
return parsedDefinition;
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
|
-
throw new Error(
|
|
100
|
+
throw new Error("Unable to load JSON definition file: " + error);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
parseDefinition(definition) {
|
|
104
104
|
try {
|
|
105
105
|
const object = JSON.parse(definition);
|
|
106
|
-
if (typeof object !==
|
|
107
|
-
throw new TypeError(
|
|
106
|
+
if (typeof object !== "object") {
|
|
107
|
+
throw new TypeError("Invalid Supernova mapping definition JSON file - root level entity must be object");
|
|
108
108
|
}
|
|
109
109
|
return object;
|
|
110
110
|
}
|
|
111
111
|
catch {
|
|
112
|
-
throw new Error(
|
|
112
|
+
throw new Error("Invalid Supernova mapping definition JSON file - file structure invalid");
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
processFileToMapping(mapping) {
|
|
@@ -130,7 +130,7 @@ export class FigmaTokensDataLoader {
|
|
|
130
130
|
...mapping.settings,
|
|
131
131
|
dryRun: mapping.settings?.dryRun ?? false,
|
|
132
132
|
preciseCopy: sdk.toPreciseCopyStrategy(mapping.settings?.preciseCopy),
|
|
133
|
-
themeOverridesStrategy: mapping.settings?.themeOverridesStrategy ??
|
|
133
|
+
themeOverridesStrategy: mapping.settings?.themeOverridesStrategy ?? "default",
|
|
134
134
|
verbose: mapping.settings?.verbose ?? false,
|
|
135
135
|
};
|
|
136
136
|
return {
|
|
@@ -139,53 +139,53 @@ export class FigmaTokensDataLoader {
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
weakValidateMapping(mapping) {
|
|
142
|
-
if (!Object.hasOwn(mapping,
|
|
143
|
-
typeof mapping.mode !==
|
|
144
|
-
(mapping.mode !==
|
|
145
|
-
throw new Error(
|
|
142
|
+
if (!Object.hasOwn(mapping, "mode") ||
|
|
143
|
+
typeof mapping.mode !== "string" ||
|
|
144
|
+
(mapping.mode !== "multi-file" && mapping.mode !== "single-file")) {
|
|
145
|
+
throw new Error("Unable to load mapping file: `mode` must be provided [single-file or multi-file]`");
|
|
146
146
|
}
|
|
147
147
|
if (!mapping.mapping || !Array.isArray(mapping.mapping)) {
|
|
148
|
-
throw new Error(
|
|
148
|
+
throw new Error("Unable to load mapping file: `mapping` key must be present and array.");
|
|
149
149
|
}
|
|
150
150
|
const mapPack = mapping.mapping;
|
|
151
151
|
for (const map of mapPack) {
|
|
152
|
-
if (typeof map !==
|
|
153
|
-
throw new TypeError(
|
|
152
|
+
if (typeof map !== "object") {
|
|
153
|
+
throw new TypeError("Unable to load mapping file: `mapping` must contain objects only");
|
|
154
154
|
}
|
|
155
155
|
if (!map.tokenSets && !map.tokensTheme) {
|
|
156
|
-
throw new Error(
|
|
156
|
+
throw new Error("Unable to load mapping file: `mapping` must contain either `tokensTheme` or `tokenSets`");
|
|
157
157
|
}
|
|
158
158
|
if (map.tokenSets && map.tokensTheme) {
|
|
159
|
-
throw new Error(
|
|
159
|
+
throw new Error("Unable to load mapping file: `mapping` must not contain both `tokensTheme` or `tokenSets`");
|
|
160
160
|
}
|
|
161
161
|
if (map.tokenSets && (!Array.isArray(map.tokenSets) || map.tokenSets.length === 0)) {
|
|
162
|
-
throw new Error(
|
|
162
|
+
throw new Error("Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry");
|
|
163
163
|
}
|
|
164
164
|
if (map.tokensTheme &&
|
|
165
|
-
((typeof map.tokensTheme !==
|
|
166
|
-
throw new Error(
|
|
165
|
+
((typeof map.tokensTheme !== "string" && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)) {
|
|
166
|
+
throw new Error("Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings");
|
|
167
167
|
}
|
|
168
|
-
if (!map.supernovaBrand || typeof map.supernovaBrand !==
|
|
169
|
-
throw new Error(
|
|
168
|
+
if (!map.supernovaBrand || typeof map.supernovaBrand !== "string" || map.supernovaBrand.length === 0) {
|
|
169
|
+
throw new Error("Unable to load mapping file: `supernovaBrand` must be a non-empty string");
|
|
170
170
|
}
|
|
171
|
-
if (map.supernovaTheme && (typeof map.supernovaTheme !==
|
|
172
|
-
throw new Error(
|
|
171
|
+
if (map.supernovaTheme && (typeof map.supernovaTheme !== "string" || map.supernovaTheme.length === 0)) {
|
|
172
|
+
throw new Error("Unable to load mapping file: `supernovaTheme` may be empty but must be non-empty string if not");
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (mapping.settings) {
|
|
176
|
-
if (typeof mapping.settings !==
|
|
177
|
-
throw new TypeError(
|
|
176
|
+
if (typeof mapping.settings !== "object") {
|
|
177
|
+
throw new TypeError("Unable to load mapping file: `settings` must be an object");
|
|
178
178
|
}
|
|
179
|
-
if (Object.hasOwn(mapping.settings,
|
|
180
|
-
throw new Error(
|
|
179
|
+
if (Object.hasOwn(mapping.settings, "dryRun") && typeof mapping.settings.dryRun !== "boolean") {
|
|
180
|
+
throw new Error("Unable to load mapping file: `dryRun` must be of boolean type");
|
|
181
181
|
}
|
|
182
|
-
if (Object.hasOwn(mapping.settings,
|
|
183
|
-
throw new Error(
|
|
182
|
+
if (Object.hasOwn(mapping.settings, "verbose") && typeof mapping.settings.verbose !== "boolean") {
|
|
183
|
+
throw new Error("Unable to load mapping file: `verbose` must be of boolean type");
|
|
184
184
|
}
|
|
185
|
-
if (Object.hasOwn(mapping.settings,
|
|
186
|
-
typeof mapping.settings.preciseCopy !==
|
|
187
|
-
typeof mapping.settings.preciseCopy !==
|
|
188
|
-
throw new Error(
|
|
185
|
+
if (Object.hasOwn(mapping.settings, "preciseCopy") &&
|
|
186
|
+
typeof mapping.settings.preciseCopy !== "boolean" &&
|
|
187
|
+
typeof mapping.settings.preciseCopy !== "string") {
|
|
188
|
+
throw new Error("Unable to load mapping file: `preciseCopy` must be of boolean or string type");
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figma-tokens-data-loader.js","sourceRoot":"","sources":["../../src/utils/figma-tokens-data-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAAC,UAAkB;QAInC,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAuC,CAAA;YACtG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;YAC1C,OAAO,IAAI,CAAC,oBAAoB,C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A;YACH,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACzC,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9F,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAChG,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACnF,CAAC;YAED,IACE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS;gBACjD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,EAChD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;YACjG,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as sdk from '@supernovaio/sdk'\nimport * as fs from 'node:fs'\n\nexport class FigmaTokensDataLoader {\n loadConfigFromPath(pathToFile: string): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n try {\n const parsedDefinition = this.loadConfigFromPathAsIs(pathToFile) as sdk.DTPluginToSupernovaMappingFile\n this.weakValidateMapping(parsedDefinition)\n return this.processFileToMapping(parsedDefinition)\n } catch (error) {\n throw new Error('Unable to load JSON definition file: ' + error)\n }\n }\n\n loadConfigFromPathAsIs(pathToFile: string): sdk.DTPluginToSupernovaMappingFile {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided configuration file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, 'utf8')\n const parsedDefinition = this.parseDefinition(definition) as sdk.DTPluginToSupernovaMappingFile\n return parsedDefinition\n } catch (error) {\n throw new Error('Unable to load JSON definition file: ' + error)\n }\n }\n\n async loadTokensFromDirectory(pathToDirectory: string, settingsPath: string): Promise<object> {\n try {\n const fullStructuredObject: Record<string, unknown> = {}\n\n if (!(fs.existsSync(pathToDirectory) && fs.lstatSync(pathToDirectory).isDirectory())) {\n throw new Error(`Provided data directory ${pathToDirectory} is not a directory or doesn't exist`)\n }\n\n const jsonPaths = this.getAllJSONFiles(pathToDirectory)\n for (const path of jsonPaths) {\n if (path.endsWith('json') && path !== settingsPath && !path.includes('$')) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.loadObjectFile(path)\n if (typeof result === 'object') {\n // let name = this.getFileNameWithoutExtension(path)\n const name = this.getSetKey(path, pathToDirectory)\n fullStructuredObject[name] = result\n }\n }\n }\n\n // Try to load themes, if any\n // eslint-disable-next-line no-useless-concat\n const themePath = pathToDirectory + '/' + '$themes.json'\n if (fs.existsSync(themePath)) {\n const themes = await this.loadObjectFile(themePath)\n fullStructuredObject.$themes = themes\n }\n\n // Try to load metadata, if any\n // eslint-disable-next-line no-useless-concat\n const metadataPath = pathToDirectory + '/' + '$metadata.json'\n if (fs.existsSync(metadataPath)) {\n const metadata = await this.loadObjectFile(metadataPath)\n fullStructuredObject.$metadata = metadata\n }\n\n return fullStructuredObject\n } catch (error) {\n throw new Error('Unable to load JSON definition file: ' + error)\n }\n }\n\n /** Load token definitions from path */\n async loadTokensFromPath(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, 'utf8')\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error('Unable to load JSON definition file: ' + error)\n }\n }\n\n private getAllJSONFiles(dir: string): string[] {\n const files = fs.readdirSync(dir)\n const jsonFiles = []\n\n for (const file of files) {\n const filePath = `${dir}/${file}`\n const fileStat = fs.statSync(filePath)\n\n if (fileStat.isDirectory()) {\n jsonFiles.push(...this.getAllJSONFiles(filePath))\n } else if (fileStat.isFile() && filePath.endsWith('.json')) {\n jsonFiles.push(filePath)\n }\n }\n\n return jsonFiles\n }\n\n private getSetKey(jsonFilePath: string, loadedDirectory: string): string {\n return jsonFilePath.slice(loadedDirectory.length + 1, -5)\n }\n\n private async loadObjectFile(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, 'utf8')\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error('Unable to load JSON definition file: ' + error)\n }\n }\n\n private parseDefinition(definition: string): object {\n try {\n const object = JSON.parse(definition)\n if (typeof object !== 'object') {\n throw new TypeError('Invalid Supernova mapping definition JSON file - root level entity must be object')\n }\n\n return object\n } catch {\n throw new Error('Invalid Supernova mapping definition JSON file - file structure invalid')\n }\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - File Parser\n\n private processFileToMapping(mapping: sdk.DTPluginToSupernovaMappingFile): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n const result: sdk.DTPluginToSupernovaMap[] = []\n for (const map of mapping.mapping) {\n result.push({\n bindToBrand: map.supernovaBrand,\n bindToTheme: map.supernovaTheme ?? null,\n nodes: null,\n pluginSets: map.tokenSets ?? null,\n pluginTheme: map.tokensTheme ?? null,\n processedGroups: null,\n processedNodes: null,\n type: map.tokenSets ? sdk.DTPluginToSupernovaMapType.set : sdk.DTPluginToSupernovaMapType.theme,\n })\n }\n\n const settings: sdk.DTPluginToSupernovaSettings = {\n ...mapping.settings,\n dryRun: mapping.settings?.dryRun ?? false,\n preciseCopy: sdk.toPreciseCopyStrategy(mapping.settings?.preciseCopy),\n themeOverridesStrategy:\n mapping.settings?.themeOverridesStrategy ?? ('default' as sdk.DTPluginThemeOverrideStrategy),\n verbose: mapping.settings?.verbose ?? false,\n }\n\n return {\n mapping: result,\n settings,\n }\n }\n\n private weakValidateMapping(mapping: sdk.DTPluginToSupernovaMappingFile) {\n if (\n !Object.hasOwn(mapping, 'mode') ||\n typeof mapping.mode !== 'string' ||\n (mapping.mode !== 'multi-file' && mapping.mode !== 'single-file')\n ) {\n throw new Error('Unable to load mapping file: `mode` must be provided [single-file or multi-file]`')\n }\n\n if (!mapping.mapping || !Array.isArray(mapping.mapping)) {\n throw new Error('Unable to load mapping file: `mapping` key must be present and array.')\n }\n\n const mapPack = mapping.mapping\n for (const map of mapPack) {\n if (typeof map !== 'object') {\n throw new TypeError('Unable to load mapping file: `mapping` must contain objects only')\n }\n\n if (!map.tokenSets && !map.tokensTheme) {\n throw new Error('Unable to load mapping file: `mapping` must contain either `tokensTheme` or `tokenSets`')\n }\n\n if (map.tokenSets && map.tokensTheme) {\n throw new Error('Unable to load mapping file: `mapping` must not contain both `tokensTheme` or `tokenSets`')\n }\n\n if (map.tokenSets && (!Array.isArray(map.tokenSets) || (map.tokenSets as Array<unknown>).length === 0)) {\n throw new Error('Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry')\n }\n\n if (\n map.tokensTheme &&\n ((typeof map.tokensTheme !== 'string' && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)\n ) {\n throw new Error(\n 'Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings',\n )\n }\n\n if (!map.supernovaBrand || typeof map.supernovaBrand !== 'string' || map.supernovaBrand.length === 0) {\n throw new Error('Unable to load mapping file: `supernovaBrand` must be a non-empty string')\n }\n\n if (map.supernovaTheme && (typeof map.supernovaTheme !== 'string' || map.supernovaTheme.length === 0)) {\n throw new Error(\n 'Unable to load mapping file: `supernovaTheme` may be empty but must be non-empty string if not',\n )\n }\n }\n\n if (mapping.settings) {\n if (typeof mapping.settings !== 'object') {\n throw new TypeError('Unable to load mapping file: `settings` must be an object')\n }\n\n if (Object.hasOwn(mapping.settings, 'dryRun') && typeof mapping.settings.dryRun !== 'boolean') {\n throw new Error('Unable to load mapping file: `dryRun` must be of boolean type')\n }\n\n if (Object.hasOwn(mapping.settings, 'verbose') && typeof mapping.settings.verbose !== 'boolean') {\n throw new Error('Unable to load mapping file: `verbose` must be of boolean type')\n }\n\n if (\n Object.hasOwn(mapping.settings, 'preciseCopy') &&\n typeof mapping.settings.preciseCopy !== 'boolean' &&\n typeof mapping.settings.preciseCopy !== 'string'\n ) {\n throw new Error('Unable to load mapping file: `preciseCopy` must be of boolean or string type')\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"figma-tokens-data-loader.js","sourceRoot":"","sources":["../../src/utils/figma-tokens-data-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAAC,UAAkB;QAInC,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAuC,CAAA;YACtG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;YAC1C,OAAO,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uCAAuC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KAAK,QAAQ,EAAE,CAAC;gBACzC,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9F,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAChG,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACnF,CAAC;YAED,IACE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS;gBACjD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,EAChD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;YACjG,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as sdk from \"@supernovaio/sdk\"\nimport * as fs from \"node:fs\"\n\nexport class FigmaTokensDataLoader {\n loadConfigFromPath(pathToFile: string): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n try {\n const parsedDefinition = this.loadConfigFromPathAsIs(pathToFile) as sdk.DTPluginToSupernovaMappingFile\n this.weakValidateMapping(parsedDefinition)\n return this.processFileToMapping(parsedDefinition)\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n loadConfigFromPathAsIs(pathToFile: string): sdk.DTPluginToSupernovaMappingFile {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided configuration file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition) as sdk.DTPluginToSupernovaMappingFile\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n async loadTokensFromDirectory(pathToDirectory: string, settingsPath: string): Promise<object> {\n try {\n const fullStructuredObject: Record<string, unknown> = {}\n\n if (!(fs.existsSync(pathToDirectory) && fs.lstatSync(pathToDirectory).isDirectory())) {\n throw new Error(`Provided data directory ${pathToDirectory} is not a directory or doesn't exist`)\n }\n\n const jsonPaths = this.getAllJSONFiles(pathToDirectory)\n for (const path of jsonPaths) {\n if (path.endsWith(\"json\") && path !== settingsPath && !path.includes(\"$\")) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.loadObjectFile(path)\n if (typeof result === \"object\") {\n // let name = this.getFileNameWithoutExtension(path)\n const name = this.getSetKey(path, pathToDirectory)\n fullStructuredObject[name] = result\n }\n }\n }\n\n // Try to load themes, if any\n // eslint-disable-next-line no-useless-concat\n const themePath = pathToDirectory + \"/\" + \"$themes.json\"\n if (fs.existsSync(themePath)) {\n const themes = await this.loadObjectFile(themePath)\n fullStructuredObject.$themes = themes\n }\n\n // Try to load metadata, if any\n // eslint-disable-next-line no-useless-concat\n const metadataPath = pathToDirectory + \"/\" + \"$metadata.json\"\n if (fs.existsSync(metadataPath)) {\n const metadata = await this.loadObjectFile(metadataPath)\n fullStructuredObject.$metadata = metadata\n }\n\n return fullStructuredObject\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n /** Load token definitions from path */\n async loadTokensFromPath(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private getAllJSONFiles(dir: string): string[] {\n const files = fs.readdirSync(dir)\n const jsonFiles = []\n\n for (const file of files) {\n const filePath = `${dir}/${file}`\n const fileStat = fs.statSync(filePath)\n\n if (fileStat.isDirectory()) {\n jsonFiles.push(...this.getAllJSONFiles(filePath))\n } else if (fileStat.isFile() && filePath.endsWith(\".json\")) {\n jsonFiles.push(filePath)\n }\n }\n\n return jsonFiles\n }\n\n private getSetKey(jsonFilePath: string, loadedDirectory: string): string {\n return jsonFilePath.slice(loadedDirectory.length + 1, -5)\n }\n\n private async loadObjectFile(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private parseDefinition(definition: string): object {\n try {\n const object = JSON.parse(definition)\n if (typeof object !== \"object\") {\n throw new TypeError(\"Invalid Supernova mapping definition JSON file - root level entity must be object\")\n }\n\n return object\n } catch {\n throw new Error(\"Invalid Supernova mapping definition JSON file - file structure invalid\")\n }\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - File Parser\n\n private processFileToMapping(mapping: sdk.DTPluginToSupernovaMappingFile): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n const result: sdk.DTPluginToSupernovaMap[] = []\n for (const map of mapping.mapping) {\n result.push({\n bindToBrand: map.supernovaBrand,\n bindToTheme: map.supernovaTheme ?? null,\n nodes: null,\n pluginSets: map.tokenSets ?? null,\n pluginTheme: map.tokensTheme ?? null,\n processedGroups: null,\n processedNodes: null,\n type: map.tokenSets ? sdk.DTPluginToSupernovaMapType.set : sdk.DTPluginToSupernovaMapType.theme,\n })\n }\n\n const settings: sdk.DTPluginToSupernovaSettings = {\n ...mapping.settings,\n dryRun: mapping.settings?.dryRun ?? false,\n preciseCopy: sdk.toPreciseCopyStrategy(mapping.settings?.preciseCopy),\n themeOverridesStrategy:\n mapping.settings?.themeOverridesStrategy ?? (\"default\" as sdk.DTPluginThemeOverrideStrategy),\n verbose: mapping.settings?.verbose ?? false,\n }\n\n return {\n mapping: result,\n settings,\n }\n }\n\n private weakValidateMapping(mapping: sdk.DTPluginToSupernovaMappingFile) {\n if (\n !Object.hasOwn(mapping, \"mode\") ||\n typeof mapping.mode !== \"string\" ||\n (mapping.mode !== \"multi-file\" && mapping.mode !== \"single-file\")\n ) {\n throw new Error(\"Unable to load mapping file: `mode` must be provided [single-file or multi-file]`\")\n }\n\n if (!mapping.mapping || !Array.isArray(mapping.mapping)) {\n throw new Error(\"Unable to load mapping file: `mapping` key must be present and array.\")\n }\n\n const mapPack = mapping.mapping\n for (const map of mapPack) {\n if (typeof map !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `mapping` must contain objects only\")\n }\n\n if (!map.tokenSets && !map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must contain either `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must not contain both `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && (!Array.isArray(map.tokenSets) || (map.tokenSets as Array<unknown>).length === 0)) {\n throw new Error(\"Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry\")\n }\n\n if (\n map.tokensTheme &&\n ((typeof map.tokensTheme !== \"string\" && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)\n ) {\n throw new Error(\n \"Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings\",\n )\n }\n\n if (!map.supernovaBrand || typeof map.supernovaBrand !== \"string\" || map.supernovaBrand.length === 0) {\n throw new Error(\"Unable to load mapping file: `supernovaBrand` must be a non-empty string\")\n }\n\n if (map.supernovaTheme && (typeof map.supernovaTheme !== \"string\" || map.supernovaTheme.length === 0)) {\n throw new Error(\n \"Unable to load mapping file: `supernovaTheme` may be empty but must be non-empty string if not\",\n )\n }\n }\n\n if (mapping.settings) {\n if (typeof mapping.settings !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `settings` must be an object\")\n }\n\n if (Object.hasOwn(mapping.settings, \"dryRun\") && typeof mapping.settings.dryRun !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `dryRun` must be of boolean type\")\n }\n\n if (Object.hasOwn(mapping.settings, \"verbose\") && typeof mapping.settings.verbose !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `verbose` must be of boolean type\")\n }\n\n if (\n Object.hasOwn(mapping.settings, \"preciseCopy\") &&\n typeof mapping.settings.preciseCopy !== \"boolean\" &&\n typeof mapping.settings.preciseCopy !== \"string\"\n ) {\n throw new Error(\"Unable to load mapping file: `preciseCopy` must be of boolean or string type\")\n }\n }\n }\n}\n"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./api-client.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./api-client.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA","sourcesContent":["export * from
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA","sourcesContent":["export * from \"./api-client.js\"\n"]}
|
package/oclif.manifest.json
CHANGED