@cms-lab/core 1.0.10 → 1.1.0

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/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ type CMSDocument = {
4
4
  type: string;
5
5
  uid?: string;
6
6
  url?: string;
7
+ routable?: boolean;
7
8
  status: CMSDocumentStatus;
8
9
  data: unknown;
9
10
  };
@@ -53,11 +54,16 @@ type StrapiCollectionConfig = {
53
54
  type: string;
54
55
  endpoint: string;
55
56
  } & CmsFieldMappingConfig;
57
+ type StrapiSingleTypeConfig = {
58
+ type: string;
59
+ endpoint: string;
60
+ } & CmsFieldMappingConfig;
56
61
  type StrapiCmsProviderConfig = {
57
62
  provider: "strapi";
58
63
  url: string;
59
64
  token?: string;
60
- collections: StrapiCollectionConfig[];
65
+ collections?: StrapiCollectionConfig[];
66
+ singleTypes?: StrapiSingleTypeConfig[];
61
67
  };
62
68
  type DirectusCollectionConfig = {
63
69
  type: string;
@@ -193,4 +199,4 @@ type ScanDocumentsOptions = {
193
199
  };
194
200
  declare function scanDocuments(options: ScanDocumentsOptions): Promise<ScanResult>;
195
201
 
196
- export { type CMSDocument, type CMSDocumentStatus, type CheckGroup, CmsFetchError, type CmsFieldMappingConfig, type CmsLabConfig, CmsLabError, type CmsProviderConfig, ConfigLoadError, type ContentfulCmsProviderConfig, type ContentfulContentTypeConfig, type Diagnostic, type DiagnosticExplanation, type DiagnosticSeverity, type DirectusCmsProviderConfig, type DirectusCollectionConfig, type FetchLike, type LoadedCmsLabConfig, type PrismicCmsProviderConfig, type ProjectInfo, type RequiredFieldRule, type RouteDefinition, type SanityCmsProviderConfig, type SanityContentTypeConfig, type ScanDocumentsOptions, type ScanFilters, type ScanResult, type ScanSummary, SiteUnreachableError, type StrapiCmsProviderConfig, type StrapiCollectionConfig, type WordPressCmsProviderConfig, type WordPressContentTypeConfig, createDiagnostic, defineConfig, explainDiagnostic, listDiagnosticExplanations, loadCmsLabConfig, readCmsDataPath, scanDocuments, summarizeDiagnostics, validateConfig };
202
+ export { type CMSDocument, type CMSDocumentStatus, type CheckGroup, CmsFetchError, type CmsFieldMappingConfig, type CmsLabConfig, CmsLabError, type CmsProviderConfig, ConfigLoadError, type ContentfulCmsProviderConfig, type ContentfulContentTypeConfig, type Diagnostic, type DiagnosticExplanation, type DiagnosticSeverity, type DirectusCmsProviderConfig, type DirectusCollectionConfig, type FetchLike, type LoadedCmsLabConfig, type PrismicCmsProviderConfig, type ProjectInfo, type RequiredFieldRule, type RouteDefinition, type SanityCmsProviderConfig, type SanityContentTypeConfig, type ScanDocumentsOptions, type ScanFilters, type ScanResult, type ScanSummary, SiteUnreachableError, type StrapiCmsProviderConfig, type StrapiCollectionConfig, type StrapiSingleTypeConfig, type WordPressCmsProviderConfig, type WordPressContentTypeConfig, createDiagnostic, defineConfig, explainDiagnostic, listDiagnosticExplanations, loadCmsLabConfig, readCmsDataPath, scanDocuments, summarizeDiagnostics, validateConfig };
package/dist/index.js CHANGED
@@ -53,18 +53,24 @@ var cmsFieldMappingShape = {
53
53
  uidField: z.string().min(1).optional(),
54
54
  urlField: z.string().min(1).optional()
55
55
  };
56
+ var strapiContentShape = z.object({
57
+ type: z.string().min(1),
58
+ endpoint: z.string().min(1),
59
+ ...cmsFieldMappingShape
60
+ }).strict();
56
61
  var strapiConfigSchema = z.object({
57
62
  provider: z.literal("strapi"),
58
63
  url: z.string().url(),
59
64
  token: z.string().optional(),
60
- collections: z.array(
61
- z.object({
62
- type: z.string().min(1),
63
- endpoint: z.string().min(1),
64
- ...cmsFieldMappingShape
65
- }).strict()
66
- ).min(1)
67
- }).strict();
65
+ collections: z.array(strapiContentShape).min(1).optional(),
66
+ singleTypes: z.array(strapiContentShape).min(1).optional()
67
+ }).refine(
68
+ (config) => (config.collections?.length ?? 0) > 0 || (config.singleTypes?.length ?? 0) > 0,
69
+ {
70
+ message: "Strapi config must include collections or singleTypes",
71
+ path: ["collections"]
72
+ }
73
+ ).strict();
68
74
  var directusConfigSchema = z.object({
69
75
  provider: z.literal("directus"),
70
76
  url: z.string().url(),
@@ -379,6 +385,9 @@ function resolveRouteCandidates(config, documents, diagnostics) {
379
385
  (candidate) => candidate.type === document.type
380
386
  );
381
387
  if (!route) {
388
+ if (document.routable === false) {
389
+ continue;
390
+ }
382
391
  diagnostics.push(
383
392
  createDiagnostic({
384
393
  severity: "info",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cms-lab/core",
3
- "version": "1.0.10",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Core config, scan, diagnostics, and checks for cms-lab.",
6
6
  "license": "MIT",