busabase-cms-sdk 0.1.3
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/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/content-BXgsWQjQ.js +1175 -0
- package/dist/fumadocs.d.ts +24 -0
- package/dist/fumadocs.js +188 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +14 -0
- package/dist/integration/index.d.ts +251 -0
- package/dist/integration/index.js +268 -0
- package/dist/next.d.ts +34 -0
- package/dist/next.js +107 -0
- package/dist/routing-C3lkVAZ8.js +91 -0
- package/dist/routing-VU56uuJ0.d.ts +321 -0
- package/dist/types-QKFW2jvT.d.ts +205 -0
- package/package.json +84 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { c as PostVO, d as TagVO, i as CategoryVO, o as PageVO } from "./types-QKFW2jvT.js";
|
|
2
|
+
import { BusabaseConfig } from "busabase-sdk";
|
|
3
|
+
//#region src/errors.d.ts
|
|
4
|
+
declare class BusabaseCmsError extends Error {
|
|
5
|
+
constructor(message: string, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
declare class BusabaseCmsSetupError extends BusabaseCmsError {
|
|
8
|
+
constructor(message: string, options?: ErrorOptions);
|
|
9
|
+
}
|
|
10
|
+
declare class BusabaseCmsSchemaDriftError extends BusabaseCmsSetupError {
|
|
11
|
+
constructor(message: string, options?: ErrorOptions);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/source.d.ts
|
|
15
|
+
type BusabaseCmsFieldType = "text" | "longtext" | "markdown" | "html" | "attachment" | "relation" | "number" | "date" | "checkbox" | "select" | "multiselect" | "url" | "embed" | "email" | "phone" | "created_time" | "updated_time" | "created_by" | "updated_by" | "auto_number" | "ai_summary" | "ai_tags" | "code" | "yaml" | "json" | "formula" | "lookup" | "whiteboard";
|
|
16
|
+
interface BusabaseCmsFieldOptions {
|
|
17
|
+
attachment?: {
|
|
18
|
+
maxFiles?: number;
|
|
19
|
+
allowedMimeTypes?: string[];
|
|
20
|
+
maxFileSize?: number;
|
|
21
|
+
};
|
|
22
|
+
choices?: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
color?: string;
|
|
26
|
+
}>;
|
|
27
|
+
multiple?: boolean;
|
|
28
|
+
targetBaseId?: string;
|
|
29
|
+
targetBaseSlug?: string;
|
|
30
|
+
}
|
|
31
|
+
interface BusabaseCmsField {
|
|
32
|
+
id?: string;
|
|
33
|
+
baseId?: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
name: string | Record<string, string | undefined>;
|
|
36
|
+
type: BusabaseCmsFieldType;
|
|
37
|
+
required: boolean;
|
|
38
|
+
position?: number;
|
|
39
|
+
options: BusabaseCmsFieldOptions;
|
|
40
|
+
}
|
|
41
|
+
interface BusabaseCmsBase {
|
|
42
|
+
id: string;
|
|
43
|
+
nodeId: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
fields: BusabaseCmsField[];
|
|
48
|
+
}
|
|
49
|
+
interface BusabaseCmsNode {
|
|
50
|
+
id: string;
|
|
51
|
+
parentId: string | null;
|
|
52
|
+
type: string;
|
|
53
|
+
slug: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
metadata: Record<string, unknown>;
|
|
57
|
+
baseId: string | null;
|
|
58
|
+
children: BusabaseCmsNode[];
|
|
59
|
+
}
|
|
60
|
+
interface CreateBusabaseCmsBaseInput {
|
|
61
|
+
parentNodeId: string;
|
|
62
|
+
slug: string;
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
fields: Array<Omit<BusabaseCmsField, "id" | "baseId" | "position">>;
|
|
66
|
+
autoMerge: true;
|
|
67
|
+
}
|
|
68
|
+
interface CreateBusabaseCmsFieldInput extends Omit<BusabaseCmsField, "id" | "baseId" | "position"> {
|
|
69
|
+
baseId: string;
|
|
70
|
+
}
|
|
71
|
+
interface BusabaseCmsRecord {
|
|
72
|
+
id: string;
|
|
73
|
+
status: "active" | "archived";
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
headCommit: {
|
|
76
|
+
/** Polymorphic commit payload; for a record commit this is its field values. */
|
|
77
|
+
payload: Record<string, unknown>;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
interface BusabaseCmsSource {
|
|
81
|
+
getBaseBySlug: (slug: string) => Promise<{
|
|
82
|
+
id: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
} | null>;
|
|
85
|
+
getBaseById?: (baseId: string) => Promise<BusabaseCmsBase | null>;
|
|
86
|
+
getNode?: (nodeId: string) => Promise<BusabaseCmsNode | null>;
|
|
87
|
+
listDirectChildren?: (parentNodeId: string) => Promise<BusabaseCmsNode[]>;
|
|
88
|
+
createBase?: (input: CreateBusabaseCmsBaseInput) => Promise<BusabaseCmsBase>;
|
|
89
|
+
createField?: (input: CreateBusabaseCmsFieldInput) => Promise<BusabaseCmsBase>;
|
|
90
|
+
updateNodeMetadata?: (input: {
|
|
91
|
+
nodeId: string;
|
|
92
|
+
metadata: Record<string, unknown>;
|
|
93
|
+
}) => Promise<BusabaseCmsNode>;
|
|
94
|
+
listRecordsPage: (input: {
|
|
95
|
+
baseId: string;
|
|
96
|
+
limit: number;
|
|
97
|
+
cursor?: string;
|
|
98
|
+
}) => Promise<{
|
|
99
|
+
records: BusabaseCmsRecord[];
|
|
100
|
+
nextCursor: string | null;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Point lookup by an exact field value, scoped to one Base — lets callers with a
|
|
104
|
+
* unique key per Base (a `path`, a `slug`) skip paging through every record just to
|
|
105
|
+
* find one. Optional: sources that don't implement it fall back to list+find.
|
|
106
|
+
*/
|
|
107
|
+
getRecordByField?: (input: {
|
|
108
|
+
baseId: string;
|
|
109
|
+
fieldSlug: string;
|
|
110
|
+
valueText: string;
|
|
111
|
+
}) => Promise<BusabaseCmsRecord | null>;
|
|
112
|
+
}
|
|
113
|
+
interface BusabaseCmsClient {
|
|
114
|
+
bases: {
|
|
115
|
+
get: (input: {
|
|
116
|
+
baseId: string;
|
|
117
|
+
}) => Promise<BusabaseCmsBase | null>;
|
|
118
|
+
create: (input: CreateBusabaseCmsBaseInput) => Promise<BusabaseCmsBase | {
|
|
119
|
+
materialized: false;
|
|
120
|
+
}>;
|
|
121
|
+
createField: (input: CreateBusabaseCmsFieldInput) => Promise<BusabaseCmsBase>;
|
|
122
|
+
};
|
|
123
|
+
nodes: {
|
|
124
|
+
list: (input?: {
|
|
125
|
+
parentId?: string | null;
|
|
126
|
+
depth?: number;
|
|
127
|
+
status?: "active" | "archived";
|
|
128
|
+
}) => Promise<BusabaseCmsNode[]>;
|
|
129
|
+
updateMetadata: (input: {
|
|
130
|
+
nodeId: string;
|
|
131
|
+
metadata: Record<string, unknown>;
|
|
132
|
+
}) => Promise<BusabaseCmsNode>;
|
|
133
|
+
};
|
|
134
|
+
records: {
|
|
135
|
+
list: (input: {
|
|
136
|
+
baseId: string;
|
|
137
|
+
limit: number;
|
|
138
|
+
cursor?: string;
|
|
139
|
+
status?: "active" | "archived";
|
|
140
|
+
}) => Promise<{
|
|
141
|
+
records: BusabaseCmsRecord[];
|
|
142
|
+
nextCursor: string | null;
|
|
143
|
+
}>;
|
|
144
|
+
getByField?: (input: {
|
|
145
|
+
baseId: string;
|
|
146
|
+
fieldSlug: string;
|
|
147
|
+
valueText: string;
|
|
148
|
+
}) => Promise<BusabaseCmsRecord | null>;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
declare const createBusabaseCmsSource: (client?: BusabaseCmsClient) => BusabaseCmsSource;
|
|
152
|
+
declare const createBusabaseCmsSourceFromConfig: (config?: BusabaseConfig) => BusabaseCmsSource;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/schema.d.ts
|
|
155
|
+
declare const BUSABASE_CMS_SCHEMA_VERSION = 1;
|
|
156
|
+
declare const BUSABASE_CMS_METADATA_KEY = "busabaseCms";
|
|
157
|
+
declare const BUSABASE_CMS_ROLES: readonly ["categories", "tags", "posts", "pages"];
|
|
158
|
+
/** The only profile the SDK itself ships a field shape for. Any other non-empty string is a
|
|
159
|
+
* caller-owned profile label (see `fieldsOverride`/`legacyOptionalFields` on the provisioning
|
|
160
|
+
* options) — the SDK stores and round-trips it but never branches on its value. */
|
|
161
|
+
declare const BUSABASE_CMS_SCHEMA_PROFILES: readonly ["standard"];
|
|
162
|
+
type BusabaseCmsBaseRole = (typeof BUSABASE_CMS_ROLES)[number];
|
|
163
|
+
type BusabaseCmsBaseIds = Record<BusabaseCmsBaseRole, string>;
|
|
164
|
+
/** `"standard"` selects the SDK's built-in field shape. Any other label is opaque to the SDK —
|
|
165
|
+
* it's persisted as Folder metadata and used for mismatch detection, but the actual field shape
|
|
166
|
+
* for that label must be supplied by the caller via `fieldsOverride`. */
|
|
167
|
+
type BusabaseCmsSchemaProfile = "standard" | (string & {});
|
|
168
|
+
interface BusabaseCmsFolderMetadata {
|
|
169
|
+
schemaVersion: typeof BUSABASE_CMS_SCHEMA_VERSION;
|
|
170
|
+
/** Missing in metadata written before profiles were introduced; it means `standard`. */
|
|
171
|
+
profile?: BusabaseCmsSchemaProfile;
|
|
172
|
+
bases: BusabaseCmsBaseIds;
|
|
173
|
+
}
|
|
174
|
+
interface BusabaseCmsFieldDefinition extends Omit<BusabaseCmsField, "id" | "baseId" | "position"> {}
|
|
175
|
+
interface BusabaseCmsBaseDefinition {
|
|
176
|
+
role: BusabaseCmsBaseRole;
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
fields: BusabaseCmsFieldDefinition[];
|
|
180
|
+
}
|
|
181
|
+
declare const i18nName: (en: string, zhCN: string) => {
|
|
182
|
+
en: string;
|
|
183
|
+
"zh-CN": string;
|
|
184
|
+
};
|
|
185
|
+
declare const replaceField: (fields: BusabaseCmsFieldDefinition[], slug: string, replacement: BusabaseCmsFieldDefinition) => BusabaseCmsFieldDefinition[];
|
|
186
|
+
/**
|
|
187
|
+
* Lets a caller reshape the SDK's standard `posts`/`pages` field list into its own app-specific
|
|
188
|
+
* contract (e.g. a richer page-builder shape) without the SDK itself knowing that app by name.
|
|
189
|
+
* Receives the standard fields for that role plus the resolved Base ids, returns the field list
|
|
190
|
+
* to actually provision/validate against.
|
|
191
|
+
*/
|
|
192
|
+
type BusabaseCmsFieldsOverride = (role: "posts" | "pages", standardFields: BusabaseCmsFieldDefinition[], baseIds: Partial<BusabaseCmsBaseIds>) => BusabaseCmsFieldDefinition[];
|
|
193
|
+
declare const getBusabaseCmsBaseDefinition: (role: BusabaseCmsBaseRole, baseIds?: Partial<BusabaseCmsBaseIds>, fieldsOverride?: BusabaseCmsFieldsOverride) => BusabaseCmsBaseDefinition;
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/content.d.ts
|
|
196
|
+
declare const DEFAULT_POSTS_BASE_SLUG = "busabase-cms-posts";
|
|
197
|
+
declare const DEFAULT_PAGES_BASE_SLUG = "busabase-cms-pages";
|
|
198
|
+
declare const DEFAULT_CATEGORIES_BASE_SLUG = "busabase-cms-categories";
|
|
199
|
+
declare const DEFAULT_TAGS_BASE_SLUG = "busabase-cms-tags";
|
|
200
|
+
type CmsRecordKind = "post" | "page" | "category" | "tag";
|
|
201
|
+
interface InvalidCmsRecordIssue {
|
|
202
|
+
kind: CmsRecordKind;
|
|
203
|
+
recordId: string;
|
|
204
|
+
error: BusabaseCmsError;
|
|
205
|
+
}
|
|
206
|
+
interface BusabaseCmsOptions {
|
|
207
|
+
config?: BusabaseConfig;
|
|
208
|
+
client?: BusabaseCmsClient;
|
|
209
|
+
source?: BusabaseCmsSource;
|
|
210
|
+
/** Stable Folder node id used to discover and remember the four CMS Base ids. */
|
|
211
|
+
folderId?: string;
|
|
212
|
+
/** Directly materialize missing CMS Bases/fields on first read. Requires folderId. */
|
|
213
|
+
lazyCreate?: boolean;
|
|
214
|
+
/** Provisioning contract label for the Folder. Defaults to the reusable standard CMS schema. */
|
|
215
|
+
schemaProfile?: BusabaseCmsSchemaProfile;
|
|
216
|
+
/**
|
|
217
|
+
* Reshapes the standard `posts`/`pages` field list into an app-specific contract. Required
|
|
218
|
+
* when `schemaProfile` is anything other than `"standard"` — the SDK has no field shape of
|
|
219
|
+
* its own for a custom profile label, only what this override returns.
|
|
220
|
+
*/
|
|
221
|
+
fieldsOverride?: BusabaseCmsFieldsOverride;
|
|
222
|
+
/** Grandfather in a field that predates a later required-field tightening for this profile. */
|
|
223
|
+
legacyOptionalFields?: Array<{
|
|
224
|
+
role: BusabaseCmsBaseRole;
|
|
225
|
+
slug: string;
|
|
226
|
+
}>;
|
|
227
|
+
baseSlugs?: {
|
|
228
|
+
posts?: string;
|
|
229
|
+
pages?: string;
|
|
230
|
+
categories?: string;
|
|
231
|
+
tags?: string;
|
|
232
|
+
};
|
|
233
|
+
pageSize?: number;
|
|
234
|
+
invalidRecords?: "skip" | "throw";
|
|
235
|
+
onInvalidRecord?: (issue: InvalidCmsRecordIssue) => void;
|
|
236
|
+
}
|
|
237
|
+
interface BusabaseCmsPathCollection<T> {
|
|
238
|
+
list: () => Promise<T[]>;
|
|
239
|
+
getByPath: (path: string) => Promise<T | null>;
|
|
240
|
+
}
|
|
241
|
+
interface BusabaseCmsTaxonomyCollection<T> {
|
|
242
|
+
list: () => Promise<T[]>;
|
|
243
|
+
getBySlug: (slug: string) => Promise<T | null>;
|
|
244
|
+
}
|
|
245
|
+
interface BusabaseCms {
|
|
246
|
+
posts: BusabaseCmsPathCollection<PostVO>;
|
|
247
|
+
pages: BusabaseCmsPathCollection<PageVO>;
|
|
248
|
+
categories: BusabaseCmsTaxonomyCollection<CategoryVO>;
|
|
249
|
+
tags: BusabaseCmsTaxonomyCollection<TagVO>;
|
|
250
|
+
}
|
|
251
|
+
declare const mapPublishedPostRecord: (record: BusabaseCmsRecord) => PostVO | null;
|
|
252
|
+
declare const mapPublishedPageRecord: (record: BusabaseCmsRecord) => PageVO | null;
|
|
253
|
+
declare const mapActiveCategoryRecord: (record: BusabaseCmsRecord) => CategoryVO | null;
|
|
254
|
+
declare const mapActiveTagRecord: (record: BusabaseCmsRecord) => TagVO | null;
|
|
255
|
+
declare const createBusabaseCms: (options?: BusabaseCmsOptions) => BusabaseCms;
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/routing.d.ts
|
|
258
|
+
interface CmsCanonicalPath {
|
|
259
|
+
canonicalPath: string;
|
|
260
|
+
locale: string;
|
|
261
|
+
pathWithoutLocale: string;
|
|
262
|
+
segments: string[];
|
|
263
|
+
}
|
|
264
|
+
interface CmsCanonicalPathOptions {
|
|
265
|
+
supportedLocales: readonly string[];
|
|
266
|
+
defaultLocale?: string;
|
|
267
|
+
}
|
|
268
|
+
type CmsTaxonomyKind = "categories" | "tags";
|
|
269
|
+
/** Normalize a stored or requested path into a stable, decoded canonical key. */
|
|
270
|
+
declare const normalizeCmsPath: (path: string) => string | null;
|
|
271
|
+
/** Parse locale ownership from a canonical CMS path. The default locale is unprefixed. */
|
|
272
|
+
declare const parseCmsCanonicalPath: (path: string, { supportedLocales, defaultLocale }: CmsCanonicalPathOptions) => CmsCanonicalPath | null;
|
|
273
|
+
declare const buildCmsCanonicalPath: (locale: string, path: string | readonly string[], options: CmsCanonicalPathOptions) => string | null;
|
|
274
|
+
declare const isCmsContentForLocale: (item: {
|
|
275
|
+
locale: string;
|
|
276
|
+
path: string;
|
|
277
|
+
}, locale: string, options: CmsCanonicalPathOptions) => boolean;
|
|
278
|
+
declare const isCmsBlogPostPath: (path: string, options: CmsCanonicalPathOptions) => boolean;
|
|
279
|
+
/** Build a locale-aware archive URL for a Category or Tag record. */
|
|
280
|
+
declare const buildCmsTaxonomyArchivePath: (kind: CmsTaxonomyKind, taxonomy: {
|
|
281
|
+
locale: string;
|
|
282
|
+
slug: string;
|
|
283
|
+
}, options: CmsCanonicalPathOptions) => string | null;
|
|
284
|
+
/**
|
|
285
|
+
* A `CmsCanonicalPathOptions` bound once into ready-to-call helpers — every app consuming
|
|
286
|
+
* busabase-cms was hand-rolling the same `buildXPath`/`parseXPath`/`isXForLocale` wrappers
|
|
287
|
+
* around its own copy of `{ supportedLocales, defaultLocale }`. Call this once per app with
|
|
288
|
+
* its locale config and pass the result around instead of re-deriving these closures.
|
|
289
|
+
*/
|
|
290
|
+
interface CmsPathHelpers {
|
|
291
|
+
readonly options: CmsCanonicalPathOptions;
|
|
292
|
+
normalizePath: (path: string) => string | null;
|
|
293
|
+
parsePath: (path: string) => CmsCanonicalPath | null;
|
|
294
|
+
buildPath: (locale: string, path: string | readonly string[]) => string | null;
|
|
295
|
+
isForLocale: (item: {
|
|
296
|
+
locale: string;
|
|
297
|
+
path: string;
|
|
298
|
+
}, locale: string) => boolean;
|
|
299
|
+
/** A record is valid content when its path parses AND actually belongs to its own claimed locale. */
|
|
300
|
+
isValidContent: (item: {
|
|
301
|
+
locale: string;
|
|
302
|
+
path: string;
|
|
303
|
+
}) => boolean;
|
|
304
|
+
isBlogPostPath: (path: string) => boolean;
|
|
305
|
+
buildTaxonomyArchivePath: (kind: CmsTaxonomyKind, taxonomy: {
|
|
306
|
+
locale: string;
|
|
307
|
+
slug: string;
|
|
308
|
+
}) => string | null;
|
|
309
|
+
}
|
|
310
|
+
declare const createCmsPathHelpers: (options: CmsCanonicalPathOptions) => CmsPathHelpers;
|
|
311
|
+
/** Select Posts related to one taxonomy record without mixing locales. */
|
|
312
|
+
declare const filterCmsPostsByTaxonomy: <T extends {
|
|
313
|
+
locale: string;
|
|
314
|
+
categoryIds: readonly string[];
|
|
315
|
+
tagIds: readonly string[];
|
|
316
|
+
}>(posts: readonly T[], kind: CmsTaxonomyKind, taxonomy: {
|
|
317
|
+
id: string;
|
|
318
|
+
locale: string;
|
|
319
|
+
}) => T[];
|
|
320
|
+
//#endregion
|
|
321
|
+
export { BusabaseCmsSetupError as $, BUSABASE_CMS_SCHEMA_PROFILES as A, i18nName as B, createBusabaseCms as C, mapPublishedPostRecord as D, mapPublishedPageRecord as E, BusabaseCmsFieldDefinition as F, BusabaseCmsFieldOptions as G, BusabaseCmsBase as H, BusabaseCmsFieldsOverride as I, BusabaseCmsSource as J, BusabaseCmsNode as K, BusabaseCmsFolderMetadata as L, BusabaseCmsBaseDefinition as M, BusabaseCmsBaseIds as N, BUSABASE_CMS_METADATA_KEY as O, BusabaseCmsBaseRole as P, BusabaseCmsSchemaDriftError as Q, BusabaseCmsSchemaProfile as R, InvalidCmsRecordIssue as S, mapActiveTagRecord as T, BusabaseCmsClient as U, replaceField as V, BusabaseCmsField as W, createBusabaseCmsSourceFromConfig as X, createBusabaseCmsSource as Y, BusabaseCmsError as Z, CmsRecordKind as _, buildCmsCanonicalPath as a, DEFAULT_POSTS_BASE_SLUG as b, filterCmsPostsByTaxonomy as c, normalizeCmsPath as d, parseCmsCanonicalPath as f, BusabaseCmsTaxonomyCollection as g, BusabaseCmsPathCollection as h, CmsTaxonomyKind as i, BUSABASE_CMS_SCHEMA_VERSION as j, BUSABASE_CMS_ROLES as k, isCmsBlogPostPath as l, BusabaseCmsOptions as m, CmsCanonicalPathOptions as n, buildCmsTaxonomyArchivePath as o, BusabaseCms as p, BusabaseCmsRecord as q, CmsPathHelpers as r, createCmsPathHelpers as s, CmsCanonicalPath as t, isCmsContentForLocale as u, DEFAULT_CATEGORIES_BASE_SLUG as v, mapActiveCategoryRecord as w, DEFAULT_TAGS_BASE_SLUG as x, DEFAULT_PAGES_BASE_SLUG as y, getBusabaseCmsBaseDefinition as z };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
declare const attachmentVOSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
attachmentId: z.ZodString;
|
|
6
|
+
assetId: z.ZodNullable<z.ZodString>;
|
|
7
|
+
url: z.ZodURL;
|
|
8
|
+
fileName: z.ZodString;
|
|
9
|
+
mimeType: z.ZodString;
|
|
10
|
+
size: z.ZodNumber;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
declare const attachmentFieldsDTOSchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
url: z.ZodURL;
|
|
17
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
19
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$loose>;
|
|
21
|
+
declare const relationFieldsDTOSchema: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
22
|
+
declare const postFieldsDTOSchema: z.ZodObject<{
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
title: z.ZodString;
|
|
25
|
+
slug: z.ZodString;
|
|
26
|
+
locale: z.ZodString;
|
|
27
|
+
status: z.ZodLiteral<"published">;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
body: z.ZodString;
|
|
30
|
+
"cover-image": z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
url: z.ZodURL;
|
|
35
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
37
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$loose>, z.ZodArray<z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
41
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
url: z.ZodURL;
|
|
43
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
44
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
45
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
}, z.core.$loose>>, z.ZodURL]>>;
|
|
47
|
+
attachments: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
url: z.ZodURL;
|
|
52
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
53
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
54
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
}, z.core.$loose>>>>;
|
|
56
|
+
author: z.ZodOptional<z.ZodString>;
|
|
57
|
+
categories: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
58
|
+
tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
59
|
+
"published-at": z.ZodOptional<z.ZodString>;
|
|
60
|
+
"canonical-url": z.ZodOptional<z.ZodURL>;
|
|
61
|
+
"legacy-paths": z.ZodOptional<z.ZodUnknown>;
|
|
62
|
+
"seo-title": z.ZodOptional<z.ZodString>;
|
|
63
|
+
"seo-description": z.ZodOptional<z.ZodString>;
|
|
64
|
+
"schema-version": z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
65
|
+
"updated-at": z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$loose>;
|
|
67
|
+
declare const postVOSchema: z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
path: z.ZodString;
|
|
70
|
+
title: z.ZodString;
|
|
71
|
+
slug: z.ZodString;
|
|
72
|
+
locale: z.ZodString;
|
|
73
|
+
status: z.ZodLiteral<"published">;
|
|
74
|
+
description: z.ZodNullable<z.ZodString>;
|
|
75
|
+
body: z.ZodString;
|
|
76
|
+
coverImage: z.ZodNullable<z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
attachmentId: z.ZodString;
|
|
79
|
+
assetId: z.ZodNullable<z.ZodString>;
|
|
80
|
+
url: z.ZodURL;
|
|
81
|
+
fileName: z.ZodString;
|
|
82
|
+
mimeType: z.ZodString;
|
|
83
|
+
size: z.ZodNumber;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
attachmentId: z.ZodString;
|
|
88
|
+
assetId: z.ZodNullable<z.ZodString>;
|
|
89
|
+
url: z.ZodURL;
|
|
90
|
+
fileName: z.ZodString;
|
|
91
|
+
mimeType: z.ZodString;
|
|
92
|
+
size: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
author: z.ZodNullable<z.ZodString>;
|
|
95
|
+
categoryIds: z.ZodArray<z.ZodString>;
|
|
96
|
+
tagIds: z.ZodArray<z.ZodString>;
|
|
97
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
98
|
+
canonicalUrl: z.ZodNullable<z.ZodString>;
|
|
99
|
+
legacyPaths: z.ZodArray<z.ZodString>;
|
|
100
|
+
seoTitle: z.ZodNullable<z.ZodString>;
|
|
101
|
+
seoDescription: z.ZodNullable<z.ZodString>;
|
|
102
|
+
schemaVersion: z.ZodNumber;
|
|
103
|
+
updatedAt: z.ZodString;
|
|
104
|
+
rawFields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
declare const pageFieldsDTOSchema: z.ZodObject<{
|
|
107
|
+
path: z.ZodString;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
slug: z.ZodString;
|
|
110
|
+
locale: z.ZodString;
|
|
111
|
+
status: z.ZodLiteral<"published">;
|
|
112
|
+
template: z.ZodOptional<z.ZodEnum<{
|
|
113
|
+
landing: "landing";
|
|
114
|
+
product: "product";
|
|
115
|
+
standard: "standard";
|
|
116
|
+
"use-case": "use-case";
|
|
117
|
+
}>>;
|
|
118
|
+
body: z.ZodString;
|
|
119
|
+
hero: z.ZodOptional<z.ZodUnknown>;
|
|
120
|
+
features: z.ZodOptional<z.ZodUnknown>;
|
|
121
|
+
faqs: z.ZodOptional<z.ZodUnknown>;
|
|
122
|
+
"canonical-url": z.ZodOptional<z.ZodURL>;
|
|
123
|
+
"legacy-paths": z.ZodOptional<z.ZodUnknown>;
|
|
124
|
+
"seo-title": z.ZodOptional<z.ZodString>;
|
|
125
|
+
"seo-description": z.ZodOptional<z.ZodString>;
|
|
126
|
+
"schema-version": z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
127
|
+
"updated-at": z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$loose>;
|
|
129
|
+
declare const pageVOSchema: z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
path: z.ZodString;
|
|
132
|
+
title: z.ZodString;
|
|
133
|
+
slug: z.ZodString;
|
|
134
|
+
locale: z.ZodString;
|
|
135
|
+
status: z.ZodLiteral<"published">;
|
|
136
|
+
template: z.ZodNullable<z.ZodEnum<{
|
|
137
|
+
landing: "landing";
|
|
138
|
+
product: "product";
|
|
139
|
+
standard: "standard";
|
|
140
|
+
"use-case": "use-case";
|
|
141
|
+
}>>;
|
|
142
|
+
body: z.ZodString;
|
|
143
|
+
hero: z.ZodUnknown;
|
|
144
|
+
features: z.ZodUnknown;
|
|
145
|
+
faqs: z.ZodUnknown;
|
|
146
|
+
canonicalUrl: z.ZodNullable<z.ZodString>;
|
|
147
|
+
legacyPaths: z.ZodArray<z.ZodString>;
|
|
148
|
+
seoTitle: z.ZodNullable<z.ZodString>;
|
|
149
|
+
seoDescription: z.ZodNullable<z.ZodString>;
|
|
150
|
+
schemaVersion: z.ZodNumber;
|
|
151
|
+
updatedAt: z.ZodString;
|
|
152
|
+
rawFields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
declare const taxonomyFieldsDTOSchema: z.ZodObject<{
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
slug: z.ZodString;
|
|
157
|
+
locale: z.ZodString;
|
|
158
|
+
description: z.ZodOptional<z.ZodString>;
|
|
159
|
+
"updated-at": z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$loose>;
|
|
161
|
+
declare const categoryFieldsDTOSchema: z.ZodObject<{
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
slug: z.ZodString;
|
|
164
|
+
locale: z.ZodString;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
"updated-at": z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$loose>;
|
|
168
|
+
declare const tagFieldsDTOSchema: z.ZodObject<{
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
slug: z.ZodString;
|
|
171
|
+
locale: z.ZodString;
|
|
172
|
+
description: z.ZodOptional<z.ZodString>;
|
|
173
|
+
"updated-at": z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$loose>;
|
|
175
|
+
declare const categoryVOSchema: z.ZodObject<{
|
|
176
|
+
id: z.ZodString;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
slug: z.ZodString;
|
|
179
|
+
locale: z.ZodString;
|
|
180
|
+
description: z.ZodNullable<z.ZodString>;
|
|
181
|
+
updatedAt: z.ZodString;
|
|
182
|
+
rawFields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
declare const tagVOSchema: z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
slug: z.ZodString;
|
|
188
|
+
locale: z.ZodString;
|
|
189
|
+
description: z.ZodNullable<z.ZodString>;
|
|
190
|
+
updatedAt: z.ZodString;
|
|
191
|
+
rawFields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
type AttachmentFieldsDTO = z.infer<typeof attachmentFieldsDTOSchema>;
|
|
194
|
+
type AttachmentVO = z.infer<typeof attachmentVOSchema>;
|
|
195
|
+
type RelationFieldsDTO = z.infer<typeof relationFieldsDTOSchema>;
|
|
196
|
+
type PostFieldsDTO = z.infer<typeof postFieldsDTOSchema>;
|
|
197
|
+
type PostVO = z.infer<typeof postVOSchema>;
|
|
198
|
+
type PageFieldsDTO = z.infer<typeof pageFieldsDTOSchema>;
|
|
199
|
+
type PageVO = z.infer<typeof pageVOSchema>;
|
|
200
|
+
type CategoryFieldsDTO = z.infer<typeof categoryFieldsDTOSchema>;
|
|
201
|
+
type CategoryVO = z.infer<typeof categoryVOSchema>;
|
|
202
|
+
type TagFieldsDTO = z.infer<typeof tagFieldsDTOSchema>;
|
|
203
|
+
type TagVO = z.infer<typeof tagVOSchema>;
|
|
204
|
+
//#endregion
|
|
205
|
+
export { taxonomyFieldsDTOSchema as C, tagVOSchema as S, pageVOSchema as _, PageFieldsDTO as a, relationFieldsDTOSchema as b, PostVO as c, TagVO as d, attachmentFieldsDTOSchema as f, pageFieldsDTOSchema as g, categoryVOSchema as h, CategoryVO as i, RelationFieldsDTO as l, categoryFieldsDTOSchema as m, AttachmentVO as n, PageVO as o, attachmentVOSchema as p, CategoryFieldsDTO as r, PostFieldsDTO as s, AttachmentFieldsDTO as t, TagFieldsDTO as u, postFieldsDTOSchema as v, tagFieldsDTOSchema as x, postVOSchema as y };
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "busabase-cms-sdk",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Typed Posts, Pages, Categories, and Tags for Busabase CMS, Next.js, and Fumadocs.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/busabase/busabase/tree/main/packages/busabase-cms-sdk",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/busabase/busabase.git",
|
|
10
|
+
"directory": "packages/busabase-cms-sdk"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/busabase/busabase/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"private": false,
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./next": {
|
|
26
|
+
"types": "./dist/next.d.ts",
|
|
27
|
+
"default": "./dist/next.js"
|
|
28
|
+
},
|
|
29
|
+
"./fumadocs": {
|
|
30
|
+
"types": "./dist/fumadocs.d.ts",
|
|
31
|
+
"default": "./dist/fumadocs.js"
|
|
32
|
+
},
|
|
33
|
+
"./integration": {
|
|
34
|
+
"types": "./dist/integration/index.d.ts",
|
|
35
|
+
"default": "./dist/integration/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"busabase-sdk": "^0.30.1",
|
|
45
|
+
"fumadocs-core": "16.14.5",
|
|
46
|
+
"rehype-sanitize": "^6.0.0",
|
|
47
|
+
"remark-gfm": "^4.0.1",
|
|
48
|
+
"sanitize-html": "^2.17.6",
|
|
49
|
+
"server-only": "^0.0.1",
|
|
50
|
+
"zod": "^4.3.6"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"next": ">=15 <17",
|
|
54
|
+
"react": ">=19"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"next": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^24.13.2",
|
|
66
|
+
"@types/react": "^19.2.17",
|
|
67
|
+
"@types/sanitize-html": "^2.16.1",
|
|
68
|
+
"next": "16.3.3",
|
|
69
|
+
"react": "^19.2.7",
|
|
70
|
+
"tsdown": "^0.22.14",
|
|
71
|
+
"typescript": "^7.0.2",
|
|
72
|
+
"vitest": "^4.1.11"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=24.18.0"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "tsdown",
|
|
79
|
+
"typecheck": "tsc --noEmit",
|
|
80
|
+
"test": "vitest run",
|
|
81
|
+
"lint": "biome format . --write && biome check .",
|
|
82
|
+
"lint:err": "biome check . --diagnostic-level=error"
|
|
83
|
+
}
|
|
84
|
+
}
|