@supernova-studio/client 0.58.9 → 0.58.10

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.
Files changed (32) hide show
  1. package/dist/index.d.mts +1659 -196
  2. package/dist/index.d.ts +1659 -196
  3. package/dist/index.js +258 -141
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +685 -568
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/api/dto/design-systems/index.ts +0 -1
  9. package/src/api/dto/elements/components/figma-component-group.ts +19 -0
  10. package/src/api/dto/elements/components/index.ts +1 -0
  11. package/src/api/dto/elements/frame-node-structures/frame-node-structure.ts +17 -0
  12. package/src/api/dto/elements/frame-node-structures/index.ts +1 -0
  13. package/src/api/dto/elements/index.ts +1 -0
  14. package/src/api/dto/export/exporter-property.ts +95 -0
  15. package/src/api/dto/export/exporter.ts +2 -0
  16. package/src/api/dto/export/index.ts +1 -0
  17. package/src/api/dto/export/job.ts +3 -0
  18. package/src/api/dto/export/pipeline.ts +3 -0
  19. package/src/api/endpoints/codegen/exporters.ts +2 -7
  20. package/src/api/endpoints/design-system/versions/elements-action.ts +16 -59
  21. package/src/api/endpoints/design-system/versions/elements.ts +13 -0
  22. package/src/api/endpoints/design-system/versions/figma-component-groups.ts +13 -0
  23. package/src/api/endpoints/design-system/versions/figma-components.ts +13 -0
  24. package/src/api/endpoints/design-system/versions/figma-frame-structures.ts +13 -0
  25. package/src/api/endpoints/design-system/versions/index.ts +5 -1
  26. package/src/api/endpoints/design-system/versions/versions.ts +13 -1
  27. package/src/api/payloads/export/pipeline.ts +3 -0
  28. package/src/api/transport/request-executor.ts +2 -0
  29. package/src/utils/index.ts +1 -0
  30. package/src/utils/query.ts +18 -0
  31. package/src/api/dto/design-systems/exporter-property.ts +0 -8
  32. /package/src/api/endpoints/design-system/versions/{components.ts → ds-components.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.58.9",
3
+ "version": "0.58.10",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -4,7 +4,6 @@ export * from "./contact";
4
4
  export * from "./data-source";
5
5
  export * from "./design-system";
6
6
  export * from "./elements-diff";
7
- export * from "./exporter-property";
8
7
  export * from "./figma-variables";
9
8
  export * from "./import-job";
10
9
  export * from "./members";
@@ -0,0 +1,19 @@
1
+ import z from "zod";
2
+ import { DTOObjectMeta } from "../../aux/meta";
3
+
4
+ export const DTOFigmaComponentGroup = z.object({
5
+ id: z.string(),
6
+ designSystemVersionId: z.string(),
7
+ persistentId: z.string(),
8
+ isRoot: z.boolean(),
9
+ brandId: z.string(),
10
+ meta: DTOObjectMeta,
11
+ childrenIds: z.string().array(),
12
+ });
13
+
14
+ export const DTOFigmaComponentGroupListResponse = z.object({
15
+ groups: DTOFigmaComponentGroup.array(),
16
+ });
17
+
18
+ export type DTOFigmaComponentGroup = z.infer<typeof DTOFigmaComponentGroup>;
19
+ export type DTOFigmaComponentGroupListResponse = z.infer<typeof DTOFigmaComponentGroupListResponse>;
@@ -1 +1,2 @@
1
+ export * from "./figma-component-group";
1
2
  export * from "./figma-component";
@@ -0,0 +1,17 @@
1
+ import { FigmaFileStructureOrigin, FigmaFileStructureStatistics } from "@supernova-studio/model";
2
+ import { z } from "zod";
3
+
4
+ export const DTOFrameNodeStructure = z.object({
5
+ id: z.string(),
6
+ persistentId: z.string(),
7
+ designSystemVersionId: z.string(),
8
+ origin: FigmaFileStructureOrigin,
9
+ assetsInFile: FigmaFileStructureStatistics,
10
+ });
11
+
12
+ export const DTOFrameNodeStructureListResponse = z.object({
13
+ structures: DTOFrameNodeStructure.array(),
14
+ });
15
+
16
+ export type DTOFrameNodeStructure = z.infer<typeof DTOFrameNodeStructure>;
17
+ export type DTOFrameNodeStructureListResponse = z.infer<typeof DTOFrameNodeStructureListResponse>;
@@ -0,0 +1 @@
1
+ export * from "./frame-node-structure";
@@ -1,6 +1,7 @@
1
1
  export * from "./components";
2
2
  export * from "./documentation";
3
3
  export * from "./figma-nodes";
4
+ export * from "./frame-node-structures";
4
5
  export * from "./properties";
5
6
  export * from "./elements-action-v2";
6
7
  export * from "./get-elements-v2";
@@ -0,0 +1,95 @@
1
+ import { z } from "zod";
2
+
3
+ //
4
+ // Primitives
5
+ //
6
+
7
+ const PrimitiveValue = z.number().or(z.boolean()).or(z.string());
8
+ const ArrayValue = z.array(z.string());
9
+ const ObjectValue = z.record(z.string());
10
+
11
+ export const DTOExporterPropertyDefinitionValue = PrimitiveValue.or(ArrayValue).or(ObjectValue);
12
+ export const DTOExporterPropertyType = z.enum(["Enum", "Boolean", "String", "Number", "Array", "Object"]);
13
+
14
+ export type DTOExporterPropertyDefinitionValue = z.infer<typeof DTOExporterPropertyDefinitionValue>;
15
+ export type DTOExporterPropertyType = z.infer<typeof DTOExporterPropertyType>;
16
+
17
+ //
18
+ // Property
19
+ //
20
+
21
+ const PropertyDefinitionBase = z.object({
22
+ key: z.string(),
23
+ title: z.string(),
24
+ description: z.string(),
25
+ });
26
+
27
+ export const DTOExporterPropertyDefinitionEnum = PropertyDefinitionBase.extend({
28
+ type: z.literal(DTOExporterPropertyType.Enum.Enum),
29
+ options: z.string().array(),
30
+ default: z.string(),
31
+ });
32
+
33
+ export const DTOExporterPropertyDefinitionBoolean = PropertyDefinitionBase.extend({
34
+ type: z.literal(DTOExporterPropertyType.Enum.Boolean),
35
+ default: z.boolean(),
36
+ });
37
+
38
+ export const DTOExporterPropertyDefinitionString = PropertyDefinitionBase.extend({
39
+ type: z.literal(DTOExporterPropertyType.Enum.String),
40
+ default: z.string(),
41
+ });
42
+
43
+ export const DTOExporterPropertyDefinitionNumber = PropertyDefinitionBase.extend({
44
+ type: z.literal(DTOExporterPropertyType.Enum.Number),
45
+ default: z.number(),
46
+ });
47
+
48
+ export const DTOExporterPropertyDefinitionArray = PropertyDefinitionBase.extend({
49
+ type: z.literal(DTOExporterPropertyType.Enum.Array),
50
+ default: ArrayValue,
51
+ });
52
+
53
+ export const DTOExporterPropertyDefinitionObject = PropertyDefinitionBase.extend({
54
+ type: z.literal(DTOExporterPropertyType.Enum.Object),
55
+ default: ObjectValue,
56
+ allowedKeys: z
57
+ .object({
58
+ options: z.string().array(),
59
+ })
60
+ .optional(),
61
+ allowedValues: z
62
+ .object({
63
+ options: z.string().array(),
64
+ })
65
+ .optional(),
66
+ });
67
+
68
+ export const DTOExporterPropertyDefinition = z.discriminatedUnion("type", [
69
+ DTOExporterPropertyDefinitionEnum,
70
+ DTOExporterPropertyDefinitionBoolean,
71
+ DTOExporterPropertyDefinitionString,
72
+ DTOExporterPropertyDefinitionNumber,
73
+ DTOExporterPropertyDefinitionArray,
74
+ DTOExporterPropertyDefinitionObject,
75
+ ]);
76
+
77
+ export const DTOExporterPropertyDefinitionsResponse = z.object({
78
+ properties: DTOExporterPropertyDefinition.array(),
79
+ });
80
+
81
+ export type DTOExporterPropertyDefinitionEnum = z.infer<typeof DTOExporterPropertyDefinitionEnum>;
82
+ export type DTOExporterPropertyDefinitionBoolean = z.infer<typeof DTOExporterPropertyDefinitionBoolean>;
83
+ export type DTOExporterPropertyDefinitionString = z.infer<typeof DTOExporterPropertyDefinitionString>;
84
+ export type DTOExporterPropertyDefinitionNumber = z.infer<typeof DTOExporterPropertyDefinitionNumber>;
85
+ export type DTOExporterPropertyDefinitionArray = z.infer<typeof DTOExporterPropertyDefinitionArray>;
86
+ export type DTOExporterPropertyDefinitionObject = z.infer<typeof DTOExporterPropertyDefinitionObject>;
87
+ export type DTOExporterPropertyDefinition = z.infer<typeof DTOExporterPropertyDefinition>;
88
+ export type DTOExporterPropertyDefinitionsResponse = z.infer<typeof DTOExporterPropertyDefinitionsResponse>;
89
+
90
+ //
91
+ // Value
92
+ //
93
+
94
+ export const DTOExporterPropertyDefinitionValueMap = z.record(DTOExporterPropertyDefinitionValue);
95
+ export type DTOExporterPropertyDefinitionValueMap = z.infer<typeof DTOExporterPropertyDefinitionValueMap>;
@@ -5,6 +5,7 @@ import {
5
5
  PulsarCustomBlock,
6
6
  } from "@supernova-studio/model";
7
7
  import { z } from "zod";
8
+ import { DTOExporterPropertyDefinition } from "./exporter-property";
8
9
 
9
10
  //
10
11
  // Read
@@ -27,6 +28,7 @@ export const DTOExporter = z.object({
27
28
 
28
29
  iconURL: z.string().optional(),
29
30
  configurationProperties: PulsarContributionConfigurationProperty.array(),
31
+ properties: DTOExporterPropertyDefinition.array().optional(),
30
32
  customBlocks: PulsarCustomBlock.array(),
31
33
  blockVariants: z.record(z.string(), PulsarContributionVariant.array()),
32
34
 
@@ -1,3 +1,4 @@
1
+ export * from "./exporter-property";
1
2
  export * from "./exporter";
2
3
  export * from "./filter";
3
4
  export * from "./job";
@@ -11,6 +11,7 @@ import {
11
11
  ObjectMeta,
12
12
  } from "@supernova-studio/model";
13
13
  import { z } from "zod";
14
+ import { DTOExporterPropertyDefinitionValueMap } from "./exporter-property";
14
15
 
15
16
  export const DTOExportJobCreatedBy = z.object({
16
17
  userId: z.string(),
@@ -69,6 +70,8 @@ export const DTOExportJob = z.object({
69
70
  brandPersistentId: z.string().optional(),
70
71
  themePersistentId: z.string().optional(),
71
72
  themePersistentIds: z.string().array().optional(),
73
+
74
+ exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
72
75
  });
73
76
 
74
77
  export const DTOExportJobResponse = z.object({
@@ -1,5 +1,6 @@
1
1
  import { ExportDestinationsMap, PipelineEventType } from "@supernova-studio/model";
2
2
  import { z } from "zod";
3
+ import { DTOExporterPropertyDefinitionValueMap } from "./exporter-property";
3
4
  import { DTOExportJob } from "./job";
4
5
 
5
6
  export const DTOPipelineListQuery = z.object({
@@ -21,6 +22,8 @@ export const DTOPipeline = z.object({
21
22
  themePersistentId: z.string().optional(),
22
23
  themePersistentIds: z.string().array().optional(),
23
24
 
25
+ exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
26
+
24
27
  ...ExportDestinationsMap.shape,
25
28
 
26
29
  latestJobs: DTOExportJob.array(),
@@ -1,3 +1,4 @@
1
+ import { serializeQuery } from "../../../utils";
1
2
  import { DTOExporterListQuery, DTOExporterListResponse } from "../../dto";
2
3
  import { RequestExecutor } from "../../transport";
3
4
 
@@ -5,14 +6,8 @@ export class ExportersEndpoint {
5
6
  constructor(private readonly requestExecutor: RequestExecutor) {}
6
7
 
7
8
  list(workspaceId: string, query: DTOExporterListQuery) {
8
- const queryWithStrings = Object.fromEntries(
9
- Object.entries(query)
10
- .filter(e => !!e[1])
11
- .map(([k, v]) => [k, v.toString()])
12
- );
13
-
14
9
  return this.requestExecutor.json(`/codegen/workspaces/${workspaceId}/exporters`, DTOExporterListResponse, {
15
- query: new URLSearchParams(queryWithStrings),
10
+ query: serializeQuery(query),
16
11
  });
17
12
  }
18
13
  }
@@ -2,7 +2,9 @@ import {
2
2
  DTOCreateDocumentationGroupInput,
3
3
  DTOCreateDocumentationPageInputV2,
4
4
  DTOCreateDocumentationTabInput,
5
+ DTOElementActionInput,
5
6
  DTOElementActionOutput,
7
+ DTOFigmaNodeRenderInput,
6
8
  DTOMoveDocumentationGroupInput,
7
9
  DTOUpdateDocumentationGroupInput,
8
10
  DTOUpdateDocumentationPageInputV2,
@@ -13,84 +15,39 @@ export class ElementsActionEndpoint {
13
15
  constructor(private readonly requestExecutor: RequestExecutor) {}
14
16
 
15
17
  async createDocPage(dsId: string, vId: string, input: DTOCreateDocumentationPageInputV2) {
16
- return this.requestExecutor.json(
17
- `/design-systems/${dsId}/versions/${vId}/elements-action`,
18
- DTOElementActionOutput,
19
- {
20
- body: {
21
- type: "DocumentationPageCreate",
22
- input,
23
- },
24
- method: "POST",
25
- }
26
- );
18
+ return this.action(dsId, vId, { type: "DocumentationPageCreate", input });
27
19
  }
28
20
 
29
21
  async createDocGroup(dsId: string, vId: string, input: DTOCreateDocumentationGroupInput) {
30
- return this.requestExecutor.json(
31
- `/design-systems/${dsId}/versions/${vId}/elements-action`,
32
- DTOElementActionOutput,
33
- {
34
- body: {
35
- type: "DocumentationGroupCreate",
36
- input,
37
- },
38
- method: "POST",
39
- }
40
- );
22
+ return this.action(dsId, vId, { type: "DocumentationGroupCreate", input });
41
23
  }
42
24
 
43
25
  async moveDocGroup(dsId: string, vId: string, input: DTOMoveDocumentationGroupInput) {
44
- return this.requestExecutor.json(
45
- `/design-systems/${dsId}/versions/${vId}/elements-action`,
46
- DTOElementActionOutput,
47
- {
48
- body: {
49
- type: "DocumentationGroupMove",
50
- input,
51
- },
52
- method: "POST",
53
- }
54
- );
26
+ return this.action(dsId, vId, { type: "DocumentationGroupMove", input });
55
27
  }
56
28
 
57
29
  async updateDocPage(dsId: string, vId: string, input: DTOUpdateDocumentationPageInputV2) {
58
- return this.requestExecutor.json(
59
- `/design-systems/${dsId}/versions/${vId}/elements-action`,
60
- DTOElementActionOutput,
61
- {
62
- body: {
63
- type: "DocumentationPageUpdate",
64
- input,
65
- },
66
- method: "POST",
67
- }
68
- );
30
+ return this.action(dsId, vId, { type: "DocumentationPageUpdate", input });
69
31
  }
70
32
 
71
33
  async updateDocGroup(dsId: string, vId: string, input: DTOUpdateDocumentationGroupInput) {
72
- return this.requestExecutor.json(
73
- `/design-systems/${dsId}/versions/${vId}/elements-action`,
74
- DTOElementActionOutput,
75
- {
76
- body: {
77
- type: "DocumentationGroupUpdate",
78
- input,
79
- },
80
- method: "POST",
81
- }
82
- );
34
+ return this.action(dsId, vId, { type: "DocumentationGroupUpdate", input });
83
35
  }
84
36
 
85
37
  async createDocTab(dsId: string, vId: string, input: DTOCreateDocumentationTabInput) {
38
+ return this.action(dsId, vId, { type: "DocumentationTabCreate", input });
39
+ }
40
+
41
+ async renderNodes(dsId: string, vId: string, input: DTOFigmaNodeRenderInput[]) {
42
+ return this.action(dsId, vId, { type: "FigmaNodeRender", input });
43
+ }
44
+
45
+ private async action(dsId: string, vId: string, input: DTOElementActionInput) {
86
46
  return this.requestExecutor.json(
87
47
  `/design-systems/${dsId}/versions/${vId}/elements-action`,
88
48
  DTOElementActionOutput,
89
49
  {
90
- body: {
91
- type: "DocumentationTabCreate",
92
- input,
93
- },
50
+ body: input,
94
51
  method: "POST",
95
52
  }
96
53
  );
@@ -0,0 +1,13 @@
1
+ import { serializeQuery } from "../../../../utils";
2
+ import { DTOElementsGetOutput, DTOElementsGetQueryParsed } from "../../../dto";
3
+ import { RequestExecutor } from "../../../transport/request-executor";
4
+
5
+ export class ElementsEndpoint {
6
+ constructor(private readonly requestExecutor: RequestExecutor) {}
7
+
8
+ getElements(dsId: string, vId: string, query: DTOElementsGetQueryParsed) {
9
+ return this.requestExecutor.json(`/design-systems/${dsId}/versions/${vId}/elements`, DTOElementsGetOutput, {
10
+ query: serializeQuery(query),
11
+ });
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import { DTOFigmaComponentGroupListResponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+
4
+ export class FigmaComponentGroupsEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ async list(dsId: string, vId: string) {
8
+ return this.requestExecutor.json(
9
+ `/design-systems/${dsId}/versions/${vId}/component-groups`,
10
+ DTOFigmaComponentGroupListResponse
11
+ );
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import { DTOFigmaComponentListResponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+
4
+ export class FigmaComponentsEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ async list(dsId: string, vId: string) {
8
+ return this.requestExecutor.json(
9
+ `/design-systems/${dsId}/versions/${vId}/components`,
10
+ DTOFigmaComponentListResponse
11
+ );
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import { DTOFrameNodeStructureListResponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+
4
+ export class FigmaFrameStructuresEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ list(dsId: string, vId: string) {
8
+ return this.requestExecutor.json(
9
+ `/design-systems/${dsId}/versions/${vId}/figma-frames/node-structures`,
10
+ DTOFrameNodeStructureListResponse
11
+ );
12
+ }
13
+ }
@@ -1,7 +1,11 @@
1
1
  export * from "./brands";
2
- export * from "./components";
3
2
  export * from "./documentation";
3
+ export * from "./ds-components";
4
4
  export * from "./elements-action";
5
+ export * from "./elements";
6
+ export * from "./figma-component-groups";
7
+ export * from "./figma-components";
8
+ export * from "./figma-frame-structures";
5
9
  export * from "./import-jobs";
6
10
  export * from "./overrides";
7
11
  export * from "./property-definitions";
@@ -6,9 +6,13 @@ import {
6
6
  import { DTOCreateVersionInput } from "../../../payloads";
7
7
  import { RequestExecutor } from "../../../transport/request-executor";
8
8
  import { BrandsEndpoint } from "./brands";
9
- import { DesignSystemComponentEndpoint } from "./components";
10
9
  import { DocumentationEndpoint } from "./documentation";
10
+ import { DesignSystemComponentEndpoint } from "./ds-components";
11
+ import { ElementsEndpoint } from "./elements";
11
12
  import { ElementsActionEndpoint } from "./elements-action";
13
+ import { FigmaComponentGroupsEndpoint } from "./figma-component-groups";
14
+ import { FigmaComponentsEndpoint } from "./figma-components";
15
+ import { FigmaFrameStructuresEndpoint } from "./figma-frame-structures";
12
16
  import { ImportJobsEndpoint } from "./import-jobs";
13
17
  import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
14
18
  import { ElementPropertyValuesEndpoint } from "./property-values";
@@ -25,10 +29,14 @@ export class DesignSystemVersionsEndpoint {
25
29
  readonly importJobs: ImportJobsEndpoint;
26
30
  readonly tokens: TokensEndpoint;
27
31
  readonly tokenGroups: TokenGroupsEndpoint;
32
+ readonly figmaComponents: FigmaComponentsEndpoint;
33
+ readonly figmaComponentGroups: FigmaComponentGroupsEndpoint;
34
+ readonly figmaFrameStructures: FigmaFrameStructuresEndpoint;
28
35
  readonly stats: VersionStatsEndpoint;
29
36
  readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
30
37
  readonly elementPropertyValues: ElementPropertyValuesEndpoint;
31
38
  readonly elementsAction: ElementsActionEndpoint;
39
+ readonly elements: ElementsEndpoint;
32
40
  readonly designSystemComponents: DesignSystemComponentEndpoint;
33
41
  readonly documentation: DocumentationEndpoint;
34
42
 
@@ -39,10 +47,14 @@ export class DesignSystemVersionsEndpoint {
39
47
  this.importJobs = new ImportJobsEndpoint(requestExecutor);
40
48
  this.tokens = new TokensEndpoint(requestExecutor);
41
49
  this.tokenGroups = new TokenGroupsEndpoint(requestExecutor);
50
+ this.figmaComponents = new FigmaComponentsEndpoint(requestExecutor);
51
+ this.figmaComponentGroups = new FigmaComponentGroupsEndpoint(requestExecutor);
52
+ this.figmaFrameStructures = new FigmaFrameStructuresEndpoint(requestExecutor);
42
53
  this.stats = new VersionStatsEndpoint(requestExecutor);
43
54
  this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
44
55
  this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
45
56
  this.elementsAction = new ElementsActionEndpoint(requestExecutor);
57
+ this.elements = new ElementsEndpoint(requestExecutor);
46
58
  this.designSystemComponents = new DesignSystemComponentEndpoint(requestExecutor);
47
59
  this.documentation = new DocumentationEndpoint(requestExecutor);
48
60
  }
@@ -10,6 +10,7 @@ import {
10
10
  PipelineEventType,
11
11
  } from "@supernova-studio/model";
12
12
  import { z } from "zod";
13
+ import { DTOExporterPropertyDefinitionValueMap } from "../../dto/export/exporter-property";
13
14
 
14
15
  export const DTOPipelineCreateBody = z.object({
15
16
  name: z.string(),
@@ -21,6 +22,8 @@ export const DTOPipelineCreateBody = z.object({
21
22
  themePersistentId: z.string().optional(),
22
23
  themePersistentIds: z.string().array().optional(),
23
24
 
25
+ exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
26
+
24
27
  destination: PipelineDestinationType.optional(),
25
28
  gitQuery: GitObjectsQuery,
26
29
  destinations: z.object({
@@ -68,6 +68,8 @@ export class RequestExecutor {
68
68
 
69
69
  const responseParseResult = schema.safeParse(wrapperParseResult.data.result);
70
70
  if (!responseParseResult.success) {
71
+ console.error(`Response was:`);
72
+ console.error(wrapperParseResult.data.result);
71
73
  throw RequestExecutorError.responseParsingError(endpoint, responseParseResult.error);
72
74
  }
73
75
 
@@ -1 +1,2 @@
1
1
  export * from "./hash";
2
+ export * from "./query";
@@ -0,0 +1,18 @@
1
+ type CompatibleValue = number | string | boolean | undefined;
2
+ type QueryObject = Record<string, CompatibleValue | CompatibleValue[]>;
3
+
4
+ export function serializeQuery(query: QueryObject): URLSearchParams {
5
+ const queryWithStrings = Object.fromEntries(
6
+ Object.entries(query)
7
+ .filter(e => !!e[1])
8
+ .map(([k, v]) => {
9
+ if (Array.isArray(v)) {
10
+ return [k, v.join(", ")];
11
+ } else {
12
+ return [k, v!.toString()];
13
+ }
14
+ })
15
+ );
16
+
17
+ return new URLSearchParams(queryWithStrings);
18
+ }
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const DTOExporterProperty = z.any({});
4
-
5
- export const DTOExporterPropertyListResponse = z.object({ items: z.array(DTOExporterProperty) });
6
-
7
- export type DTOExporterProperty = z.infer<typeof DTOExporterProperty>;
8
- export type DTOExporterPropertyListResponse = z.infer<typeof DTOExporterPropertyListResponse>;