@supernova-studio/model 0.58.26 → 0.58.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/model",
3
- "version": "0.58.26",
3
+ "version": "0.58.27",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,90 @@
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 ExporterPropertyDefinitionValue = PrimitiveValue.or(ArrayValue).or(ObjectValue);
12
+ export const ExporterPropertyType = z.enum(["Enum", "Boolean", "String", "Number", "Array", "Object"]);
13
+
14
+ export type ExporterPropertyDefinitionValue = z.infer<typeof ExporterPropertyDefinitionValue>;
15
+ export type ExporterPropertyType = z.infer<typeof ExporterPropertyType>;
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 ExporterPropertyDefinitionEnum = PropertyDefinitionBase.extend({
28
+ type: z.literal(ExporterPropertyType.Enum.Enum),
29
+ options: z.string().array(),
30
+ default: z.string(),
31
+ });
32
+
33
+ export const ExporterPropertyDefinitionBoolean = PropertyDefinitionBase.extend({
34
+ type: z.literal(ExporterPropertyType.Enum.Boolean),
35
+ default: z.boolean(),
36
+ });
37
+
38
+ export const ExporterPropertyDefinitionString = PropertyDefinitionBase.extend({
39
+ type: z.literal(ExporterPropertyType.Enum.String),
40
+ default: z.string(),
41
+ });
42
+
43
+ export const ExporterPropertyDefinitionNumber = PropertyDefinitionBase.extend({
44
+ type: z.literal(ExporterPropertyType.Enum.Number),
45
+ default: z.number(),
46
+ });
47
+
48
+ export const ExporterPropertyDefinitionArray = PropertyDefinitionBase.extend({
49
+ type: z.literal(ExporterPropertyType.Enum.Array),
50
+ default: ArrayValue,
51
+ });
52
+
53
+ export const ExporterPropertyDefinitionObject = PropertyDefinitionBase.extend({
54
+ type: z.literal(ExporterPropertyType.Enum.Object),
55
+ default: ObjectValue,
56
+ allowedKeys: z
57
+ .object({
58
+ options: z.string().array(),
59
+ type: z.string(),
60
+ })
61
+ .optional(),
62
+ allowedValues: z
63
+ .object({
64
+ type: z.string(),
65
+ })
66
+ .optional(),
67
+ });
68
+
69
+ export const ExporterPropertyDefinition = z.discriminatedUnion("type", [
70
+ ExporterPropertyDefinitionEnum,
71
+ ExporterPropertyDefinitionBoolean,
72
+ ExporterPropertyDefinitionString,
73
+ ExporterPropertyDefinitionNumber,
74
+ ExporterPropertyDefinitionArray,
75
+ ExporterPropertyDefinitionObject,
76
+ ]);
77
+
78
+ export type ExporterPropertyDefinitionEnum = z.infer<typeof ExporterPropertyDefinitionEnum>;
79
+ export type ExporterPropertyDefinitionBoolean = z.infer<typeof ExporterPropertyDefinitionBoolean>;
80
+ export type ExporterPropertyDefinitionString = z.infer<typeof ExporterPropertyDefinitionString>;
81
+ export type ExporterPropertyDefinitionNumber = z.infer<typeof ExporterPropertyDefinitionNumber>;
82
+ export type ExporterPropertyDefinitionArray = z.infer<typeof ExporterPropertyDefinitionArray>;
83
+ export type ExporterPropertyDefinitionObject = z.infer<typeof ExporterPropertyDefinitionObject>;
84
+ export type ExporterPropertyDefinition = z.infer<typeof ExporterPropertyDefinition>;
85
+ //
86
+ // Value
87
+ //
88
+
89
+ export const ExporterPropertyDefinitionValueMap = z.record(ExporterPropertyDefinitionValue);
90
+ export type ExporterPropertyDefinitionValueMap = z.infer<typeof ExporterPropertyDefinitionValueMap>;
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { PublishedDocEnvironment } from "../dsm";
3
3
  import { DbCreateInputOmit, DbUpdate, nullishToOptional } from "../helpers";
