codify-schemas 1.0.25 → 1.0.27

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/index.d.ts CHANGED
@@ -9,5 +9,7 @@ import PlanRequestDataSchema from './messages/plan-request-data-schema.json';
9
9
  import PlanResponseDataSchema from './messages/plan-response-data-schema.json';
10
10
  import ValidateRequestDataSchema from './messages/validate-request-data-schema.json';
11
11
  import ValidateResponseDataSchema from './messages/validate-response-data-schema.json';
12
- export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, };
12
+ import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json';
13
+ import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json';
14
+ export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, };
13
15
  export * from './types/index.js';
package/dist/index.js CHANGED
@@ -9,6 +9,8 @@ import PlanRequestDataSchema from './messages/plan-request-data-schema.json' ass
9
9
  import PlanResponseDataSchema from './messages/plan-response-data-schema.json' assert { type: 'json' };
10
10
  import ValidateRequestDataSchema from './messages/validate-request-data-schema.json' assert { type: 'json' };
11
11
  import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' assert { type: 'json' };
12
- export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, };
12
+ import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' assert { type: 'json' };
13
+ import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' assert { type: 'json' };
14
+ export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, };
13
15
  export * from './types/index.js';
14
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AAC/E,OAAO,aAAa,MAAM,uBAAuB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACxE,OAAO,cAAc,MAAM,wBAAwB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AAC1E,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AAC/E,OAAO,sBAAsB,MAAM,2CAA2C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACrG,OAAO,uBAAuB,MAAM,4CAA4C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACvG,OAAO,uBAAuB,MAAM,4CAA4C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACvG,OAAO,qBAAqB,MAAM,0CAA0C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACnG,OAAO,sBAAsB,MAAM,2CAA2C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AACrG,OAAO,yBAAyB,MAAM,8CAA8C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AAC3G,OAAO,0BAA0B,MAAM,+CAA+C,CAAC,SAAS,IAAI,EAAE,MAAM,EAAC,CAAA;AAE7G,OA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AC,SAAQ,IAAI,EAAE,MAAM,EAAC,CAAA;AAGhH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,GAC7B,CAAA;AAED,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://www.codify.com/initialize-request-data-schema.json",
4
+ "title": "Initialize Request Schema Data",
5
+ "description": "Initialize the plugin",
6
+ "type": "object",
7
+ "properties": {},
8
+ "additionalProperties": false
9
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://www.codify.com/initialize-response-data-schema.json",
4
+ "title": "Initialize Request Schema Data",
5
+ "description": "Initialize the plugin",
6
+ "type": "object",
7
+ "properties": {
8
+ "resourceDefinitions": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "properties": {
13
+ "type": {
14
+ "type": "string"
15
+ },
16
+ "dependencies": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "string"
20
+ }
21
+ }
22
+ },
23
+ "required": [
24
+ "type",
25
+ "dependencies"
26
+ ]
27
+ }
28
+ }
29
+ },
30
+ "required": ["resourceDefinitions"]
31
+ }
@@ -2,5 +2,16 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://www.codify.com/validate-response-data-schema.json",
4
4
  "title": "Validate Response Schema Data",
5
- "type": "null"
5
+ "type": "object",
6
+ "properties": {
7
+ "isValid": {
8
+ "type": "boolean"
9
+ },
10
+ "errors": {
11
+ "type": "array",
12
+ "description": "Any errors in validation"
13
+ }
14
+ },
15
+ "required": ["isValid"],
16
+ "additionalProperties": false
6
17
  }
