convex-cms 0.0.16 → 0.0.17

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.
Files changed (99) hide show
  1. package/admin/dist/types/admin/src/components/ui/field.d.ts +1 -1
  2. package/admin/dist/types/admin/src/lib/cmsExports.d.ts +6 -6
  3. package/admin/dist/types/admin/src/lib/cmsExports.d.ts.map +1 -1
  4. package/admin/src/lib/cmsExports.ts +8 -8
  5. package/admin-dist/assets/index-DagpgVMo.js +104 -0
  6. package/admin-dist/embed/favicon.ico +0 -0
  7. package/admin-dist/embed/index.js +30961 -0
  8. package/admin-dist/embed/index.js.map +1 -0
  9. package/admin-dist/index.html +1 -1
  10. package/package.json +12 -5
  11. package/admin/dist/types/src/client/admin/bulk.d.ts +0 -79
  12. package/admin/dist/types/src/client/admin/bulk.d.ts.map +0 -1
  13. package/admin/dist/types/src/client/admin/contentLock.d.ts +0 -118
  14. package/admin/dist/types/src/client/admin/contentLock.d.ts.map +0 -1
  15. package/admin/dist/types/src/client/admin/contentTypes.d.ts +0 -1627
  16. package/admin/dist/types/src/client/admin/contentTypes.d.ts.map +0 -1
  17. package/admin/dist/types/src/client/admin/dashboard.d.ts +0 -16
  18. package/admin/dist/types/src/client/admin/dashboard.d.ts.map +0 -1
  19. package/admin/dist/types/src/client/admin/entries.d.ts +0 -357
  20. package/admin/dist/types/src/client/admin/entries.d.ts.map +0 -1
  21. package/admin/dist/types/src/client/admin/index.d.ts +0 -7502
  22. package/admin/dist/types/src/client/admin/index.d.ts.map +0 -1
  23. package/admin/dist/types/src/client/admin/media.d.ts +0 -1038
  24. package/admin/dist/types/src/client/admin/media.d.ts.map +0 -1
  25. package/admin/dist/types/src/client/admin/settings.d.ts +0 -50
  26. package/admin/dist/types/src/client/admin/settings.d.ts.map +0 -1
  27. package/admin/dist/types/src/client/admin/taxonomies.d.ts +0 -339
  28. package/admin/dist/types/src/client/admin/taxonomies.d.ts.map +0 -1
  29. package/admin/dist/types/src/client/admin/trash.d.ts +0 -90
  30. package/admin/dist/types/src/client/admin/trash.d.ts.map +0 -1
  31. package/admin/dist/types/src/client/admin/types.d.ts +0 -594
  32. package/admin/dist/types/src/client/admin/types.d.ts.map +0 -1
  33. package/admin/dist/types/src/client/admin/users.d.ts +0 -58
  34. package/admin/dist/types/src/client/admin/users.d.ts.map +0 -1
  35. package/admin/dist/types/src/client/admin/validators.d.ts +0 -7732
  36. package/admin/dist/types/src/client/admin/validators.d.ts.map +0 -1
  37. package/admin/dist/types/src/client/admin/versions.d.ts +0 -106
  38. package/admin/dist/types/src/client/admin/versions.d.ts.map +0 -1
  39. package/admin/dist/types/src/client/adminConfig.d.ts +0 -125
  40. package/admin/dist/types/src/client/adminConfig.d.ts.map +0 -1
  41. package/admin/dist/types/src/client/config.d.ts +0 -155
  42. package/admin/dist/types/src/client/config.d.ts.map +0 -1
  43. package/admin/dist/types/src/client/field-types.d.ts +0 -55
  44. package/admin/dist/types/src/client/field-types.d.ts.map +0 -1
  45. package/admin/dist/types/src/client/fields.d.ts +0 -70
  46. package/admin/dist/types/src/client/fields.d.ts.map +0 -1
  47. package/admin/dist/types/src/client/registry.d.ts +0 -77
  48. package/admin/dist/types/src/client/registry.d.ts.map +0 -1
  49. package/admin/dist/types/src/client/schema/defineContentType.d.ts +0 -233
  50. package/admin/dist/types/src/client/schema/defineContentType.d.ts.map +0 -1
  51. package/admin/dist/types/src/client/schema/types.d.ts +0 -540
  52. package/admin/dist/types/src/client/schema/types.d.ts.map +0 -1
  53. package/admin/dist/types/src/client/types.d.ts +0 -449
  54. package/admin/dist/types/src/client/types.d.ts.map +0 -1
  55. package/admin/dist/types/src/client/utils/toSlug.d.ts +0 -60
  56. package/admin/dist/types/src/client/utils/toSlug.d.ts.map +0 -1
  57. package/admin/dist/types/src/client/workflows.d.ts +0 -51
  58. package/admin/dist/types/src/client/workflows.d.ts.map +0 -1
  59. package/admin/dist/types/src/component/_generated/component.d.ts +0 -4813
  60. package/admin/dist/types/src/component/_generated/component.d.ts.map +0 -1
  61. package/admin/dist/types/src/component/_generated/dataModel.d.ts +0 -46
  62. package/admin/dist/types/src/component/_generated/dataModel.d.ts.map +0 -1
  63. package/admin/dist/types/src/component/_generated/server.d.ts +0 -121
  64. package/admin/dist/types/src/component/_generated/server.d.ts.map +0 -1
  65. package/admin/dist/types/src/component/contentEntryMutations.d.ts +0 -551
  66. package/admin/dist/types/src/component/contentEntryMutations.d.ts.map +0 -1
  67. package/admin/dist/types/src/component/contentLock.d.ts +0 -328
  68. package/admin/dist/types/src/component/contentLock.d.ts.map +0 -1
  69. package/admin/dist/types/src/component/contentTypeMutations.d.ts +0 -1253
  70. package/admin/dist/types/src/component/contentTypeMutations.d.ts.map +0 -1
  71. package/admin/dist/types/src/component/documentTypes.d.ts +0 -186
  72. package/admin/dist/types/src/component/documentTypes.d.ts.map +0 -1
  73. package/admin/dist/types/src/component/eventEmitter.d.ts +0 -309
  74. package/admin/dist/types/src/component/eventEmitter.d.ts.map +0 -1
  75. package/admin/dist/types/src/component/lib/errors.d.ts +0 -306
  76. package/admin/dist/types/src/component/lib/errors.d.ts.map +0 -1
  77. package/admin/dist/types/src/component/lib/metadataExtractor.d.ts +0 -245
  78. package/admin/dist/types/src/component/lib/metadataExtractor.d.ts.map +0 -1
  79. package/admin/dist/types/src/component/lib/mutationAuth.d.ts +0 -95
  80. package/admin/dist/types/src/component/lib/mutationAuth.d.ts.map +0 -1
  81. package/admin/dist/types/src/component/lib/slugGenerator.d.ts +0 -71
  82. package/admin/dist/types/src/component/lib/slugGenerator.d.ts.map +0 -1
  83. package/admin/dist/types/src/component/lib/slugUniqueness.d.ts +0 -131
  84. package/admin/dist/types/src/component/lib/slugUniqueness.d.ts.map +0 -1
  85. package/admin/dist/types/src/component/lib/softDelete.d.ts +0 -18
  86. package/admin/dist/types/src/component/lib/softDelete.d.ts.map +0 -1
  87. package/admin/dist/types/src/component/localeFields.d.ts +0 -508
  88. package/admin/dist/types/src/component/localeFields.d.ts.map +0 -1
  89. package/admin/dist/types/src/component/mediaAssetMutations.d.ts +0 -282
  90. package/admin/dist/types/src/component/mediaAssetMutations.d.ts.map +0 -1
  91. package/admin/dist/types/src/component/schema.d.ts +0 -5248
  92. package/admin/dist/types/src/component/schema.d.ts.map +0 -1
  93. package/admin/dist/types/src/component/validation.d.ts +0 -407
  94. package/admin/dist/types/src/component/validation.d.ts.map +0 -1
  95. package/admin/dist/types/src/component/validators.d.ts +0 -5722
  96. package/admin/dist/types/src/component/validators.d.ts.map +0 -1
  97. package/admin/dist/types/src/react/index.d.ts +0 -493
  98. package/admin/dist/types/src/react/index.d.ts.map +0 -1
  99. package/admin-dist/assets/index-DTgANhXL.js +0 -104
