@nuasite/cms-core 0.56.4 → 0.57.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.
Files changed (56) hide show
  1. package/dist/types/astro-source-analysis.d.ts +32 -0
  2. package/dist/types/astro-source-analysis.d.ts.map +1 -0
  3. package/dist/types/check-entries.d.ts +2 -0
  4. package/dist/types/check-entries.d.ts.map +1 -1
  5. package/dist/types/check.d.ts.map +1 -1
  6. package/dist/types/collection-scanner.d.ts +22 -2
  7. package/dist/types/collection-scanner.d.ts.map +1 -1
  8. package/dist/types/content-config-ast.d.ts +76 -2
  9. package/dist/types/content-config-ast.d.ts.map +1 -1
  10. package/dist/types/core.d.ts +19 -3
  11. package/dist/types/core.d.ts.map +1 -1
  12. package/dist/types/fs/glob.d.ts +17 -0
  13. package/dist/types/fs/glob.d.ts.map +1 -1
  14. package/dist/types/fs/node-fs.d.ts.map +1 -1
  15. package/dist/types/fs/types.d.ts +30 -2
  16. package/dist/types/fs/types.d.ts.map +1 -1
  17. package/dist/types/handlers/entry-ops.d.ts.map +1 -1
  18. package/dist/types/index.d.ts +7 -5
  19. package/dist/types/index.d.ts.map +1 -1
  20. package/dist/types/media/contember.d.ts.map +1 -1
  21. package/dist/types/media/errors.d.ts +17 -0
  22. package/dist/types/media/errors.d.ts.map +1 -0
  23. package/dist/types/media/index.d.ts +3 -0
  24. package/dist/types/media/index.d.ts.map +1 -1
  25. package/dist/types/media/local.d.ts.map +1 -1
  26. package/dist/types/media/names.d.ts +17 -0
  27. package/dist/types/media/names.d.ts.map +1 -0
  28. package/dist/types/media/s3.d.ts.map +1 -1
  29. package/dist/types/media/type-filter.d.ts +67 -0
  30. package/dist/types/media/type-filter.d.ts.map +1 -0
  31. package/dist/types/project-config-ast.d.ts +5 -1
  32. package/dist/types/project-config-ast.d.ts.map +1 -1
  33. package/dist/types/route-scan.d.ts +10 -0
  34. package/dist/types/route-scan.d.ts.map +1 -0
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +2 -2
  37. package/src/astro-source-analysis.ts +562 -0
  38. package/src/check-entries.ts +16 -1
  39. package/src/check.ts +14 -1
  40. package/src/collection-scanner.ts +413 -19
  41. package/src/content-config-ast.ts +616 -13
  42. package/src/core.ts +21 -5
  43. package/src/fs/glob.ts +39 -0
  44. package/src/fs/node-fs.ts +87 -11
  45. package/src/fs/types.ts +31 -2
  46. package/src/handlers/entry-ops.ts +11 -13
  47. package/src/index.ts +28 -3
  48. package/src/media/contember.ts +10 -2
  49. package/src/media/errors.ts +21 -0
  50. package/src/media/index.ts +10 -0
  51. package/src/media/local.ts +177 -79
  52. package/src/media/names.ts +24 -0
  53. package/src/media/s3.ts +33 -3
  54. package/src/media/type-filter.ts +186 -0
  55. package/src/project-config-ast.ts +185 -10
  56. package/src/route-scan.ts +32 -0
@@ -0,0 +1,32 @@
1
+ import type * as t from '@babel/types';
2
+ export type AstroContentAccessor = 'getCollection' | 'getEntry' | 'getEntryBySlug' | 'getEntries';
3
+ export interface AstroSourceImport {
4
+ source: string;
5
+ }
6
+ export interface AstroContentCall {
7
+ accessor: AstroContentAccessor;
8
+ collectionName: string | null;
9
+ inExportedGetStaticPaths: boolean;
10
+ }
11
+ export interface AstroCollectionBinding {
12
+ localName: string;
13
+ collectionName: string;
14
+ /** Path from an item (array) or value (entry) to the value held by this binding. */
15
+ itemPath: string;
16
+ }
17
+ export interface AstroSourceAnalysis {
18
+ imports: AstroSourceImport[];
19
+ collectionCalls: AstroContentCall[];
20
+ collectionBindings: AstroCollectionBinding[];
21
+ }
22
+ /**
23
+ * Analyze JavaScript or TypeScript containing Astro content accessors: a module, or the
24
+ * frontmatter of an `.astro` file once it has been extracted.
25
+ *
26
+ * A caller that already holds the frontmatter (or a Babel parse of it, as the CMS source
27
+ * finder does) passes that directly, so the source is neither re-extracted nor re-parsed.
28
+ */
29
+ export declare function analyzeAstroScript(source: string | t.File): AstroSourceAnalysis;
30
+ /** Analyze the frontmatter of a complete `.astro` source string. */
31
+ export declare function analyzeAstroSource(source: string): AstroSourceAnalysis;
32
+ //# sourceMappingURL=astro-source-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-source-analysis.d.ts","sourceRoot":"","sources":["../../src/astro-source-analysis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,UAAU,GAAG,gBAAgB,GAAG,YAAY,CAAA;AAEjG,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,wBAAwB,EAAE,OAAO,CAAA;CACjC;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;CAC5C;AAqgBD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,mBAAmB,CAG/E;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAKtE"}
@@ -25,6 +25,8 @@ export interface LoadedCollection {
25
25
  base: string;
26
26
  /** False when the loader base directory is not there at all. */
27
27
  exists: boolean;
28
+ /** Why the collection's files could not be listed, when they could not: its `entries` are then no account of it. */
29
+ unreadable?: string;
28
30
  entries: LoadedEntry[];
29
31
  }
