@supernova-studio/client 0.57.9 → 0.57.11
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/index.d.mts +538 -215
- package/dist/index.d.ts +538 -215
- package/dist/index.js +153 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1879 -1775
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/collections/index.ts +1 -1
- package/src/api/dto/collections/{collection.ts → token-collection.ts} +4 -5
- package/src/api/dto/elements/properties/property-definitions-actions-v2.ts +6 -6
- package/src/api/dto/elements/properties/property-definitions.ts +16 -12
- package/src/api/dto/elements/properties/property-values.ts +23 -2
- package/src/api/endpoints/design-system/design-systems.ts +1 -1
- package/src/api/endpoints/design-system/index.ts +0 -1
- package/src/api/endpoints/design-system/versions/index.ts +4 -0
- package/src/api/endpoints/design-system/versions/property-definitions.ts +25 -0
- package/src/api/endpoints/design-system/versions/property-values.ts +25 -0
- package/src/api/endpoints/design-system/versions/token-collections.ts +13 -0
- package/src/api/endpoints/design-system/versions/versions.ts +36 -0
- package/src/api/endpoints/index.ts +0 -1
- package/src/api/endpoints/design-system/versions.ts +0 -27
- package/src/api/endpoints/token-collections.ts +0 -13
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./collection";
|
|
1
|
+
export * from "./token-collection";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ObjectMeta } from "@supernova-studio/model";
|
|
1
|
+
import { CollectionOrigin, ColorTokenInlineData, ObjectMeta } from "@supernova-studio/model";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const DTOTokenCollection = z.object({
|
|
@@ -7,14 +7,13 @@ export const DTOTokenCollection = z.object({
|
|
|
7
7
|
designSystemVersionId: z.string(),
|
|
8
8
|
|
|
9
9
|
meta: ObjectMeta,
|
|
10
|
+
backgroundColor: ColorTokenInlineData.optional(),
|
|
11
|
+
elementPropertyOptionId: z.string(),
|
|
10
12
|
|
|
11
13
|
createdAt: z.coerce.date(),
|
|
12
14
|
updatedAt: z.coerce.date(),
|
|
13
15
|
|
|
14
|
-
origin:
|
|
15
|
-
id: z.string(),
|
|
16
|
-
sourceId: z.string(),
|
|
17
|
-
}),
|
|
16
|
+
origin: CollectionOrigin.optional(),
|
|
18
17
|
});
|
|
19
18
|
|
|
20
19
|
export const DTOTokenCollectionsListReponse = z.object({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import {
|
|
3
|
-
DTOCreateElementPropertyDefinitionInputV2,
|
|
4
|
-
DTODeleteElementPropertyDefinitionInputV2,
|
|
5
3
|
DTOElementPropertyDefinition,
|
|
6
|
-
|
|
4
|
+
DTOElementPropertyDefinitionCreatePayload,
|
|
5
|
+
DTOElementPropertyDefinitionDeletePayload,
|
|
6
|
+
DTOElementPropertyDefinitionUpdatePayload,
|
|
7
7
|
} from "./property-definitions";
|
|
8
8
|
|
|
9
9
|
// Outputs
|
|
@@ -35,17 +35,17 @@ export type DTOPropertyDefinitionDeleteActionOutputV2 = z.infer<typeof DTOProper
|
|
|
35
35
|
|
|
36
36
|
export const DTOPropertyDefinitionCreateActionInputV2 = z.object({
|
|
37
37
|
type: z.literal("PropertyDefinitionCreate"),
|
|
38
|
-
input:
|
|
38
|
+
input: DTOElementPropertyDefinitionCreatePayload,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
export const DTOPropertyDefinitionUpdateActionInputV2 = z.object({
|
|
42
42
|
type: z.literal("PropertyDefinitionUpdate"),
|
|
43
|
-
input:
|
|
43
|
+
input: DTOElementPropertyDefinitionUpdatePayload,
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export const DTOPropertyDefinitionDeleteActionInputV2 = z.object({
|
|
47
47
|
type: z.literal("PropertyDefinitionDelete"),
|
|
48
|
-
input:
|
|
48
|
+
input: DTOElementPropertyDefinitionDeletePayload,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
export type DTOPropertyDefinitionCreateActionInputV2 = z.infer<typeof DTOPropertyDefinitionCreateActionInputV2>;
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ElementPropertyLinkType,
|
|
4
4
|
ElementPropertyTargetType,
|
|
5
5
|
ElementPropertyTypeSchema,
|
|
6
|
+
nullishToOptional,
|
|
6
7
|
ObjectMeta,
|
|
7
8
|
} from "@supernova-studio/model";
|
|
8
9
|
import { z } from "zod";
|
|
@@ -18,8 +19,8 @@ export const DTOElementPropertyDefinition = z.object({
|
|
|
18
19
|
type: ElementPropertyTypeSchema,
|
|
19
20
|
targetElementType: ElementPropertyTargetType,
|
|
20
21
|
codeName: z.string().regex(CODE_NAME_REGEX),
|
|
21
|
-
options: z.array(ElementPropertyDefinitionOption)
|
|
22
|
-
linkElementType: ElementPropertyLinkType
|
|
22
|
+
options: nullishToOptional(z.array(ElementPropertyDefinitionOption)),
|
|
23
|
+
linkElementType: nullishToOptional(ElementPropertyLinkType),
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
export type DTOElementPropertyDefinition = z.infer<typeof DTOElementPropertyDefinition>;
|
|
@@ -28,24 +29,27 @@ export type DTOElementPropertyDefinition = z.infer<typeof DTOElementPropertyDefi
|
|
|
28
29
|
// Read
|
|
29
30
|
//
|
|
30
31
|
|
|
31
|
-
export const
|
|
32
|
+
export const DTOElementPropertyDefinitionListResponse = z.object({
|
|
32
33
|
definitions: z.array(DTOElementPropertyDefinition),
|
|
33
34
|
});
|
|
34
35
|
|
|
35
|
-
export
|
|
36
|
+
export const DTOElementPropertyDefinitionResponse = z.object({
|
|
37
|
+
definition: DTOElementPropertyDefinition,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type DTOElementPropertyDefinitionListResponse = z.infer<typeof DTOElementPropertyDefinitionListResponse>;
|
|
41
|
+
export type DTOElementPropertyDefinitionResponse = z.infer<typeof DTOElementPropertyDefinitionResponse>;
|
|
36
42
|
|
|
37
43
|
//
|
|
38
44
|
// Write
|
|
39
45
|
//
|
|
40
46
|
|
|
41
|
-
export const
|
|
47
|
+
export const DTOElementPropertyDefinitionCreatePayload = DTOElementPropertyDefinition.omit({
|
|
42
48
|
id: true,
|
|
43
49
|
designSystemVersionId: true,
|
|
44
50
|
});
|
|
45
51
|
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
export const DTOUpdateElementPropertyDefinitionInputV2 = z.object({
|
|
52
|
+
export const DTOElementPropertyDefinitionUpdatePayload = z.object({
|
|
49
53
|
id: z.string(),
|
|
50
54
|
name: z.string().optional(),
|
|
51
55
|
description: z.string().optional(),
|
|
@@ -53,10 +57,10 @@ export const DTOUpdateElementPropertyDefinitionInputV2 = z.object({
|
|
|
53
57
|
options: z.array(ElementPropertyDefinitionOption).optional(),
|
|
54
58
|
});
|
|
55
59
|
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
export const DTODeleteElementPropertyDefinitionInputV2 = z.object({
|
|
60
|
+
export const DTOElementPropertyDefinitionDeletePayload = z.object({
|
|
59
61
|
id: z.string(),
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
export type
|
|
64
|
+
export type DTOElementPropertyDefinitionCreatePayload = z.infer<typeof DTOElementPropertyDefinitionCreatePayload>;
|
|
65
|
+
export type DTOElementPropertyDefinitionUpdatePayload = z.infer<typeof DTOElementPropertyDefinitionUpdatePayload>;
|
|
66
|
+
export type DTOElementPropertyDefinitionDeletePayload = z.infer<typeof DTOElementPropertyDefinitionDeletePayload>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
+
//
|
|
4
|
+
// Read
|
|
5
|
+
//
|
|
6
|
+
|
|
3
7
|
export const DTOElementPropertyValue = z.object({
|
|
4
8
|
id: z.string(),
|
|
5
9
|
designSystemVersionId: z.string(),
|
|
@@ -9,9 +13,26 @@ export const DTOElementPropertyValue = z.object({
|
|
|
9
13
|
valuePreview: z.string().optional(),
|
|
10
14
|
});
|
|
11
15
|
|
|
12
|
-
export const
|
|
16
|
+
export const DTOElementPropertyValueListResponse = z.object({
|
|
13
17
|
values: z.array(DTOElementPropertyValue),
|
|
14
18
|
});
|
|
15
19
|
|
|
20
|
+
export const DTOElementPropertyValueResponse = z.object({
|
|
21
|
+
value: DTOElementPropertyValue,
|
|
22
|
+
});
|
|
23
|
+
|
|
16
24
|
export type DTOElementPropertyValue = z.infer<typeof DTOElementPropertyValue>;
|
|
17
|
-
export type
|
|
25
|
+
export type DTOElementPropertyValueListResponse = z.infer<typeof DTOElementPropertyValueListResponse>;
|
|
26
|
+
export type DTOElementPropertyValueResponse = z.infer<typeof DTOElementPropertyValueResponse>;
|
|
27
|
+
|
|
28
|
+
//
|
|
29
|
+
// Create
|
|
30
|
+
//
|
|
31
|
+
|
|
32
|
+
export const DTOElementPropertyValueUpsertPaylod = z.object({
|
|
33
|
+
definitionId: z.string(),
|
|
34
|
+
targetElementId: z.string(),
|
|
35
|
+
value: z.string().or(z.number()).or(z.boolean()),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type DTOElementPropertyValueUpsertPaylod = z.infer<typeof DTOElementPropertyValueUpsertPaylod>;
|
|
@@ -5,7 +5,7 @@ import { RequestExecutor } from "../../transport/request-executor";
|
|
|
5
5
|
import { DesignSystemBffEndpoint } from "./bff";
|
|
6
6
|
import { DesignSystemMembersEndpoint } from "./members";
|
|
7
7
|
import { DesignSystemSourcesEndpoint } from "./sources";
|
|
8
|
-
import { DesignSystemVersionsEndpoint } from "./versions";
|
|
8
|
+
import { DesignSystemVersionsEndpoint } from "./versions/versions";
|
|
9
9
|
|
|
10
10
|
export class DesignSystemsEndpoint {
|
|
11
11
|
readonly members: DesignSystemMembersEndpoint;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from "./brands";
|
|
2
2
|
export * from "./import-jobs";
|
|
3
3
|
export * from "./overrides";
|
|
4
|
+
export * from "./property-definitions";
|
|
5
|
+
export * from "./property-values";
|
|
4
6
|
export * from "./stats";
|
|
5
7
|
export * from "./themes";
|
|
8
|
+
export * from "./token-collections";
|
|
6
9
|
export * from "./tokens";
|
|
10
|
+
export * from "./versions";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DTOElementPropertyDefinitionCreatePayload,
|
|
3
|
+
DTOElementPropertyDefinitionListResponse,
|
|
4
|
+
DTOElementPropertyDefinitionResponse,
|
|
5
|
+
} from "../../../dto";
|
|
6
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
7
|
+
|
|
8
|
+
export class ElementPropertyDefinitionsEndpoint {
|
|
9
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
10
|
+
|
|
11
|
+
list(designSystemId: string, versionId: string) {
|
|
12
|
+
return this.requestExecutor.json(
|
|
13
|
+
`/design-systems/${designSystemId}/versions/${versionId}/element-properties/definitions`,
|
|
14
|
+
DTOElementPropertyDefinitionListResponse
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
create(designSystemId: string, versionId: string, body: DTOElementPropertyDefinitionCreatePayload) {
|
|
19
|
+
return this.requestExecutor.json(
|
|
20
|
+
`/design-systems/${designSystemId}/versions/${versionId}/element-properties/definitions`,
|
|
21
|
+
DTOElementPropertyDefinitionResponse,
|
|
22
|
+
{ method: "POST", body }
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DTOElementPropertyValueListResponse,
|
|
3
|
+
DTOElementPropertyValueResponse,
|
|
4
|
+
DTOElementPropertyValueUpsertPaylod,
|
|
5
|
+
} from "../../../dto";
|
|
6
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
7
|
+
|
|
8
|
+
export class ElementPropertyValuesEndpoint {
|
|
9
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
10
|
+
|
|
11
|
+
list(designSystemId: string, versionId: string) {
|
|
12
|
+
return this.requestExecutor.json(
|
|
13
|
+
`/design-systems/${designSystemId}/versions/${versionId}/element-properties/values`,
|
|
14
|
+
DTOElementPropertyValueListResponse
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
upsert(designSystemId: string, versionId: string, body: DTOElementPropertyValueUpsertPaylod) {
|
|
19
|
+
return this.requestExecutor.json(
|
|
20
|
+
`/design-systems/${designSystemId}/versions/${versionId}/element-properties/values`,
|
|
21
|
+
DTOElementPropertyValueResponse,
|
|
22
|
+
{ method: "POST", body }
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DTOTokenCollectionsListReponse } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class TokenCollectionsEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
list(designSystemId: string, versionId: string) {
|
|
8
|
+
return this.requestExecutor.json(
|
|
9
|
+
`/design-systems/${designSystemId}/versions/${versionId}/token-collections`,
|
|
10
|
+
DTOTokenCollectionsListReponse
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DTODesignSystemVersionsListResponse } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
import { BrandsEndpoint } from "./brands";
|
|
4
|
+
import { ImportJobsEndpoint } from "./import-jobs";
|
|
5
|
+
import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
|
|
6
|
+
import { ElementPropertyValuesEndpoint } from "./property-values";
|
|
7
|
+
import { VersionStatsEndpoint } from "./stats";
|
|
8
|
+
import { ThemesEndpoint } from "./themes";
|
|
9
|
+
import { TokenCollectionsEndpoint } from "./token-collections";
|
|
10
|
+
import { TokensEndpoint } from "./tokens";
|
|
11
|
+
|
|
12
|
+
export class DesignSystemVersionsEndpoint {
|
|
13
|
+
readonly themes: ThemesEndpoint;
|
|
14
|
+
readonly brands: BrandsEndpoint;
|
|
15
|
+
readonly tokenCollections: TokenCollectionsEndpoint;
|
|
16
|
+
readonly importJobs: ImportJobsEndpoint;
|
|
17
|
+
readonly tokens: TokensEndpoint;
|
|
18
|
+
readonly stats: VersionStatsEndpoint;
|
|
19
|
+
readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
|
|
20
|
+
readonly elementPropertyValues: ElementPropertyValuesEndpoint;
|
|
21
|
+
|
|
22
|
+
constructor(private readonly requestExecutor: RequestExecutor) {
|
|
23
|
+
this.themes = new ThemesEndpoint(requestExecutor);
|
|
24
|
+
this.brands = new BrandsEndpoint(requestExecutor);
|
|
25
|
+
this.tokenCollections = new TokenCollectionsEndpoint(requestExecutor);
|
|
26
|
+
this.importJobs = new ImportJobsEndpoint(requestExecutor);
|
|
27
|
+
this.tokens = new TokensEndpoint(requestExecutor);
|
|
28
|
+
this.stats = new VersionStatsEndpoint(requestExecutor);
|
|
29
|
+
this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
|
|
30
|
+
this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
list(dsId: string) {
|
|
34
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions`, DTODesignSystemVersionsListResponse);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { DTODesignSystemVersionsListResponse } from "../../dto";
|
|
2
|
-
import { RequestExecutor } from "../../transport/request-executor";
|
|
3
|
-
import { BrandsEndpoint } from "./versions/brands";
|
|
4
|
-
import { ImportJobsEndpoint } from "./versions/import-jobs";
|
|
5
|
-
import { VersionStatsEndpoint } from "./versions/stats";
|
|
6
|
-
import { ThemesEndpoint } from "./versions/themes";
|
|
7
|
-
import { TokensEndpoint } from "./versions/tokens";
|
|
8
|
-
|
|
9
|
-
export class DesignSystemVersionsEndpoint {
|
|
10
|
-
readonly themes: ThemesEndpoint;
|
|
11
|
-
readonly brands: BrandsEndpoint;
|
|
12
|
-
readonly importJobs: ImportJobsEndpoint;
|
|
13
|
-
readonly tokens: TokensEndpoint;
|
|
14
|
-
readonly stats: VersionStatsEndpoint;
|
|
15
|
-
|
|
16
|
-
constructor(private readonly requestExecutor: RequestExecutor) {
|
|
17
|
-
this.themes = new ThemesEndpoint(requestExecutor);
|
|
18
|
-
this.brands = new BrandsEndpoint(requestExecutor);
|
|
19
|
-
this.importJobs = new ImportJobsEndpoint(requestExecutor);
|
|
20
|
-
this.tokens = new TokensEndpoint(requestExecutor);
|
|
21
|
-
this.stats = new VersionStatsEndpoint(requestExecutor);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
list(dsId: string) {
|
|
25
|
-
return this.requestExecutor.json(`/design-systems/${dsId}/versions`, DTODesignSystemVersionsListResponse);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DTOTokenCollectionsListReponse } from "../dto";
|
|
2
|
-
import { RequestExecutor } from "../transport/request-executor";
|
|
3
|
-
|
|
4
|
-
export class TokenCollectionsEndpoint {
|
|
5
|
-
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
-
|
|
7
|
-
list(dsId: string, vId: string) {
|
|
8
|
-
return this.requestExecutor.json(
|
|
9
|
-
`/design-systems/${dsId}/versions/${vId}/token-collections`,
|
|
10
|
-
DTOTokenCollectionsListReponse
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
}
|