@jpmorganchase/mosaic-schemas 0.1.0-beta.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.
@@ -0,0 +1,178 @@
1
+ import { z } from 'zod';
2
+ export declare const mosaicConfigSchema: z.ZodObject<{
3
+ /**
4
+ * A collection of file extensions that can be served
5
+ * e.g. [".mdx", ".json"]
6
+ */
7
+ pageExtensions: z.ZodArray<z.ZodString, "atleastone">;
8
+ /**
9
+ * A collection of filenames to ignore
10
+ * These are typically generated by plugins.
11
+ */
12
+ ignorePages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
+ serialisers: z.ZodArray<z.ZodObject<z.extendShape<{
14
+ modulePath: z.ZodString;
15
+ options: z.ZodOptional<z.ZodUnknown>;
16
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
17
+ priority: z.ZodOptional<z.ZodNumber>;
18
+ }, {
19
+ filter: z.ZodEffects<z.ZodAny, RegExp, any>;
20
+ }>, "strip", z.ZodTypeAny, {
21
+ options?: unknown;
22
+ runTimeOnly?: boolean | undefined;
23
+ priority?: number | undefined;
24
+ modulePath: string;
25
+ filter: RegExp;
26
+ }, {
27
+ options?: unknown;
28
+ runTimeOnly?: boolean | undefined;
29
+ priority?: number | undefined;
30
+ filter?: any;
31
+ modulePath: string;
32
+ }>, "many">;
33
+ plugins: z.ZodArray<z.ZodObject<{
34
+ modulePath: z.ZodString;
35
+ options: z.ZodOptional<z.ZodUnknown>;
36
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
37
+ priority: z.ZodOptional<z.ZodNumber>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ options?: unknown;
40
+ runTimeOnly?: boolean | undefined;
41
+ priority?: number | undefined;
42
+ modulePath: string;
43
+ }, {
44
+ options?: unknown;
45
+ runTimeOnly?: boolean | undefined;
46
+ priority?: number | undefined;
47
+ modulePath: string;
48
+ }>, "many">;
49
+ sources: z.ZodArray<z.ZodObject<z.extendShape<{
50
+ modulePath: z.ZodString;
51
+ options: z.ZodOptional<z.ZodUnknown>;
52
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
53
+ priority: z.ZodOptional<z.ZodNumber>;
54
+ }, {
55
+ namespace: z.ZodString;
56
+ cache: z.ZodOptional<z.ZodBoolean>;
57
+ workflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
+ name: z.ZodString;
59
+ options: z.ZodUnknown;
60
+ action: z.ZodAny;
61
+ }, "strip", z.ZodTypeAny, {
62
+ options?: unknown;
63
+ action?: any;
64
+ name: string;
65
+ }, {
66
+ options?: unknown;
67
+ action?: any;
68
+ name: string;
69
+ }>, "many">>;
70
+ }>, "strip", z.ZodTypeAny, {
71
+ options?: unknown;
72
+ runTimeOnly?: boolean | undefined;
73
+ priority?: number | undefined;
74
+ cache?: boolean | undefined;
75
+ workflows?: {
76
+ options?: unknown;
77
+ action?: any;
78
+ name: string;
79
+ }[] | undefined;
80
+ modulePath: string;
81
+ namespace: string;
82
+ }, {
83
+ options?: unknown;
84
+ runTimeOnly?: boolean | undefined;
85
+ priority?: number | undefined;
86
+ cache?: boolean | undefined;
87
+ workflows?: {
88
+ options?: unknown;
89
+ action?: any;
90
+ name: string;
91
+ }[] | undefined;
92
+ modulePath: string;
93
+ namespace: string;
94
+ }>, "atleastone">;
95
+ }, "strip", z.ZodTypeAny, {
96
+ ignorePages?: string[] | undefined;
97
+ pageExtensions: [string, ...string[]];
98
+ serialisers: {
99
+ options?: unknown;
100
+ runTimeOnly?: boolean | undefined;
101
+ priority?: number | undefined;
102
+ modulePath: string;
103
+ filter: RegExp;
104
+ }[];
105
+ plugins: {
106
+ options?: unknown;
107
+ runTimeOnly?: boolean | undefined;
108
+ priority?: number | undefined;
109
+ modulePath: string;
110
+ }[];
111
+ sources: [{
112
+ options?: unknown;
113
+ runTimeOnly?: boolean | undefined;
114
+ priority?: number | undefined;
115
+ cache?: boolean | undefined;
116
+ workflows?: {
117
+ options?: unknown;
118
+ action?: any;
119
+ name: string;
120
+ }[] | undefined;
121
+ modulePath: string;
122
+ namespace: string;
123
+ }, ...{
124
+ options?: unknown;
125
+ runTimeOnly?: boolean | undefined;
126
+ priority?: number | undefined;
127
+ cache?: boolean | undefined;
128
+ workflows?: {
129
+ options?: unknown;
130
+ action?: any;
131
+ name: string;
132
+ }[] | undefined;
133
+ modulePath: string;
134
+ namespace: string;
135
+ }[]];
136
+ }, {
137
+ ignorePages?: string[] | undefined;
138
+ pageExtensions: [string, ...string[]];
139
+ serialisers: {
140
+ options?: unknown;
141
+ runTimeOnly?: boolean | undefined;
142
+ priority?: number | undefined;
143
+ filter?: any;
144
+ modulePath: string;
145
+ }[];
146
+ plugins: {
147
+ options?: unknown;
148
+ runTimeOnly?: boolean | undefined;
149
+ priority?: number | undefined;
150
+ modulePath: string;
151
+ }[];
152
+ sources: [{
153
+ options?: unknown;
154
+ runTimeOnly?: boolean | undefined;
155
+ priority?: number | undefined;
156
+ cache?: boolean | undefined;
157
+ workflows?: {
158
+ options?: unknown;
159
+ action?: any;
160
+ name: string;
161
+ }[] | undefined;
162
+ modulePath: string;
163
+ namespace: string;
164
+ }, ...{
165
+ options?: unknown;
166
+ runTimeOnly?: boolean | undefined;
167
+ priority?: number | undefined;
168
+ cache?: boolean | undefined;
169
+ workflows?: {
170
+ options?: unknown;
171
+ action?: any;
172
+ name: string;
173
+ }[] | undefined;
174
+ modulePath: string;
175
+ namespace: string;
176
+ }[]];
177
+ }>;
178
+ export declare type MosaicConfig = z.infer<typeof mosaicConfigSchema>;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { fileExtensionSchema } from './fileExtensionSchema.js';
3
+ import { pluginModuleSchema } from './PluginModuleSchema.js';
4
+ import { serialiserModuleSchema } from './SerialiserModuleSchema.js';
5
+ import { sourceModuleSchema } from './SourceModuleSchema.js';
6
+ export const mosaicConfigSchema = z.object({
7
+ /**
8
+ * A collection of file extensions that can be served
9
+ * e.g. [".mdx", ".json"]
10
+ */
11
+ pageExtensions: fileExtensionSchema.array().nonempty(),
12
+ /**
13
+ * A collection of filenames to ignore
14
+ * These are typically generated by plugins.
15
+ */
16
+ ignorePages: z.string().array().optional(),
17
+ serialisers: z.array(serialiserModuleSchema),
18
+ plugins: z.array(pluginModuleSchema),
19
+ sources: z.array(sourceModuleSchema).nonempty()
20
+ });
21
+ //# sourceMappingURL=MosaicConfigSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MosaicConfigSchema.js","sourceRoot":"","sources":["../src/MosaicConfigSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC;;;OAGG;IACH,cAAc,EAAE,mBAAmB,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IACtD;;;OAGG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ export declare const pluginModuleSchema: z.ZodObject<{
3
+ /**
4
+ * Path to the JS file for this plugin (can either export a `default` module with lifecycle methods,
5
+ * or export the methods individually)
6
+ */
7
+ modulePath: z.ZodString;
8
+ /**
9
+ * Options to pass to the plugin lifecycle methods.
10
+ */
11
+ options: z.ZodOptional<z.ZodUnknown>;
12
+ /**
13
+ * Exclude this plugin when running `mosaic build`
14
+ */
15
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
16
+ /**
17
+ * The importance of this plugin. This highest number plugin will be run first
18
+ */
19
+ priority: z.ZodOptional<z.ZodNumber>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ options?: unknown;
22
+ runTimeOnly?: boolean | undefined;
23
+ priority?: number | undefined;
24
+ modulePath: string;
25
+ }, {
26
+ options?: unknown;
27
+ runTimeOnly?: boolean | undefined;
28
+ priority?: number | undefined;
29
+ modulePath: string;
30
+ }>;
31
+ export declare type PluginModuleDefinition = z.infer<typeof pluginModuleSchema>;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export const pluginModuleSchema = z.object({
3
+ /**
4
+ * Path to the JS file for this plugin (can either export a `default` module with lifecycle methods,
5
+ * or export the methods individually)
6
+ */
7
+ modulePath: z.string({ required_error: 'A path to the plugin module is required.' }),
8
+ /**
9
+ * Options to pass to the plugin lifecycle methods.
10
+ */
11
+ options: z.unknown().optional(),
12
+ /**
13
+ * Exclude this plugin when running `mosaic build`
14
+ */
15
+ runTimeOnly: z.boolean().optional(),
16
+ /**
17
+ * The importance of this plugin. This highest number plugin will be run first
18
+ */
19
+ priority: z.number().optional()
20
+ });
21
+ //# sourceMappingURL=PluginModuleSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginModuleSchema.js","sourceRoot":"","sources":["../src/PluginModuleSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,0CAA0C,EAAE,CAAC;IACpF;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC;;OAEG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ export declare const serialiserModuleSchema: z.ZodObject<z.extendShape<{
3
+ modulePath: z.ZodString;
4
+ options: z.ZodOptional<z.ZodUnknown>;
5
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
6
+ priority: z.ZodOptional<z.ZodNumber>;
7
+ }, {
8
+ filter: z.ZodEffects<z.ZodAny, RegExp, any>;
9
+ }>, "strip", z.ZodTypeAny, {
10
+ options?: unknown;
11
+ runTimeOnly?: boolean | undefined;
12
+ priority?: number | undefined;
13
+ modulePath: string;
14
+ filter: RegExp;
15
+ }, {
16
+ options?: unknown;
17
+ runTimeOnly?: boolean | undefined;
18
+ priority?: number | undefined;
19
+ filter?: any;
20
+ modulePath: string;
21
+ }>;
22
+ export declare type SerialiserModuleDefinition = z.infer<typeof serialiserModuleSchema>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { pluginModuleSchema } from './PluginModuleSchema.js';
3
+ export const serialiserModuleSchema = pluginModuleSchema.merge(z.object({
4
+ filter: z
5
+ .any({ required_error: 'A regex is required to filter pages' })
6
+ .transform(val => new RegExp(val))
7
+ }));
8
+ //# sourceMappingURL=SerialiserModuleSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SerialiserModuleSchema.js","sourceRoot":"","sources":["../src/SerialiserModuleSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,KAAK,CAC5D,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC;SACN,GAAG,CAAC,EAAE,cAAc,EAAE,qCAAqC,EAAE,CAAC;SAC9D,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;CACrC,CAAC,CACH,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export declare const sourceModuleSchema: z.ZodObject<z.extendShape<{
3
+ modulePath: z.ZodString;
4
+ options: z.ZodOptional<z.ZodUnknown>;
5
+ runTimeOnly: z.ZodOptional<z.ZodBoolean>;
6
+ priority: z.ZodOptional<z.ZodNumber>;
7
+ }, {
8
+ /**
9
+ * each site has it's own namespace, think of this as your content's uid
10
+ */
11
+ namespace: z.ZodString;
12
+ /**
13
+ * set to true to cache the the source pages
14
+ */
15
+ cache: z.ZodOptional<z.ZodBoolean>;
16
+ /**
17
+ * A collection of workflows that can be triggered for this source
18
+ */
19
+ workflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
20
+ name: z.ZodString;
21
+ options: z.ZodUnknown;
22
+ action: z.ZodAny;
23
+ }, "strip", z.ZodTypeAny, {
24
+ options?: unknown;
25
+ action?: any;
26
+ name: string;
27
+ }, {
28
+ options?: unknown;
29
+ action?: any;
30
+ name: string;
31
+ }>, "many">>;
32
+ }>, "strip", z.ZodTypeAny, {
33
+ options?: unknown;
34
+ runTimeOnly?: boolean | undefined;
35
+ priority?: number | undefined;
36
+ cache?: boolean | undefined;
37
+ workflows?: {
38
+ options?: unknown;
39
+ action?: any;
40
+ name: string;
41
+ }[] | undefined;
42
+ modulePath: string;
43
+ namespace: string;
44
+ }, {
45
+ options?: unknown;
46
+ runTimeOnly?: boolean | undefined;
47
+ priority?: number | undefined;
48
+ cache?: boolean | undefined;
49
+ workflows?: {
50
+ options?: unknown;
51
+ action?: any;
52
+ name: string;
53
+ }[] | undefined;
54
+ modulePath: string;
55
+ namespace: string;
56
+ }>;
57
+ export declare type SourceModuleDefinition = z.infer<typeof sourceModuleSchema>;
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { pluginModuleSchema } from './PluginModuleSchema.js';
3
+ import { sourceWorkflowSchema } from './SourceWorkflowSchema.js';
4
+ export const sourceModuleSchema = pluginModuleSchema.merge(z.object({
5
+ /**
6
+ * each site has it's own namespace, think of this as your content's uid
7
+ */
8
+ namespace: z.string(),
9
+ /**
10
+ * set to true to cache the the source pages
11
+ */
12
+ cache: z.boolean().optional(),
13
+ /**
14
+ * A collection of workflows that can be triggered for this source
15
+ */
16
+ workflows: z.array(sourceWorkflowSchema).optional()
17
+ }));
18
+ //# sourceMappingURL=SourceModuleSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceModuleSchema.js","sourceRoot":"","sources":["../src/SourceModuleSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,KAAK,CACxD,CAAC,CAAC,MAAM,CAAC;IACP;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7B;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;CACpD,CAAC,CACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export declare const sourceWorkflowSchema: z.ZodObject<{
3
+ /**
4
+ * The name of the workflow
5
+ */
6
+ name: z.ZodString;
7
+ /**
8
+ * Workflow config options
9
+ */
10
+ options: z.ZodUnknown;
11
+ /**
12
+ * action to run when workflow is triggered
13
+ */
14
+ action: z.ZodAny;
15
+ }, "strip", z.ZodTypeAny, {
16
+ options?: unknown;
17
+ action?: any;
18
+ name: string;
19
+ }, {
20
+ options?: unknown;
21
+ action?: any;
22
+ name: string;
23
+ }>;
24
+ export declare type SourceWorkflow = z.infer<typeof sourceWorkflowSchema>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export const sourceWorkflowSchema = z.object({
3
+ /**
4
+ * The name of the workflow
5
+ */
6
+ name: z.string(),
7
+ /**
8
+ * Workflow config options
9
+ */
10
+ options: z.unknown(),
11
+ /**
12
+ * action to run when workflow is triggered
13
+ */
14
+ action: z.any()
15
+ });
16
+ //# sourceMappingURL=SourceWorkflowSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceWorkflowSchema.js","sourceRoot":"","sources":["../src/SourceWorkflowSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE;CAChB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const credentialsSchema: z.ZodString;
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export const credentialsSchema = z
3
+ .string({ required_error: 'Please provide credentials to access the repository' })
4
+ .regex(/[:]/, 'credentials must be in the form username:token');
5
+ //# sourceMappingURL=credentialsSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentialsSchema.js","sourceRoot":"","sources":["../src/credentialsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC,EAAE,cAAc,EAAE,qDAAqD,EAAE,CAAC;KACjF,KAAK,CAAC,KAAK,EAAE,gDAAgD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const fileExtensionSchema: z.ZodString;
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export const fileExtensionSchema = z
3
+ .string()
4
+ .startsWith('.', 'Page extensions must start with a "."');
5
+ //# sourceMappingURL=fileExtensionSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileExtensionSchema.js","sourceRoot":"","sources":["../src/fileExtensionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,EAAE;KACR,UAAU,CAAC,GAAG,EAAE,uCAAuC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './PluginModuleSchema.js';
2
+ export * from './MosaicConfigSchema.js';
3
+ export * from './SerialiserModuleSchema.js';
4
+ export * from './SourceModuleSchema.js';
5
+ export * from './SourceWorkflowSchema.js';
6
+ export * from './fileExtensionSchema.js';
7
+ export * from './credentialsSchema.js';
8
+ export * from './validate.js';
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from './PluginModuleSchema.js';
2
+ export * from './MosaicConfigSchema.js';
3
+ export * from './SerialiserModuleSchema.js';
4
+ export * from './SourceModuleSchema.js';
5
+ export * from './SourceWorkflowSchema.js';
6
+ export * from './fileExtensionSchema.js';
7
+ export * from './credentialsSchema.js';
8
+ export * from './validate.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare function validateMosaicSchema<T extends z.ZodTypeAny>(schema: T, options: Record<string, unknown>, exitOnError?: boolean): void;
@@ -0,0 +1,15 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export function validateMosaicSchema(schema, options, exitOnError = false) {
3
+ try {
4
+ schema.parse(options);
5
+ }
6
+ catch (err) {
7
+ console.group('[Mosaic] schema validation error');
8
+ console.table(err.issues);
9
+ console.groupEnd();
10
+ if (exitOnError) {
11
+ process.exit(1);
12
+ }
13
+ }
14
+ }
15
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAEA,wDAAwD;AACxD,MAAM,UAAU,oBAAoB,CAClC,MAAS,EACT,OAAgC,EAChC,WAAW,GAAG,KAAK;IAEnB,IAAI;QACF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KACvB;IAAC,OAAO,GAAY,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAE,GAAgB,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnB,IAAI,WAAW,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;KACF;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@jpmorganchase/mosaic-schemas",
3
+ "version": "0.1.0-beta.10",
4
+ "author": "",
5
+ "description": "Mosaic Schemas",
6
+ "license": "Apache-2.0",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "type": "module",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "node": "./dist/index.js"
15
+ }
16
+ },
17
+ "engines": {
18
+ "node": ">= 16.0.0"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git@github.com:jpmorganchase/mosaic.git"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsc",
29
+ "clean": "rm -fr dist",
30
+ "lint": "eslint --ignore-pattern \"**/__tests__/**\""
31
+ },
32
+ "dependencies": {
33
+ "zod": "^3.19.1"
34
+ }
35
+ }