30
32
  export type LoadedCollections = Map<string, LoadedCollection>;
@@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E,aAAa,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAkK7G;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CA0B7D"}
@@ -1,6 +1,13 @@
1
- import type { CollectionDefinition } from '@nuasite/cms-types';
1
+ import type { CollectionDefinition, CollectionScanReport } from '@nuasite/cms-types';
2
2
  import { type ParseCache } from './content-config-ast';
3
3
  import type { CmsFileSystem } from './fs/types';
4
+ /**
5
+ * Normalize a glob loader `base` (`./src/content/x`, `src/content/x/`) into a
6
+ * root-relative path comparable with a collection definition's `path`. The project
7
+ * root comes out as `.`. Entry reads and writes resolve their directory with this too,
8
+ * so they land where the scan reports a collection.
9
+ */
10
+ export declare function normalizeBasePath(basePath: string): string;
4
11
  /**
5
12
  * Scan all collections in the content directory.
6
13
  *
@@ -8,5 +15,18 @@ import type { CmsFileSystem } from './fs/types';
8
15
  * resolved against the injected `CmsFileSystem`'s root. `parseCache` keeps the
9
16
  * mtime-keyed content-config parse result across calls within one core instance.
10
17
  */
11
- export declare function scanCollections(fs: CmsFileSystem, contentDir?: string, parseCache?: ParseCache): Promise<Record<string, CollectionDefinition>>;
18
+ export declare function scanCollections(fs: CmsFileSystem, contentDir?: string, parseCache?: ParseCache, options?: {
19
+ report?: boolean;
20
+ }): Promise<Record<string, CollectionDefinition>>;
21
+ /**
22
+ * What the scan that returned `collections` could not vouch for.
23
+ *
24
+ * Looked up by the record itself instead of being returned next to it: `scanCollections`
25
+ * keeps its return type for the callers that only want the definitions, and a report cannot
26
+ * be paired with another scan's collections. `undefined` for a scan that was not asked for a
27
+ * report (`options.report`), for one whose report could not be built, and for any other
28
+ * object (a copy, a hand-built record) — read that as "not reported", never as "nothing
29
+ * unresolved".
30
+ */
31
+ export declare function collectionScanReport(collections: Record<string, CollectionDefinition>): CollectionScanReport | undefined;
12
32
  //# sourceMappingURL=collection-scanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-scanner.d.ts","sourceRoot":"","sources":["../../src/collection-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAmD,MAAM,oBAAoB,CAAA;AAG/G,OAAO,EAAE,KAAK,UAAU,EAA2D,MAAM,sBAAsB,CAAA;AAC/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAyjC/C;;;;;;GAMG;AACH,wBAAsB,eAAe,CACpC,EAAE,EAAE,aAAa,EACjB,UAAU,GAAE,MAAsB,EAClC,UAAU,GAAE,UAAsB,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAoF/C"}
