@postxl/schema 1.0.0 → 1.0.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.
@@ -4,22 +4,7 @@ export declare const zProjectSchemaJSON: z.ZodEffects<z.ZodObject<{
4
4
  name: z.ZodString;
5
5
  slug: z.ZodString;
6
6
  description: z.ZodOptional<z.ZodString>;
7
- projectType: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
8
- kind: z.ZodLiteral<"standalone">;
9
- }, "strip", z.ZodTypeAny, {
10
- kind: "standalone";
11
- }, {
12
- kind: "standalone";
13
- }>, z.ZodObject<{
14
- kind: z.ZodLiteral<"workspace">;
15
- projectDirectory: z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- kind: "workspace";
18
- projectDirectory: string;
19
- }, {
20
- kind: "workspace";
21
- projectDirectory: string;
22
- }>]>>;
7
+ projectType: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"standalone">, z.ZodLiteral<"workspace">]>>>;
23
8
  version: z.ZodOptional<z.ZodString>;
24
9
  schemas: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
10
  defaultSchema: z.ZodOptional<z.ZodString>;
@@ -156,14 +141,9 @@ export declare const zProjectSchemaJSON: z.ZodEffects<z.ZodObject<{
156
141
  name: string;
157
142
  source: Record<string, unknown>;
158
143
  slug: string;
144
+ projectType: "standalone" | "workspace";
159
145
  description?: string | undefined;
160
146
  version?: string | undefined;
161
- projectType?: {
162
- kind: "standalone";
163
- } | {
164
- kind: "workspace";
165
- projectDirectory: string;
166
- } | undefined;
167
147
  schemas?: string[] | undefined;
168
148
  defaultSchema?: string | undefined;
169
149
  systemUser?: Record<string, any> | undefined;
@@ -206,12 +186,7 @@ export declare const zProjectSchemaJSON: z.ZodEffects<z.ZodObject<{
206
186
  slug: string;
207
187
  description?: string | undefined;
208
188
  version?: string | undefined;
209
- projectType?: {
210
- kind: "standalone";
211
- } | {
212
- kind: "workspace";
213
- projectDirectory: string;
214
- } | undefined;
189
+ projectType?: "standalone" | "workspace" | undefined;
215
190
  schemas?: string[] | undefined;
216
191
  defaultSchema?: string | undefined;
217
192
  systemUser?: Record<string, any> | undefined;
@@ -232,14 +207,9 @@ export declare const zProjectSchemaJSON: z.ZodEffects<z.ZodObject<{
232
207
  name: string;
233
208
  source: Record<string, unknown>;
234
209
  slug: string;
210
+ projectType: "standalone" | "workspace";
235
211
  description?: string | undefined;
236
212
  version?: string | undefined;
237
- projectType?: {
238
- kind: "standalone";
239
- } | {
240
- kind: "workspace";
241
- projectDirectory: string;
242
- } | undefined;
243
213
  schemas?: string[] | undefined;
244
214
  defaultSchema?: string | undefined;
245
215
  systemUser?: Record<string, any> | undefined;
@@ -80,20 +80,10 @@ exports.zProjectSchemaJSON = zod_1.z
80
80
  .describe('A helpful description of the project.'),
81
81
  projectType: zod_1.z
82
82
  //
83
- .union([
84
- zod_1.z.object({
85
- kind: zod_1.z.literal('standalone'),
86
- }),
87
- zod_1.z.object({
88
- kind: zod_1.z.literal('workspace'),
89
- projectDirectory: zod_1.z
90
- .string()
91
- .min(1, 'Project directory must not be empty')
92
- .describe('The project directory, without leading or trailing slash.'),
93
- }),
94
- ], (0, utils_1.unionErrorMessage)((data) => `Project type must be either ${(0, utils_1.yellow)('"standalone"')} or ${(0, utils_1.yellow)('"workspace"')} (with additional fields)! Instead, received ${(0, utils_1.red)(JSON.stringify(data))}.`))
83
+ .union([zod_1.z.literal('standalone'), zod_1.z.literal('workspace')])
95
84
  .optional()
96
- .describe('The type of the project, either "standalone" or "workspace".'),
85
+ .default('standalone')
86
+ .describe('The type of the project, either "standalone" or "workspace". Defaults to "standalone".'),
97
87
  version: zod_1.z
98
88
  //
99
89
  .string()
@@ -9,22 +9,7 @@ export declare const zProjectSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
9
9
  name: z.ZodString;
10
10
  slug: z.ZodString;
11
11
  description: z.ZodOptional<z.ZodString>;
12
- projectType: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
13
- kind: z.ZodLiteral<"standalone">;
14
- }, "strip", z.ZodTypeAny, {
15
- kind: "standalone";
16
- }, {
17
- kind: "standalone";
18
- }>, z.ZodObject<{
19
- kind: z.ZodLiteral<"workspace">;
20
- projectDirectory: z.ZodString;
21
- }, "strip", z.ZodTypeAny, {
22
- kind: "workspace";
23
- projectDirectory: string;
24
- }, {
25
- kind: "workspace";
26
- projectDirectory: string;
27
- }>]>>;
12
+ projectType: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"standalone">, z.ZodLiteral<"workspace">]>>>;
28
13
  version: z.ZodOptional<z.ZodString>;
29
14
  schemas: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
