codify-schemas 1.0.43 → 1.0.45
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/config-file-schema.json +1 -1
- package/dist/ipc-message-schema.json +1 -1
- package/dist/messages/apply-request-data-schema.json +1 -1
- package/dist/messages/apply-response-data-schema.json +1 -1
- package/dist/messages/error-response-data-schema.json +1 -1
- package/dist/messages/initialize-request-data-schema.json +1 -1
- package/dist/messages/initialize-response-data-schema.json +1 -1
- package/dist/messages/plan-request-data-schema.json +7 -3
- package/dist/messages/plan-response-data-schema.json +1 -1
- package/dist/messages/sudo-request-data-schema.json +1 -1
- package/dist/messages/sudo-response-data-schema.json +1 -1
- package/dist/messages/validate-request-data-schema.json +1 -1
- package/dist/messages/validate-response-data-schema.json +1 -1
- package/dist/project-schema.json +1 -1
- package/dist/resource-schema.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config-file-schema.json +1 -1
- package/src/config-file-schema.test.ts +2 -2
- package/src/ipc-message-schema.json +1 -1
- package/src/ipc-message-schema.test.ts +2 -2
- package/src/messages/apply-request-data-schema.json +1 -1
- package/src/messages/apply-request-data-schema.test.ts +4 -3
- package/src/messages/apply-response-data-schema.json +1 -1
- package/src/messages/apply-response-data-schema.test.ts +21 -0
- package/src/messages/error-response-data-schema.json +1 -1
- package/src/messages/error-response-data-schema.test.ts +23 -0
- package/src/messages/get-resources-response-data-schema.json +1 -1
- package/src/messages/get-resources-response-data-schema.test.ts +2 -2
- package/src/messages/initialize-request-data-schema.json +1 -1
- package/src/messages/initialize-request-data-schema.test.ts +2 -2
- package/src/messages/initialize-response-data-schema.json +1 -1
- package/src/messages/initialize-response-data-schema.test.ts +2 -2
- package/src/messages/plan-request-data-schema.json +7 -3
- package/src/messages/plan-request-data-schema.test.ts +28 -10
- package/src/messages/plan-response-data-schema.json +1 -1
- package/src/messages/plan-response-data-schema.test.ts +2 -2
- package/src/messages/sudo-request-data-schema.json +1 -1
- package/src/messages/sudo-request-data-schema.test.ts +2 -2
- package/src/messages/sudo-response-data-schema.json +1 -1
- package/src/messages/sudo-response-data-schema.test.ts +2 -2
- package/src/messages/validate-request-data-schema.json +1 -1
- package/src/messages/validate-response-data-schema.json +1 -1
- package/src/messages/validate-response-data-schema.test.ts +2 -2
- package/src/project-schema.json +1 -1
- package/src/project-schema.test.ts +2 -2
- package/src/resource-schema.json +1 -1
- package/src/resource-schema.test.ts +2 -2
- package/src/types/index.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/apply-request-data-schema.json",
|
|
4
4
|
"title": "Apply Request Schema Data",
|
|
5
5
|
"description": "Apply the previously generated plan. The plan must already be generated in order for apply to work.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/initialize-request-data-schema.json",
|
|
4
4
|
"title": "Initialize Request Schema Data",
|
|
5
5
|
"description": "Initialize the plugin",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/initialize-response-data-schema.json",
|
|
4
4
|
"title": "Initialize Request Schema Data",
|
|
5
5
|
"description": "Initialize the plugin",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/plan-request-data-schema.json",
|
|
4
4
|
"title": "Plan Request Schema Data",
|
|
5
5
|
"type": "object",
|
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
},
|
|
10
10
|
"state": {
|
|
11
11
|
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"isStateful": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "If the plan is stateful"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"additionalProperties": false,
|
|
15
19
|
"anyOf": [
|
|
16
|
-
{ "required": ["desired"] },
|
|
17
|
-
{ "required": ["state"] }
|
|
20
|
+
{ "required": ["desired", "isStateful"] },
|
|
21
|
+
{ "required": ["state", "isStateful"] }
|
|
18
22
|
]
|
|
19
23
|
}
|
package/dist/project-schema.json
CHANGED
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AA4BD,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAmDD,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import configFileSchema from './config-file-schema.json';
|
|
2
2
|
import { describe, it, expect } from 'vitest'
|
|
3
|
-
import
|
|
3
|
+
import Ajv from 'ajv'
|
|
4
4
|
|
|
5
|
-
const ajv = new
|
|
5
|
+
const ajv = new Ajv.default({
|
|
6
6
|
strict: true,
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/apply-request-data-schema.json",
|
|
4
4
|
"title": "Apply Request Schema Data",
|
|
5
5
|
"description": "Apply the previously generated plan. The plan must already be generated in order for apply to work.",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import schema from './apply-request-data-schema.json';
|
|
2
2
|
import resourceSchema from '../resource-schema.json'
|
|
3
3
|
import {describe, expect, it} from 'vitest'
|
|
4
|
-
import Ajv2020 from 'ajv/dist/2020.js'
|
|
5
4
|
import addFormats from 'ajv-formats';
|
|
6
|
-
import {ApplyRequestData, ParameterOperation, ResourceOperation} from "../types/index.js";
|
|
5
|
+
import { ApplyRequestData, ParameterOperation, ResourceOperation } from "../types/index.js";
|
|
6
|
+
import Ajv from 'ajv';
|
|
7
7
|
|
|
8
|
-
const ajv = new
|
|
8
|
+
const ajv = new Ajv.default({
|
|
9
9
|
strict: true,
|
|
10
10
|
})
|
|
11
|
+
|
|
11
12
|
addFormats.default(ajv);
|
|
12
13
|
ajv.addSchema(resourceSchema);
|
|
13
14
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import schema from './apply-response-data-schema.json';
|
|
2
|
+
import {describe, expect, it} from 'vitest'
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
4
|
+
import Ajv from 'ajv';
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv.default({
|
|
7
|
+
strict: true,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
addFormats.default(ajv);
|
|
11
|
+
|
|
12
|
+
describe('Apply request data schema', () => {
|
|
13
|
+
it('compiles', () => {
|
|
14
|
+
ajv.compile(schema);
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("validates an empty config", () => {
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
expect(validate(null)).to.be.true;
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import schema from './error-response-data-schema.json';
|
|
2
|
+
import {describe, expect, it} from 'vitest'
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
4
|
+
import Ajv from 'ajv';
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv.default({
|
|
7
|
+
strict: true,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
addFormats.default(ajv);
|
|
11
|
+
|
|
12
|
+
describe('Apply request data schema', () => {
|
|
13
|
+
it('compiles', () => {
|
|
14
|
+
ajv.compile(schema);
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("validates an error message", () => {
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
expect(validate({
|
|
20
|
+
reason: "This was an error"
|
|
21
|
+
})).to.be.true;
|
|
22
|
+
})
|
|
23
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import schema from './get-resources-response-data-schema.json';
|
|
2
2
|
import resourceSchema from '../resource-schema.json'
|
|
3
3
|
import { describe, it, expect } from 'vitest'
|
|
4
|
-
import
|
|
4
|
+
import Ajv from 'ajv'
|
|
5
5
|
|
|
6
|
-
const ajv = new
|
|
6
|
+
const ajv = new Ajv.default({
|
|
7
7
|
strict: true,
|
|
8
8
|
})
|
|
9
9
|
ajv.addSchema(resourceSchema);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/initialize-request-data-schema.json",
|
|
4
4
|
"title": "Initialize Request Schema Data",
|
|
5
5
|
"description": "Initialize the plugin",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import schema from './initialize-request-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
|
-
import
|
|
3
|
+
import Ajv from 'ajv'
|
|
4
4
|
|
|
5
|
-
const ajv = new
|
|
5
|
+
const ajv = new Ajv.default({
|
|
6
6
|
strict: true,
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/initialize-response-data-schema.json",
|
|
4
4
|
"title": "Initialize Request Schema Data",
|
|
5
5
|
"description": "Initialize the plugin",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import schema from './initialize-response-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
|
-
import
|
|
3
|
+
import Ajv from 'ajv'
|
|
4
4
|
|
|
5
|
-
const ajv = new
|
|
5
|
+
const ajv = new Ajv.default({
|
|
6
6
|
strict: true,
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/plan-request-data-schema.json",
|
|
4
4
|
"title": "Plan Request Schema Data",
|
|
5
5
|
"type": "object",
|
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
},
|
|
10
10
|
"state": {
|
|
11
11
|
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"isStateful": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "If the plan is stateful"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"additionalProperties": false,
|
|
15
19
|
"anyOf": [
|
|
16
|
-
{ "required": ["desired"] },
|
|
17
|
-
{ "required": ["state"] }
|
|
20
|
+
{ "required": ["desired", "isStateful"] },
|
|
21
|
+
{ "required": ["state", "isStateful"] }
|
|
18
22
|
]
|
|
19
23
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import schema from './plan-request-data-schema.json';
|
|
2
2
|
import resourceSchema from '../resource-schema.json'
|
|
3
3
|
import { describe, it, expect } from 'vitest'
|
|
4
|
-
import
|
|
4
|
+
import Ajv from 'ajv'
|
|
5
5
|
|
|
6
|
-
const ajv = new
|
|
6
|
+
const ajv = new Ajv.default({
|
|
7
7
|
strict: true,
|
|
8
8
|
strictRequired: false,
|
|
9
9
|
})
|
|
@@ -19,12 +19,14 @@ describe('Plan request data schema', () => {
|
|
|
19
19
|
expect(validate({
|
|
20
20
|
desired: {
|
|
21
21
|
type: "type"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
isStateful: false
|
|
23
24
|
})).to.be.true;
|
|
24
25
|
expect(validate({
|
|
25
26
|
state: {
|
|
26
27
|
type: "type"
|
|
27
|
-
}
|
|
28
|
+
},
|
|
29
|
+
isStateful: false
|
|
28
30
|
})).to.be.true;
|
|
29
31
|
expect(validate({
|
|
30
32
|
desired: {
|
|
@@ -32,19 +34,35 @@ describe('Plan request data schema', () => {
|
|
|
32
34
|
},
|
|
33
35
|
state: {
|
|
34
36
|
type: "type"
|
|
35
|
-
}
|
|
37
|
+
},
|
|
38
|
+
isStateful: false
|
|
36
39
|
})).to.be.true;
|
|
37
40
|
expect(validate({})).to.be.false;
|
|
38
41
|
})
|
|
39
42
|
|
|
40
43
|
it ("name and type are alpha-numeric and follow variable naming conventions", () => {
|
|
41
44
|
const validate = ajv.compile(schema);
|
|
42
|
-
expect(validate({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
expect(validate({
|
|
46
|
+
desired: { type: "a234abcDEF_-" },
|
|
47
|
+
isStateful: false
|
|
48
|
+
})).to.be.true;
|
|
49
|
+
expect(validate({
|
|
50
|
+
desired: { type: "234" },
|
|
51
|
+
isStateful: false
|
|
52
|
+
})).to.be.false;
|
|
53
|
+
expect(validate({
|
|
54
|
+
desired: { type: "ABCDEF$" },
|
|
55
|
+
isStateful: false
|
|
56
|
+
})).to.be.false;
|
|
45
57
|
|
|
46
|
-
expect(validate({
|
|
47
|
-
|
|
58
|
+
expect(validate({
|
|
59
|
+
desired: { type: "type", name: "a234abcDEF_-" },
|
|
60
|
+
isStateful: false
|
|
61
|
+
})).to.be.true;
|
|
62
|
+
expect(validate({
|
|
63
|
+
desired: { type: "type", name: "ABCDEF$" },
|
|
64
|
+
isStateful: false
|
|
65
|
+
})).to.be.false;
|
|
48
66
|
});
|
|
49
67
|
|
|
50
68
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import schema from './plan-response-data-schema.json';
|
|
2
2
|
import resourceSchema from '../resource-schema.json'
|
|
3
3
|
import {describe, expect, it} from 'vitest'
|
|
4
|
-
import
|
|
4
|
+
import Ajv from 'ajv'
|
|
5
5
|
import addFormats from 'ajv-formats';
|
|
6
6
|
import {ParameterOperation, PlanResponseData, ResourceOperation} from "../types/index.js";
|
|
7
7
|
|
|
8
|
-
const ajv = new
|
|
8
|
+
const ajv = new Ajv.default({
|
|
9
9
|
strict: true,
|
|
10
10
|
})
|
|
11
11
|
addFormats.default(ajv);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import schema from './validate-response-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
|
-
import
|
|
3
|
+
import Ajv from 'ajv'
|
|
4
4
|
import addFormats from 'ajv-formats';
|
|
5
5
|
import {ValidateResponseData} from "../types/index.js";
|
|
6
6
|
|
|
7
|
-
const ajv = new
|
|
7
|
+
const ajv = new Ajv.default({
|
|
8
8
|
strict: true,
|
|
9
9
|
})
|
|
10
10
|
addFormats.default(ajv);
|
package/src/project-schema.json
CHANGED
package/src/resource-schema.json
CHANGED