1
+ {"version":3,"file":"collection-scanner.d.ts","sourceRoot":"","sources":["../../src/collection-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EAEpB,oBAAoB,EAIpB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAMN,KAAK,UAAU,EAKf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,YAAY,CAAA;AAyiC5D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAqCD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACpC,EAAE,EAAE,aAAa,EACjB,UAAU,GAAE,MAAsB,EAClC,UAAU,GAAE,UAAsB,EAClC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CA4G/C;AAKD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAAG,oBAAoB,GAAG,SAAS,CAExH"}
@@ -63,15 +63,69 @@ export interface ParsedCollection {
63
63
  fragment?: true;
64
64
  /** Preview target of a fragment collection, from a `defineCmsCollection({ cms: { previewOf } })` block. */
65
65
  previewOf?: string;
66
+ /** Display label, from a `defineCmsCollection({ cms: { label } })` block. */
67
+ label?: string;
68
+ /** The collection is left out of collection browsers, from a `defineCmsCollection({ cms: { hidden } })` block. */
69
+ hidden?: true;
70
+ /** Position in collection browsers, from a `defineCmsCollection({ cms: { order } })` block. */
71
+ order?: number;
72
+ /** Section heading in collection browsers, from a `defineCmsCollection({ cms: { group } })` block. */
73
+ group?: string;
66
74
  }
67
75
  export type ParsedConfig = Map<string, ParsedCollection>;
76
+ /**
77
+ * A key of the config's `collections` export, whether or not the rest of its declaration
78
+ * could be read. `ParsedConfig` only holds the collections with a readable schema or glob
79
+ * pattern; this is every name, so a scan can tell a collection it could not locate from one
80
+ * that does not exist.
81
+ *
82
+ * The loader facts are stricter than `ParsedCollection`'s: an option is only reported when
83
+ * nothing next to it (a spread) could replace it, because a scan report vouches by them.
84
+ */
85
+ export interface DeclaredCollection {
86
+ name: string;
87
+ /** Literal `base` of a `glob()` loader; `.` when the options name none, which is the project root to Astro. */
88
+ loaderBase?: string;
89
+ /** Literal `pattern` of a `glob()` loader. */
90
+ loaderPattern?: string;
91
+ /** The patterns of a `glob()` loader that takes a list of them, when every one is a literal. */
92
+ loaderPatterns?: string[];
93
+ /** Literal path of a `file()` loader. */
94
+ loaderFile?: string;
95
+ /** The declaration has a `loader`, whatever it is. */
96
+ hasLoader?: true;
97
+ /** The declaration has no `loader` at all: its entries are the files of `<contentDir>/<name>`. */
98
+ noLoader?: true;
99
+ }
100
+ /** One read of a content config: what {@link parseContentConfig} returns, and what the config declares beyond it. */
101
+ export interface ContentConfigRead {
102
+ parsed: ParsedConfig;
103
+ /** Every collection name the reader could make out. */
104
+ declared: DeclaredCollection[];
105
+ /**
106
+ * The reader could not see the whole `collections` export, so `declared` may be missing
107
+ * names: the export is not an object literal (a call, a re-export from another module),
108
+ * the literal has a spread, a method, a `__proto__` or a computed key in it, or the file
109
+ * mentions `collections` in a way that may add to it.
110
+ */
111
+ partial: boolean;
112
+ /**
113
+ * The file exports `collections`, or may through `export *`. Astro takes no collections
114
+ * from a content config that does not, whatever the file declares without exporting it.
115
+ */
116
+ exportsCollections: boolean;
117
+ }
68
118
  /** Cached parse result keyed by config path; invalidated by mtime. */
69
119
  export type ParseCache = Map<string, {
70
120
  mtimeMs: number;
71
- parsed: ParsedConfig;
72
- }>;
121
+ } & ContentConfigRead>;
73
122
  /** Where a project may keep its content config, in the order the parser prefers them. */
74
123
  export declare const CONTENT_CONFIG_PATHS: readonly ["src/content/config.ts", "src/content.config.ts"];
124
+ /**
125
+ * Where Astro also takes a content config from and this reader does not look. A project with
126
+ * one of these has a config; it is only out of the reader's sight.
127
+ */
128
+ export declare const UNREAD_CONTENT_CONFIG_PATHS: readonly ["src/content.config.mjs", "src/content.config.js", "src/content.config.mts", "src/content/config.mjs", "src/content/config.js", "src/content/config.mts"];
75
129
  /**
76
130
  * Why `parseContentConfig` came back empty. Three different facts share that one return value, and
77
131
  * only two of them are a defect: a site with no content collections is a legitimate site.
@@ -91,6 +145,26 @@ export declare function classifyEmptyContentConfig(fs: CmsFileSystem): Promise<E
91
145
  * re-reading and re-parsing an unchanged config file.
92
146
  */
93
147
  export declare function parseContentConfig(fs: CmsFileSystem, cache: ParseCache): Promise<ParsedConfig>;
148
+ /**
149
+ * {@link parseContentConfig}, plus every collection name the config declares — including the
150
+ * ones the parsed map leaves out because neither a schema nor a glob pattern could be read.
151
+ * Same file choice and the same cache.
152
+ */
153
+ export declare function readContentConfig(fs: CmsFileSystem, cache: ParseCache): Promise<ContentConfigRead>;
94
154
  /** Exported for unit testing — operates on a source string directly. */
95
155
  export declare function parseConfigSource(source: string, _sourcePath?: string): ParsedConfig;
156
+ /**
157
+ * Every mention of the string option `name` in the code of a config file, comments aside: as
158
+ * an identifier or as a string of exactly that name, anywhere. One that is the key of a
159
+ * property given a plain string is that string. Any other mention is `null`: another kind of
160
+ * value (a call, a concatenation, a variable), a shorthand, a variable, a parameter or a
161
+ * member of that name, and the name as a string that is not such a key, since a string can be
162
+ * made a key in more ways than can be listed (`Object.defineProperty(config, 'srcDir', …)`,
163
+ * `const KEY = 'srcDir'`). A key given an object literal is left out: it is not a string option, so it is
164
+ * another option of that name. `null` instead of a list for a file that does not parse.
165
+ *
166
+ * For telling whether an option is set to a known value wherever the file could set it,
167
+ * without evaluating the file.
168
+ */
169
+ export declare function configOptionMentions(source: string, name: string): Array<string | null> | null;
96
170
  //# sourceMappingURL=content-config-ast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-config-ast.d.ts","sourceRoot":"","sources":["../../src/content-config-ast.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EAId,KAAK,YAAY,EACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE;QAAE,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAA;IACvC,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,2GAA2G;IAC3G,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,mFAAmF;IACnF,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,6GAA6G;IAC7G,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC1B;AA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AAG,OAAO,CAAC,YAAY,CAAC,CAEpG;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuBxG;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAEpF;AA+bD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAoB9F"}
