@cms0/shared 0.2.20 → 0.2.21

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,9 @@
1
+ export type AssetKind = "image" | "video" | "file";
2
+ export declare function joinStorageKey(...segments: string[]): string;
3
+ export declare function normalizeAssetFilename(value: string): string;
4
+ export declare function inferAssetKindFromFilename(filename: string): AssetKind;
5
+ export declare function getAssetPathSegment(kind: AssetKind): string;
6
+ export declare function getAssetLogicalPath(kind: AssetKind, filename: string): string;
7
+ export declare function deriveAssetFilenameFromStorageKey(storageKey: string): string | undefined;
8
+ export declare function deriveAssetKindFromStorageKey(storageKey: string): AssetKind | undefined;
9
+ //# sourceMappingURL=asset-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-storage.d.ts","sourceRoot":"","sources":["../src/asset-storage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAOnD,wBAAgB,cAAc,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE5D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAKtE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAS3D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAKpB;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GACjB,SAAS,GAAG,SAAS,CAUvB"}
@@ -0,0 +1,50 @@
1
+ const IMAGE_EXTENSION = /\.(png|jpe?g|gif|webp|svg|avif|bmp|ico)$/i;
2
+ const VIDEO_EXTENSION = /\.(mp4|webm|mov|m4v|mkv|avi|ogg)$/i;
3
+ const trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
4
+ export function joinStorageKey(...segments) {
5
+ return segments.map(trimSlashes).filter(Boolean).join("/");
6
+ }
7
+ export function normalizeAssetFilename(value) {
8
+ return value.replace(/\\/g, "/").replace(/^\/+/, "").trim();
9
+ }
10
+ export function inferAssetKindFromFilename(filename) {
11
+ const normalized = normalizeAssetFilename(filename);
12
+ if (VIDEO_EXTENSION.test(normalized))
13
+ return "video";
14
+ if (IMAGE_EXTENSION.test(normalized))
15
+ return "image";
16
+ return "file";
17
+ }
18
+ export function getAssetPathSegment(kind) {
19
+ switch (kind) {
20
+ case "image":
21
+ return "images";
22
+ case "video":
23
+ return "videos";
24
+ case "file":
25
+ return "files";
26
+ }
27
+ }
28
+ export function getAssetLogicalPath(kind, filename) {
29
+ return joinStorageKey("uploads", getAssetPathSegment(kind), normalizeAssetFilename(filename));
30
+ }
31
+ export function deriveAssetFilenameFromStorageKey(storageKey) {
32
+ const normalized = normalizeAssetFilename(storageKey);
33
+ if (!normalized)
34
+ return undefined;
35
+ const parts = normalized.split("/").filter(Boolean);
36
+ return parts.length > 0 ? parts[parts.length - 1] : undefined;
37
+ }
38
+ export function deriveAssetKindFromStorageKey(storageKey) {
39
+ const normalized = normalizeAssetFilename(storageKey);
40
+ const parts = normalized.split("/").filter(Boolean);
41
+ const uploadsIndex = parts.findIndex((part) => part === "uploads");
42
+ const segment = uploadsIndex >= 0 ? parts[uploadsIndex + 1] : parts[0];
43
+ if (segment === "images")
44
+ return "image";
45
+ if (segment === "videos")
46
+ return "video";
47
+ if (segment === "files")
48
+ return "file";
49
+ return undefined;
50
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-capabilities.d.ts","sourceRoot":"","sources":["../src/descriptor-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EAC1B,MAAM,Y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IAAI,CAoB7B;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,eAAe,EAC3B,KAAK,SAAI,GACR,MAAM,CAeR"}
@@ -0,0 +1,35 @@
1
+ export type GraphOrderDirection = "asc" | "desc";
2
+ export type GraphFieldSelector = string | string[];
3
+ export type GraphPageSize = number | "full";
4
+ export type GraphPathQueryOptions = {
5
+ page?: number;
6
+ pageSize?: GraphPageSize;
7
+ orderBy?: string;
8
+ orderDir?: GraphOrderDirection;
9
+ search?: string;
10
+ fields?: GraphFieldSelector;
11
+ exclude?: GraphFieldSelector;
12
+ };
13
+ export type GraphPathQueryMap = Record<string, GraphPathQueryOptions>;
14
+ export type GraphQueryOptions = Omit<GraphPathQueryOptions, "fields" | "exclude"> & {
15
+ fields?: GraphFieldSelector;
16
+ exclude?: GraphFieldSelector;
17
+ locale?: string;
18
+ maxDepth?: number;
19
+ resolveModelRefs?: boolean;
20
+ paths?: GraphPathQueryMap;
21
+ };
22
+ export type ParsedGraphPathQueryOptions = Omit<GraphPathQueryOptions, "fields" | "exclude"> & {
23
+ fields?: string[];
24
+ exclude?: string[];
25
+ };
26
+ export type ParsedGraphQueryOptions = Omit<GraphQueryOptions, "fields" | "exclude" | "paths"> & {
27
+ fields?: string[];
28
+ exclude?: string[];
29
+ paths?: Record<string, ParsedGraphPathQueryOptions>;
30
+ };
31
+ export declare const appendGraphQueryOptions: (params: URLSearchParams, options: GraphQueryOptions | undefined) => URLSearchParams;
32
+ export declare const serializeGraphQueryOptions: (options: GraphQueryOptions | undefined) => URLSearchParams;
33
+ export declare const parseGraphQueryOptions: (searchParams: URLSearchParams) => ParsedGraphQueryOptions;
34
+ export declare const resolveGraphPathQueryOptions: <TOptions extends ParsedGraphPathQueryOptions>(defaults: TOptions, paths: Record<string, TOptions> | undefined, fieldPath: string) => TOptions;
35
+ //# sourceMappingURL=graph-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-query.d.ts","sourceRoot":"","sources":["../src/graph-query.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EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;CACrD,CAAC;AAkEF,eAAO,MAAM,uBAAuB,GAClC,QAAQ,eAAe,EACvB,SAAS,iBAAiB,GAAG,SAAS,oBAqBvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,SAAS,iBAAiB,GAAG,SAAS,oBACoB,CAAC;AAE7D,eAAO,MAAM,sBAAsB,GACjC,cAAc,eAAe,KAC5B,uBA4DF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,QAAQ,SAAS,2BAA2B,EAE5C,UAAU,QAAQ,EAClB,OAAO,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,EAC3C,WAAW,MAAM,KAChB,QAYF,CAAC"}
@@ -0,0 +1,140 @@
1
+ const parseListQueryParam = (value) => {
2
+ if (!value || !value.trim())
3
+ return undefined;
4
+ const items = value
5
+ .split(",")
6
+ .map((item) => item.trim())
7
+ .filter(Boolean);
8
+ return items.length ? items : undefined;
9
+ };
10
+ const normalizeListValue = (value) => {
11
+ if (value === undefined)
12
+ return undefined;
13
+ if (Array.isArray(value)) {
14
+ const items = value
15
+ .map((item) => String(item).trim())
16
+ .filter(Boolean);
17
+ return items.length ? items.join(",") : undefined;
18
+ }
19
+ const trimmed = String(value).trim();
20
+ return trimmed.length ? trimmed : undefined;
21
+ };
22
+ const appendValue = (params, key, value) => {
23
+ if (value === undefined || value === "")
24
+ return;
25
+ params.set(key, String(value));
26
+ };
27
+ const appendListValue = (params, key, value) => {
28
+ const normalized = normalizeListValue(value);
29
+ if (normalized !== undefined)
30
+ params.set(key, normalized);
31
+ };
32
+ const appendPathOptions = (params, prefix, options) => {
33
+ appendValue(params, `${prefix}.page`, options.page);
34
+ appendValue(params, `${prefix}.pageSize`, options.pageSize);
35
+ appendValue(params, `${prefix}.orderBy`, options.orderBy);
36
+ appendValue(params, `${prefix}.orderDir`, options.orderDir);
37
+ appendValue(params, `${prefix}.search`, options.search);
38
+ appendListValue(params, `${prefix}.fields`, options.fields);
39
+ appendListValue(params, `${prefix}.exclude`, options.exclude);
40
+ };
41
+ const parsePageSizeQueryParam = (value) => {
42
+ if (!value || !value.trim())
43
+ return undefined;
44
+ if (value.trim().toLowerCase() === "full")
45
+ return "full";
46
+ const parsed = Number(value);
47
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
48
+ };
49
+ export const appendGraphQueryOptions = (params, options) => {
50
+ if (!options)
51
+ return params;
52
+ appendListValue(params, "fields", options.fields);
53
+ appendListValue(params, "exclude", options.exclude);
54
+ appendValue(params, "locale", options.locale);
55
+ appendValue(params, "maxDepth", options.maxDepth);
56
+ appendValue(params, "page", options.page);
57
+ appendValue(params, "pageSize", options.pageSize);
58
+ appendValue(params, "orderBy", options.orderBy);
59
+ appendValue(params, "orderDir", options.orderDir);
60
+ appendValue(params, "search", options.search);
61
+ appendValue(params, "resolveModelRefs", options.resolveModelRefs);
62
+ for (const [path, pathOptions] of Object.entries(options.paths ?? {})) {
63
+ if (!path.trim())
64
+ continue;
65
+ appendPathOptions(params, path, pathOptions);
66
+ }
67
+ return params;
68
+ };
69
+ export const serializeGraphQueryOptions = (options) => appendGraphQueryOptions(new URLSearchParams(), options);
70
+ export const parseGraphQueryOptions = (searchParams) => {
71
+ const paths = {};
72
+ for (const [key, value] of searchParams.entries()) {
73
+ const match = key.match(/^(\w+(?:\.\w+)*)\.(page|pageSize|orderBy|orderDir|search|fields|exclude)$/);
74
+ if (!match)
75
+ continue;
76
+ const [, path, option] = match;
77
+ if (!path || !option)
78
+ continue;
79
+ const existing = paths[path] ?? {};
80
+ if (option === "page") {
81
+ paths[path] = { ...existing, [option]: Number(value) };
82
+ }
83
+ else if (option === "pageSize") {
84
+ paths[path] = {
85
+ ...existing,
86
+ pageSize: parsePageSizeQueryParam(value),
87
+ };
88
+ }
89
+ else if (option === "orderDir") {
90
+ paths[path] = {
91
+ ...existing,
92
+ orderDir: value === "desc" ? "desc" : "asc",
93
+ };
94
+ }
95
+ else if (option === "fields" || option === "exclude") {
96
+ paths[path] = {
97
+ ...existing,
98
+ [option]: parseListQueryParam(value),
99
+ };
100
+ }
101
+ else {
102
+ paths[path] = { ...existing, [option]: value };
103
+ }
104
+ }
105
+ const resolveModelRefsRaw = searchParams.get("resolveModelRefs");
106
+ const maxDepthRaw = searchParams.get("maxDepth");
107
+ const pageRaw = searchParams.get("page");
108
+ const pageSizeRaw = searchParams.get("pageSize");
109
+ const orderDirRaw = searchParams.get("orderDir");
110
+ return {
111
+ locale: searchParams.get("locale") ?? undefined,
112
+ resolveModelRefs: resolveModelRefsRaw === null
113
+ ? undefined
114
+ : resolveModelRefsRaw !== "false" && resolveModelRefsRaw !== "0",
115
+ maxDepth: maxDepthRaw ? Number(maxDepthRaw) : undefined,
116
+ page: pageRaw ? Number(pageRaw) : undefined,
117
+ pageSize: parsePageSizeQueryParam(pageSizeRaw),
118
+ orderBy: searchParams.get("orderBy") ?? undefined,
119
+ orderDir: orderDirRaw === null
120
+ ? undefined
121
+ : (orderDirRaw === "desc" ? "desc" : "asc"),
122
+ search: searchParams.get("search") ?? undefined,
123
+ fields: parseListQueryParam(searchParams.get("fields")),
124
+ exclude: parseListQueryParam(searchParams.get("exclude")),
125
+ paths: Object.keys(paths).length > 0 ? paths : undefined,
126
+ };
127
+ };
128
+ export const resolveGraphPathQueryOptions = (defaults, paths, fieldPath) => {
129
+ const resolved = { ...defaults };
130
+ if (!paths)
131
+ return resolved;
132
+ const tokens = fieldPath.split(".").filter(Boolean);
133
+ for (let index = 1; index <= tokens.length; index += 1) {
134
+ const path = tokens.slice(0, index).join(".");
135
+ const options = paths[path];
136
+ if (options)
137
+ Object.assign(resolved, options);
138
+ }
139
+ return resolved;
140
+ };
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ export * from "./validation.js";
3
+ export * from "./union.js";
4
+ export * from "./descriptor-capabilities.js";
5
+ export * from "./asset-storage.js";
6
+ export * from "./graph-query.js";
7
+ export declare const environmentKeySchema: z.ZodString;
8
+ export declare const emailTransportKindSchema: z.ZodEnum<{
9
+ log: "log";
10
+ smtp: "smtp";
11
+ plunk: "plunk";
12
+ }>;
13
+ export declare const storageProviderKindSchema: z.ZodEnum<{
14
+ filesystem: "filesystem";
15
+ s3: "s3";
16
+ }>;
17
+ export declare const emailAddressSchema: z.ZodObject<{
18
+ email: z.ZodEmail;
19
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ }, z.core.$strip>;
21
+ export type EmailAddress = z.infer<typeof emailAddressSchema>;
22
+ export declare const logEmailTransportConfigSchema: z.ZodObject<{
23
+ kind: z.ZodLiteral<"log">;
24
+ }, z.core.$strip>;
25
+ export declare const smtpEmailTransportConfigSchema: z.ZodObject<{
26
+ kind: z.ZodLiteral<"smtp">;
27
+ host: z.ZodString;
28
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ port: z.ZodInt;
30
+ secure: z.ZodBoolean;
31
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ }, z.core.$strip>;
33
+ export declare const plunkEmailTransportConfigSchema: z.ZodObject<{
34
+ apiKey: z.ZodString;
35
+ baseUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
36
+ kind: z.ZodLiteral<"plunk">;
37
+ }, z.core.$strip>;
38
+ export declare const emailTransportConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
39
+ kind: z.ZodLiteral<"log">;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ kind: z.ZodLiteral<"smtp">;
42
+ host: z.ZodString;
43
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ port: z.ZodInt;
45
+ secure: z.ZodBoolean;
46
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ apiKey: z.ZodString;
49
+ baseUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
50
+ kind: z.ZodLiteral<"plunk">;
51
+ }, z.core.$strip>], "kind">;
52
+ export type LogEmailTransportConfig = z.infer<typeof logEmailTransportConfigSchema>;
53
+ export type SmtpEmailTransportConfig = z.infer<typeof smtpEmailTransportConfigSchema>;
54
+ export type PlunkEmailTransportConfig = z.infer<typeof plunkEmailTransportConfigSchema>;
55
+ export type EmailTransportConfig = z.infer<typeof emailTransportConfigSchema>;
56
+ export declare const fileSystemStorageProviderConfigSchema: z.ZodObject<{
57
+ kind: z.ZodLiteral<"filesystem">;
58
+ rootPath: z.ZodString;
59
+ }, z.core.$strip>;
60
+ export declare const s3StorageProviderConfigSchema: z.ZodObject<{
61
+ accessKeyId: z.ZodString;
62
+ bucket: z.ZodString;
63
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
64
+ forcePathStyle: z.ZodBoolean;
65
+ kind: z.ZodLiteral<"s3">;
66
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ region: z.ZodString;
68
+ secretAccessKey: z.ZodString;
69
+ }, z.core.$strip>;
70
+ export declare const storageProviderConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
+ kind: z.ZodLiteral<"filesystem">;
72
+ rootPath: z.ZodString;
73
+ }, z.core.$strip>, z.ZodObject<{
74
+ accessKeyId: z.ZodString;
75
+ bucket: z.ZodString;
76
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
77
+ forcePathStyle: z.ZodBoolean;
78
+ kind: z.ZodLiteral<"s3">;
79
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ region: z.ZodString;
81
+ secretAccessKey: z.ZodString;
82
+ }, z.core.$strip>], "kind">;
83
+ export type FileSystemStorageProviderConfig = z.infer<typeof fileSystemStorageProviderConfigSchema>;
84
+ export type S3StorageProviderConfig = z.infer<typeof s3StorageProviderConfigSchema>;
85
+ export type StorageProviderConfig = z.infer<typeof storageProviderConfigSchema>;
86
+ type DescriptorObject = Record<string, unknown>;
87
+ export type DescriptorFieldKind = "primitive" | "object" | "array" | "modelRef";
88
+ export type DescriptorFieldEntry = {
89
+ descriptor: DescriptorObject;
90
+ name: string;
91
+ required: boolean;
92
+ type: string;
93
+ };
94
+ export type ResolvedDescriptorPath = {
95
+ apiPath: string;
96
+ descriptor: DescriptorObject;
97
+ fields: DescriptorFieldEntry[];
98
+ kind: DescriptorFieldKind;
99
+ segments: string[];
100
+ } | null;
101
+ export declare const slugify: (value: string) => string;
102
+ export declare const invariant: (condition: unknown, message: string) => asserts condition;
103
+ export declare const readDescriptorFields: (descriptor: unknown) => DescriptorFieldEntry[];
104
+ export declare const getDescriptorFieldKind: (descriptor: unknown) => DescriptorFieldKind;
105
+ export declare const resolveDescriptorPath: (descriptor: unknown, value: string | string[] | undefined) => ResolvedDescriptorPath;
106
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,eAAO,MAAM,oBAAoB,aAIT,CAAC;AAEzB,eAAO,MAAM,wBAAwB;;;;EAAmC,CAAC;AAEzE,eAAO,MAAM,yBAAyB;;;EAA+B,CAAC;AAEtE,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;iBAOzC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;iBAI1C,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;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B,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,IAAI,CAAC;AAET,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,WAKT,CAAC;AAE7B,eAAO,MAAM,SAAS,GACpB,WAAW,OAAO,EAClB,SAAS,MAAM,KACd,QAAQ,SAIV,CAAC;AAqCF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,OAAO,KAClB,oBAAoB,EAoBtB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,YAAY,OAAO,KAClB,mBAsBF,CAAC;AAOF,eAAO,MAAM,qBAAqB,GAChC,YAAY,OAAO,EACnB,OAAO,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,KACnC,sBAmEF,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,185 @@
1
+ import { z } from "zod";
2
+ export * from "./validation.js";
3
+ export * from "./union.js";
4
+ export * from "./descriptor-capabilities.js";
5
+ export * from "./asset-storage.js";
6
+ export * from "./graph-query.js";
7
+ export const environmentKeySchema = z
8
+ .string()
9
+ .min(2)
10
+ .max(64)
11
+ .regex(/^[a-z0-9-]+$/);
12
+ export const emailTransportKindSchema = z.enum(["log", "smtp", "plunk"]);
13
+ export const storageProviderKindSchema = z.enum(["filesystem", "s3"]);
14
+ export const emailAddressSchema = z.object({
15
+ email: z.email(),
16
+ name: z.string().trim().min(1).max(160).nullable().optional(),
17
+ });
18
+ export const logEmailTransportConfigSchema = z.object({
19
+ kind: z.literal("log"),
20
+ });
21
+ export const smtpEmailTransportConfigSchema = z.object({
22
+ kind: z.literal("smtp"),
23
+ host: z.string().trim().min(1),
24
+ password: z.string().nullable().optional(),
25
+ port: z.int().min(1).max(65535),
26
+ secure: z.boolean(),
27
+ username: z.string().trim().min(1).nullable().optional(),
28
+ });
29
+ export const plunkEmailTransportConfigSchema = z.object({
30
+ apiKey: z.string().trim().min(1),
31
+ baseUrl: z.url().nullable().optional(),
32
+ kind: z.literal("plunk"),
33
+ });
34
+ export const emailTransportConfigSchema = z.discriminatedUnion("kind", [
35
+ logEmailTransportConfigSchema,
36
+ smtpEmailTransportConfigSchema,
37
+ plunkEmailTransportConfigSchema,
38
+ ]);
39
+ export const fileSystemStorageProviderConfigSchema = z.object({
40
+ kind: z.literal("filesystem"),
41
+ rootPath: z.string().trim().min(1),
42
+ });
43
+ export const s3StorageProviderConfigSchema = z.object({
44
+ accessKeyId: z.string().trim().min(1),
45
+ bucket: z.string().trim().min(1),
46
+ endpoint: z.url().nullable().optional(),
47
+ forcePathStyle: z.boolean(),
48
+ kind: z.literal("s3"),
49
+ prefix: z.string().trim().min(1).nullable().optional(),
50
+ region: z.string().trim().min(1),
51
+ secretAccessKey: z.string().trim().min(1),
52
+ });
53
+ export const storageProviderConfigSchema = z.discriminatedUnion("kind", [
54
+ fileSystemStorageProviderConfigSchema,
55
+ s3StorageProviderConfigSchema,
56
+ ]);
57
+ export const slugify = (value) => value
58
+ .trim()
59
+ .toLowerCase()
60
+ .replace(/[^a-z0-9]+/g, "-")
61
+ .replace(/(^-|-$)/g, "");
62
+ export const invariant = (condition, message) => {
63
+ if (!condition) {
64
+ throw new Error(message);
65
+ }
66
+ };
67
+ const isDescriptorObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
68
+ const readDescriptorFieldType = (value) => {
69
+ if (!isDescriptorObject(value)) {
70
+ return "unknown";
71
+ }
72
+ if (value.kind === "union") {
73
+ return "union";
74
+ }
75
+ if (typeof value.type === "string" && value.type.trim().length > 0) {
76
+ return value.type;
77
+ }
78
+ if (Array.isArray(value.type) && value.type.length > 0) {
79
+ return value.type.filter((item) => typeof item === "string").join(" | ");
80
+ }
81
+ if (isDescriptorObject(value.properties)) {
82
+ return "object";
83
+ }
84
+ if (Array.isArray(value.enum)) {
85
+ return "enum";
86
+ }
87
+ if (typeof value.model === "string" && value.model.trim().length > 0) {
88
+ return `model:${value.model}`;
89
+ }
90
+ return "unknown";
91
+ };
92
+ export const readDescriptorFields = (descriptor) => {
93
+ if (!isDescriptorObject(descriptor)) {
94
+ return [];
95
+ }
96
+ const properties = isDescriptorObject(descriptor.properties)
97
+ ? descriptor.properties
98
+ : {};
99
+ const required = new Set(Array.isArray(descriptor.required)
100
+ ? descriptor.required.filter((value) => typeof value === "string")
101
+ : []);
102
+ return Object.entries(properties).map(([name, fieldDescriptor]) => ({
103
+ descriptor: isDescriptorObject(fieldDescriptor) ? fieldDescriptor : {},
104
+ name,
105
+ required: required.has(name),
106
+ type: readDescriptorFieldType(fieldDescriptor),
107
+ }));
108
+ };
109
+ export const getDescriptorFieldKind = (descriptor) => {
110
+ if (!isDescriptorObject(descriptor)) {
111
+ return "primitive";
112
+ }
113
+ if (descriptor.kind === "modelRef") {
114
+ return "modelRef";
115
+ }
116
+ if (descriptor.type === "array") {
117
+ return "array";
118
+ }
119
+ if (descriptor.type === "object" || isDescriptorObject(descriptor.properties)) {
120
+ return "object";
121
+ }
122
+ if (typeof descriptor.model === "string" && descriptor.model.trim().length > 0) {
123
+ return "modelRef";
124
+ }
125
+ return "primitive";
126
+ };
127
+ const normalizeDescriptorPath = (value) => {
128
+ const joined = Array.isArray(value) ? value.join("/") : (value ?? "");
129
+ return joined.replace(/^\/+|\/+$/g, "");
130
+ };
131
+ export const resolveDescriptorPath = (descriptor, value) => {
132
+ if (!isDescriptorObject(descriptor) || !isDescriptorObject(descriptor.roots)) {
133
+ return null;
134
+ }
135
+ const path = normalizeDescriptorPath(value);
136
+ if (!path) {
137
+ return null;
138
+ }
139
+ const segments = path.split("/").filter(Boolean);
140
+ const [rootName, ...rest] = segments;
141
+ if (!rootName) {
142
+ return null;
143
+ }
144
+ const rootDescriptor = descriptor.roots[rootName];
145
+ if (!isDescriptorObject(rootDescriptor)) {
146
+ return null;
147
+ }
148
+ let current = rootDescriptor;
149
+ const resolvedSegments = [rootName];
150
+ for (const segment of rest) {
151
+ let kind = getDescriptorFieldKind(current);
152
+ if (kind === "array") {
153
+ const itemDescriptor = isDescriptorObject(current.items)
154
+ ? current.items
155
+ : null;
156
+ if (!itemDescriptor) {
157
+ return null;
158
+ }
159
+ current = itemDescriptor;
160
+ kind = getDescriptorFieldKind(current);
161
+ if (/^\d+$/.test(segment)) {
162
+ continue;
163
+ }
164
+ }
165
+ if (kind === "object") {
166
+ const next = isDescriptorObject(current.properties)
167
+ ? current.properties[segment]
168
+ : null;
169
+ if (!isDescriptorObject(next)) {
170
+ return null;
171
+ }
172
+ current = next;
173
+ resolvedSegments.push(segment);
174
+ continue;
175
+ }
176
+ return null;
177
+ }
178
+ return {
179
+ apiPath: path,
180
+ descriptor: current,
181
+ fields: readDescriptorFields(current),
182
+ kind: getDescriptorFieldKind(current),
183
+ segments: resolvedSegments,
184
+ };
185
+ };
package/dist/saas.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import { z } from "zod";
2
+ export declare const hostedRedisCapabilityConfigSchema: z.ZodObject<{
3
+ namespacePrefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ }, z.core.$strip>;
6
+ export declare const hostedStorageBundleConfigSchema: z.ZodObject<{
7
+ environment: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ kind: z.ZodLiteral<"filesystem">;
9
+ rootPath: z.ZodString;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ accessKeyId: z.ZodString;
12
+ bucket: z.ZodString;
13
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
14
+ forcePathStyle: z.ZodBoolean;
15
+ kind: z.ZodLiteral<"s3">;
16
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ region: z.ZodString;
18
+ secretAccessKey: z.ZodString;
19
+ }, z.core.$strip>], "kind">;
20
+ platform: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ kind: z.ZodLiteral<"filesystem">;
22
+ rootPath: z.ZodString;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ accessKeyId: z.ZodString;
25
+ bucket: z.ZodString;
26
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
27
+ forcePathStyle: z.ZodBoolean;
28
+ kind: z.ZodLiteral<"s3">;
29
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ region: z.ZodString;
31
+ secretAccessKey: z.ZodString;
32
+ }, z.core.$strip>], "kind">;
33
+ }, z.core.$strip>;
34
+ export declare const hostedDefaultRuntimeBindingConfigSchema: z.ZodObject<{
35
+ databaseNamePrefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ databaseUrlTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ email: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ kind: z.ZodLiteral<"log">;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ kind: z.ZodLiteral<"smtp">;
41
+ host: z.ZodString;
42
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ port: z.ZodInt;
44
+ secure: z.ZodBoolean;
45
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ apiKey: z.ZodString;
48
+ baseUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
49
+ kind: z.ZodLiteral<"plunk">;
50
+ }, z.core.$strip>], "kind">>>;
51
+ redis: z.ZodOptional<z.ZodNullable<z.ZodObject<{
52
+ namespacePrefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ }, z.core.$strip>>>;
55
+ storage: z.ZodObject<{
56
+ environment: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ kind: z.ZodLiteral<"filesystem">;
58
+ rootPath: z.ZodString;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ accessKeyId: z.ZodString;
61
+ bucket: z.ZodString;
62
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
63
+ forcePathStyle: z.ZodBoolean;
64
+ kind: z.ZodLiteral<"s3">;
65
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ region: z.ZodString;
67
+ secretAccessKey: z.ZodString;
68
+ }, z.core.$strip>], "kind">;
69
+ platform: z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ kind: z.ZodLiteral<"filesystem">;
71
+ rootPath: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ accessKeyId: z.ZodString;
74
+ bucket: z.ZodString;
75
+ endpoint: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
76
+ forcePathStyle: z.ZodBoolean;
77
+ kind: z.ZodLiteral<"s3">;
78
+ prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ region: z.ZodString;
80
+ secretAccessKey: z.ZodString;
81
+ }, z.core.$strip>], "kind">;
82
+ }, z.core.$strip>;
83
+ }, z.core.$strip>;
84
+ export type HostedRedisCapabilityConfig = z.infer<typeof hostedRedisCapabilityConfigSchema>;
85
+ export type HostedStorageBundleConfig = z.infer<typeof hostedStorageBundleConfigSchema>;
86
+ export type HostedDefaultRuntimeBindingConfig = z.infer<typeof hostedDefaultRuntimeBindingConfigSchema>;
87
+ //# sourceMappingURL=saas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saas.d.ts","sourceRoot":"","sources":["../src/saas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,iCAAiC;;;iBAG5C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG1C,CAAC;AAEH,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMlD,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC"}
package/dist/saas.js ADDED
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ import { emailTransportConfigSchema, storageProviderConfigSchema, } from "./index.js";
3
+ export const hostedRedisCapabilityConfigSchema = z.object({
4
+ namespacePrefix: z.string().trim().min(1).nullable().optional(),
5
+ url: z.string().trim().min(1).nullable().optional(),
6
+ });
7
+ export const hostedStorageBundleConfigSchema = z.object({
8
+ environment: storageProviderConfigSchema,
9
+ platform: storageProviderConfigSchema,
10
+ });
11
+ export const hostedDefaultRuntimeBindingConfigSchema = z.object({
12
+ databaseNamePrefix: z.string().trim().min(1).nullable().optional(),
13
+ databaseUrlTemplate: z.string().trim().min(1).nullable().optional(),
14
+ email: emailTransportConfigSchema.nullable().optional(),
15
+ redis: hostedRedisCapabilityConfigSchema.nullable().optional(),
16
+ storage: hostedStorageBundleConfigSchema,
17
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../src/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAG,aAAsB,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC3C,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AA8FnE,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAc5E;AAED,wBAAgB,kB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