4
4
  import { ExportDestinationsMap } from "./export-destinations";
5
+ import { ExporterPropertyDefinitionValueMap } from "./export-configuration";
5
6
 
6
7
  //
7
8
  // Enums
@@ -89,6 +90,7 @@ export const ExportJob = z.object({
89
90
  status: ExportJobStatus,
90
91
  result: ExportJobResult.optional(),
91
92
  createdByUserId: z.string().optional(),
93
+ exporterConfigurationProperties: ExporterPropertyDefinitionValueMap.optional(),
92
94
 
93
95
  // Destinations
94
96
  ...ExportDestinationsMap.shape,
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ExporterPropertyValue, PublishedDocEnvironment } from "../../dsm";
3
+ import { ExporterPropertyDefinitionValueMap } from "../export-configuration";
3
4
 
4
5
  export const ExportJobDocumentationContext = z.object({
5
6
  isSingleVersionDocs: z.boolean(),
@@ -27,6 +28,7 @@ export const ExportJobContext = z.object({
27
28
  export const ExportJobExporterConfiguration = z.object({
28
29
  exporterPackageUrl: z.string(),
29
30
  exporterPropertyValues: ExporterPropertyValue.array(),
31
+ exporterConfigurationProperties: ExporterPropertyDefinitionValueMap.optional(),
30
32
  });
31
33
 
32
34
  export type ExportJobDocumentationContext = z.infer<typeof ExportJobDocumentationContext>;
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { nullishToOptional } from "../helpers";
3
3
  import { GitProvider } from "./git-providers";
4
4
  import { PulsarContributionConfigurationProperty, PulsarContributionVariant, PulsarCustomBlock } from "./pulsar";
5
+ import { ExporterPropertyDefinition } from "./export-configuration";
5
6
 
6
7
  export const ExporterType = z.enum(["code", "documentation"]);
7
8
  export const ExporterSource = z.enum(["git", "upload"]);
@@ -22,6 +23,7 @@ export const ExporterPulsarDetails = z.object({
22
23
  configurationProperties: nullishToOptional(z.array(PulsarContributionConfigurationProperty)).default([]),
23
24
  customBlocks: nullishToOptional(z.array(PulsarCustomBlock)).default([]),
24
25
  blockVariants: nullishToOptional(z.record(z.string(), z.array(PulsarContributionVariant))).default({}),
26
+ properties: nullishToOptional(ExporterPropertyDefinition.array()),
25
27
 
26
28
  usesBrands: nullishToOptional(z.boolean()).default(false),
27
29
  usesThemes: nullishToOptional(z.boolean()).default(false),
@@ -45,6 +47,7 @@ export const Exporter = z.object({
45
47
  details: ExporterDetails,
46
48
  exporterType: nullishToOptional(ExporterType).default("code"),
47
49
  storagePath: nullishToOptional(z.string()).default(""),
50
+ properties: nullishToOptional(ExporterPropertyDefinition.array()),
48
51
  });
49
52
 
50
53
  export type ExporterType = z.infer<typeof ExporterType>;
@@ -1,4 +1,5 @@
1
1
  export * from "./export-runner";
2
+ export * from "./export-configuration";
2
3
  export * from "./export-destinations";
3
4
  export * from "./export-jobs";
4
5
  export * from "./exporter-workspace-membership-role";
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ExportDestinationsMap } from "./export-destinations";
3
+ import { ExporterPropertyDefinitionValueMap } from "./export-configuration";
3
4
 
4
5
  export const PipelineEventType = z.enum(["OnVersionReleased", "OnHeadChanged", "OnSourceUpdated", "None"]);
5
6
 
@@ -21,6 +22,7 @@ export const Pipeline = z.object({
21
22
  brandPersistentId: z.string().optional(),
22
23
  themePersistentId: z.string().optional(),
23
24
  themePersistentIds: z.string().array().optional(),
25
+ exporterConfigurationProperties: ExporterPropertyDefinitionValueMap.optional(),
24
26
 
25
27
  // Destinations
26
28
  ...ExportDestinationsMap.shape,