@@ -22,7 +22,10 @@ export interface IpcMessage {
22
22
  export interface ValidateRequestData {
23
23
  configs: ResourceConfig[];
24
24
  }
25
- export type ValidateResponseData = null;
25
+ export interface ValidateResponseData {
26
+ isValid: boolean;
27
+ errors: unknown[] | null;
28
+ }
26
29
  export interface PlanRequestData extends ResourceConfig {
27
30
  }
28
31
  export declare enum ResourceOperation {
@@ -53,3 +56,13 @@ export interface PlanResponseData {
53
56
  export interface ApplyRequestData {
54
57
  planId: string;
55
58
  }
59
+ export interface ResourceDefinition {
60
+ type: string;
61
+ dependencies: string[];
62
+ }
63
+ export interface InitializeRequestData {
64
+ }
65
+ export interface InitializeResponseData {
66
+ type: string;
67
+ dependencies: string[];
68
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAeA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAgBD,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAeA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAmBD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-schemas",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  // @ts-ignore
2
- import ConfigFileSchema from './config-file-schema.json' assert { type: 'json'}
3
- import ProjectSchema from './project-schema.json' assert { type: 'json'}
4
- import ResourceSchema from './resource-schema.json' assert { type: 'json'}
5
- import IpcMessageSchema from './ipc-message-schema.json' assert { type: 'json'}
6
- import ApplyRequestDataSchema from './messages/apply-request-data-schema.json' assert { type: 'json'}
7
- import ApplyResponseDataSchema from './messages/apply-response-data-schema.json' assert { type: 'json'}
8
- import ErrorResponseDataSchema from './messages/error-response-data-schema.json' assert { type: 'json'}
9
- import PlanRequestDataSchema from './messages/plan-request-data-schema.json' assert { type: 'json'}
10
- import PlanResponseDataSchema from './messages/plan-response-data-schema.json' assert { type: 'json'}
11
- import ValidateRequestDataSchema from './messages/validate-request-data-schema.json' assert { type: 'json'}
12
- import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' assert { type: 'json'}
2
+ import ConfigFileSchema from './config-file-schema.json' assert {type: 'json'}
3
+ import ProjectSchema from './project-schema.json' assert {type: 'json'}
4
+ import ResourceSchema from './resource-schema.json' assert {type: 'json'}
5
+ import IpcMessageSchema from './ipc-message-schema.json' assert {type: 'json'}
6
+ import ApplyRequestDataSchema from './messages/apply-request-data-schema.json' assert {type: 'json'}
7
+ import ApplyResponseDataSchema from './messages/apply-response-data-schema.json' assert {type: 'json'}
8
+ import ErrorResponseDataSchema from './messages/error-response-data-schema.json' assert {type: 'json'}
9
+ import PlanRequestDataSchema from './messages/plan-request-data-schema.json' assert {type: 'json'}
10
+ import PlanResponseDataSchema from './messages/plan-response-data-schema.json' assert {type: 'json'}
11
+ import ValidateRequestDataSchema from './messages/validate-request-data-schema.json' assert {type: 'json'}
12
+ import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' assert {type: 'json'}
13
+ import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' assert {type: 'json'}
14
+ import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' assert {type: 'json'}
15
+
13
16
 
14
17
  export {
15
18
  ConfigFileSchema,
@@ -23,6 +26,8 @@ export {
23
26
  PlanResponseDataSchema,
24
27
  ValidateRequestDataSchema,
25
28
  ValidateResponseDataSchema,
29
+ InitializeRequestDataSchema,
30
+ InitializeResponseDataSchema,
26
31
  }
27
32
 
28
33
  export * from './types/index.js';
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://www.codify.com/initialize-request-data-schema.json",
4
+ "title": "Initialize Request Schema Data",
5
+ "description": "Initialize the plugin",
6
+ "type": "object",
7
+ "properties": {},
8
+ "additionalProperties": false
9
+ }
@@ -0,0 +1,19 @@
1
+ import schema from './initialize-request-data-schema.json';
2
+ import {describe, expect, it} from 'vitest'
3
+ import Ajv2020 from 'ajv/dist/2020.js'
4
+
5
+ const ajv = new Ajv2020.default({
6
+ strict: true,
7
+ })
8
+
9
+ describe('Get resources response data schema', () => {
10
+ it('compiles', () => {
11
+ ajv.compile(schema);
12
+ })
13
+
14
+ it("requires an empty object", () => {
15
+ const validate = ajv.compile(schema);
16
+ expect(validate({})).to.be.true;
17
+ })
18
+
19
+ })
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://www.codify.com/initialize-response-data-schema.json",
4
+ "title": "Initialize Request Schema Data",
5
+ "description": "Initialize the plugin",
6
+ "type": "object",
7
+ "properties": {
8
+ "resourceDefinitions": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "properties": {
13
+ "type": {
14
+ "type": "string"
15
+ },
16
+ "dependencies": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "string"
20
+ }
21
+ }
22
+ },
23
+ "required": [
24
+ "type",
25
+ "dependencies"
26
+ ]
27
+ }
28
+ }
29
+ },
30
+ "required": ["resourceDefinitions"]
31
+ }
@@ -0,0 +1,41 @@
1
+ import schema from './initialize-response-data-schema.json';
2
+ import {describe, expect, it} from 'vitest'
3
+ import Ajv2020 from 'ajv/dist/2020.js'
4
+
5
+ const ajv = new Ajv2020.default({
6
+ strict: true,
7
+ })
8
+
9
+ describe('Get resources response data schema', () => {
10
+ it('compiles', () => {
11
+ ajv.compile(schema);
12
+ })
13
+
14
+ it("requires type and dependencies to be defined", () => {
15
+ const validate = ajv.compile(schema);
16
+ expect(validate({
17
+ resourceDefinitions: [
18
+ {
19
+ type: 'typeA',
20
+ dependencies: ['typeB']
21
+ },
22
+ {
23
+ type: 'typeB',
24
+ dependencies: [],
25
+ }
26
+ ]
27
+ })).to.be.true;
28
+
29
+ expect(validate({
30
+ resourceDefinitions: [
31
+ {
32
+ dependencies: ['typeB']
33
+ },
34
+ {
35
+ type: 'typeB',
36
+ }
37
+ ]
38
+ })).to.be.false;
39
+ });
40
+
41
+ })
@@ -2,5 +2,16 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://www.codify.com/validate-response-data-schema.json",
4
4
  "title": "Validate Response Schema Data",
5
- "type": "null"
5
+ "type": "object",
6
+ "properties": {
7
+ "isValid": {
8
+ "type": "boolean"
9
+ },
10
+ "errors": {
11
+ "type": "array",
12
+ "description": "Any errors in validation"
13
+ }
14
+ },
15
+ "required": ["isValid"],
16
+ "additionalProperties": false
6
17
  }
@@ -28,7 +28,10 @@ export interface ValidateRequestData {
28
28
  configs: ResourceConfig[];
29
29
  }
30
30
 
31
- export type ValidateResponseData = null;
31
+ export interface ValidateResponseData {
32
+ isValid: boolean;
33
+ errors: unknown[] | null;
34
+ }
32
35
 
33
36
  export interface PlanRequestData extends ResourceConfig {}
34
37
 
@@ -63,3 +66,15 @@ export interface PlanResponseData {
63
66
  export interface ApplyRequestData {
64
67
  planId: string;
65
68
  }
69
+
70
+ export interface ResourceDefinition {
71
+ type: string;
72
+ dependencies: string[];
73
+ }
74
+
75
+ export interface InitializeRequestData {}
76
+
77
+ export interface InitializeResponseData {
78
+ type: string;
79
+ dependencies: string[];
80
+ }