@@ -1,4 +1,4 @@
1
- import type { AddRedirectRequest, CollectionDefinition, ComponentDefinition, CreatePageRequest, DeletePageRequest, DeleteRedirectRequest, DuplicatePageRequest, GetRedirectsResponse, LayoutInfo, MediaStorageAdapter, MutationResult, PageOperationResponse, RedirectOperationResponse, UpdateRedirectRequest } from '@nuasite/cms-types';
1
+ import type { AddRedirectRequest, CollectionDefinition, CollectionScanReport, ComponentDefinition, CreatePageRequest, DeletePageRequest, DeleteRedirectRequest, DuplicatePageRequest, GetRedirectsResponse, LayoutInfo, MediaStorageAdapter, MutationResult, PageOperationResponse, RedirectOperationResponse, UpdateRedirectRequest } from '@nuasite/cms-types';
2
2
  import type { CmsFileSystem } from './fs/types';
3
3
  import { type AddArrayItemInput, type CreateEntryInput, type EntryAsset, type GetEntryResult, type RemoveArrayItemInput, type UpdateEntryInput } from './handlers/entry-ops';
4
4
  export interface CmsCoreOptions {
@@ -18,8 +18,24 @@ export interface CmsCoreOptions {
18
18
  * render-time page manifest.
19
19
  */
20
20
  export interface CmsCore {
21
- /** Scan all content collections, returning their inferred definitions keyed by name. */
22
- scanCollections(): Promise<Record<string, CollectionDefinition>>;
21
+ /**
22
+ * Scan all content collections, returning their inferred definitions keyed by name.
23
+ *
24
+ * The scan carries a report (see {@link CmsCore.collectionScanReport}) only when asked for
25
+ * `{ report: true }`. Building one costs a listing per declared collection, so it is paid
26
+ * only where it is read. A wrapper around this method has to pass `options` on: one that
27
+ * drops them leaves its caller without a report, which reads as "not reported".
28
+ */
29
+ scanCollections(options?: {
30
+ report?: boolean;
31
+ }): Promise<Record<string, CollectionDefinition>>;
32
+ /**
33
+ * What the scan that returned `collections` could not vouch for: pass the record
34
+ * `scanCollections()` resolved to. `undefined` when it has no report: read that as "not
35
+ * reported", never as "nothing unresolved". Optional, so a core built before the report
36
+ * existed is still a `CmsCore`.
37
+ */
38
+ collectionScanReport?(collections: Record<string, CollectionDefinition>): CollectionScanReport | undefined;
23
39
  /** Resolve the Astro component definitions used for MDX import injection. */
24
40
  scanComponents(): Promise<Record<string, ComponentDefinition>>;
25
41
  /** Read a single entry's frontmatter + body, or `null` when it does not exist. */
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAEN,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAIf,KAAK,cAAc,EAGnB,KAAK,oBAAoB,EAGzB,KAAK,gBAAgB,EACrB,MAAM,sBAAsB,CAAA;AAc7B,MAAM,WAAW,cAAc;IAC9B,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,mHAAmH;IACnH,aAAa,CAAC,EAAE,MAAM,EAA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M,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAGlF,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAC/D,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAGrE,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACpE,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC1E,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACpE,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACnC,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC9C,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC1E,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAChF,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAGhF,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CA2EnF"}
@@ -1,3 +1,20 @@
1
+ /**
2
+ * A directory a glob had to read and could not. Kept apart from every other failure so a
3
+ * caller can report it as a finding and still let a bug (or a path traversal) surface.
4
+ */
5
+ export declare class UnreadableDirectoryError extends Error {
6
+ /** Root-relative, forward slashes; the root itself is `.`. */
7
+ readonly directory: string;
8
+ /** The runtime's error code, e.g. `EACCES`. */
9
+ readonly code: string;
10
+ constructor(directory: string, code: string, options?: ErrorOptions);
11
+ }
1
12
  /** Convert a glob pattern (supports `*`, `**`, `?`, `{a,b}`) to an anchored RegExp. */
2
13
  export declare function globToRegExp(glob: string): RegExp;
14
+ /**
15
+ * Whether `glob` could match a file somewhere below the directory `dir` (both root-relative,
16
+ * forward slashes). Errs on the side of yes: only a directory that no path the pattern
17
+ * matches can run through is ruled out.
18
+ */
19
+ export declare function globMayMatchUnder(glob: string, dir: string): boolean;
3
20
  //# sourceMappingURL=glob.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/fs/glob.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BjD"}
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/fs/glob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAMnE;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BjD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAcpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"node-fs.d.ts","sourceRoot":"","sources":["../../../src/fs/node-fs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AA+D5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAsExD"}
1
+ {"version":3,"file":"node-fs.d.ts","sourceRoot":"","sources":["../../../src/fs/node-fs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AA6H5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAoFxD"}
@@ -6,6 +6,30 @@
6
6
  * escapes it (path traversal). The same brain therefore runs unchanged over
7
7
  * `node:fs` (sidecar + local dev) and, in principle, over a remote adapter.
8
8
  */
9
+ export interface GlobOptions {
10
+ /**
11
+ * Directories (root-relative, forward slashes) whose files the caller would throw away.
12
+ * An implementation may leave them unread, so one that cannot be read fails nothing.
13
+ * A match under one may still come back: the caller filters its results as before.
14
+ */
15
+ skipDirectory?: (dir: string) => boolean;
16
+ /**
17
+ * Symbolic links below the pattern's static prefix are left out unless this is set. With it,
18
+ * a linked file is listed under the link's own path, wherever it points, and a linked
19
+ * directory is walked as if it were there, as often as a path leads into it; a link back
20
+ * into a directory already entered through a link on the same path is not entered again.
21
+ * A linked directory whose real path is outside the root is not walked: when the pattern
22
+ * could match under it, the call rejects instead of answering without it. An implementation
23
+ * that ignores the option keeps leaving them out.
24
+ */
25
+ followSymlinks?: boolean;
26
+ /**
27
+ * Bounds what following links adds to the walk: when listing would have to read more
28
+ * directories than that behind links, the call rejects instead of answering with a part of
29
+ * the files. Directories reached without a link do not count.
30
+ */
31
+ maxLinkedDirectories?: number;
32
+ }
9
33
  export interface CmsFileSystem {
10
34
  /** Read a UTF-8 text file. Rejects when the file does not exist. */
11
35
  readFile(path: string): Promise<string>;
@@ -24,8 +48,12 @@ export interface CmsFileSystem {
24
48
  name: string;
25
49
  isDirectory: boolean;
26
50
  }[]>;
27
- /** Resolve a glob pattern (supports `*`, `**`, `?`, `{a,b}`) to matching file paths, root-relative. */
28
- glob(pattern: string): Promise<string[]>;
51
+ /**
52
+ * Resolve a glob pattern (supports `*`, `**`, `?`, `{a,b}`) to matching file paths, root-relative.
53
+ * Rejects with an `UnreadableDirectoryError` for a directory it cannot read that may hold a match.
54
+ * See {@link GlobOptions} for skipping directories and following symbolic links.
55
+ */
56
+ glob(pattern: string, options?: GlobOptions): Promise<string[]>;
29
57
  /** File metadata. Rejects when the path does not exist. */
30
58
  stat(path: string): Promise<{
31
59
  mtimeMs: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fs/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,qGAAqG;IACrG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAC5C,qFAAqF;IACrF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,gEAAgE;IAChE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,mDAAmD;IACnD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,0CAA0C;IAC1C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,qFAAqF;IACrF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC,CAAA;IACpE,uGAAuG;IACvG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACxC,2DAA2D;IAC3D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC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M,GAAG,OAAO,CAAC,cAAc,CAAC,CAkC3H;AAsLD,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACb;AAwED,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CA8BxG;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAwB9G;AAED,kFAAkF;AAClF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAGlH"}
@@ -1,21 +1,23 @@
1
1
  export { resolveAssetCandidates } from './asset-paths';
2
+ export { analyzeAstroScript, analyzeAstroSource, type AstroCollectionBinding, type AstroContentAccessor, type AstroContentCall, type AstroSourceAnalysis, type AstroSourceImport, } from './astro-source-analysis';
2
3
  export { checkContent, type CheckContentOptions, type CheckFinding, type CheckReport, type CheckSeverity, formatCheckReport } from './check';
3
4
  export { collectionKind, entryStem, loadCollections, type LoadedCollection, type LoadedCollections, type LoadedEntry, normalizeBase, parseEntry, } from './check-entries';
4
5
  export { checkAgainstSchemas, type LiveCheckInput } from './check-live';
5
6
  export { checkFieldShapes, type ShapeCheckInput } from './check-shape';
6
7
  export { checkEditorWrites, type WriteCheckInput } from './check-write';
7
- export { scanCollections } from './collection-scanner';
8
+ export { collectionScanReport, scanCollections } from './collection-scanner';
8
9
  export { scanComponentDefinitions } from './component-registry';
9
- export { classifyEmptyContentConfig, CONTENT_CONFIG_PATHS, type EmptyContentConfigReason, type ParseCache, parseConfigSource, parseContentConfig, type ParsedCollection, type ParsedConfig, type ParsedField, type ParsedReference, } from './content-config-ast';
10
+ export { classifyEmptyContentConfig, CONTENT_CONFIG_PATHS, type ContentConfigRead, type DeclaredCollection, type EmptyContentConfigReason, type ParseCache, parseConfigSource, parseContentConfig, type ParsedCollection, type ParsedConfig, type ParsedField, type ParsedReference, readContentConfig, UNREAD_CONTENT_CONFIG_PATHS, } from './content-config-ast';
10
11
  export { createCmsCore } from './core';
11
12
  export type { CmsCore, CmsCoreOptions } from './core';
12
13
  export { applyCreateRouteFields, blankFieldValue, blankRequiredFields, type CollectionKind, type CreateWriteField, isBlankFieldValue, newEntryFrontmatter, newRepeaterItem, normalizeCreateWrite, omitEmptyOnCreate, type RepeaterItemField, type RequiredGuardField, seedValueForRequiredField, withoutBlankArrayItems, type WriteModelField, } from './editor-write-model';
13
- export { globToRegExp } from './fs/glob';
14
+ export { globMayMatchUnder, globToRegExp, UnreadableDirectoryError } from './fs/glob';
14
15
  export { createNodeFs } from './fs/node-fs';
15
- export type { CmsFileSystem } from './fs/types';
16
+ export type { CmsFileSystem, GlobOptions } from './fs/types';
16
17
  export { type AddArrayItemInput, type CreateEntryInput, ensureMdxImports, type EntryAsset, type EntryOpsDeps, type GetEntryResult, parseFrontmatter, type RemoveArrayItemInput, serializeFrontmatter, type UpdateEntryInput, } from './handlers/entry-ops';
17
- export { type ContemberStorageOptions, createContemberStorageAdapter, createLocalStorageAdapter, createS3StorageAdapter, getFileExtension, listProjectImages, type ListProjectImagesOptions, type LocalStorageOptions, MIME_BY_EXT, mimeFromExt, type S3StorageOptions, uploadsDirRelativeToRoot, } from './media/index';
18
+ export { type ContemberStorageOptions, createContemberStorageAdapter, createLocalStorageAdapter, createS3StorageAdapter, decodeFilteredMediaCursor, getFileExtension, isUnsafeFolder, listFilteredMedia, listProjectImages, type ListProjectImagesOptions, type LocalStorageOptions, MEDIA_CURSOR_TYPE_MISMATCH, MEDIA_INVALID_CURSOR, MEDIA_INVALID_FOLDER, MEDIA_INVALID_ID, MEDIA_NOT_FOUND, MediaCursorError, mediaErrorStatus, MIME_BY_EXT, mimeFromExt, parseMediaTypeFilter, type S3StorageOptions, uploadsDirRelativeToRoot, } from './media/index';
18
19
  export { parseProjectCmsConfig, parseProjectCmsConfigSource } from './project-config-ast';
20
+ export { type RouteCollectionScan, scanRouteCollections } from './route-scan';
19
21
  export { describeIssue, type LiveIssue, type LiveParseResult, type LiveSchema, type LiveSchemas, schemaFor } from './schema-port';
20
22
  export { acceptsMissing, firstAcceptedEntry, governsPath, pointAt, type ProbePoint, rejectsValueAt } from './schema-probe';
21
23
  export { applyDerivedTransform, computeDerivedFieldUpdates, computePathnameFromSpec, type DerivedFieldSpec, escapeHtml, relativeImportPath, resolvePathnameFromSpec, slugify, slugifyHref, } from './shared';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC5I,OAAO,EACN,cAAc,EACd,SAAS,EACT,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,aAAa,EACb,UAAU,GACV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AACv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pB,KAAK,gBAAgB,GACrB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACN,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,wBAAwB,GACxB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AACzF,OAAO,EAAE,KAAK,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACjI,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC1H,OAAO,EACN,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,OAAO,EACP,WAAW,GACX,MAAM,UAAU,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"contember.d.ts","sourceRoot":"","sources":["../../../src/media/contember.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,MAAM,WAAW,uBAAuB;IACvC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;IAClB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,uBAAuB,GAAG,mBAAmB,CAuEnG"}
1
+ {"version":3,"file":"contember.d.ts","sourceRoot":"","sources":["../../../src/media/contember.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAGhF,MAAM,WAAW,uBAAuB;IACvC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;IAClB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,uBAAuB,GAAG,mBAAmB,CA8EnG"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The `error` a media adapter answers with when it refuses what the caller named, or
3
+ * when the file is not there. They are exact strings so a host can tell these apart
4
+ * from a storage failure by comparing, not by reading the text of an arbitrary error:
5
+ * an HTTP layer answers the first two with a 400 and the third with a 404.
6
+ */
7
+ export declare const MEDIA_INVALID_ID = "Invalid media id";
8
+ export declare const MEDIA_INVALID_FOLDER = "Invalid folder name";
9
+ export declare const MEDIA_NOT_FOUND = "Media file not found";
10
+ /**
11
+ * The HTTP status for a failed media adapter result: 400 for an id or folder the adapter
12
+ * refuses, 404 for a file that is not there, 500 for anything else. Only the exact
13
+ * strings above decide; the text of any other error may come from an SDK or an upstream
14
+ * service and is a storage failure whatever it says.
15
+ */
16
+ export declare function mediaErrorStatus(error: string | undefined): 400 | 404 | 500;
17
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/media/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,oBAAoB,wBAAwB,CAAA;AACzD,eAAO,MAAM,eAAe,yBAAyB,CAAA;AAErD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAI3E"}
@@ -1,5 +1,8 @@
1
1
  export { type ContemberStorageOptions, createContemberStorageAdapter } from './contember';
2
+ export { MEDIA_INVALID_FOLDER, MEDIA_INVALID_ID, MEDIA_NOT_FOUND, mediaErrorStatus } from './errors';
2
3
  export { createLocalStorageAdapter, getFileExtension, type LocalStorageOptions, MIME_BY_EXT, mimeFromExt } from './local';
4
+ export { isUnsafeFolder } from './names';
3
5
  export { listProjectImages, type ListProjectImagesOptions, uploadsDirRelativeToRoot } from './project-images';
4
6
  export { createS3StorageAdapter, type S3StorageOptions } from './s3';
7
+ export { decodeFilteredMediaCursor, listFilteredMedia, MEDIA_CURSOR_TYPE_MISMATCH, MEDIA_INVALID_CURSOR, MediaCursorError, parseMediaTypeFilter, } from './type-filter';
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACzH,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC7G,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACpG,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACzH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC7G,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,MAAM,CAAA;AACpE,OAAO,EACN,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,eAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/media/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAKlH,MAAM,WAAW,mBAAmB;IACnC;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,mBAAwB,GAAG,mBAAmB,CA8GhG;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY9C,CAAA;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/media/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAOlH,MAAM,WAAW,mBAAmB;IACnC;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAsCD,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,mBAAwB,GAAG,mBAAmB,CA0KhG;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY9C,CAAA;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Whether a `/`-separated name holds a `.` or `..` segment as it is spelled. These are
3
+ * the segments a path resolves away.
4
+ */
5
+ export declare function hasDotSegment(value: string): boolean;
6
+ /**
7
+ * Whether a folder a caller asks to create or upload into would turn into something
8
+ * else once it is part of a URL. A URL parser reads a segment spelled `%2e`, `.%2e`,
9
+ * `%2e.` or `%2e%2e` (in any case) as `.` or `..`, and a backslash as `/`, so the URL
10
+ * built for a file in such a folder would address a different path than the one the
11
+ * file was stored at. Literal `.` and `..` segments count too.
12
+ *
13
+ * Only new folders are held to this: an id or folder that already exists in storage is
14
+ * still listed and deleted as it is spelled.
15
+ */
16
+ export declare function isUnsafeFolder(folder: string): boolean;
17
+ //# sourceMappingURL=names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../../src/media/names.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../src/media/s3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAKlH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAQD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAiIrF"}
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../src/media/s3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAwBlH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAQD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CA4IrF"}
@@ -0,0 +1,67 @@
1
+ import { type MediaListOptions, type MediaListResult, type MediaTypeFilter } from '@nuasite/cms-types';
2
+ /** The value of a `?type=` parameter, or `null` when it names no tab we know. */
3
+ export declare function parseMediaTypeFilter(raw: string | null | undefined): MediaTypeFilter | null;
4
+ /**
5
+ * A cursor `listFilteredMedia` refused: not one it minted, or minted under a different tab. A host
6
+ * answers it with a 400 and the message, never by listing from the start.
7
+ */
8
+ export declare class MediaCursorError extends Error {
9
+ name: string;
10
+ }
11
+ export declare const MEDIA_INVALID_CURSOR = "Invalid media cursor";
12
+ export declare const MEDIA_CURSOR_TYPE_MISMATCH = "This cursor continues a listing filtered by a different ?type=. Start the listing again when the filter changes";
13
+ /**
14
+ * Where a filtered listing continues: the source page that `source` (the source's own cursor,
15
+ * absent for its first page) fetches at `size` items, from its `skip`-th item on. A filtered page
16
+ * that fills up halfway through a source page ends there, and this is how the next one starts at
17
+ * the item after, rather than at the next source page with the rest of this one lost.
18
+ */
19
+ interface FilteredPosition {
20
+ source: string | undefined;
21
+ skip: number;
22
+ size: number;
23
+ }
24
+ /**
25
+ * The tab and position a filtered cursor carries, or `null` when `raw` is not one `listFilteredMedia`
26
+ * minted. A host that also serves unfiltered listings uses it to refuse one followed without its
27
+ * `?type=`, which the adapter would otherwise read as its own cursor.
28
+ */
29
+ export declare function decodeFilteredMediaCursor(raw: string): (FilteredPosition & {
30
+ type: MediaTypeFilter;
31
+ }) | null;
32
+ /**
33
+ * The largest filtered page, and so the largest source page. The same bound both HTTP layers put on
34
+ * an unfiltered `limit`, applied here again so a caller that forgets to clamp cannot widen the scan.
35
+ */
36
+ export declare const MAX_FILTERED_MEDIA_LIMIT = 1000;
37
+ /**
38
+ * One page of a cursor-paged listing, filtered to `type`.
39
+ *
40
+ * A filter cannot be pushed into the adapters: they page over a filesystem, a bucket or a remote
41
+ * API, each with its own cursor. So it is applied here, above whichever one answered, by pulling
42
+ * further pages until this one is full. That keeps the cost of a filter inside a single request:
43
+ * without it the client is the one that drains, one round trip per page, and every round trip that
44
+ * reaches the sidecar's project scan makes it re-walk the project.
45
+ *
46
+ * A filtered page holds at most `limit` items. The source is read at `max(limit, 200)` items a
47
+ * page, so a page usually fills halfway through a source page; the cursor it hands back is one of
48
+ * ours, bound to `type`, and resumes by re-reading that source page and skipping what was already
49
+ * listed. That relies on a source answering the same cursor and size with the same page, which an
50
+ * offset or continuation-token listing does as long as nothing is written in between: the same
51
+ * caveat any offset pager carries. An unfiltered listing is passed straight through, the source's
52
+ * own cursor included.
53
+ *
54
+ * A cursor this did not mint, or minted under another tab, throws `MediaCursorError`.
55
+ * `hasMore` can be true on a page short of `limit`: that is what the scan bound below leaves behind.
56
+ */
57
+ export declare function listFilteredMedia(list: (options: MediaListOptions) => Promise<MediaListResult>, options: MediaListOptions & {
58
+ type?: MediaTypeFilter;
59
+ },
60
+ /**
61
+ * How many source items one filtered page may ask for, counted as the larger of what each source
62
+ * page was asked for and what it returned. Reaching it just ends the page early. `hasMore` still
63
+ * says there is more, so the caller can ask again. The first source page is always read.
64
+ */
65
+ maxScanned?: number): Promise<MediaListResult>;
66
+ export {};
67
+ //# sourceMappingURL=type-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-filter.d.ts","sourceRoot":"","sources":["../../../src/media/type-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,oBAAoB,CAAA;AAE3B,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAG3F;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACjC,IAAI,SAAqB;CAClC;AAED,eAAO,MAAM,oBAAoB,yBAAyB,CAAA;AAC1D,eAAO,MAAM,0BAA0B,oHAC2E,CAAA;AAElH;;;;;GAKG;AACH,UAAU,gBAAgB;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACZ;AAoBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,gBAAgB,GAAG;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,GAAG,IAAI,CAoB5G;AASD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAe5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,EAC7D,OAAO,EAAE,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,eAAe,CAAA;CAAE;AACtD;;;;GAIG;AACH,UAAU,SAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CA8C1B"}
@@ -1,6 +1,10 @@
1
1
  import type { CmsConfig } from '@nuasite/cms-types';
2
2
  import type { CmsFileSystem } from './fs/types';
3
- /** Parse `nua.cms.cmsConfig.listStyles` from an Astro config source string. */
3
+ /**
4
+ * Parse the project-level CMS config from an Astro config source string: `listStyles` and
5
+ * the project's language (see {@link parseLocale}), from wherever the config hands the
6
+ * integration its `cmsConfig` (see {@link effectiveCmsConfig}).
7
+ */
4
8
  export declare function parseProjectCmsConfigSource(source: string): CmsConfig;
5
9
  /** Read and parse the consuming project's Astro config, tolerating absence or malformed config. */
6
10
  export declare function parseProjectCmsConfig(fs: CmsFileSystem): Promise<CmsConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"project-config-ast.d.ts","sourceRoot":"","sources":["../../src/project-config-ast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAsH/C,+EAA+E;AAC/E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAerE;AAID,mGAAmG;AACnG,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAWjF"}
1
+ {"version":3,"file":"project-config-ast.d.ts","sourceRoot":"","sources":["../../src/project-config-ast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAqS/C;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAWrE;AAID,mGAAmG;AACnG,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAWjF"}
@@ -0,0 +1,10 @@
1
+ /** Content collections referenced by an Astro route, split by route role. */
2
+ export interface RouteCollectionScan {
3
+ /** Collections read directly inside the exported `getStaticPaths` function. */
4
+ staticPaths: string[];
5
+ /** Every collection read through an `astro:content` import. */
6
+ all: string[];
7
+ }
8
+ /** Find the content collections read by an Astro route's frontmatter. */
9
+ export declare function scanRouteCollections(source: string): RouteCollectionScan;
10
+ //# sourceMappingURL=route-scan.d.ts.map