@ctcstack/ctcdocs-core 0.11.0 → 0.12.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.
@@ -87,6 +87,12 @@ export interface SyncConfigurationDefaults {
87
87
  readonly commitBotName: string;
88
88
  /** Locale assumed for documents whose language cannot be determined. */
89
89
  readonly defaultLocale: string;
90
+ /**
91
+ * The size, in megabytes of a million bytes, above which the sync report
92
+ * notes a published image. What is too large is not settled yet, so a
93
+ * project sets the line it wants numbers for. Defaults to 2.
94
+ */
95
+ readonly largeImageMegabytes: number;
90
96
  }
91
97
  export interface NavigationConfiguration {
92
98
  /**
@@ -134,6 +134,17 @@ function optionalCount(source, key, path, fallback) {
134
134
  }
135
135
  return value;
136
136
  }
137
+ /** A size above zero, in megabytes; a fraction such as 1.5 is allowed. */
138
+ function optionalMegabytes(source, key, path, fallback) {
139
+ const value = source[key];
140
+ if (value === undefined) {
141
+ return fallback;
142
+ }
143
+ if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {
144
+ fail(path, 'must be a number of megabytes above 0');
145
+ }
146
+ return value;
147
+ }
137
148
  function optionalAddressPolicy(source, key, path) {
138
149
  const value = source[key];
139
150
  if (value === undefined) {
@@ -237,6 +248,7 @@ export function parseSiteConfiguration(input) {
237
248
  commitBotName: text(syncSource, 'commitBotName', 'sync.commitBotName'),
238
249
  defaultLocale,
239
250
  generatedBy,
251
+ largeImageMegabytes: optionalMegabytes(syncSource, 'largeImageMegabytes', 'sync.largeImageMegabytes', 2),
240
252
  },
241
253
  };
242
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctcstack/ctcdocs-core",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Configuration schema, project layout, and generated-path allowlist shared by the CTCDocs platform packages.",
5
5
  "keywords": [
6
6
  "ctcdocs",
@@ -111,6 +111,12 @@ export interface SyncConfigurationDefaults {
111
111
  readonly commitBotName: string;
112
112
  /** Locale assumed for documents whose language cannot be determined. */
113
113
  readonly defaultLocale: string;
114
+ /**
115
+ * The size, in megabytes of a million bytes, above which the sync report
116
+ * notes a published image. What is too large is not settled yet, so a
117
+ * project sets the line it wants numbers for. Defaults to 2.
118
+ */
119
+ readonly largeImageMegabytes: number;
114
120
  }
115
121
 
116
122
  export interface NavigationConfiguration {
@@ -322,6 +328,23 @@ function optionalCount(
322
328
  return value;
323
329
  }
324
330
 
331
+ /** A size above zero, in megabytes; a fraction such as 1.5 is allowed. */
332
+ function optionalMegabytes(
333
+ source: Record<string, unknown>,
334
+ key: string,
335
+ path: string,
336
+ fallback: number,
337
+ ): number {
338
+ const value = source[key];
339
+ if (value === undefined) {
340
+ return fallback;
341
+ }
342
+ if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {
343
+ fail(path, 'must be a number of megabytes above 0');
344
+ }
345
+ return value;
346
+ }
347
+
325
348
  function optionalAddressPolicy(
326
349
  source: Record<string, unknown>,
327
350
  key: string,
@@ -485,6 +508,12 @@ export function parseSiteConfiguration(input: unknown): SiteConfiguration {
485
508
  commitBotName: text(syncSource, 'commitBotName', 'sync.commitBotName'),
486
509
  defaultLocale,
487
510
  generatedBy,
511
+ largeImageMegabytes: optionalMegabytes(
512
+ syncSource,
513
+ 'largeImageMegabytes',
514
+ 'sync.largeImageMegabytes',
515
+ 2,
516
+ ),
488
517
  },
489
518
  };
490
519
  }