@ploaness/governance 1.2.0 → 1.3.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/checkov-check.d.ts +9 -0
- package/dist/checkov-check.d.ts.map +1 -0
- package/dist/checkov-check.js +4 -0
- package/dist/checkov-check.js.map +1 -0
- package/dist/checkov-checks-aws.d.ts +4 -0
- package/dist/checkov-checks-aws.d.ts.map +1 -0
- package/dist/checkov-checks-aws.js +93 -0
- package/dist/checkov-checks-aws.js.map +1 -0
- package/dist/checkov-checks-azure.d.ts +4 -0
- package/dist/checkov-checks-azure.d.ts.map +1 -0
- package/dist/checkov-checks-azure.js +32 -0
- package/dist/checkov-checks-azure.js.map +1 -0
- package/dist/checkov-checks-google.d.ts +6 -0
- package/dist/checkov-checks-google.d.ts.map +1 -0
- package/dist/checkov-checks-google.js +53 -0
- package/dist/checkov-checks-google.js.map +1 -0
- package/dist/checkov-policy.d.ts +63 -0
- package/dist/checkov-policy.d.ts.map +1 -0
- package/dist/checkov-policy.js +105 -0
- package/dist/checkov-policy.js.map +1 -0
- package/dist/environment-coherence.d.ts +59 -5
- package/dist/environment-coherence.d.ts.map +1 -1
- package/dist/environment-coherence.js +107 -5
- package/dist/environment-coherence.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/payload-bootstrap.d.ts +52 -0
- package/dist/payload-bootstrap.d.ts.map +1 -0
- package/dist/payload-bootstrap.js +195 -0
- package/dist/payload-bootstrap.js.map +1 -0
- package/dist/payload-database.d.ts +80 -0
- package/dist/payload-database.d.ts.map +1 -0
- package/dist/payload-database.js +164 -0
- package/dist/payload-database.js.map +1 -0
- package/dist/payload-policy.d.ts +8 -0
- package/dist/payload-policy.d.ts.map +1 -1
- package/dist/payload-policy.js +12 -4
- package/dist/payload-policy.js.map +1 -1
- package/dist/shell-files.d.ts +45 -0
- package/dist/shell-files.d.ts.map +1 -0
- package/dist/shell-files.js +105 -0
- package/dist/shell-files.js.map +1 -0
- package/dist/source-security.d.ts +10 -0
- package/dist/source-security.d.ts.map +1 -1
- package/dist/source-security.js +88 -1
- package/dist/source-security.js.map +1 -1
- package/dist/terraform-files.d.ts +29 -0
- package/dist/terraform-files.d.ts.map +1 -0
- package/dist/terraform-files.js +50 -0
- package/dist/terraform-files.js.map +1 -0
- package/dist/terraform-policy.d.ts +13 -0
- package/dist/terraform-policy.d.ts.map +1 -0
- package/dist/terraform-policy.js +261 -0
- package/dist/terraform-policy.js.map +1 -0
- package/dist/terraform-providers.d.ts +28 -0
- package/dist/terraform-providers.d.ts.map +1 -0
- package/dist/terraform-providers.js +68 -0
- package/dist/terraform-providers.js.map +1 -0
- package/dist/toolchain-pins.d.ts +1 -1
- package/dist/toolchain-pins.d.ts.map +1 -1
- package/dist/toolchain-pins.js +9 -2
- package/dist/toolchain-pins.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// Require environment reads, example declarations, compose interpolation,
|
|
1
|
+
// Require environment reads, example declarations, compose interpolation, verifying workflows, and the
|
|
2
|
+
// build arguments an image declares to agree.
|
|
3
|
+
import { logicalLines } from './container-images.js';
|
|
2
4
|
/**
|
|
3
5
|
* The module a Payload project reads `process.env` in, which is the only module ploaness exempts from
|
|
4
6
|
* the ban and therefore the only one this rule can read a variable name out of.
|
|
@@ -27,6 +29,19 @@ export const ENVIRONMENT_EXAMPLE_FILES = [
|
|
|
27
29
|
'.env.sample',
|
|
28
30
|
'.env.template',
|
|
29
31
|
];
|
|
32
|
+
/**
|
|
33
|
+
* The framework configuration a member may hold at its own root.
|
|
34
|
+
*
|
|
35
|
+
* It is evaluated during the image build, so a variable it reads is one the build has to be given - and
|
|
36
|
+
* it sits outside `sourceRoots`, which is why the `process.env` ban never reached it and why this rule
|
|
37
|
+
* has to. Every spelling present is read, unlike the example files above, because a project ships one
|
|
38
|
+
* and reading all of them cannot produce two answers that disagree.
|
|
39
|
+
*/
|
|
40
|
+
export const BUILD_CONFIGURATION_FILES = [
|
|
41
|
+
'next.config.ts',
|
|
42
|
+
'next.config.mjs',
|
|
43
|
+
'next.config.js',
|
|
44
|
+
];
|
|
30
45
|
// BRACKET ACCESS ONLY, and that is the rule rather than a shortcut. `process.env` is an index
|
|
31
46
|
// signature, so a variable this project invented can only be read with brackets; a variable node or the
|
|
32
47
|
// framework DECLARES - `NODE_ENV` above all - is a known property and is read with a dot. The two forms
|
|
@@ -41,6 +56,23 @@ const EXAMPLE_ASSIGNMENT = /^[ \t]*(?:export[ \t]+)?(?<name>[A-Za-z_]\w*)[ \t]*=
|
|
|
41
56
|
// gate's business. The braced form alone is read: `$NAME` is legal in compose and rare in practice, and
|
|
42
57
|
// telling it apart from a `$$` escape or a shell fragment inside a `command:` is guesswork.
|
|
43
58
|
const COMPOSE_INTERPOLATION = /\$\{(?<name>[A-Z_]\w*)\}/gi;
|
|
59
|
+
// BOTH ACCESS FORMS, and the PREFIX is what makes that sound rather than a relaxation of the rule
|
|
60
|
+
// above. `NEXT_PUBLIC_` is reserved by the framework for values the project invents; no runtime declares
|
|
61
|
+
// one, so a dotted read of a prefixed name cannot be naming an ambient variable the way
|
|
62
|
+
// `process.env.NODE_ENV` does. It is also the ONLY form the bundler substitutes, because the
|
|
63
|
+
// substitution is textual - so the dotted read is not merely admissible here, it is the read that makes
|
|
64
|
+
// the value a build input at all. A name read through a plain record parameter is not matched: nothing
|
|
65
|
+
// is inlined there, and the value arrives from whoever built the record.
|
|
66
|
+
const INLINED_DOTTED_READ = /process\.env\.(?<name>NEXT_PUBLIC_\w+)/g;
|
|
67
|
+
const INLINED_BRACKETED_READ = /process\.env\[\s*(?<quote>['"])(?<name>NEXT_PUBLIC_\w+)\k<quote>\s*\]/g;
|
|
68
|
+
// A build-argument DECLARATION, with or without a default. The compose analogue above puts
|
|
69
|
+
// `${NAME:-5432}` out of scope because a default SUPPLIES the value and the claim was that something
|
|
70
|
+
// must supply it. This containment runs the other way - the Dockerfile is the side that must DECLARE -
|
|
71
|
+
// and `ARG NAME=x` declares NAME just as `ARG NAME` does: `--build-arg NAME=...` is honoured either way
|
|
72
|
+
// and the read resolves. What this rule is about is a name the file never mentions.
|
|
73
|
+
const ARG_DECLARATION = /^[ \t]*ARG[ \t]+(?<names>\S.*)$/i;
|
|
74
|
+
const ARGUMENT_SEPARATOR = /[ \t]+/;
|
|
75
|
+
const DEFAULT_SEPARATOR = '=';
|
|
44
76
|
// A name a workflow supplies: a mapping key in SCREAMING_SNAKE, or a reference to a secret, a variable,
|
|
45
77
|
// or the job environment. The key form is matched at any indentation, for the reason the header states.
|
|
46
78
|
const WORKFLOW_KEY = /^[ \t]*(?<name>[A-Z_][A-Z0-9_]*)[ \t]*:/gm;
|
|
@@ -73,6 +105,32 @@ export const documentedEnvironmentNames = (example) => uniqueSorted(namesMatchin
|
|
|
73
105
|
* @returns each name once, sorted.
|
|
74
106
|
*/
|
|
75
107
|
export const interpolatedEnvironmentNames = (compose) => uniqueSorted(namesMatching(compose, COMPOSE_INTERPOLATION));
|
|
108
|
+
/**
|
|
109
|
+
* The variables a file's reads inline into the image at build time.
|
|
110
|
+
* @param source the contents of a validated environment module or a framework configuration.
|
|
111
|
+
* @returns each name once, sorted.
|
|
112
|
+
*/
|
|
113
|
+
export const inlinedEnvironmentNames = (source) => uniqueSorted([
|
|
114
|
+
...namesMatching(source, INLINED_DOTTED_READ),
|
|
115
|
+
...namesMatching(source, INLINED_BRACKETED_READ),
|
|
116
|
+
]);
|
|
117
|
+
const argumentNamesIn = (declaration) => declaration
|
|
118
|
+
.split(ARGUMENT_SEPARATOR)
|
|
119
|
+
.map((token) => token.split(DEFAULT_SEPARATOR)[0] ?? '')
|
|
120
|
+
.filter((name) => name.length > 0);
|
|
121
|
+
/**
|
|
122
|
+
* The build arguments a Dockerfile declares, in every stage and under either spelling.
|
|
123
|
+
*
|
|
124
|
+
* Every stage, because `ARG` scope is per stage and which stage runs the build is not a fact this text
|
|
125
|
+
* can establish. Reading the file as one namespace can only ACCEPT a declaration that sits in the wrong
|
|
126
|
+
* stage; resolving stages by guessing which `RUN` is the build would REJECT correct files.
|
|
127
|
+
* @param dockerfile the Dockerfile body.
|
|
128
|
+
* @returns each name once, sorted.
|
|
129
|
+
*/
|
|
130
|
+
export const declaredBuildArguments = (dockerfile) => uniqueSorted(logicalLines(dockerfile).flatMap((line) => {
|
|
131
|
+
const names = ARG_DECLARATION.exec(line)?.groups?.['names'];
|
|
132
|
+
return names === undefined ? [] : argumentNamesIn(names);
|
|
133
|
+
}));
|
|
76
134
|
/**
|
|
77
135
|
* The variables a workflow supplies, by any means and at any nesting depth.
|
|
78
136
|
* @param workflow the contents of the workflow file.
|
|
@@ -88,6 +146,22 @@ export const workflowSuppliedNames = (workflow) => uniqueSorted([
|
|
|
88
146
|
* @returns true when the workflow invokes verification or a single gate.
|
|
89
147
|
*/
|
|
90
148
|
export const isVerifyingWorkflow = (workflow) => VERIFYING_COMMANDS.some((command) => workflow.includes(command));
|
|
149
|
+
const ROOT_MEMBER = '.';
|
|
150
|
+
// The member a path belongs to: the deepest one whose directory contains it, the same rule a working
|
|
151
|
+
// directory is resolved by, so a nested member keeps its own image instead of inheriting its parent's.
|
|
152
|
+
const ownerOf = (file, everyMemberPath) => [...everyMemberPath]
|
|
153
|
+
.filter((candidate) => candidate !== ROOT_MEMBER && file.startsWith(`${candidate}/`))
|
|
154
|
+
.toSorted((left, right) => right.length - left.length)
|
|
155
|
+
.at(0) ?? ROOT_MEMBER;
|
|
156
|
+
/**
|
|
157
|
+
* The Dockerfiles that build one member: those inside its own directory, and - for the member at the
|
|
158
|
+
* repository root - those no other member owns.
|
|
159
|
+
* @param memberPath the member's repo-relative path, `.` at the repository root.
|
|
160
|
+
* @param everyMemberPath every governed member's path.
|
|
161
|
+
* @param dockerfiles every Dockerfile the repository tracks.
|
|
162
|
+
* @returns the Dockerfiles that build this member, in the order given.
|
|
163
|
+
*/
|
|
164
|
+
export const dockerfilesBuilding = (memberPath, everyMemberPath, dockerfiles) => dockerfiles.filter((dockerfile) => ownerOf(dockerfile.file, everyMemberPath) === memberPath);
|
|
91
165
|
const undocumented = (names, documented, origin, reason) => names
|
|
92
166
|
.filter((name) => !documented.has(name))
|
|
93
167
|
.map((name) => ({ name, origin, reason }));
|
|
@@ -104,15 +178,42 @@ const missingFromWorkflow = (names, workflow) => {
|
|
|
104
178
|
].join(' '),
|
|
105
179
|
}));
|
|
106
180
|
};
|
|
181
|
+
const missingBuildArguments = (build) => {
|
|
182
|
+
// A member that ships no image owes no build argument. One-directional, like every rule above.
|
|
183
|
+
if (build.dockerfiles.length === 0) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const declared = new Set(build.dockerfiles.flatMap((dockerfile) => declaredBuildArguments(dockerfile.content)));
|
|
187
|
+
const files = build.dockerfiles
|
|
188
|
+
.map((dockerfile) => dockerfile.file)
|
|
189
|
+
.join(', ');
|
|
190
|
+
return uniqueSorted(build.sources.flatMap((source) => inlinedEnvironmentNames(source)))
|
|
191
|
+
.filter((name) => !declared.has(name))
|
|
192
|
+
.map((name) => ({
|
|
193
|
+
name,
|
|
194
|
+
origin: 'dockerfile',
|
|
195
|
+
reason: [
|
|
196
|
+
`inlined into the image at build time but declared by no ARG in ${files},`,
|
|
197
|
+
'so docker discards the --build-arg that supplies it and warns rather than failing:',
|
|
198
|
+
`add "ARG ${name}" to the stage that runs the build`,
|
|
199
|
+
].join(' '),
|
|
200
|
+
}));
|
|
201
|
+
};
|
|
107
202
|
/**
|
|
108
203
|
* Every environment variable declared in one place and absent from another it has to reach.
|
|
109
204
|
*
|
|
110
|
-
*
|
|
205
|
+
* Four containments, each one-directional. What the application reads must be documented. What a
|
|
111
206
|
* compose file interpolates must be documented, because `docker compose config` reads the example file
|
|
112
|
-
* a developer copied.
|
|
113
|
-
* verifies, because a workflow has no copied file to interpolate from.
|
|
207
|
+
* a developer copied. What a compose file interpolates must be supplied by every workflow that
|
|
208
|
+
* verifies, because a workflow has no copied file to interpolate from. And what a build inlines must be
|
|
209
|
+
* declared as an `ARG`, because docker discards a `--build-arg` the Dockerfile never named and warns
|
|
210
|
+
* rather than failing - so the value is absent from the image and nothing says so.
|
|
211
|
+
*
|
|
212
|
+
* The inlined names feed the Dockerfile containment ALONE. Joining them to the example-file rule would
|
|
213
|
+
* report a member that documents its public variables in its own example file rather than the
|
|
214
|
+
* repository's, which is where they belong and where this reader does not look.
|
|
114
215
|
* @param inputs the files, already read.
|
|
115
|
-
* @returns the violations, sorted by name within each rule. An empty array means the
|
|
216
|
+
* @returns the violations, sorted by name within each rule. An empty array means the five places agree.
|
|
116
217
|
*/
|
|
117
218
|
export const findEnvironmentViolations = (inputs) => {
|
|
118
219
|
const documented = new Set(inputs.example === undefined ? [] : documentedEnvironmentNames(inputs.example));
|
|
@@ -123,6 +224,7 @@ export const findEnvironmentViolations = (inputs) => {
|
|
|
123
224
|
...undocumented(read, documented, 'application', 'read by the validated environment module but documented in no example file'),
|
|
124
225
|
...undocumented(interpolated, documented, 'compose', 'interpolated by a compose file but documented in no example file'),
|
|
125
226
|
...verifying.flatMap((workflow) => missingFromWorkflow(interpolated, workflow)),
|
|
227
|
+
...inputs.builds.flatMap((build) => missingBuildArguments(build)),
|
|
126
228
|
];
|
|
127
229
|
};
|
|
128
230
|
//# sourceMappingURL=environment-coherence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-coherence.js","sourceRoot":"","sources":["../src/environment-coherence.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"environment-coherence.js","sourceRoot":"","sources":["../src/environment-coherence.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,8CAA8C;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AA8CpD;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAW,wBAAwB,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM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C,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,CAAC,CAC/E,CAAA;IACD,MAAM,IAAI,GAAsB,YAAY,CAC1C,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,MAAc,EAAqB,EAAE,CACtE,oBAAoB,CAAC,MAAM,CAAC,CAC7B,CACF,CAAA;IACD,MAAM,YAAY,GAAsB,YAAY,CAClD,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAc,EAAqB,EAAE,CAClE,4BAA4B,CAAC,MAAM,CAAC,CACrC,CACF,CAAA;IACD,MAAM,SAAS,GAA4B,MAAM,CAAC,SAAS,CAAC,MAAM,CAChE,CAAC,QAAsB,EAAW,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC3E,CAAA;IACD,OAAO;QACL,GAAG,YAAY,CACb,IAAI,EACJ,UAAU,EACV,aAAa,EACb,4EAA4E,CAC7E;QACD,GAAG,YAAY,CACb,YAAY,EACZ,UAAU,EACV,SAAS,EACT,kEAAkE,CACnE;QACD,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,QAAsB,EAAmC,EAAE,CAC/E,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAC5C;QACD,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAiB,EAAmC,EAAE,CAC9E,qBAAqB,CAAC,KAAK,CAAC,CAC7B;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export * from './blocklist.js';
|
|
|
11
11
|
export * from './blocklist-entries.js';
|
|
12
12
|
export * from './build-diagnosis.js';
|
|
13
13
|
export * from './bundle-budget.js';
|
|
14
|
+
export * from './checkov-check.js';
|
|
15
|
+
export * from './checkov-policy.js';
|
|
14
16
|
export * from './commit-message.js';
|
|
15
17
|
export * from './config-references.js';
|
|
16
18
|
export * from './container-failure.js';
|
|
@@ -42,6 +44,8 @@ export * from './oxlint-scope.js';
|
|
|
42
44
|
export * from './oxlint-suppressions.js';
|
|
43
45
|
export * from './paired-assets.js';
|
|
44
46
|
export * from './payload-access.js';
|
|
47
|
+
export * from './payload-bootstrap.js';
|
|
48
|
+
export * from './payload-database.js';
|
|
45
49
|
export * from './payload-defaults.js';
|
|
46
50
|
export * from './payload-policy.js';
|
|
47
51
|
export * from './payload-source.js';
|
|
@@ -55,10 +59,14 @@ export * from './run-policy.js';
|
|
|
55
59
|
export * from './secret-policy.js';
|
|
56
60
|
export * from './settings.js';
|
|
57
61
|
export * from './settings-layering.js';
|
|
62
|
+
export * from './shell-files.js';
|
|
58
63
|
export * from './skill-manifest.js';
|
|
59
64
|
export * from './source-text.js';
|
|
60
65
|
export * from './suppression-ceiling.js';
|
|
61
66
|
export * from './tailwind-tokens.js';
|
|
67
|
+
export * from './terraform-files.js';
|
|
68
|
+
export * from './terraform-policy.js';
|
|
69
|
+
export * from './terraform-providers.js';
|
|
62
70
|
export * from './text-escapes.js';
|
|
63
71
|
export * from './toolchain-pins.js';
|
|
64
72
|
export * from './version-policy.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAA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AAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,8 @@ export * from './blocklist.js';
|
|
|
15
15
|
export * from './blocklist-entries.js';
|
|
16
16
|
export * from './build-diagnosis.js';
|
|
17
17
|
export * from './bundle-budget.js';
|
|
18
|
+
export * from './checkov-check.js';
|
|
19
|
+
export * from './checkov-policy.js';
|
|
18
20
|
export * from './commit-message.js';
|
|
19
21
|
export * from './config-references.js';
|
|
20
22
|
export * from './container-failure.js';
|
|
@@ -46,6 +48,8 @@ export * from './oxlint-scope.js';
|
|
|
46
48
|
export * from './oxlint-suppressions.js';
|
|
47
49
|
export * from './paired-assets.js';
|
|
48
50
|
export * from './payload-access.js';
|
|
51
|
+
export * from './payload-bootstrap.js';
|
|
52
|
+
export * from './payload-database.js';
|
|
49
53
|
export * from './payload-defaults.js';
|
|
50
54
|
export * from './payload-policy.js';
|
|
51
55
|
export * from './payload-source.js';
|
|
@@ -59,10 +63,14 @@ export * from './run-policy.js';
|
|
|
59
63
|
export * from './secret-policy.js';
|
|
60
64
|
export * from './settings.js';
|
|
61
65
|
export * from './settings-layering.js';
|
|
66
|
+
export * from './shell-files.js';
|
|
62
67
|
export * from './skill-manifest.js';
|
|
63
68
|
export * from './source-text.js';
|
|
64
69
|
export * from './suppression-ceiling.js';
|
|
65
70
|
export * from './tailwind-tokens.js';
|
|
71
|
+
export * from './terraform-files.js';
|
|
72
|
+
export * from './terraform-policy.js';
|
|
73
|
+
export * from './terraform-providers.js';
|
|
66
74
|
export * from './text-escapes.js';
|
|
67
75
|
export * from './toolchain-pins.js';
|
|
68
76
|
export * from './version-policy.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,oGAAoG;AACpG,mGAAmG;AACnG,0DAA0D;AAE1D,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,g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CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SpecSource } from './axe-coverage.js';
|
|
2
|
+
import type { LocatedViolation } from './relationship-cleanup.js';
|
|
3
|
+
/**
|
|
4
|
+
* The Local API operations that change stored state.
|
|
5
|
+
*
|
|
6
|
+
* Derived from the one catalogue rather than written out again: a second list is a second thing to keep
|
|
7
|
+
* in step, and the two would disagree the first time Payload gained an operation. A read at boot is
|
|
8
|
+
* legitimate and deliberately absent from this set.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LOCAL_API_MUTATIONS: readonly string[];
|
|
11
|
+
/** The body of a configuration's boot hook, and the line its configuration begins on. */
|
|
12
|
+
export interface BootstrapHook {
|
|
13
|
+
readonly body: string;
|
|
14
|
+
readonly line: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The boot hook every root configuration in a source declares.
|
|
18
|
+
* @param code the file's text, with comments already stripped.
|
|
19
|
+
* @returns one entry per configuration that declares `onInit` with a body.
|
|
20
|
+
*/
|
|
21
|
+
export declare const bootstrapHooksIn: (code: string) => readonly BootstrapHook[];
|
|
22
|
+
/**
|
|
23
|
+
* The module specifier a name is imported from.
|
|
24
|
+
* @param code the importing file's text.
|
|
25
|
+
* @param name the imported binding to find.
|
|
26
|
+
* @returns the specifier, or undefined when the file imports no such name.
|
|
27
|
+
*/
|
|
28
|
+
export declare const moduleOfImport: (code: string, name: string) => string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The repository-relative paths a specifier could name, in the order a resolver would try them.
|
|
31
|
+
* @param specifier the module specifier as written.
|
|
32
|
+
* @param fromPath the member-relative path of the importing file.
|
|
33
|
+
* @returns the candidate paths, empty when the specifier names a package rather than project source.
|
|
34
|
+
*/
|
|
35
|
+
export declare const candidatePathsFor: (specifier: string, fromPath: string) => readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* The body of a named export.
|
|
38
|
+
* @param source the module's text, with comments already stripped.
|
|
39
|
+
* @param name the exported binding to read.
|
|
40
|
+
* @returns the body, or undefined when the module exports no such binding with one.
|
|
41
|
+
*/
|
|
42
|
+
export declare const exportedBodyIn: (source: string, name: string) => string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Report every Local API write a boot hook performs, or reaches in one call.
|
|
45
|
+
*
|
|
46
|
+
* Reported against the configuration that schedules the write rather than the module that performs it:
|
|
47
|
+
* the module may be a legitimate seed, and what makes it a defect is being wired into `onInit`.
|
|
48
|
+
* @param files every source file of the member, as read.
|
|
49
|
+
* @returns one violation per write, located on the configuration that declares the hook.
|
|
50
|
+
*/
|
|
51
|
+
export declare const findBootstrapWrites: (files: readonly SpecSource[]) => readonly LocatedViolation[];
|
|
52
|
+
//# sourceMappingURL=payload-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-bootstrap.d.ts","sourceRoot":"","sources":["../src/payload-bootstrap.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAInD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAajE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAEhD,CAAA;AAED,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAaD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,SAAS,aAAa,EAKlE,CAAA;AAkDJ;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,SAI3D,CAAA;AAkCV;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,UAAU,MAAM,KAAG,SAAS,MAAM,EAQtF,CAAA;AAgBD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,SAGtE,CAAA;AAiDD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,UAAU,EAAE,KAAG,SAAS,gBAAgB,EAexF,CAAA"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { rootConfigsIn } from './payload-database.js';
|
|
2
|
+
import { LOCAL_API_CALLS, PAYLOAD_RECEIVER } from './payload-policy.js';
|
|
3
|
+
import { depthOneValue } from './payload-source.js';
|
|
4
|
+
import { balancedArguments, NOT_FOUND, occurrences, stripComments } from './source-text.js';
|
|
5
|
+
/** The operations that change stored state, named as the catalogue spells them. */
|
|
6
|
+
const MUTATION_NAMES = new Set([
|
|
7
|
+
'create',
|
|
8
|
+
'delete',
|
|
9
|
+
'restoreGlobalVersion',
|
|
10
|
+
'restoreVersion',
|
|
11
|
+
'update',
|
|
12
|
+
'updateGlobal',
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* The Local API operations that change stored state.
|
|
16
|
+
*
|
|
17
|
+
* Derived from the one catalogue rather than written out again: a second list is a second thing to keep
|
|
18
|
+
* in step, and the two would disagree the first time Payload gained an operation. A read at boot is
|
|
19
|
+
* legitimate and deliberately absent from this set.
|
|
20
|
+
*/
|
|
21
|
+
export const LOCAL_API_MUTATIONS = LOCAL_API_CALLS.filter((call) => MUTATION_NAMES.has(call.slice(1, -1)));
|
|
22
|
+
const ARROW = '=>';
|
|
23
|
+
// The body a hook value opens, found after the arrow rather than at the first brace: a hook written
|
|
24
|
+
// `async ({ payload }) => { ... }` destructures before it opens, and the first brace is that pattern.
|
|
25
|
+
const hookBodyIn = (value) => {
|
|
26
|
+
const arrow = value.indexOf(ARROW);
|
|
27
|
+
const from = arrow === NOT_FOUND ? 0 : arrow + ARROW.length;
|
|
28
|
+
const open = value.indexOf('{', from);
|
|
29
|
+
return open === NOT_FOUND ? undefined : balancedArguments(value, open);
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The boot hook every root configuration in a source declares.
|
|
33
|
+
* @param code the file's text, with comments already stripped.
|
|
34
|
+
* @returns one entry per configuration that declares `onInit` with a body.
|
|
35
|
+
*/
|
|
36
|
+
export const bootstrapHooksIn = (code) => rootConfigsIn(code).flatMap((config) => {
|
|
37
|
+
const value = depthOneValue(config.body, 'onInit');
|
|
38
|
+
const body = value === undefined ? undefined : hookBodyIn(value);
|
|
39
|
+
return body === undefined ? [] : [{ body, line: config.line }];
|
|
40
|
+
});
|
|
41
|
+
// A Local API mutation performed on a Payload receiver, anywhere in a body.
|
|
42
|
+
//
|
|
43
|
+
// Distinct operations, not occurrences: a seed that writes two globals performs `updateGlobal` twice,
|
|
44
|
+
// and reporting it twice would print the same sentence twice for one repair. What the reader has to act
|
|
45
|
+
// on is that the body writes at all.
|
|
46
|
+
const mutationsIn = (body) => [
|
|
47
|
+
...new Set(LOCAL_API_MUTATIONS.flatMap((call) => occurrences(body, call)
|
|
48
|
+
.filter((found) => PAYLOAD_RECEIVER.test(body.slice(0, found)))
|
|
49
|
+
.map(() => call.slice(1, -1)))),
|
|
50
|
+
];
|
|
51
|
+
// The names a body calls. The keywords are removed because `if (` and `while (` are indistinguishable
|
|
52
|
+
// from a call by this pattern, and a keyword can never name an import.
|
|
53
|
+
const CALLED_IDENTIFIER = /\b([a-z_$][\w$]*)\s*\(/gi;
|
|
54
|
+
const STATEMENT_KEYWORDS = new Set([
|
|
55
|
+
'await',
|
|
56
|
+
'catch',
|
|
57
|
+
'for',
|
|
58
|
+
'function',
|
|
59
|
+
'if',
|
|
60
|
+
'return',
|
|
61
|
+
'switch',
|
|
62
|
+
'typeof',
|
|
63
|
+
'while',
|
|
64
|
+
]);
|
|
65
|
+
const calledNamesIn = (body) => [
|
|
66
|
+
...new Set([...body.matchAll(CALLED_IDENTIFIER)]
|
|
67
|
+
.map((match) => match[1] ?? '')
|
|
68
|
+
.filter((name) => !STATEMENT_KEYWORDS.has(name))),
|
|
69
|
+
];
|
|
70
|
+
// Every quantifier here is bounded by a literal that cannot itself match, so the scan is linear: a
|
|
71
|
+
// binding clause runs to the one brace that closes it, and a specifier to the one quote that ends it.
|
|
72
|
+
const IMPORT_BINDING = /\bimport\s+\{([^}]+)\}\s+from\s*['"]([^'"]+)['"]/g;
|
|
73
|
+
const boundNames = (clause) => clause
|
|
74
|
+
.split(',')
|
|
75
|
+
.map((binding) => binding.trim().split(/\s+/).at(-1) ?? '')
|
|
76
|
+
.filter((name) => name.length > 0);
|
|
77
|
+
/**
|
|
78
|
+
* The module specifier a name is imported from.
|
|
79
|
+
* @param code the importing file's text.
|
|
80
|
+
* @param name the imported binding to find.
|
|
81
|
+
* @returns the specifier, or undefined when the file imports no such name.
|
|
82
|
+
*/
|
|
83
|
+
export const moduleOfImport = (code, name) => [...code.matchAll(IMPORT_BINDING)]
|
|
84
|
+
.filter((match) => boundNames(match[1] ?? '').includes(name))
|
|
85
|
+
.map((match) => match[2])
|
|
86
|
+
.at(0);
|
|
87
|
+
const SOURCE_EXTENSIONS = ['.ts', '.tsx'];
|
|
88
|
+
const ALIAS = '@/';
|
|
89
|
+
const ALIAS_ROOT = 'src/';
|
|
90
|
+
const directoryOf = (filePath) => {
|
|
91
|
+
const slash = filePath.lastIndexOf('/');
|
|
92
|
+
return slash === NOT_FOUND ? '' : filePath.slice(0, slash);
|
|
93
|
+
};
|
|
94
|
+
// `.` and `..` resolved without node:path, which keeps this layer free of every runtime module.
|
|
95
|
+
const flattened = (segments) => segments.reduce((kept, segment) => {
|
|
96
|
+
if (segment === '' || segment === '.') {
|
|
97
|
+
return kept;
|
|
98
|
+
}
|
|
99
|
+
return segment === '..' ? kept.slice(0, -1) : [...kept, segment];
|
|
100
|
+
}, []);
|
|
101
|
+
// The path a specifier names before an extension is tried. A package specifier resolves to nothing,
|
|
102
|
+
// which is what keeps the rule inside the member's own source.
|
|
103
|
+
const resolvedBase = (specifier, fromPath) => {
|
|
104
|
+
if (specifier.startsWith(ALIAS)) {
|
|
105
|
+
return `${ALIAS_ROOT}${specifier.slice(ALIAS.length)}`;
|
|
106
|
+
}
|
|
107
|
+
return specifier.startsWith('.')
|
|
108
|
+
? flattened([...directoryOf(fromPath).split('/'), ...specifier.split('/')]).join('/')
|
|
109
|
+
: undefined;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The repository-relative paths a specifier could name, in the order a resolver would try them.
|
|
113
|
+
* @param specifier the module specifier as written.
|
|
114
|
+
* @param fromPath the member-relative path of the importing file.
|
|
115
|
+
* @returns the candidate paths, empty when the specifier names a package rather than project source.
|
|
116
|
+
*/
|
|
117
|
+
export const candidatePathsFor = (specifier, fromPath) => {
|
|
118
|
+
const base = resolvedBase(specifier, fromPath);
|
|
119
|
+
return base === undefined
|
|
120
|
+
? []
|
|
121
|
+
: [
|
|
122
|
+
...SOURCE_EXTENSIONS.map((extension) => `${base}${extension}`),
|
|
123
|
+
`${base}/index.ts`,
|
|
124
|
+
];
|
|
125
|
+
};
|
|
126
|
+
// The body of one named export, so a module holding an unrelated writer beside the function the hook
|
|
127
|
+
// actually calls is not reported for the writer it never reached.
|
|
128
|
+
const declarationOf = (name) => new RegExp(String.raw `export\s+(?:async\s+)?(?:function\s+|const\s+)${name}\b`);
|
|
129
|
+
const bodyAfter = (source, at) => {
|
|
130
|
+
const open = source.indexOf('(', at);
|
|
131
|
+
const parameters = open === NOT_FOUND ? undefined : balancedArguments(source, open);
|
|
132
|
+
const from = parameters === undefined ? at : open + parameters.length + 1;
|
|
133
|
+
const brace = source.indexOf('{', from);
|
|
134
|
+
return brace === NOT_FOUND ? undefined : balancedArguments(source, brace);
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* The body of a named export.
|
|
138
|
+
* @param source the module's text, with comments already stripped.
|
|
139
|
+
* @param name the exported binding to read.
|
|
140
|
+
* @returns the body, or undefined when the module exports no such binding with one.
|
|
141
|
+
*/
|
|
142
|
+
export const exportedBodyIn = (source, name) => {
|
|
143
|
+
const found = declarationOf(name).exec(source);
|
|
144
|
+
return found === null ? undefined : bodyAfter(source, found.index);
|
|
145
|
+
};
|
|
146
|
+
const RULE = 'no-boot-time-writes';
|
|
147
|
+
const REPAIR = 'move the write behind a command the project runs deliberately, such as a seed script invoked by ' +
|
|
148
|
+
'its own package script';
|
|
149
|
+
const directReason = (call) => `onInit: must not write through the Local API; ${call}() here runs on every boot of every ` +
|
|
150
|
+
'container, so a restart, a new replica and a redeploy each overwrite whatever an editor last ' +
|
|
151
|
+
`saved - ${REPAIR}`;
|
|
152
|
+
const reachedReason = (name, specifier, call) => `onInit: must not reach a Local API write; it calls ${name}() from "${specifier}", which runs ` +
|
|
153
|
+
`${call}() in its own body, so every boot of every container overwrites whatever an editor last ` +
|
|
154
|
+
`saved - ${REPAIR}`;
|
|
155
|
+
const sourceAt = (files, paths) => files
|
|
156
|
+
.filter((file) => paths.includes(file.path))
|
|
157
|
+
.map((file) => stripComments(file.source))
|
|
158
|
+
.at(0);
|
|
159
|
+
// One call out of the hook: the name has to be imported, the module has to be one of this member's own
|
|
160
|
+
// files, and the export it names has to perform the write itself.
|
|
161
|
+
const reachedWrites = (code, hook, file, files) => calledNamesIn(hook.body).flatMap((name) => {
|
|
162
|
+
const specifier = moduleOfImport(code, name);
|
|
163
|
+
if (specifier === undefined) {
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
const target = sourceAt(files, candidatePathsFor(specifier, file.path));
|
|
167
|
+
const body = target === undefined ? undefined : exportedBodyIn(target, name);
|
|
168
|
+
return body === undefined
|
|
169
|
+
? []
|
|
170
|
+
: mutationsIn(body).map((call) => ({
|
|
171
|
+
line: hook.line,
|
|
172
|
+
rule: RULE,
|
|
173
|
+
reason: reachedReason(name, specifier, call),
|
|
174
|
+
}));
|
|
175
|
+
});
|
|
176
|
+
/**
|
|
177
|
+
* Report every Local API write a boot hook performs, or reaches in one call.
|
|
178
|
+
*
|
|
179
|
+
* Reported against the configuration that schedules the write rather than the module that performs it:
|
|
180
|
+
* the module may be a legitimate seed, and what makes it a defect is being wired into `onInit`.
|
|
181
|
+
* @param files every source file of the member, as read.
|
|
182
|
+
* @returns one violation per write, located on the configuration that declares the hook.
|
|
183
|
+
*/
|
|
184
|
+
export const findBootstrapWrites = (files) => files.flatMap((file) => {
|
|
185
|
+
const code = stripComments(file.source);
|
|
186
|
+
return bootstrapHooksIn(code).flatMap((hook) => [
|
|
187
|
+
...mutationsIn(hook.body).map((call) => ({
|
|
188
|
+
line: hook.line,
|
|
189
|
+
rule: RULE,
|
|
190
|
+
reason: directReason(call),
|
|
191
|
+
})),
|
|
192
|
+
...reachedWrites(code, hook, file, files),
|
|
193
|
+
].map((violation) => ({ path: file.path, violation })));
|
|
194
|
+
});
|
|
195
|
+
//# sourceMappingURL=payload-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-bootstrap.js","sourceRoot":"","sources":["../src/payload-bootstrap.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAA;AAE1E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAE3F,mFAAmF;AACnF,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;IAClD,QAAQ;IACR,QAAQ;IACR,sBAAsB;IACtB,gBAAgB;IAChB,QAAQ;IACR,cAAc;CACf,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB,eAAe,CAAC,MAAM,CAC1E,CAAC,IAAY,EAAW,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAA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AAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC;SAC7C,CAAC,CACH,CAAA;AACP,CAAC,CAAC,CAAA;AAEJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAA4B,EAA+B,EAAE,CAC/F,KAAK,CAAC,OAAO,CAAC,CAAC,IAAgB,EAA+B,EAAE;IAC9D,MAAM,IAAI,GAAW,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAmB,EAA+B,EAAE,CACzF;QACE,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAC3B,CAAC,IAAY,EAAoB,EAAE,CAAC,CAAC;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;SAC3B,CAAC,CACH;QACD,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;KAC1C,CAAC,GAAG,CAAC,CAAC,SAA2B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAC3F,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type PayloadViolation } from './payload-source.js';
|
|
2
|
+
/** One `buildConfig({ ... })` literal: its brace-wrapped body, and the line the call begins on. */
|
|
3
|
+
export interface FoundRootConfig {
|
|
4
|
+
readonly body: string;
|
|
5
|
+
readonly line: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Every root configuration literal the source declares.
|
|
9
|
+
*
|
|
10
|
+
* The collection and global readers key on a type marker, which the root configuration does not carry:
|
|
11
|
+
* it is an argument to a call rather than an annotated declaration. So this reads the call instead.
|
|
12
|
+
* @param code the file's text, with comments already stripped.
|
|
13
|
+
* @returns one entry per `buildConfig` call whose argument is an object literal.
|
|
14
|
+
*/
|
|
15
|
+
export declare const rootConfigsIn: (code: string) => readonly FoundRootConfig[];
|
|
16
|
+
/**
|
|
17
|
+
* The database adapters whose schema Payload can apply by pushing it.
|
|
18
|
+
*
|
|
19
|
+
* Only the adapter whose behaviour is established belongs here. Naming one that does not carry the
|
|
20
|
+
* option would report a project for failing to disable something it never had, and an adapter left out
|
|
21
|
+
* is merely unreported - the safe direction of the two.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PUSHING_ADAPTERS: readonly string[];
|
|
24
|
+
/** The rule name a schema-push finding carries. */
|
|
25
|
+
export declare const SCHEMA_PUSH_RULE: string;
|
|
26
|
+
/**
|
|
27
|
+
* Report a root configuration whose database adapter does not disable schema push.
|
|
28
|
+
* @param code the file's text, with comments already stripped.
|
|
29
|
+
* @returns one violation per configuration that pushes, declared or by omission.
|
|
30
|
+
*/
|
|
31
|
+
export declare const findUnreviewedSchemaPush: (code: string) => readonly PayloadViolation[];
|
|
32
|
+
/**
|
|
33
|
+
* Whether a source declares a database adapter whose schema is applied by push.
|
|
34
|
+
* @param code the file's text, with comments already stripped.
|
|
35
|
+
* @returns true when at least one root configuration names such an adapter.
|
|
36
|
+
*/
|
|
37
|
+
export declare const declaresPushingAdapter: (code: string) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The migration directory a configuration names, when it names one.
|
|
40
|
+
* @param code the file's text, with comments already stripped.
|
|
41
|
+
* @returns the declared directory, or undefined when the adapter leaves it to Payload's default.
|
|
42
|
+
*/
|
|
43
|
+
export declare const declaredMigrationDirectoryIn: (code: string) => string | undefined;
|
|
44
|
+
/** The directories Payload looks in, in the order its own resolver tries them. */
|
|
45
|
+
export declare const MIGRATION_DIRECTORY_CANDIDATES: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* Whether a file name is one Payload reads as a migration.
|
|
48
|
+
*
|
|
49
|
+
* Taken from Payload's own reader rather than invented here: a `.ts` or `.js` file that is not the
|
|
50
|
+
* barrel. An empty directory, or one holding only a barrel, records no schema - and that is exactly the
|
|
51
|
+
* distinction a project would otherwise satisfy the rule with.
|
|
52
|
+
* @param name the file's base name.
|
|
53
|
+
* @returns true when Payload would read it as a migration.
|
|
54
|
+
*/
|
|
55
|
+
export declare const isMigrationFile: (name: string) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The directories to read for a member, the declared one first.
|
|
58
|
+
* @param declared the directory the configuration names, when it names one.
|
|
59
|
+
* @returns the candidate paths, relative to the member root.
|
|
60
|
+
*/
|
|
61
|
+
export declare const migrationDirectoriesFor: (declared: string | undefined) => readonly string[];
|
|
62
|
+
/** One candidate directory as the gate found it: its path, and the entries it holds. */
|
|
63
|
+
export interface MigrationDirectory {
|
|
64
|
+
readonly path: string;
|
|
65
|
+
readonly names: readonly string[];
|
|
66
|
+
}
|
|
67
|
+
/** What the gate read about where a member's schema would come from. */
|
|
68
|
+
export interface MigrationEvidence {
|
|
69
|
+
readonly declaresPushingAdapter: boolean;
|
|
70
|
+
readonly directories: readonly MigrationDirectory[];
|
|
71
|
+
}
|
|
72
|
+
/** The rule name a missing-migration finding carries. */
|
|
73
|
+
export declare const RECORDED_MIGRATIONS_RULE: string;
|
|
74
|
+
/**
|
|
75
|
+
* Report a member that records no migration for the schema it expects.
|
|
76
|
+
* @param evidence the adapter it declares, and the candidate directories as they were read.
|
|
77
|
+
* @returns one finding when the member pushes and records nothing, or none.
|
|
78
|
+
*/
|
|
79
|
+
export declare const findMissingMigrations: (evidence: MigrationEvidence) => readonly string[];
|
|
80
|
+
//# sourceMappingURL=payload-database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-database.d.ts","sourceRoot":"","sources":["../src/payload-database.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG1E,mGAAmG;AACnG,MAAM,WAAW,eAAe;IAC9B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