@aws/cloudformation-validate 1.0.0-beta
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/LICENSE +175 -0
- package/README.md +217 -0
- package/THIRD-PARTY-LICENSES.txt +19192 -0
- package/bindings_wasm.d.ts +476 -0
- package/bindings_wasm.js +871 -0
- package/bindings_wasm_bg.wasm +0 -0
- package/bindings_wasm_bg.wasm.d.ts +69 -0
- package/index.d.ts +112 -0
- package/index.js +106 -0
- package/package.json +25 -0
|
Binary file
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmcelengine_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmregoengine_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_wasmschemavalidator_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_wasmsemanticmodel_free: (a: number, b: number) => void;
|
|
8
|
+
export const init: () => void;
|
|
9
|
+
export const version: () => [number, number];
|
|
10
|
+
export const wasmcelengine_engineName: (a: number) => [number, number];
|
|
11
|
+
export const wasmcelengine_listRules: (a: number) => [number, number, number];
|
|
12
|
+
export const wasmcelengine_new: (a: any) => [number, number, number];
|
|
13
|
+
export const wasmcelengine_validateDetailed: (
|
|
14
|
+
a: number,
|
|
15
|
+
b: number,
|
|
16
|
+
c: number,
|
|
17
|
+
d: any,
|
|
18
|
+
e: number,
|
|
19
|
+
f: number,
|
|
20
|
+
) => [number, number, number];
|
|
21
|
+
export const wasmcelengine_validateStandard: (
|
|
22
|
+
a: number,
|
|
23
|
+
b: number,
|
|
24
|
+
c: number,
|
|
25
|
+
d: any,
|
|
26
|
+
e: number,
|
|
27
|
+
f: number,
|
|
28
|
+
) => [number, number, number];
|
|
29
|
+
export const wasmregoengine_engineName: (a: number) => [number, number];
|
|
30
|
+
export const wasmregoengine_listRules: (a: number) => [number, number, number];
|
|
31
|
+
export const wasmregoengine_new: (a: any) => [number, number, number];
|
|
32
|
+
export const wasmregoengine_validateDetailed: (
|
|
33
|
+
a: number,
|
|
34
|
+
b: number,
|
|
35
|
+
c: number,
|
|
36
|
+
d: any,
|
|
37
|
+
e: number,
|
|
38
|
+
f: number,
|
|
39
|
+
) => [number, number, number];
|
|
40
|
+
export const wasmregoengine_validateStandard: (
|
|
41
|
+
a: number,
|
|
42
|
+
b: number,
|
|
43
|
+
c: number,
|
|
44
|
+
d: any,
|
|
45
|
+
e: number,
|
|
46
|
+
f: number,
|
|
47
|
+
) => [number, number, number];
|
|
48
|
+
export const wasmschemavalidator_listRules: (a: number) => [number, number, number];
|
|
49
|
+
export const wasmschemavalidator_new: () => number;
|
|
50
|
+
export const wasmschemavalidator_schemaCount: (a: number) => number;
|
|
51
|
+
export const wasmschemavalidator_validate: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
52
|
+
export const wasmsemanticmodel_conditions: (a: number) => [number, number, number];
|
|
53
|
+
export const wasmsemanticmodel_description: (a: number) => [number, number];
|
|
54
|
+
export const wasmsemanticmodel_formatVersion: (a: number) => [number, number];
|
|
55
|
+
export const wasmsemanticmodel_outputs: (a: number) => [number, number, number];
|
|
56
|
+
export const wasmsemanticmodel_parameters: (a: number) => [number, number, number];
|
|
57
|
+
export const wasmsemanticmodel_parse: (a: number, b: number) => [number, number, number];
|
|
58
|
+
export const wasmsemanticmodel_resources: (a: number) => [number, number, number];
|
|
59
|
+
export const wasmsemanticmodel_sourceLocation: (a: number, b: number, c: number) => [number, number, number];
|
|
60
|
+
export const wasmsemanticmodel_toDiagnosticModel: (a: number) => [number, number, number];
|
|
61
|
+
export const wasmsemanticmodel_transforms: (a: number) => [number, number, number];
|
|
62
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
63
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
64
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
65
|
+
export const __externref_table_alloc: () => number;
|
|
66
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
67
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
68
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
69
|
+
export const __wbindgen_start: () => void;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DetailedReport,
|
|
3
|
+
DiagnosticModel,
|
|
4
|
+
EngineConfig,
|
|
5
|
+
ParameterInfo,
|
|
6
|
+
ResolvedOutput,
|
|
7
|
+
ResolvedResource,
|
|
8
|
+
RuleInfo,
|
|
9
|
+
SourceSpan,
|
|
10
|
+
StandardDiagnostic,
|
|
11
|
+
StandardReport,
|
|
12
|
+
ValidateConfig,
|
|
13
|
+
} from './bindings_wasm';
|
|
14
|
+
export type {
|
|
15
|
+
Severity,
|
|
16
|
+
DetailLevel,
|
|
17
|
+
RuleOrigin,
|
|
18
|
+
IdRange,
|
|
19
|
+
ResourceIdFilter,
|
|
20
|
+
ResourceTypeFilter,
|
|
21
|
+
RuleFilterConfig,
|
|
22
|
+
RuleInfo,
|
|
23
|
+
SourceSpan,
|
|
24
|
+
ResourceRef,
|
|
25
|
+
RelatedResource,
|
|
26
|
+
ViolationContext,
|
|
27
|
+
StandardDiagnostic,
|
|
28
|
+
DetailedDiagnostic,
|
|
29
|
+
PhaseMetric,
|
|
30
|
+
PerformanceMetrics,
|
|
31
|
+
Summary,
|
|
32
|
+
ReportMetadata,
|
|
33
|
+
StandardReport,
|
|
34
|
+
DetailedReport,
|
|
35
|
+
PseudoParameterOverrides,
|
|
36
|
+
EngineConfig,
|
|
37
|
+
ValidateConfig,
|
|
38
|
+
ExternalRuleSource,
|
|
39
|
+
ResolvedValue,
|
|
40
|
+
RefKind,
|
|
41
|
+
ParameterInfo,
|
|
42
|
+
ResolvedResource,
|
|
43
|
+
ResolvedOutput,
|
|
44
|
+
ForEachExpansion,
|
|
45
|
+
ResourceDiagnostics,
|
|
46
|
+
MapEntry,
|
|
47
|
+
PathValuePair,
|
|
48
|
+
ConditionalNull,
|
|
49
|
+
ConditionalNullEntry,
|
|
50
|
+
DiagnosticModel,
|
|
51
|
+
DiagnosticTemplate,
|
|
52
|
+
DiagnosticCondition,
|
|
53
|
+
DiagnosticImplication,
|
|
54
|
+
DiagnosticMutexGroup,
|
|
55
|
+
ReferenceEdge,
|
|
56
|
+
OutgoingRef,
|
|
57
|
+
IncomingRef,
|
|
58
|
+
DiagnosticResource,
|
|
59
|
+
PathVariable,
|
|
60
|
+
DiagnosticForEachExpansion,
|
|
61
|
+
PathTarget,
|
|
62
|
+
GetAttRef,
|
|
63
|
+
DiagnosticOutput,
|
|
64
|
+
DiagnosticRule,
|
|
65
|
+
DiagnosticRuleAssertion,
|
|
66
|
+
ResolutionSource,
|
|
67
|
+
} from './bindings_wasm';
|
|
68
|
+
export type JsonValue =
|
|
69
|
+
| string
|
|
70
|
+
| number
|
|
71
|
+
| boolean
|
|
72
|
+
| null
|
|
73
|
+
| JsonValue[]
|
|
74
|
+
| {
|
|
75
|
+
[key: string]: JsonValue;
|
|
76
|
+
};
|
|
77
|
+
export interface Engine {
|
|
78
|
+
validateStandard(template: TemplateFile, config?: ValidateConfig): StandardReport;
|
|
79
|
+
validateDetailed(template: TemplateFile, config?: ValidateConfig): DetailedReport;
|
|
80
|
+
listRules(): RuleInfo[];
|
|
81
|
+
engineName(): string;
|
|
82
|
+
free(): void;
|
|
83
|
+
}
|
|
84
|
+
export declare class TemplateFile {
|
|
85
|
+
readonly path: string;
|
|
86
|
+
constructor(path: string);
|
|
87
|
+
readBytes(): Uint8Array;
|
|
88
|
+
}
|
|
89
|
+
export declare class TemplateModel {
|
|
90
|
+
private readonly inner;
|
|
91
|
+
constructor(template: TemplateFile);
|
|
92
|
+
resources(): Record<string, ResolvedResource>;
|
|
93
|
+
parameters(): Record<string, ParameterInfo>;
|
|
94
|
+
outputs(): Record<string, ResolvedOutput>;
|
|
95
|
+
conditions(): string[];
|
|
96
|
+
transforms(): string[];
|
|
97
|
+
formatVersion(): string | undefined;
|
|
98
|
+
description(): string | undefined;
|
|
99
|
+
toDiagnosticModel(): DiagnosticModel;
|
|
100
|
+
sourceLocation(path: string): SourceSpan | null;
|
|
101
|
+
free(): void;
|
|
102
|
+
}
|
|
103
|
+
export declare class SchemaValidator {
|
|
104
|
+
private readonly inner;
|
|
105
|
+
listRules(): RuleInfo[];
|
|
106
|
+
schemaCount(): number;
|
|
107
|
+
validate(template: TemplateFile, region?: string): StandardDiagnostic[];
|
|
108
|
+
free(): void;
|
|
109
|
+
}
|
|
110
|
+
export declare const RegoEngine: new (config?: EngineConfig) => Engine;
|
|
111
|
+
export declare const CelEngine: new (config?: EngineConfig) => Engine;
|
|
112
|
+
export declare function version(): string;
|
package/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.CelEngine =
|
|
4
|
+
exports.RegoEngine =
|
|
5
|
+
exports.SchemaValidator =
|
|
6
|
+
exports.TemplateModel =
|
|
7
|
+
exports.TemplateFile =
|
|
8
|
+
void 0;
|
|
9
|
+
exports.version = version;
|
|
10
|
+
const fs_1 = require('fs');
|
|
11
|
+
const bridge = require('./bindings_wasm');
|
|
12
|
+
class TemplateFile {
|
|
13
|
+
constructor(path) {
|
|
14
|
+
this.path = path;
|
|
15
|
+
}
|
|
16
|
+
readBytes() {
|
|
17
|
+
return (0, fs_1.readFileSync)(this.path);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.TemplateFile = TemplateFile;
|
|
21
|
+
class TemplateModel {
|
|
22
|
+
constructor(template) {
|
|
23
|
+
this.inner = bridge.WasmSemanticModel.parse(template.readBytes());
|
|
24
|
+
}
|
|
25
|
+
resources() {
|
|
26
|
+
return this.inner.resources();
|
|
27
|
+
}
|
|
28
|
+
parameters() {
|
|
29
|
+
return this.inner.parameters();
|
|
30
|
+
}
|
|
31
|
+
outputs() {
|
|
32
|
+
return this.inner.outputs();
|
|
33
|
+
}
|
|
34
|
+
conditions() {
|
|
35
|
+
return this.inner.conditions();
|
|
36
|
+
}
|
|
37
|
+
transforms() {
|
|
38
|
+
return this.inner.transforms();
|
|
39
|
+
}
|
|
40
|
+
formatVersion() {
|
|
41
|
+
return this.inner.formatVersion();
|
|
42
|
+
}
|
|
43
|
+
description() {
|
|
44
|
+
return this.inner.description();
|
|
45
|
+
}
|
|
46
|
+
toDiagnosticModel() {
|
|
47
|
+
return this.inner.toDiagnosticModel();
|
|
48
|
+
}
|
|
49
|
+
sourceLocation(path) {
|
|
50
|
+
return this.inner.sourceLocation(path);
|
|
51
|
+
}
|
|
52
|
+
free() {
|
|
53
|
+
this.inner.free();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.TemplateModel = TemplateModel;
|
|
57
|
+
class SchemaValidator {
|
|
58
|
+
constructor() {
|
|
59
|
+
this.inner = new bridge.WasmSchemaValidator();
|
|
60
|
+
}
|
|
61
|
+
listRules() {
|
|
62
|
+
return this.inner.listRules();
|
|
63
|
+
}
|
|
64
|
+
schemaCount() {
|
|
65
|
+
return this.inner.schemaCount();
|
|
66
|
+
}
|
|
67
|
+
validate(template, region = 'us-east-1') {
|
|
68
|
+
const model = bridge.WasmSemanticModel.parse(template.readBytes());
|
|
69
|
+
try {
|
|
70
|
+
return this.inner.validate(model, region).diagnostics;
|
|
71
|
+
} finally {
|
|
72
|
+
model.free();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
free() {
|
|
76
|
+
this.inner.free();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SchemaValidator = SchemaValidator;
|
|
80
|
+
function createEngineClass(WasmClass) {
|
|
81
|
+
return class {
|
|
82
|
+
constructor(config) {
|
|
83
|
+
this.inner = new WasmClass(config ?? {});
|
|
84
|
+
}
|
|
85
|
+
validateStandard(template, config) {
|
|
86
|
+
return this.inner.validateStandard(template.readBytes(), config ?? {}, template.path);
|
|
87
|
+
}
|
|
88
|
+
validateDetailed(template, config) {
|
|
89
|
+
return this.inner.validateDetailed(template.readBytes(), config ?? {}, template.path);
|
|
90
|
+
}
|
|
91
|
+
listRules() {
|
|
92
|
+
return this.inner.listRules();
|
|
93
|
+
}
|
|
94
|
+
engineName() {
|
|
95
|
+
return this.inner.engineName();
|
|
96
|
+
}
|
|
97
|
+
free() {
|
|
98
|
+
this.inner.free();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
exports.RegoEngine = createEngineClass(bridge.WasmRegoEngine);
|
|
103
|
+
exports.CelEngine = createEngineClass(bridge.WasmCelEngine);
|
|
104
|
+
function version() {
|
|
105
|
+
return bridge.version();
|
|
106
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws/cloudformation-validate",
|
|
3
|
+
"version": "1.0.0-beta",
|
|
4
|
+
"description": "AWS CloudFormation Validate",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Amazon Web Services",
|
|
7
|
+
"url": "https://aws.amazon.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "^22.15.0",
|
|
12
|
+
"npm": ">=10.5.0"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/aws-cloudformation/cloudformation-validate"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/aws-cloudformation/cloudformation-validate#readme",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"provenance": true
|
|
22
|
+
},
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"types": "index.d.ts"
|
|
25
|
+
}
|