@kubuild/schema 0.0.1

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 @@
1
+ {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsM/B,CAAC;AAEX,wBAAgB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyF1B,CAAC;AAEX,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpC;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKjC,CAAC;AAEX,wBAAgB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE1C"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export declare const ManifestAssetItemSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ path: z.ZodString;
5
+ mimeType: z.ZodString;
6
+ size: z.ZodNumber;
7
+ checksum: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ export type ManifestAssetItem = z.infer<typeof ManifestAssetItemSchema>;
10
+ export declare const ManifestSchema: z.ZodObject<{
11
+ schema: z.ZodDefault<z.ZodLiteral<"stora.page">>;
12
+ schemaVersion: z.ZodDefault<z.ZodString>;
13
+ packageVersion: z.ZodDefault<z.ZodString>;
14
+ builderCompatibility: z.ZodDefault<z.ZodString>;
15
+ requiredComponents: z.ZodDefault<z.ZodArray<z.ZodString>>;
16
+ requiredCapabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
17
+ assets: z.ZodDefault<z.ZodArray<z.ZodObject<{
18
+ id: z.ZodString;
19
+ path: z.ZodString;
20
+ mimeType: z.ZodString;
21
+ size: z.ZodNumber;
22
+ checksum: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>>>;
24
+ createdAt: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ export type Manifest = z.infer<typeof ManifestSchema>;
27
+ export declare function isManifest(value: unknown): value is Manifest;
28
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;;;;iBAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;iBASzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D"}
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ import { type AssetReference } from './document';
3
+ /**
4
+ * Validates a string as a safe URL or safe asset path.
5
+ */
6
+ export declare function isSafeThumbnailUrl(url: string): boolean;
7
+ /**
8
+ * Safe Thumbnail URL String Schema
9
+ */
10
+ export declare const SafeThumbnailUrlSchema: z.ZodString;
11
+ /**
12
+ * Safe Thumbnail Object Schema
13
+ */
14
+ export declare const SafeThumbnailObjectSchema: z.ZodObject<{
15
+ url: z.ZodString;
16
+ alt: z.ZodOptional<z.ZodString>;
17
+ width: z.ZodOptional<z.ZodNumber>;
18
+ height: z.ZodOptional<z.ZodNumber>;
19
+ }, z.core.$strip>;
20
+ export type SafeThumbnailObject = z.infer<typeof SafeThumbnailObjectSchema>;
21
+ /**
22
+ * Safe Thumbnail Schema (AssetReference | safe URL string | safe thumbnail object)
23
+ */
24
+ export declare const SafeThumbnailSchema: z.ZodUnion<readonly [z.ZodObject<{
25
+ type: z.ZodLiteral<"asset">;
26
+ assetId: z.ZodString;
27
+ filename: z.ZodOptional<z.ZodString>;
28
+ mimeType: z.ZodOptional<z.ZodString>;
29
+ fallbackUrl: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ url: z.ZodString;
32
+ alt: z.ZodOptional<z.ZodString>;
33
+ width: z.ZodOptional<z.ZodNumber>;
34
+ height: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$strip>, z.ZodString]>;
36
+ export type SafeThumbnail = AssetReference | SafeThumbnailObject | string;
37
+ /**
38
+ * Template Package Reference Schema
39
+ * Points to an external or archived .stora / JSON package file.
40
+ */
41
+ export declare const TemplatePackageRefSchema: z.ZodObject<{
42
+ path: z.ZodOptional<z.ZodString>;
43
+ url: z.ZodOptional<z.ZodString>;
44
+ checksum: z.ZodOptional<z.ZodString>;
45
+ format: z.ZodDefault<z.ZodEnum<{
46
+ json: "json";
47
+ stora: "stora";
48
+ }>>;
49
+ }, z.core.$strip>;
50
+ export type TemplatePackageRef = z.infer<typeof TemplatePackageRefSchema>;
51
+ /**
52
+ * Template Requirements Schema
53
+ * Declares custom components and host capabilities required by this template.
54
+ */
55
+ export declare const TemplateRequirementsSchema: z.ZodObject<{
56
+ requiredComponents: z.ZodDefault<z.ZodArray<z.ZodString>>;
57
+ requiredCapabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
58
+ }, z.core.$strip>;
59
+ export type TemplateRequirements = z.infer<typeof TemplateRequirementsSchema>;
60
+ /**
61
+ * Template Record Schema v1
62
+ * Represents a reusable page template with full metadata, safe thumbnail,
63
+ * component/capability requirements, and snapshot document / package reference.
64
+ */
65
+ export declare const TemplateRecordSchema: z.ZodObject<{
66
+ id: z.ZodString;
67
+ name: z.ZodString;
68
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
69
+ category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
70
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
71
+ thumbnail: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
72
+ type: z.ZodLiteral<"asset">;
73
+ assetId: z.ZodString;
74
+ filename: z.ZodOptional<z.ZodString>;
75
+ mimeType: z.ZodOptional<z.ZodString>;
76
+ fallbackUrl: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ url: z.ZodString;
79
+ alt: z.ZodOptional<z.ZodString>;
80
+ width: z.ZodOptional<z.ZodNumber>;
81
+ height: z.ZodOptional<z.ZodNumber>;
82
+ }, z.core.$strip>, z.ZodString]>>;
83
+ author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
84
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
85
+ document: z.ZodOptional<z.ZodObject<{
86
+ schema: z.ZodLiteral<"stora.page">;
87
+ version: z.ZodDefault<z.ZodString>;
88
+ metadata: z.ZodOptional<z.ZodObject<{
89
+ title: z.ZodDefault<z.ZodString>;
90
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
91
+ author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
92
+ createdAt: z.ZodOptional<z.ZodString>;
93
+ updatedAt: z.ZodOptional<z.ZodString>;
94
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
95
+ category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
96
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
97
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
98
+ }, z.core.$strip>>;
99
+ document: z.ZodType<import("./document").RootPageNode, unknown, z.core.$ZodTypeInternals<import("./document").RootPageNode, unknown>>;
100
+ }, z.core.$strip>>;
101
+ packageReference: z.ZodOptional<z.ZodObject<{
102
+ path: z.ZodOptional<z.ZodString>;
103
+ url: z.ZodOptional<z.ZodString>;
104
+ checksum: z.ZodOptional<z.ZodString>;
105
+ format: z.ZodDefault<z.ZodEnum<{
106
+ json: "json";
107
+ stora: "stora";
108
+ }>>;
109
+ }, z.core.$strip>>;
110
+ requirements: z.ZodDefault<z.ZodObject<{
111
+ requiredComponents: z.ZodDefault<z.ZodArray<z.ZodString>>;
112
+ requiredCapabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
113
+ }, z.core.$strip>>;
114
+ createdAt: z.ZodOptional<z.ZodString>;
115
+ updatedAt: z.ZodOptional<z.ZodString>;
116
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
117
+ }, z.core.$strip>;
118
+ export type TemplateRecord = z.infer<typeof TemplateRecordSchema>;
119
+ /**
120
+ * Type guard for TemplateRecord
121
+ */
122
+ export declare function isTemplateRecord(value: unknown): value is TemplateRecord;
123
+ /**
124
+ * Type guard for SafeThumbnail
125
+ */
126
+ export declare function isSafeThumbnail(value: unknown): value is SafeThumbnail;
127
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA4C,KAAK,cAAc,EAAqB,MAAM,YAAY,CAAC;AAS9G;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMvD;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,aAGlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;gCAI9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;iBAKnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;iBAGrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@kubuild/schema",
3
+ "version": "0.0.1",
4
+ "description": "Zod schemas and TypeScript types for the KUBUILD portable page document format (.stora)",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./fixtures/*": "./src/fixtures/*"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/kustora/kubuild.git"
27
+ },
28
+ "keywords": [
29
+ "page-builder",
30
+ "visual-editor",
31
+ "low-code",
32
+ "website-builder",
33
+ "stora",
34
+ "kubuild"
35
+ ],
36
+ "author": "KUBUILD",
37
+ "license": "MIT",
38
+ "bugs": {
39
+ "url": "https://github.com/kustora/kubuild/issues"
40
+ },
41
+ "homepage": "https://github.com/kustora/kubuild#readme",
42
+ "dependencies": {
43
+ "zod": "^4.4.3"
44
+ },
45
+ "devDependencies": {
46
+ "tsup": "^8.3.6",
47
+ "typescript": "^6.0.0",
48
+ "vitest": "^3.0.5"
49
+ },
50
+ "scripts": {
51
+ "build": "tsup && tsc --emitDeclarationOnly",
52
+ "dev": "tsup --watch",
53
+ "typecheck": "tsc --noEmit",
54
+ "lint": "eslint src",
55
+ "test": "vitest run"
56
+ }
57
+ }