15
  defaultSchema: z.ZodOptional<z.ZodString>;
@@ -161,14 +146,9 @@ export declare const zProjectSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
161
146
  name: string;
162
147
  source: Record<string, unknown>;
163
148
  slug: string;
149
+ projectType: "standalone" | "workspace";
164
150
  description?: string | undefined;
165
151
  version?: string | undefined;
166
- projectType?: {
167
- kind: "standalone";
168
- } | {
169
- kind: "workspace";
170
- projectDirectory: string;
171
- } | undefined;
172
152
  schemas?: string[] | undefined;
173
153
  defaultSchema?: string | undefined;
174
154
  systemUser?: Record<string, any> | undefined;
@@ -211,12 +191,7 @@ export declare const zProjectSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
211
191
  slug: string;
212
192
  description?: string | undefined;
213
193
  version?: string | undefined;
214
- projectType?: {
215
- kind: "standalone";
216
- } | {
217
- kind: "workspace";
218
- projectDirectory: string;
219
- } | undefined;
194
+ projectType?: "standalone" | "workspace" | undefined;
220
195
  schemas?: string[] | undefined;
221
196
  defaultSchema?: string | undefined;
222
197
  systemUser?: Record<string, any> | undefined;
@@ -237,14 +212,9 @@ export declare const zProjectSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
237
212
  name: string;
238
213
  source: Record<string, unknown>;
239
214
  slug: string;
215
+ projectType: "standalone" | "workspace";
240
216
  description?: string | undefined;
241
217
  version?: string | undefined;
242
- projectType?: {
243
- kind: "standalone";
244
- } | {
245
- kind: "workspace";
246
- projectDirectory: string;
247
- } | undefined;
248
218
  schemas?: string[] | undefined;
249
219
  defaultSchema?: string | undefined;
250
220
  systemUser?: Record<string, any> | undefined;
@@ -74,7 +74,7 @@ function addDefaults(input) {
74
74
  name: input.name,
75
75
  slug: input.slug,
76
76
  description: input.description ?? '',
77
- projectType: input.projectType ?? { kind: 'workspace', projectDirectory: input.slug },
77
+ projectType: input.projectType ?? 'standalone',
78
78
  version: input.version ?? '0.0.1',
79
79
  schemas,
80
80
  defaultSchema,
@@ -66,12 +66,7 @@ export type ProjectSchema = {
66
66
  */
67
67
  source: Record<string, unknown>;
68
68
  };
69
- export type ProjectType = {
70
- kind: 'standalone';
71
- } | {
72
- kind: 'workspace';
73
- projectDirectory: string;
74
- };
69
+ export type ProjectType = 'standalone' | 'workspace';
75
70
  export type SystemUser = Record<string, unknown> & {
76
71
  id: string;
77
72
  };
@@ -661,10 +661,7 @@ export declare const sampleSchemas: {
661
661
  name: string;
662
662
  slug: string;
663
663
  description: string;
664
- projectType: {
665
- kind: string;
666
- projectDirectory: string;
667
- };
664
+ projectType: string;
668
665
  version: string;
669
666
  schemas: string[];
670
667
  defaultSchema: string;
@@ -2,10 +2,7 @@
2
2
  "name": "PXL Template Project",
3
3
  "slug": "pxl-template",
4
4
  "description": "A template for PostXL projects.",
5
- "projectType": {
6
- "kind": "workspace",
7
- "projectDirectory": "template"
8
- },
5
+ "projectType": "workspace",
9
6
  "version": "0.0.1",
10
7
  "schemas": ["PXL", "Data"],
11
8
  "defaultSchema": "Data",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/schema",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Decoders for PXL Schema definitions and validation for PXL code generation framework",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -30,21 +30,14 @@
30
30
  "files": [
31
31
  "dist"
32
32
  ],
33
- "scripts": {
34
- "build": "tsc -b tsconfig.build.json",
35
- "lint": "eslint .",
36
- "prettier:check": "prettier --check \"**/*.{ts,tsx}\" --config ../../prettier.config.js --ignore-path ../../.prettierignore",
37
- "test:jest": "jest",
38
- "test:coverage": "jest --coverage",
39
- "test:watch": "jest --watch",
40
- "test:types": "tsc --noEmit"
41
- },
42
33
  "repository": {
43
34
  "type": "git",
44
35
  "url": "https://github.com/postxl/pxl",
45
36
  "directory": "packages/schema"
46
37
  },
47
- "dependencies": {},
38
+ "dependencies": {
39
+ "@postxl/utils": "^1.0.0"
40
+ },
48
41
  "devDependencies": {},
49
42
  "wallaby": {
50
43
  "env": {
@@ -53,5 +46,14 @@
53
46
  "runner": "--experimental-vm-modules"
54
47
  }
55
48
  }
49
+ },
50
+ "scripts": {
51
+ "build": "tsc -b tsconfig.build.json",
52
+ "lint": "eslint .",
53
+ "prettier:check": "prettier --check \"**/*.{ts,tsx}\" --config ../../prettier.config.js --ignore-path ../../.prettierignore",
54
+ "test:jest": "jest",
55
+ "test:coverage": "jest --coverage",
56
+ "test:watch": "jest --watch",
57
+ "test:types": "tsc --noEmit"
56
58
  }
57
- }
59
+ }