@@ -1,540 +0,0 @@
1
- /**
2
- * Type-Safe Schema Definition Types
3
- *
4
- * These types enable full TypeScript inference for content type schemas
5
- * using Convex's native `Infer<typeof validator>` pattern.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { v, Infer } from "convex/values";
10
- * import { defineContentType, InferContentType } from "convex-cms";
11
- *
12
- * export const blogPost = defineContentType({
13
- * name: "blog_post",
14
- * validator: v.object({
15
- * title: v.string(),
16
- * content: v.string(),
17
- * publishedAt: v.optional(v.number()),
18
- * }),
19
- * meta: {
20
- * displayName: "Blog Post",
21
- * titleField: "title",
22
- * },
23
- * });
24
- *
25
- * // Type is inferred automatically
26
- * type BlogPostData = InferContentType<typeof blogPost>;
27
- * // { title: string; content: string; publishedAt?: number }
28
- * ```
29
- */
30
- /**
31
- * Structural constraint for CMS object validators.
32
- *
33
- * Matches the properties VObject inherits from BaseValidator (type, fieldPaths,
34
- * isOptional, isConvexValidator) plus VObject's own `kind` discriminant.
35
- * Intentionally excludes VObject's generic methods (omit, pick, partial, extend)
36
- * which cause a TypeScript contravariance error when comparing concrete
37
- * VObject<SpecificFields> against VObject<GeneralFields>.
38
- *
39
- * Use TValidator["type"] instead of Infer<TValidator> for data type extraction.
40
- */
41
- export type CmsObjectValidator = {
42
- kind: "object";
43
- isOptional: "required";
44
- isConvexValidator: true;
45
- type: Record<string, unknown>;
46
- fieldPaths: string;
47
- };
48
- /**
49
- * UI rendering hints for fields in the admin interface.
50
- * These help the admin UI understand how to render each field type.
51
- */
52
- export type FieldRenderAs = "text" | "textarea" | "richText" | "number" | "boolean" | "date" | "datetime" | "reference" | "media" | "json" | "select" | "multiSelect" | "tags" | "category" | "slug" | "code" | "color" | "url" | "email" | "arrayObject";
53
- /**
54
- * Metadata for a single field within a content type.
55
- * This provides UI hints, validation configuration, and searchability.
56
- *
57
- * All options here correspond to the `options` field in the database
58
- * field definition format and are passed through to the CMS component.
59
- */
60
- export interface FieldMeta {
61
- /**
62
- * Human-readable label for the field in the admin UI.
63
- * If not provided, the field name will be used.
64
- */
65
- label?: string;
66
- /**
67
- * Hint for how the admin UI should render this field.
68
- * Use this to distinguish between field types that share the same
69
- * validator type (e.g., `richText` vs `text` both use `v.string()`).
70
- * @default Inferred from validator type
71
- */
72
- renderAs?: FieldRenderAs;
73
- /**
74
- * Description/help text shown in the admin UI.
75
- */
76
- description?: string;
77
- /**
78
- * Whether this field should be indexed for search.
79
- * Only applicable for text-like fields.
80
- * @default false
81
- */
82
- searchable?: boolean;
83
- /**
84
- * Whether this field supports per-locale values.
85
- * When true, the field can have different values for each locale.
86
- * @default false
87
- */
88
- localized?: boolean;
89
- /**
90
- * Placeholder text for input fields.
91
- */
92
- placeholder?: string;
93
- /**
94
- * Display order in the admin UI (lower = earlier).
95
- */
96
- sortOrder?: number;
97
- /**
98
- * If true, this field is hidden in the admin UI.
99
- */
100
- hidden?: boolean;
101
- /**
102
- * If true, this field is read-only in the admin UI.
103
- */
104
- readOnly?: boolean;
105
- /**
106
- * Default value for the field.
107
- * Type depends on the field type.
108
- */
109
- defaultValue?: unknown;
110
- /**
111
- * Group name for organizing fields into sections in the admin editor.
112
- * Fields with the same group are rendered together in a collapsible section.
113
- * Fields without a group go into a default section.
114
- * Groups appear in the order they're first encountered.
115
- * @example "pricing", "media", "seo"
116
- */
117
- group?: string;
118
- /**
119
- * Minimum length for text fields.
120
- * Enforced during validation.
121
- */
122
- minLength?: number;
123
- /**
124
- * Maximum length for text fields.
125
- * Enforced during validation.
126
- */
127
- maxLength?: number;
128
- /**
129
- * Regex pattern for text validation.
130
- * The content must match this pattern to be valid.
131
- * @example "^[a-z0-9-]+$" for slug validation
132
- */
133
- pattern?: string;
134
- /**
135
- * Error message to display when pattern validation fails.
136
- * If not provided, a generic message is shown.
137
- */
138
- patternMessage?: string;
139
- /**
140
- * Whether the text field should render as a multiline textarea.
141
- * Only applicable when renderAs is "text" or "textarea".
142
- * @default false
143
- */
144
- multiline?: boolean;
145
- /**
146
- * Minimum value for number fields.
147
- * Enforced during validation.
148
- */
149
- min?: number;
150
- /**
151
- * Maximum value for number fields.
152
- * Enforced during validation.
153
- */
154
- max?: number;
155
- /**
156
- * Step increment for number inputs.
157
- * Used for UI number spinners.
158
- * @example 0.01 for currency values
159
- */
160
- step?: number;
161
- /**
162
- * Decimal precision for number fields.
163
- * Numbers will be rounded to this many decimal places.
164
- * @example 2 for currency (e.g., 19.99)
165
- */
166
- precision?: number;
167
- /**
168
- * Prefix to display before the number input.
169
- * @example "$" for currency
170
- */
171
- prefix?: string;
172
- /**
173
- * Suffix to display after the number input.
174
- * @example "%" for percentages
175
- */
176
- suffix?: string;
177
- /**
178
- * Default currency for money fields (ISO 4217 code).
179
- * @example "CAD", "USD", "EUR"
180
- */
181
- defaultCurrency?: string;
182
- /**
183
- * Allowed currencies for money fields.
184
- * If set, only these currencies can be selected.
185
- * @example ["CAD", "USD"]
186
- */
187
- allowedCurrencies?: string[];
188
- /**
189
- * Metadata for sub-fields within an arrayObject field.
190
- * Keys are the field names within each array item's object.
191
- * Uses the same FieldMeta type recursively.
192
- */
193
- subFields?: Record<string, FieldMeta>;
194
- /**
195
- * Label template for each array item card header.
196
- * Can reference field names with `{fieldName}` syntax.
197
- * @example "{name}" shows the item's `name` field as the card title
198
- */
199
- itemLabel?: string;
200
- /**
201
- * Label to display when the boolean is true.
202
- * @example "Yes", "Enabled", "Active"
203
- */
204
- trueLabel?: string;
205
- /**
206
- * Label to display when the boolean is false.
207
- * @example "No", "Disabled", "Inactive"
208
- */
209
- falseLabel?: string;
210
- /**
211
- * Minimum allowed date (ISO 8601 format).
212
- * @example "2026-01-01"
213
- */
214
- minDate?: string;
215
- /**
216
- * Maximum allowed date (ISO 8601 format).
217
- * @example "2025-12-31"
218
- */
219
- maxDate?: string;
220
- /**
221
- * IANA timezone for datetime fields.
222
- * Used for display and input conversion.
223
- * @example "America/New_York"
224
- */
225
- timezone?: string;
226
- /**
227
- * Display format for date/datetime fields.
228
- * Uses date-fns format strings.
229
- * @example "yyyy-MM-dd" or "PPP" (localized)
230
- */
231
- format?: string;
232
- /**
233
- * For reference fields: allowed content type names.
234
- * If not specified, references to any content type are allowed.
235
- */
236
- allowedContentTypes?: string[];
237
- /**
238
- * Whether multiple references can be selected.
239
- * When true, the field stores an array of IDs.
240
- * @default false
241
- */
242
- multiple?: boolean;
243
- /**
244
- * Minimum number of items required (for array fields).
245
- * Only applies when `multiple` is true.
246
- */
247
- minItems?: number;
248
- /**
249
- * Maximum number of items allowed (for array fields).
250
- * Only applies when `multiple` is true.
251
- */
252
- maxItems?: number;
253
- /**
254
- * Whether to allow creating new referenced entries inline.
255
- * @default false
256
- */
257
- allowInlineCreation?: boolean;
258
- /**
259
- * For media fields: allowed MIME types.
260
- * @example ["image/jpeg", "image/png", "image/webp"]
261
- */
262
- allowedMimeTypes?: string[];
263
- /**
264
- * Maximum file size in bytes.
265
- * @example 5 * 1024 * 1024 for 5MB
266
- */
267
- maxFileSize?: number;
268
- /**
269
- * For select/multiSelect fields: available options.
270
- */
271
- options?: Array<{
272
- value: string;
273
- label: string;
274
- }>;
275
- /**
276
- * Minimum number of selections required (for multiSelect).
277
- */
278
- minSelections?: number;
279
- /**
280
- * Maximum number of selections allowed (for multiSelect).
281
- */
282
- maxSelections?: number;
283
- /**
284
- * Allowed block types for rich text fields.
285
- * @example ["paragraph", "heading", "list", "blockquote"]
286
- */
287
- allowedBlocks?: string[];
288
- /**
289
- * Allowed inline marks/formatting for rich text fields.
290
- * @example ["bold", "italic", "link", "code"]
291
- */
292
- allowedMarks?: string[];
293
- /**
294
- * JSON Schema for validating the JSON field content.
295
- * Should be a valid JSON Schema object.
296
- */
297
- schema?: object;
298
- /**
299
- * The taxonomy ID to use for this tag/category field.
300
- * Either taxonomyId or taxonomyName must be provided for taxonomy fields.
301
- */
302
- taxonomyId?: string;
303
- /**
304
- * The taxonomy name to use for this tag/category field.
305
- * Alternative to taxonomyId - will look up the taxonomy by name.
306
- */
307
- taxonomyName?: string;
308
- /**
309
- * Whether to allow creating new taxonomy terms inline.
310
- * @default false
311
- */
312
- allowCreate?: boolean;
313
- /**
314
- * Maximum number of tags that can be selected.
315
- */
316
- maxTags?: number;
317
- /**
318
- * Minimum number of tags required.
319
- */
320
- minTags?: number;
321
- /**
322
- * For hierarchical taxonomies: maximum depth level to show.
323
- * 0 = root only, 1 = root and children, etc.
324
- */
325
- depth?: number;
326
- /**
327
- * Whether to allow selecting multiple categories (for category fields).
328
- * @default false
329
- */
330
- allowMultiple?: boolean;
331
- }
332
- /**
333
- * Content type metadata configuration.
334
- * Provides display information and field-level metadata.
335
- */
336
- export interface ContentTypeMeta<TFieldNames extends string = string> {
337
- /**
338
- * Human-readable display name for the content type.
339
- * Shown in the admin UI.
340
- */
341
- displayName: string;
342
- /**
343
- * Description of this content type.
344
- */
345
- description?: string;
346
- /**
347
- * Icon identifier for the admin UI (e.g., emoji or icon name).
348
- */
349
- icon?: string;
350
- /**
351
- * Field to use for the entry's title in listings.
352
- * Must be a key from the validator's object type.
353
- */
354
- titleField?: TFieldNames;
355
- /**
356
- * Field to use for generating URL slugs.
357
- * Must be a key from the validator's object type.
358
- */
359
- slugField?: TFieldNames;
360
- /**
361
- * If true, only one entry of this content type can exist.
362
- */
363
- singleton?: boolean;
364
- /**
365
- * Display order in admin UI navigation.
366
- */
367
- sortOrder?: number;
368
- /**
369
- * Field-level metadata keyed by field name.
370
- * Only fields present in the validator can have metadata.
371
- */
372
- fields?: Partial<Record<TFieldNames, FieldMeta>>;
373
- }
374
- /**
375
- * Input configuration for defineContentType().
376
- *
377
- * @typeParam TValidator - The Convex validator for the content data shape
378
- */
379
- export interface ContentTypeConfig<TValidator extends CmsObjectValidator> {
380
- /**
381
- * Unique machine-readable name for this content type.
382
- * Used as the identifier in code and URLs.
383
- *
384
- * Must be:
385
- * - Lowercase letters, numbers, and underscores only
386
- * - Start with a letter
387
- * - 1-50 characters
388
- *
389
- * @example "blog_post", "product", "author"
390
- */
391
- name: string;
392
- /**
393
- * Convex validator defining the content data shape.
394
- * Types are automatically inferred via `Infer<typeof validator>`.
395
- *
396
- * Must be a `v.object()` validator.
397
- *
398
- * @example
399
- * ```typescript
400
- * validator: v.object({
401
- * title: v.string(),
402
- * content: v.string(),
403
- * author: v.id("contentEntries"),
404
- * })
405
- * ```
406
- */
407
- validator: TValidator;
408
- /**
409
- * CMS-specific metadata for display and configuration.
410
- */
411
- meta: ContentTypeMeta<TValidator extends {
412
- type: infer T;
413
- } ? T extends Record<string, unknown> ? keyof T & string : string : string>;
414
- }
415
- /**
416
- * A fully defined content type with validator and metadata.
417
- *
418
- * @typeParam TSlug - The literal string type for the content type slug (machine name)
419
- * @typeParam TValidator - The Convex validator for content data
420
- */
421
- export interface ContentTypeDefinition<TSlug extends string = string, TValidator extends CmsObjectValidator = CmsObjectValidator> {
422
- /**
423
- * Human-readable display name for the content type.
424
- * @example "Blog Post", "Roadmap Item"
425
- */
426
- readonly name: string;
427
- /**
428
- * Machine-readable slug used for queries and code references.
429
- * Auto-generated from `name` if a display name is provided.
430
- * @example "blog_post", "roadmap_item"
431
- */
432
- readonly slug: TSlug;
433
- /**
434
- * The Convex validator for content data.
435
- * Use `Infer<typeof definition.validator>` for the TypeScript type.
436
- */
437
- readonly validator: TValidator;
438
- /**
439
- * CMS metadata for display and configuration.
440
- */
441
- readonly meta: ContentTypeMeta;
442
- /**
443
- * Internal marker to identify content type definitions.
444
- * @internal
445
- */
446
- readonly _type: "content_type_definition";
447
- }
448
- /**
449
- * Infer the TypeScript type for a content type's data from its definition.
450
- *
451
- * This is a thin wrapper around Convex's native `Infer<typeof validator>`.
452
- *
453
- * @example
454
- * ```typescript
455
- * const blogPost = defineContentType({
456
- * name: "blog_post",
457
- * validator: v.object({
458
- * title: v.string(),
459
- * content: v.string(),
460
- * }),
461
- * meta: { displayName: "Blog Post" },
462
- * });
463
- *
464
- * type BlogPostData = InferContentType<typeof blogPost>;
465
- * // { title: string; content: string }
466
- * ```
467
- */
468
- export type InferContentType<T extends ContentTypeDefinition> = T extends ContentTypeDefinition<string, infer V> ? V extends {
469
- type: infer Data;
470
- } ? Data : never : never;
471
- /**
472
- * A schema object containing multiple content type definitions.
473
- *
474
- * @example
475
- * ```typescript
476
- * export const contentSchema = {
477
- * blogPost,
478
- * author,
479
- * product,
480
- * } satisfies ContentSchema;
481
- * ```
482
- */
483
- export type ContentSchema = Record<string, ContentTypeDefinition>;
484
- /**
485
- * Infer all content data types from a schema object.
486
- *
487
- * Returns a mapped type where:
488
- * - Keys are the content type slugs (from the `slug` property)
489
- * - Values are the inferred data types
490
- *
491
- * @example
492
- * ```typescript
493
- * const contentSchema = { blogPost, author, product };
494
- *
495
- * type ContentTypes = InferSchema<typeof contentSchema>;
496
- * // {
497
- * // blog_post: { title: string; content: string; ... };
498
- * // author: { name: string; bio?: string; ... };
499
- * // product: { name: string; price: number; ... };
500
- * // }
501
- * ```
502
- */
503
- export type InferSchema<T extends ContentSchema> = {
504
- [K in keyof T as T[K] extends ContentTypeDefinition<infer Slug, CmsObjectValidator> ? Slug : never]: T[K] extends ContentTypeDefinition<string, infer V> ? V extends {
505
- type: infer Data;
506
- } ? Data : never : never;
507
- };
508
- /**
509
- * Extract all content type slugs from a schema.
510
- *
511
- * @example
512
- * ```typescript
513
- * type Slugs = SchemaContentTypeNames<typeof contentSchema>;
514
- * // "blog_post" | "author" | "product"
515
- * ```
516
- */
517
- export type SchemaContentTypeNames<T extends ContentSchema> = {
518
- [K in keyof T]: T[K] extends ContentTypeDefinition<infer Slug, CmsObjectValidator> ? Slug : never;
519
- }[keyof T];
520
- /**
521
- * Get the data type for a specific content type name from a schema.
522
- *
523
- * @example
524
- * ```typescript
525
- * type BlogData = SchemaContentType<typeof contentSchema, "blog_post">;
526
- * // { title: string; content: string; ... }
527
- * ```
528
- */
529
- export type SchemaContentType<T extends ContentSchema, Name extends SchemaContentTypeNames<T>> = InferSchema<T>[Name];
530
- /**
531
- * Extract field names from a content type definition.
532
- */
533
- export type ContentTypeFieldNames<T extends ContentTypeDefinition> = T extends ContentTypeDefinition<string, infer V> ? V extends {
534
- type: infer Data;
535
- } ? Data extends Record<string, unknown> ? keyof Data & string : never : never : never;
536
- /**
537
- * Check if a value is a ContentTypeDefinition.
538
- */
539
- export declare function isContentTypeDefinition(value: unknown): value is ContentTypeDefinition;
540
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/client/schema/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,EAAE,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAMF;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,MAAM,GACN,UAAU,GACV,WAAW,GACX,OAAO,GACP,MAAM,GACN,QAAQ,GACR,aAAa,GACb,MAAM,GACN,UAAU,GACV,MAAM,GACN,MAA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