codify-schemas 1.0.0 → 1.0.2
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 +9 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc-message-schema.json +21 -0
- package/dist/messages/apply-request-data-schema.json +16 -0
- package/dist/messages/error-response-data-schema.json +14 -0
- package/dist/messages/plan-request-data-schema.json +6 -0
- package/dist/messages/plan-response-data-schema.json +53 -0
- package/dist/messages/validate-request-data-schema.json +16 -0
- package/dist/messages/validate-response-data-schema.json +6 -0
- package/dist/project-schema.json +32 -0
- package/dist/resource-meta-schema.json +32 -0
- package/dist/resource-schema.json +26 -0
- package/dist/types/index.d.ts +54 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as ConfigFileSchema } from './config-file-schema.json';
|
|
2
|
+
export { default as ProjectSchema } from './project-schema.json';
|
|
3
|
+
export { default as ResourceMetaSchema } from './resource-meta-schema.json';
|
|
4
|
+
export { default as ResourceSchema } from './resource-schema.json';
|
|
5
|
+
export { default as IpcMessageSchema } from './ipc-message-schema.json';
|
|
6
|
+
export { default as ApplyRequestDataSchema } from './messages/apply-request-data-schema.json';
|
|
7
|
+
export { default as ErrorResponseDataSchema } from './messages/error-response-data-schema.json';
|
|
8
|
+
export { default as PlanRequestDataSchema } from './messages/plan-request-data-schema.json';
|
|
9
|
+
export { default as PlanResponseDataSchema } from './messages/plan-response-data-schema.json';
|
|
10
|
+
export { default as ValidateRequestDataSchema } from './messages/validate-request-data-schema.json';
|
|
11
|
+
export { default as ValidateResponseDataSchema } from './messages/validate-response-data-schema.json';
|
|
12
|
+
export * from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,qEAAwE;AAA/D,4IAAA,OAAO,OAAoB;AACpC,6DAAiE;AAAxD,qIAAA,OAAO,OAAiB;AACjC,yEAA4E;AAAnE,gJAAA,OAAO,OAAsB;AACtC,+DAAmE;AAA1D,uIAAA,OAAO,OAAkB;AAClC,qEAAwE;AAA/D,4IAAA,OAAO,OAAoB;AACpC,4FAA8F;AAArF,yJAAA,OAAO,OAA0B;AAC1C,8FAAgG;AAAvF,2JAAA,OAAO,OAA2B;AAC3C,0FAA4F;AAAnF,uJAAA,OAAO,OAAyB;AACzC,4FAA8F;AAArF,yJAAA,OAAO,OAA0B;AAC1C,kGAAoG;AAA3F,+JAAA,OAAO,OAA6B;AAC7C,oGAAsG;AAA7F,iKAAA,OAAO,OAA8B;AAC9C,0CAAwB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/ipc-message-schema.json",
|
|
4
|
+
"title": "IPC Message Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"cmd": {
|
|
8
|
+
"description": "The uri for the message. Like an http url",
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"status": {
|
|
12
|
+
"description": "The status of the request. Only used for responses. Can be either success or error",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["success", "error"]
|
|
15
|
+
},
|
|
16
|
+
"data": {
|
|
17
|
+
"description": "The data of the message."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["cmd", "data"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/apply-request-data-schema.json",
|
|
4
|
+
"title": "Apply Request Schema Data",
|
|
5
|
+
"description": "Apply the previously generated plan. The plan must already be generated in order for apply to work.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"planId": {
|
|
9
|
+
"description": "The plan uuid. This id is used to look up the generated plan on the plugin side",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"format": "uuid"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["planId"],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/error-response-data-schema.json",
|
|
4
|
+
"title": "Error Response Schema Data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"reason": {
|
|
8
|
+
"description": "A human read-able reason for the error",
|
|
9
|
+
"type": "string"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": ["reason"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/plan-response-data-schema.json",
|
|
4
|
+
"title": "Plan Response Schema Data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"planId": {
|
|
8
|
+
"description": "The id of the plan to look up for the apply operation",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"format": "uuid"
|
|
11
|
+
},
|
|
12
|
+
"operation": {
|
|
13
|
+
"description": "The plan operation",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["create", "destroy", "modify", "recreate", "noop"]
|
|
16
|
+
},
|
|
17
|
+
"resourceType": {
|
|
18
|
+
"description": "The resource type",
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"resourceName": {
|
|
22
|
+
"description": "The resource name",
|
|
23
|
+
"type": ["string", "null"]
|
|
24
|
+
},
|
|
25
|
+
"parameters": {
|
|
26
|
+
"description": "The properties come from the provided config and is not necessarily every parameter on the ",
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"name": {
|
|
32
|
+
"description": "The property name",
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"operation": {
|
|
36
|
+
"description": "The operation to be performed on the parameter",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": ["remove", "add", "modify", "noop"]
|
|
39
|
+
},
|
|
40
|
+
"previousValue": {
|
|
41
|
+
"description": "The value before the change"
|
|
42
|
+
},
|
|
43
|
+
"newValue": {
|
|
44
|
+
"description": "The new value"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": ["name", "operation", "previousValue", "newValue"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": ["planId", "operation", "resourceType", "parameters"],
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/validate-request-data-schema.json",
|
|
4
|
+
"title": "Validate Request Schema Data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"configs": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": {
|
|
10
|
+
"$ref": "resource-schema.json"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": [],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/resource-schema.json",
|
|
4
|
+
"title": "Resource Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"description": "All project configs are of the type project",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"const": "project"
|
|
11
|
+
},
|
|
12
|
+
"version": {
|
|
13
|
+
"description": "Semver version. Codify will throw an error if this is not satisfied",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$"
|
|
16
|
+
},
|
|
17
|
+
"plugins": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"patternProperties": {
|
|
20
|
+
".*": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"description": {
|
|
26
|
+
"description": "An optional description of the codify project",
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": ["type"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Config file Schema",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"$id": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^https://www.codify.com/"
|
|
9
|
+
},
|
|
10
|
+
"type": {
|
|
11
|
+
"const": "object"
|
|
12
|
+
},
|
|
13
|
+
"properties": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"type": false,
|
|
17
|
+
"name": false,
|
|
18
|
+
"dependsOn": false,
|
|
19
|
+
"$ref": {
|
|
20
|
+
"const": "https://www.codify.com/resource-schema.json#properties"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"$ref": {
|
|
25
|
+
"const": "https://www.codify.com/resource-schema.json"
|
|
26
|
+
},
|
|
27
|
+
"unevaluatedProperties": {
|
|
28
|
+
"const": false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["unevaluatedProperties", "$ref"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://www.codify.com/resource-schema.json",
|
|
4
|
+
"title": "Resource Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"description": "The resource type",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[a-zA-Z-_][\\w-]+$"
|
|
11
|
+
},
|
|
12
|
+
"name": {
|
|
13
|
+
"description": "Optional name. Useful for specifying multiple resources of the same type",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^[a-zA-Z-_][\\w-]+$"
|
|
16
|
+
},
|
|
17
|
+
"dependsOn": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"uniqueItems": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": ["type"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface ProjectConfig {
|
|
2
|
+
type: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
plugins?: Record<string, string>;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResourceConfig {
|
|
8
|
+
type: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
dependsOn?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare enum MessageStatus {
|
|
13
|
+
SUCCESS = "success",
|
|
14
|
+
ERROR = "error"
|
|
15
|
+
}
|
|
16
|
+
export interface IpcMessage {
|
|
17
|
+
cmd: string;
|
|
18
|
+
status?: MessageStatus;
|
|
19
|
+
data: unknown | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ValidateRequestData {
|
|
22
|
+
configs: ResourceConfig[];
|
|
23
|
+
}
|
|
24
|
+
export type ValidateResponseData = null;
|
|
25
|
+
export interface PlanRequestData extends ResourceConfig {
|
|
26
|
+
}
|
|
27
|
+
export declare enum ResourceOperation {
|
|
28
|
+
CREATE = "create",
|
|
29
|
+
DESTROY = "destroy",
|
|
30
|
+
MODIFY = "modify",
|
|
31
|
+
RECREATE = "recreate",
|
|
32
|
+
NOOP = "noop"
|
|
33
|
+
}
|
|
34
|
+
export declare enum ParameterOperation {
|
|
35
|
+
ADD = "add",
|
|
36
|
+
REMOVE = "remove",
|
|
37
|
+
MODIFY = "modify",
|
|
38
|
+
NOOP = "noop"
|
|
39
|
+
}
|
|
40
|
+
export interface PlanResponseData {
|
|
41
|
+
planId: string;
|
|
42
|
+
operation: ResourceOperation;
|
|
43
|
+
resourceName?: string;
|
|
44
|
+
resourceType: string;
|
|
45
|
+
parameters: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
operation: ParameterOperation;
|
|
48
|
+
previousValue: string | null;
|
|
49
|
+
newValue: string | null;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
export interface ApplyRequestData {
|
|
53
|
+
planId: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterOperation = exports.ResourceOperation = exports.MessageStatus = void 0;
|
|
4
|
+
var MessageStatus;
|
|
5
|
+
(function (MessageStatus) {
|
|
6
|
+
MessageStatus["SUCCESS"] = "success";
|
|
7
|
+
MessageStatus["ERROR"] = "error";
|
|
8
|
+
})(MessageStatus || (exports.MessageStatus = MessageStatus = {}));
|
|
9
|
+
var ResourceOperation;
|
|
10
|
+
(function (ResourceOperation) {
|
|
11
|
+
ResourceOperation["CREATE"] = "create";
|
|
12
|
+
ResourceOperation["DESTROY"] = "destroy";
|
|
13
|
+
ResourceOperation["MODIFY"] = "modify";
|
|
14
|
+
ResourceOperation["RECREATE"] = "recreate";
|
|
15
|
+
ResourceOperation["NOOP"] = "noop";
|
|
16
|
+
})(ResourceOperation || (exports.ResourceOperation = ResourceOperation = {}));
|
|
17
|
+
var ParameterOperation;
|
|
18
|
+
(function (ParameterOperation) {
|
|
19
|
+
ParameterOperation["ADD"] = "add";
|
|
20
|
+
ParameterOperation["REMOVE"] = "remove";
|
|
21
|
+
ParameterOperation["MODIFY"] = "modify";
|
|
22
|
+
ParameterOperation["NOOP"] = "noop";
|
|
23
|
+
})(ParameterOperation || (exports.ParameterOperation = ParameterOperation = {}));
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAaA,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAgBD,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,iCAAjB,iBAAiB,QAM5B;AAED,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B"}
|