@ploaness/governance 1.1.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/a11y-hit-target.d.ts.map +1 -1
- package/dist/a11y-hit-target.js +1 -21
- package/dist/a11y-hit-target.js.map +1 -1
- package/dist/a11y-incomplete.d.ts.map +1 -1
- package/dist/a11y-incomplete.js +1 -18
- package/dist/a11y-incomplete.js.map +1 -1
- package/dist/access-boundary.d.ts +43 -1
- package/dist/access-boundary.d.ts.map +1 -1
- package/dist/access-boundary.js +146 -5
- package/dist/access-boundary.js.map +1 -1
- package/dist/admin-view-coverage.d.ts.map +1 -1
- package/dist/admin-view-coverage.js +1 -17
- package/dist/admin-view-coverage.js.map +1 -1
- package/dist/asset-policy.d.ts.map +1 -1
- package/dist/asset-policy.js +1 -23
- package/dist/asset-policy.js.map +1 -1
- package/dist/axe-coverage.d.ts +3 -4
- package/dist/axe-coverage.d.ts.map +1 -1
- package/dist/axe-coverage.js +18 -51
- package/dist/axe-coverage.js.map +1 -1
- package/dist/blocklist-entries.d.ts +36 -0
- package/dist/blocklist-entries.d.ts.map +1 -0
- package/dist/blocklist-entries.js +338 -0
- package/dist/blocklist-entries.js.map +1 -0
- package/dist/blocklist.d.ts +91 -0
- package/dist/blocklist.d.ts.map +1 -0
- package/dist/blocklist.js +187 -0
- package/dist/blocklist.js.map +1 -0
- 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/container-failure.d.ts.map +1 -1
- package/dist/container-failure.js +1 -18
- package/dist/container-failure.js.map +1 -1
- package/dist/container-files.d.ts +16 -0
- package/dist/container-files.d.ts.map +1 -1
- package/dist/container-files.js +23 -8
- package/dist/container-files.js.map +1 -1
- package/dist/container-images.d.ts +43 -0
- package/dist/container-images.d.ts.map +1 -0
- package/dist/container-images.js +157 -0
- package/dist/container-images.js.map +1 -0
- package/dist/dependency-freshness.d.ts +8 -0
- package/dist/dependency-freshness.d.ts.map +1 -1
- package/dist/dependency-freshness.js +2 -18
- package/dist/dependency-freshness.js.map +1 -1
- package/dist/doc-blocks.d.ts.map +1 -1
- package/dist/doc-blocks.js +1 -13
- package/dist/doc-blocks.js.map +1 -1
- package/dist/editorconfig-policy.d.ts +7 -0
- package/dist/editorconfig-policy.d.ts.map +1 -1
- package/dist/editorconfig-policy.js +19 -12
- package/dist/editorconfig-policy.js.map +1 -1
- package/dist/environment-coherence.d.ts +59 -5
- package/dist/environment-coherence.d.ts.map +1 -1
- package/dist/environment-coherence.js +107 -27
- package/dist/environment-coherence.js.map +1 -1
- package/dist/environment-files.d.ts.map +1 -1
- package/dist/environment-files.js +1 -19
- package/dist/environment-files.js.map +1 -1
- package/dist/file-roles.d.ts +7 -2
- package/dist/file-roles.d.ts.map +1 -1
- package/dist/file-roles.js +10 -9
- package/dist/file-roles.js.map +1 -1
- package/dist/freshness-repair.d.ts +82 -0
- package/dist/freshness-repair.d.ts.map +1 -0
- package/dist/freshness-repair.js +91 -0
- package/dist/freshness-repair.js.map +1 -0
- package/dist/generated-denial.d.ts.map +1 -1
- package/dist/generated-denial.js +1 -9
- package/dist/generated-denial.js.map +1 -1
- package/dist/generated-drift.d.ts.map +1 -1
- package/dist/generated-drift.js +1 -12
- package/dist/generated-drift.js.map +1 -1
- package/dist/harness-package.d.ts +13 -0
- package/dist/harness-package.d.ts.map +1 -0
- package/dist/harness-package.js +20 -0
- package/dist/harness-package.js.map +1 -0
- package/dist/history-policy.d.ts.map +1 -1
- package/dist/history-policy.js +1 -7
- package/dist/history-policy.js.map +1 -1
- package/dist/image-assets.d.ts.map +1 -1
- package/dist/image-assets.js +1 -10
- package/dist/image-assets.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/install-policy.d.ts +21 -0
- package/dist/install-policy.d.ts.map +1 -1
- package/dist/install-policy.js +53 -1
- package/dist/install-policy.js.map +1 -1
- package/dist/jsx-accessibility-scope.d.ts +17 -0
- package/dist/jsx-accessibility-scope.d.ts.map +1 -0
- package/dist/jsx-accessibility-scope.js +36 -0
- package/dist/jsx-accessibility-scope.js.map +1 -0
- package/dist/jsx-accessibility.d.ts +13 -0
- package/dist/jsx-accessibility.d.ts.map +1 -0
- package/dist/jsx-accessibility.js +188 -0
- package/dist/jsx-accessibility.js.map +1 -0
- package/dist/network-policy.d.ts.map +1 -1
- package/dist/network-policy.js +1 -12
- package/dist/network-policy.js.map +1 -1
- package/dist/oxlint-policy.d.ts +16 -0
- package/dist/oxlint-policy.d.ts.map +1 -0
- package/dist/oxlint-policy.js +28 -0
- package/dist/oxlint-policy.js.map +1 -0
- package/dist/oxlint-report.d.ts +29 -0
- package/dist/oxlint-report.d.ts.map +1 -0
- package/dist/oxlint-report.js +84 -0
- package/dist/oxlint-report.js.map +1 -0
- package/dist/oxlint-scope.d.ts +13 -0
- package/dist/oxlint-scope.d.ts.map +1 -0
- package/dist/oxlint-scope.js +46 -0
- package/dist/oxlint-scope.js.map +1 -0
- package/dist/oxlint-suppressions.d.ts +17 -0
- package/dist/oxlint-suppressions.d.ts.map +1 -0
- package/dist/oxlint-suppressions.js +72 -0
- package/dist/oxlint-suppressions.js.map +1 -0
- package/dist/paired-assets.d.ts.map +1 -1
- package/dist/paired-assets.js.map +1 -1
- package/dist/payload-access.d.ts +6 -0
- package/dist/payload-access.d.ts.map +1 -1
- package/dist/payload-access.js +166 -9
- package/dist/payload-access.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-configs.d.ts +0 -1
- package/dist/payload-configs.d.ts.map +1 -1
- package/dist/payload-configs.js +36 -17
- package/dist/payload-configs.js.map +1 -1
- 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-defaults.d.ts +128 -0
- package/dist/payload-defaults.d.ts.map +1 -0
- package/dist/payload-defaults.js +295 -0
- package/dist/payload-defaults.js.map +1 -0
- package/dist/payload-policy.d.ts +21 -0
- package/dist/payload-policy.d.ts.map +1 -1
- package/dist/payload-policy.js +92 -43
- package/dist/payload-policy.js.map +1 -1
- package/dist/relationship-cleanup.d.ts.map +1 -1
- package/dist/relationship-cleanup.js +16 -16
- package/dist/relationship-cleanup.js.map +1 -1
- package/dist/release-age.d.ts.map +1 -1
- package/dist/release-age.js +1 -16
- package/dist/release-age.js.map +1 -1
- package/dist/request-limits.d.ts.map +1 -1
- package/dist/request-limits.js +1 -11
- package/dist/request-limits.js.map +1 -1
- package/dist/route-map.d.ts.map +1 -1
- package/dist/route-map.js +1 -16
- package/dist/route-map.js.map +1 -1
- package/dist/run-plan.d.ts.map +1 -1
- package/dist/run-plan.js +1 -19
- package/dist/run-plan.js.map +1 -1
- package/dist/secret-policy.d.ts.map +1 -1
- package/dist/secret-policy.js +1 -11
- package/dist/secret-policy.js.map +1 -1
- package/dist/settings-layering.d.ts +8 -30
- package/dist/settings-layering.d.ts.map +1 -1
- package/dist/settings-layering.js +19 -48
- package/dist/settings-layering.js.map +1 -1
- package/dist/settings.d.ts +9 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.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/source-text.d.ts +2 -0
- package/dist/source-text.d.ts.map +1 -1
- package/dist/source-text.js +7 -16
- package/dist/source-text.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 +11 -21
- package/dist/toolchain-pins.js.map +1 -1
- package/dist/version-policy.d.ts +7 -8
- package/dist/version-policy.d.ts.map +1 -1
- package/dist/version-policy.js +15 -26
- package/dist/version-policy.js.map +1 -1
- package/dist/vulnerability-policy.d.ts.map +1 -1
- package/dist/vulnerability-policy.js +1 -11
- package/dist/vulnerability-policy.js.map +1 -1
- package/dist/wiring-policy.d.ts.map +1 -1
- package/dist/wiring-policy.js +4 -1
- package/dist/wiring-policy.js.map +1 -1
- package/dist/wiring-violation.d.ts.map +1 -1
- package/dist/wiring-violation.js +1 -6
- package/dist/wiring-violation.js.map +1 -1
- package/dist/workspace-policy.d.ts.map +1 -1
- package/dist/workspace-policy.js +3 -9
- package/dist/workspace-policy.js.map +1 -1
- package/dist/yaml-blocks.d.ts +10 -0
- package/dist/yaml-blocks.d.ts.map +1 -1
- package/dist/yaml-blocks.js +20 -0
- package/dist/yaml-blocks.js.map +1 -1
- package/package.json +2 -2
|
@@ -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,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACjE,CAAA;AAQD,MAAM,KAAK,GAAW,IAAI,CAAA;AAE1B,oGAAoG;AACpG,sGAAsG;AACtG,MAAM,UAAU,GAAG,CAAC,KAAa,EAAsB,EAAE;IACvD,MAAM,KAAK,GAAW,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC1C,MAAM,IAAI,GAAW,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;IAC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,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"}
|
|
@@ -7,7 +7,6 @@ export interface PayloadConfigKind {
|
|
|
7
7
|
/** One Payload configuration literal, with the source position its body begins at. */
|
|
8
8
|
export interface FoundPayloadConfig {
|
|
9
9
|
readonly kind: PayloadConfigKind;
|
|
10
|
-
readonly marker: number;
|
|
11
10
|
readonly body: string;
|
|
12
11
|
readonly bodyStart: number;
|
|
13
12
|
readonly line: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload-configs.d.ts","sourceRoot":"","sources":["../src/payload-configs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payload-configs.d.ts","sourceRoot":"","sources":["../src/payload-configs.ts"],"names":[],"mappings":"AAaA,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAA;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,qFAAqF;AACrF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA0ED,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,SAAS,kBAAkB,EAI1E,CAAA;AAwCH,2EAA2E;AAC3E,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,QAAQ,kBAAkB,KACzB,SAAS,iBAAiB,EAkB5B,CAAA"}
|
package/dist/payload-configs.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
// Access policy and field policy ask different questions of the same object: whether a collection or
|
|
4
|
-
// global has declared its operation boundary, and whether a privilege-bearing field has declared its
|
|
5
|
-
// own. The declaration forms must therefore have one owner. A second regex beside the access rule was
|
|
6
|
-
// how generic annotations and `satisfies` configurations previously escaped every Payload check.
|
|
1
|
+
// Share the vocabulary of Payload configuration literals across source-policy checks.
|
|
2
|
+
import { COLLECTION_OPERATIONS, GLOBAL_OPERATIONS } from './payload-defaults.js';
|
|
7
3
|
import { configBody, depthOneValue } from './payload-source.js';
|
|
8
4
|
import { balancedArguments, lineOf, NOT_FOUND, scanDelimited, } from './source-text.js';
|
|
9
5
|
const declarationPattern = (typeName) => new RegExp(String.raw `(:|satisfies)\s*${typeName}(?=[<=,)\s]|$)`, 'g');
|
|
@@ -12,27 +8,50 @@ const CONFIG_KINDS = [
|
|
|
12
8
|
kind: 'collection',
|
|
13
9
|
label: 'CollectionConfig',
|
|
14
10
|
declaration: declarationPattern('CollectionConfig'),
|
|
15
|
-
operations:
|
|
11
|
+
operations: COLLECTION_OPERATIONS,
|
|
16
12
|
},
|
|
17
13
|
{
|
|
18
14
|
kind: 'global',
|
|
19
15
|
label: 'GlobalConfig',
|
|
20
16
|
declaration: declarationPattern('GlobalConfig'),
|
|
21
|
-
operations:
|
|
17
|
+
operations: GLOBAL_OPERATIONS,
|
|
22
18
|
},
|
|
23
19
|
];
|
|
24
20
|
const SATISFIES = 'satisfies';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
// What may stand between a leading type reference and the literal it types. Every form a config is
|
|
22
|
+
// really written in puts one of four things there: `= {`, a generic argument and then `= {`, `=> ({`,
|
|
23
|
+
// or the opening brace of a function body. Taking "the next brace anywhere after the type name"
|
|
24
|
+
// instead crossed statement boundaries and read an unrelated literal further down the file as the
|
|
25
|
+
// configuration. A call argument (`= jobsAccess({ ... })`), a parameter annotation
|
|
26
|
+
// (`(config: CollectionConfig): void => { ... }`), an interface member and a type-alias member each
|
|
27
|
+
// put an identifier, a `)` or a `}` in this gap, and each was judged as though it were a collection -
|
|
28
|
+
// so the very code a project writes to GIVE a generated collection its access block was reported as a
|
|
29
|
+
// collection with none.
|
|
30
|
+
const GOVERNED_BODY = /^\s*(?:<[^;{}]*>\s*)?(?:=>?\s*(?:\(\s*)?)?\{/;
|
|
31
|
+
/** The literal a leading annotation governs, or nothing when the annotation types something else. */
|
|
32
|
+
const governedLiteral = (source, afterType) => {
|
|
33
|
+
const gap = GOVERNED_BODY.exec(source.slice(afterType));
|
|
34
|
+
if (gap === null) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const bodyStart = afterType + gap[0].length - 1;
|
|
38
|
+
const inner = balancedArguments(source, bodyStart);
|
|
39
|
+
return inner === undefined ? undefined : { body: `{${inner}}`, bodyStart };
|
|
40
|
+
};
|
|
41
|
+
/** The literal a trailing `satisfies` types: the one that closed just before it. */
|
|
42
|
+
const precedingLiteral = (source, marker) => {
|
|
43
|
+
const body = configBody(source, marker, true);
|
|
29
44
|
if (body === undefined) {
|
|
30
|
-
return
|
|
45
|
+
return undefined;
|
|
31
46
|
}
|
|
32
|
-
const bodyStart =
|
|
33
|
-
return bodyStart === NOT_FOUND
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
const bodyStart = source.lastIndexOf(body, marker);
|
|
48
|
+
return bodyStart === NOT_FOUND ? undefined : { body, bodyStart };
|
|
49
|
+
};
|
|
50
|
+
const configsOfKind = (source, kind) => [...source.matchAll(kind.declaration)].flatMap((match) => {
|
|
51
|
+
const literal = match[1] === SATISFIES
|
|
52
|
+
? precedingLiteral(source, match.index)
|
|
53
|
+
: governedLiteral(source, match.index + match[0].length);
|
|
54
|
+
return literal === undefined ? [] : [{ kind, ...literal, line: lineOf(source, match.index) }];
|
|
36
55
|
});
|
|
37
56
|
/** Every collection and global configuration literal the source declares. */
|
|
38
57
|
export const payloadConfigsIn = (source) => CONFIG_KINDS.flatMap((kind) => configsOfKind(source, kind));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload-configs.js","sourceRoot":"","sources":["../src/payload-configs.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"payload-configs.js","sourceRoot":"","sources":["../src/payload-configs.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,iBAAiB,EAEjB,MAAM,EACN,SAAS,EAET,aAAa,GACd,MAAM,kBAAkB,CAAA;AAuBzB,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAU,EAAE,CACtD,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,mBAAmB,QAAQ,gBAAgB,EAAE,GAAG,CAAC,CAAA;AAExE,MAAM,YAAY,GAAsE;IACtF;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,kBAAkB,CAAC,kBAAkB,CAAC;QACnD,UAAU,E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EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AAE5E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,MAA0B,EACI,EAAE;IAChC,MAAM,MAAM,GAAuB,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACvE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,IAAI,GAAW,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,WAAW,GAAW,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IACjF,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,CAC5C,CAAC,IAAe,EAAgC,EAAE;QAChD,MAAM,IAAI,GAAuB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACrE,OAAO,IAAI,KAAK,SAAS;YACvB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC5E,CAAC,CACF,CAAA;AACH,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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AAS,kBAAkB,EAAE,CAAA;CACpD;AAED,yDAAyD;AACzD,eAAO,MAAM,wBAAwB,EAAE,MAAsC,CAAA;AAQ7E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,iBAAiB,KAAG,SAAS,MAAM,EASlF,CAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Whether a project's schema changes are recorded where a reader can review them.
|
|
2
|
+
//
|
|
3
|
+
// Payload's Postgres adapter can apply a schema by pushing it: at boot, it diffs the configuration
|
|
4
|
+
// against the live database and issues whatever closes the gap. Nothing is written down, so there is no
|
|
5
|
+
// artefact to review before it runs and none to roll back after. The guard Payload applies is
|
|
6
|
+
// `this.push !== false`, which is why an UNDECLARED push is the dangerous spelling rather than a neutral
|
|
7
|
+
// one, and why this rule reports it.
|
|
8
|
+
//
|
|
9
|
+
// Push is also skipped where `NODE_ENV` is production, and a production boot then falls to
|
|
10
|
+
// `prodMigrations`. A project that pushes instead of migrating therefore has no mechanism that creates
|
|
11
|
+
// its schema in production at all, which is the second rule here.
|
|
12
|
+
//
|
|
13
|
+
// The value is read from SOURCE rather than from the built configuration. `postgresAdapter()` returns a
|
|
14
|
+
// factory whose `init` closure carries `push`, and Payload calls that closure at `payload.init()`, not
|
|
15
|
+
// during `buildConfig`. A probe that imports the built configuration reads `undefined` for every project
|
|
16
|
+
// and would pass every defect.
|
|
17
|
+
import { depthOneValue } from './payload-source.js';
|
|
18
|
+
import { balancedArguments, lineOf, occurrences, topLevelSlice } from './source-text.js';
|
|
19
|
+
const BUILD_CONFIG_CALL = 'buildConfig(';
|
|
20
|
+
/**
|
|
21
|
+
* Every root configuration literal the source declares.
|
|
22
|
+
*
|
|
23
|
+
* The collection and global readers key on a type marker, which the root configuration does not carry:
|
|
24
|
+
* it is an argument to a call rather than an annotated declaration. So this reads the call instead.
|
|
25
|
+
* @param code the file's text, with comments already stripped.
|
|
26
|
+
* @returns one entry per `buildConfig` call whose argument is an object literal.
|
|
27
|
+
*/
|
|
28
|
+
export const rootConfigsIn = (code) => occurrences(code, BUILD_CONFIG_CALL).flatMap((found) => {
|
|
29
|
+
const argumentText = balancedArguments(code, found + BUILD_CONFIG_CALL.length - 1);
|
|
30
|
+
return argumentText?.trimStart().startsWith('{') === true
|
|
31
|
+
? [{ body: argumentText, line: lineOf(code, found) }]
|
|
32
|
+
: [];
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* The database adapters whose schema Payload can apply by pushing it.
|
|
36
|
+
*
|
|
37
|
+
* Only the adapter whose behaviour is established belongs here. Naming one that does not carry the
|
|
38
|
+
* option would report a project for failing to disable something it never had, and an adapter left out
|
|
39
|
+
* is merely unreported - the safe direction of the two.
|
|
40
|
+
*/
|
|
41
|
+
export const PUSHING_ADAPTERS = ['postgresAdapter'];
|
|
42
|
+
const ADAPTER_CALL = /^\s*([a-z_$][\w$]*)\s*\(/i;
|
|
43
|
+
const adapterCallIn = (databaseValue) => {
|
|
44
|
+
const matched = ADAPTER_CALL.exec(databaseValue);
|
|
45
|
+
if (matched === null) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const options = balancedArguments(databaseValue, matched[0].length - 1);
|
|
49
|
+
return options === undefined ? undefined : { name: matched[1] ?? '', options };
|
|
50
|
+
};
|
|
51
|
+
// `push` is read from the depth-one text of the adapter's own options, so a key nested inside `pool`
|
|
52
|
+
// cannot be mistaken for the adapter's own - the protection `topLevelSlice` exists to give.
|
|
53
|
+
//
|
|
54
|
+
// `migrationDir` cannot be read the same way, and that is a property of the scan rather than an
|
|
55
|
+
// oversight: the walk jumps a string literal whole, so the fold never sees the quoted value and the
|
|
56
|
+
// slice a quoted value would land in comes back empty. It is therefore read from the raw options, where
|
|
57
|
+
// the key boundary alone separates it from a value nested beneath. `push` is unaffected because `false`
|
|
58
|
+
// is not a string literal and survives the slice intact.
|
|
59
|
+
const PUSH_PROPERTY = /(?:^|,)\s*push\s*:\s*([^,]*)/;
|
|
60
|
+
const MIGRATION_DIR_PROPERTY = /(?:^|[{,])\s*migrationDir\s*:\s*['"]([^'"]*)['"]/;
|
|
61
|
+
const declaredPushIn = (options) => PUSH_PROPERTY.exec(topLevelSlice(options))?.[1]?.trim();
|
|
62
|
+
/** The rule name a schema-push finding carries. */
|
|
63
|
+
export const SCHEMA_PUSH_RULE = 'no-unreviewed-schema-push';
|
|
64
|
+
const REPAIR = 'set push: false and record the schema with `payload migrate:create`';
|
|
65
|
+
const pushReason = (adapter, declared) => declared === undefined
|
|
66
|
+
? `${adapter} declares no push; Payload treats an undeclared push as on, so it rewrites the ` +
|
|
67
|
+
'schema at every boot outside production and no committed artefact records what the schema ' +
|
|
68
|
+
`became - ${REPAIR}`
|
|
69
|
+
: `${adapter} sets push: ${declared}; Payload rewrites the schema at every boot outside ` +
|
|
70
|
+
`production and no committed artefact records what the schema became - ${REPAIR}`;
|
|
71
|
+
// The adapter a configuration's `db` names, when it is one that can push. Shared by every rule here, so
|
|
72
|
+
// the question "does this project push?" is answered in one place.
|
|
73
|
+
const pushingAdapterIn = (body) => {
|
|
74
|
+
const databaseValue = depthOneValue(body, 'db');
|
|
75
|
+
if (databaseValue === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const adapter = adapterCallIn(databaseValue);
|
|
79
|
+
return adapter !== undefined && PUSHING_ADAPTERS.includes(adapter.name) ? adapter : undefined;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Report a root configuration whose database adapter does not disable schema push.
|
|
83
|
+
* @param code the file's text, with comments already stripped.
|
|
84
|
+
* @returns one violation per configuration that pushes, declared or by omission.
|
|
85
|
+
*/
|
|
86
|
+
export const findUnreviewedSchemaPush = (code) => rootConfigsIn(code).flatMap((config) => {
|
|
87
|
+
const adapter = pushingAdapterIn(config.body);
|
|
88
|
+
if (adapter === undefined) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const declared = declaredPushIn(adapter.options);
|
|
92
|
+
return declared === 'false'
|
|
93
|
+
? []
|
|
94
|
+
: [
|
|
95
|
+
{
|
|
96
|
+
line: config.line,
|
|
97
|
+
rule: SCHEMA_PUSH_RULE,
|
|
98
|
+
reason: pushReason(adapter.name, declared),
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Whether a source declares a database adapter whose schema is applied by push.
|
|
104
|
+
* @param code the file's text, with comments already stripped.
|
|
105
|
+
* @returns true when at least one root configuration names such an adapter.
|
|
106
|
+
*/
|
|
107
|
+
export const declaresPushingAdapter = (code) => rootConfigsIn(code).some((config) => pushingAdapterIn(config.body) !== undefined);
|
|
108
|
+
/**
|
|
109
|
+
* The migration directory a configuration names, when it names one.
|
|
110
|
+
* @param code the file's text, with comments already stripped.
|
|
111
|
+
* @returns the declared directory, or undefined when the adapter leaves it to Payload's default.
|
|
112
|
+
*/
|
|
113
|
+
export const declaredMigrationDirectoryIn = (code) => rootConfigsIn(code)
|
|
114
|
+
.map((config) => {
|
|
115
|
+
const adapter = pushingAdapterIn(config.body);
|
|
116
|
+
return adapter === undefined ? undefined : MIGRATION_DIR_PROPERTY.exec(adapter.options)?.[1];
|
|
117
|
+
})
|
|
118
|
+
.find((declared) => declared !== undefined);
|
|
119
|
+
/** The directories Payload looks in, in the order its own resolver tries them. */
|
|
120
|
+
export const MIGRATION_DIRECTORY_CANDIDATES = [
|
|
121
|
+
'src/migrations',
|
|
122
|
+
'dist/migrations',
|
|
123
|
+
'migrations',
|
|
124
|
+
];
|
|
125
|
+
const MIGRATION_EXTENSIONS = ['.ts', '.js'];
|
|
126
|
+
const BARRELS = new Set(['index.ts', 'index.js']);
|
|
127
|
+
/**
|
|
128
|
+
* Whether a file name is one Payload reads as a migration.
|
|
129
|
+
*
|
|
130
|
+
* Taken from Payload's own reader rather than invented here: a `.ts` or `.js` file that is not the
|
|
131
|
+
* barrel. An empty directory, or one holding only a barrel, records no schema - and that is exactly the
|
|
132
|
+
* distinction a project would otherwise satisfy the rule with.
|
|
133
|
+
* @param name the file's base name.
|
|
134
|
+
* @returns true when Payload would read it as a migration.
|
|
135
|
+
*/
|
|
136
|
+
export const isMigrationFile = (name) => MIGRATION_EXTENSIONS.some((extension) => name.endsWith(extension)) &&
|
|
137
|
+
!BARRELS.has(name);
|
|
138
|
+
/**
|
|
139
|
+
* The directories to read for a member, the declared one first.
|
|
140
|
+
* @param declared the directory the configuration names, when it names one.
|
|
141
|
+
* @returns the candidate paths, relative to the member root.
|
|
142
|
+
*/
|
|
143
|
+
export const migrationDirectoriesFor = (declared) => declared === undefined
|
|
144
|
+
? MIGRATION_DIRECTORY_CANDIDATES
|
|
145
|
+
: [declared, ...MIGRATION_DIRECTORY_CANDIDATES];
|
|
146
|
+
/** The rule name a missing-migration finding carries. */
|
|
147
|
+
export const RECORDED_MIGRATIONS_RULE = 'require-recorded-migrations';
|
|
148
|
+
const MISSING_MIGRATIONS = `[${RECORDED_MIGRATIONS_RULE}] no migration is recorded; this member declares a database adapter ` +
|
|
149
|
+
'whose schema is applied by push, and push is skipped where NODE_ENV is production - so a ' +
|
|
150
|
+
'production boot creates nothing and no file in the repository states what the schema should be. ' +
|
|
151
|
+
'Run `payload migrate:create` and commit the file it writes';
|
|
152
|
+
/**
|
|
153
|
+
* Report a member that records no migration for the schema it expects.
|
|
154
|
+
* @param evidence the adapter it declares, and the candidate directories as they were read.
|
|
155
|
+
* @returns one finding when the member pushes and records nothing, or none.
|
|
156
|
+
*/
|
|
157
|
+
export const findMissingMigrations = (evidence) => {
|
|
158
|
+
if (!evidence.declaresPushingAdapter) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
const carriesMigration = evidence.directories.some((directory) => directory.names.some((name) => isMigrationFile(name)));
|
|
162
|
+
return carriesMigration ? [] : [MISSING_MIGRATIONS];
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=payload-database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-database.js","sourceRoot":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AAC,MAAM,qBAAqB,GAAG,CAAC,QAA2B,EAAqB,EAAE;IACtF,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACrC,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,gBAAgB,GAAY,QAAQ,CAAC,WAAW,CAAC,IAAI,CACzD,CAAC,SAA6B,EAAW,EAAE,CACzC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CACzE,CAAA;IACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;AACrD,CAAC,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** The operations a collection must decide; the static rule holds a written config to the same list. */
|
|
2
|
+
export declare const COLLECTION_OPERATIONS: readonly string[];
|
|
3
|
+
/** The operations a global must decide. */
|
|
4
|
+
export declare const GLOBAL_OPERATIONS: readonly string[];
|
|
5
|
+
/** The operation an auth collection decides on top of the four: who may clear a locked account. */
|
|
6
|
+
export declare const UNLOCK_OPERATION: string;
|
|
7
|
+
/** The operation a versioned collection or global decides: who may read a stored version. */
|
|
8
|
+
export declare const READ_VERSIONS_OPERATION: string;
|
|
9
|
+
/** What an entity of the built configuration is, as far as the operations it owes depend on it. */
|
|
10
|
+
export interface PayloadSubjectTraits {
|
|
11
|
+
readonly kind: PayloadSubjectKind;
|
|
12
|
+
readonly hasAuth: boolean;
|
|
13
|
+
readonly hasVersions: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The access operations one entity owes a decision on. Two of them are conditional, and neither may be
|
|
17
|
+
* added to the lists above: Payload writes `unlock` onto EVERY collection during sanitisation, auth or
|
|
18
|
+
* not, so demanding it unconditionally would report the whole configuration, and `readVersions` means
|
|
19
|
+
* nothing on an entity that keeps no versions.
|
|
20
|
+
* @param traits what the entity is: its kind, and whether it authenticates or keeps versions.
|
|
21
|
+
* @returns the operations that entity must decide, in the order they are reported.
|
|
22
|
+
*/
|
|
23
|
+
export declare const accessOperationsFor: (traits: PayloadSubjectTraits) => readonly string[];
|
|
24
|
+
/**
|
|
25
|
+
* The prefix the probe prints its report behind. A plugin may log on import, and a line the parser can
|
|
26
|
+
* name is what separates the report from that chatter.
|
|
27
|
+
*/
|
|
28
|
+
export declare const INHERITED_ACCESS_REPORT_MARKER: string;
|
|
29
|
+
/** One entity of the built configuration and the operations it left to Payload's default. */
|
|
30
|
+
export interface InheritedAccessEntry {
|
|
31
|
+
readonly slug: string;
|
|
32
|
+
readonly inherited: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* What a read rule answered an anonymous caller, as the probe observed it. `filtered` carries the
|
|
36
|
+
* query constraint the rule returned, which is the half `/api/access` reports and the anonymous sweep
|
|
37
|
+
* never opens; `undecidable` is a rule that threw when asked, which is reported rather than assumed
|
|
38
|
+
* safe.
|
|
39
|
+
*/
|
|
40
|
+
export type AnonymousRead = {
|
|
41
|
+
readonly kind: 'denied';
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'filtered';
|
|
44
|
+
readonly where: unknown;
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: 'open';
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: 'undecidable';
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
};
|
|
51
|
+
/** One entity that keeps drafts, and what its read rule answers a caller with no credentials. */
|
|
52
|
+
export interface DraftReadEntry {
|
|
53
|
+
readonly kind: PayloadSubjectKind;
|
|
54
|
+
readonly slug: string;
|
|
55
|
+
readonly anonymousRead: AnonymousRead;
|
|
56
|
+
}
|
|
57
|
+
/** What the probe reports: every collection and every global, decided ones included. */
|
|
58
|
+
export interface InheritedAccessReport {
|
|
59
|
+
readonly collections: readonly InheritedAccessEntry[];
|
|
60
|
+
readonly draftReads: readonly DraftReadEntry[];
|
|
61
|
+
readonly globals: readonly InheritedAccessEntry[];
|
|
62
|
+
}
|
|
63
|
+
/** The two kinds of entity a Payload configuration holds. */
|
|
64
|
+
export type PayloadSubjectKind = 'collection' | 'global';
|
|
65
|
+
/** One entity Payload builds for its own bookkeeping, which keeps the default access by design. */
|
|
66
|
+
export interface ExemptPayloadSubject {
|
|
67
|
+
readonly kind: PayloadSubjectKind;
|
|
68
|
+
readonly slug: string;
|
|
69
|
+
readonly reason: string;
|
|
70
|
+
}
|
|
71
|
+
/** The entities exempt from the rule, each with the reason. Nothing a project declares extends this. */
|
|
72
|
+
export declare const EXEMPT_PAYLOAD_SUBJECTS: readonly ExemptPayloadSubject[];
|
|
73
|
+
/**
|
|
74
|
+
* The saved-filter collection Payload builds behind `enableQueryPresets`.
|
|
75
|
+
*
|
|
76
|
+
* It is named here because the probe has to read its access from somewhere other than the collection.
|
|
77
|
+
* `getAccess` wraps EVERY operation of this one collection in a closure that calls the project's rule
|
|
78
|
+
* where there is one and Payload's own default where there is not, so the built collection carries four
|
|
79
|
+
* functions that match neither the default by reference nor its source text. Read there, a project that
|
|
80
|
+
* decided nothing is indistinguishable from one that decided everything - and undecided means an
|
|
81
|
+
* unconstrained `create` for any signed-in user, and a preset shared as `everyone` readable by every
|
|
82
|
+
* role that can log in, the ones a project keeps outside its editorial staff included.
|
|
83
|
+
*/
|
|
84
|
+
export declare const QUERY_PRESETS_SLUG: string;
|
|
85
|
+
/**
|
|
86
|
+
* Every entity of the built configuration that still carries Payload's default access on a judged
|
|
87
|
+
* operation, in configuration order, each naming where the project decides it.
|
|
88
|
+
* @param report what the probe read from the built configuration.
|
|
89
|
+
* @returns one finding per entity, or nothing when every entity decides its access.
|
|
90
|
+
*/
|
|
91
|
+
export declare const findInheritedAccess: (report: InheritedAccessReport) => readonly string[];
|
|
92
|
+
/**
|
|
93
|
+
* Whether a read filter admits published documents alone.
|
|
94
|
+
*
|
|
95
|
+
* A clause under `and` is enough on its own, because every conjunct holds. A clause under `or` counts
|
|
96
|
+
* only when EVERY branch carries one, because a single branch without it is a way in - which is the
|
|
97
|
+
* shape of the defect this rule exists for.
|
|
98
|
+
* @param where the query constraint the read rule returned.
|
|
99
|
+
* @returns whether every document the filter admits is a published one.
|
|
100
|
+
*/
|
|
101
|
+
export declare const requiresPublishedStatus: (where: unknown) => boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Every entity that keeps drafts and lets a stranger read something that was never approved, in
|
|
104
|
+
* configuration order.
|
|
105
|
+
* @param report what the probe read from the built configuration.
|
|
106
|
+
* @returns one finding per entity, or nothing when no drafts read admits an unapproved document.
|
|
107
|
+
*/
|
|
108
|
+
export declare const findUnconstrainedDraftReads: (report: InheritedAccessReport) => readonly string[];
|
|
109
|
+
/**
|
|
110
|
+
* Read the probe's report out of everything the probe wrote to standard output.
|
|
111
|
+
*
|
|
112
|
+
* The LAST marker line is the report, so a plugin that logs during import cannot hide it, and a report
|
|
113
|
+
* that fails to parse or has the wrong shape is undefined rather than empty: a probe that printed a
|
|
114
|
+
* stack trace must fail the gate, never pass it as "no findings".
|
|
115
|
+
* @param text the probe's standard output.
|
|
116
|
+
* @returns the report, or undefined when no well-formed report was printed.
|
|
117
|
+
*/
|
|
118
|
+
export declare const parseInheritedAccessReport: (text: string) => InheritedAccessReport | undefined;
|
|
119
|
+
/** Where a Payload member keeps its configuration when its tsconfig says nothing else. */
|
|
120
|
+
export declare const DEFAULT_PAYLOAD_CONFIG_PATH: string;
|
|
121
|
+
/**
|
|
122
|
+
* The path of the Payload configuration a member's tsconfig aliases as `@payload-config`, which is the
|
|
123
|
+
* alias `ploaness init` writes and Payload's own CLI resolves through.
|
|
124
|
+
* @param tsconfig the parsed tsconfig, or anything when it could not be read.
|
|
125
|
+
* @returns the configured path relative to the member root, or the default path.
|
|
126
|
+
*/
|
|
127
|
+
export declare const payloadConfigPathOf: (tsconfig: unknown) => string;
|
|
128
|
+
//# sourceMappingURL=payload-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-defaults.d.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