codify-schemas 1.0.85 → 1.0.86-beta10
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 +5 -4
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/messages/apply-request-data-schema.json +1 -2
- package/dist/messages/{sudo-request-data-schema.json → command-request-data-schema.json} +15 -3
- package/dist/messages/{sudo-response-data-schema.json → command-response-data-schema.json} +6 -3
- package/dist/messages/commands.d.ts +1 -1
- package/dist/messages/commands.js +1 -1
- package/dist/messages/commands.js.map +1 -1
- package/dist/messages/empty-response-data-schema.json +7 -0
- package/dist/messages/error-response-data-schema.json +1 -2
- package/dist/messages/initialize-request-data-schema.json +1 -2
- package/dist/messages/plan-request-data-schema.json +0 -1
- package/dist/messages/plan-response-data-schema.json +1 -2
- package/dist/messages/press-key-to-continue-request-data-schema.json +1 -2
- package/dist/messages/press-key-to-continue-response-data-schema.json +2 -3
- package/dist/messages/set-verbosity-request-data-schema.json +14 -0
- package/dist/messages/validate-request-data-schema.json +1 -2
- package/dist/messages/validate-response-data-schema.json +1 -2
- package/dist/resource-schema.json +7 -0
- package/dist/types/index.d.ts +21 -6
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +8 -6
- package/src/messages/apply-request-data-schema.json +1 -2
- package/src/messages/{sudo-request-data-schema.json → command-request-data-schema.json} +15 -3
- package/src/messages/{sudo-request-data-schema.test.ts → command-request-data-schema.test.ts} +4 -2
- package/src/messages/{sudo-response-data-schema.json → command-response-data-schema.json} +6 -3
- package/src/messages/{sudo-response-data-schema.test.ts → command-response-data-schema.test.ts} +3 -1
- package/src/messages/commands.ts +1 -1
- package/src/messages/empty-response-data-schema.json +7 -0
- package/src/messages/{apply-response-data-schema.test.ts → empty-response-data-schema.test.ts} +4 -7
- package/src/messages/error-response-data-schema.json +1 -2
- package/src/messages/initialize-request-data-schema.json +1 -2
- package/src/messages/plan-request-data-schema.json +0 -1
- package/src/messages/plan-response-data-schema.json +1 -2
- package/src/messages/press-key-to-continue-request-data-schema.json +1 -2
- package/src/messages/press-key-to-continue-response-data-schema.json +2 -3
- package/src/messages/set-verbosity-request-data-schema.json +14 -0
- package/src/messages/set-verbosity-request-data-schema.test.ts +20 -0
- package/src/messages/validate-request-data-schema.json +1 -2
- package/src/messages/validate-response-data-schema.json +1 -2
- package/src/resource-schema.json +7 -0
- package/src/resource-schema.test.ts +8 -0
- package/src/types/index.ts +23 -6
- package/tsconfig.json +1 -0
- package/src/messages/apply-response-data-schema.json +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import ResourceSchema from './resource-schema.json';
|
|
|
4
4
|
import IpcMessageSchema from './ipc-message-schema.json';
|
|
5
5
|
import IpcMessageV2Schema from './ipc-message-schema-v2.json';
|
|
6
6
|
import ApplyRequestDataSchema from './messages/apply-request-data-schema.json';
|
|
7
|
-
import ApplyResponseDataSchema from './messages/apply-response-data-schema.json';
|
|
8
7
|
import ErrorResponseDataSchema from './messages/error-response-data-schema.json';
|
|
9
8
|
import GetResourceInfoRequestDataSchema from './messages/get-resource-info-request-data-schema.json';
|
|
10
9
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json';
|
|
@@ -18,10 +17,12 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
17
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json';
|
|
19
18
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json';
|
|
20
19
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
20
|
+
import CommandRequestDataSchema from './messages/command-request-data-schema.json';
|
|
21
|
+
import CommandRequestResponseDataSchema from './messages/command-response-data-schema.json';
|
|
23
22
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json';
|
|
24
23
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json';
|
|
25
|
-
|
|
24
|
+
import SetVerbosityRequestDataSchema from './messages/set-verbosity-request-data-schema.json';
|
|
25
|
+
import EmptyResponseDataSchema from './messages/empty-response-data-schema.json';
|
|
26
|
+
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, CommandRequestDataSchema, CommandRequestResponseDataSchema, PressKeyToContinueRequestDataSchema, PressKeyToContinueResponseDataSchema, SetVerbosityRequestDataSchema, EmptyResponseDataSchema, };
|
|
26
27
|
export * from './types/index.js';
|
|
27
28
|
export * from './messages/commands.js';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import ResourceSchema from './resource-schema.json' with { type: 'json' };
|
|
|
4
4
|
import IpcMessageSchema from './ipc-message-schema.json' with { type: 'json' };
|
|
5
5
|
import IpcMessageV2Schema from './ipc-message-schema-v2.json' with { type: 'json' };
|
|
6
6
|
import ApplyRequestDataSchema from './messages/apply-request-data-schema.json' with { type: 'json' };
|
|
7
|
-
import ApplyResponseDataSchema from './messages/apply-response-data-schema.json' with { type: 'json' };
|
|
8
7
|
import ErrorResponseDataSchema from './messages/error-response-data-schema.json' with { type: 'json' };
|
|
9
8
|
import GetResourceInfoRequestDataSchema from './messages/get-resource-info-request-data-schema.json' with { type: 'json' };
|
|
10
9
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json' with { type: 'json' };
|
|
@@ -18,11 +17,13 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
17
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' with { type: 'json' };
|
|
19
18
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' with { type: 'json' };
|
|
20
19
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with { type: 'json' };
|
|
21
|
-
import
|
|
22
|
-
import
|
|
20
|
+
import CommandRequestDataSchema from './messages/command-request-data-schema.json' with { type: 'json' };
|
|
21
|
+
import CommandRequestResponseDataSchema from './messages/command-response-data-schema.json' with { type: 'json' };
|
|
23
22
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json' with { type: 'json' };
|
|
24
23
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with { type: 'json' };
|
|
25
|
-
|
|
24
|
+
import SetVerbosityRequestDataSchema from './messages/set-verbosity-request-data-schema.json' with { type: 'json' };
|
|
25
|
+
import EmptyResponseDataSchema from './messages/empty-response-data-schema.json' with { type: 'json' };
|
|
26
|
+
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, CommandRequestDataSchema, CommandRequestResponseDataSchema, PressKeyToContinueRequestDataSchema, PressKeyToContinueResponseDataSchema, SetVerbosityRequestDataSchema, EmptyResponseDataSchema, };
|
|
26
27
|
export * from './types/index.js';
|
|
27
28
|
export * from './messages/commands.js';
|
|
28
29
|
//# 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":"AAAA,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAM,IAAI,EAAE,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AAE,MAAM,EAAC,CAAC;AAErG,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,iCAAiC,EACjC,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,gCAAgC,EAChC,mCAAmC,EACnC,oCAAoC,EACpC,6BAA6B,EAC7B,uBAAuB,GACxB,CAAA;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://www.codifycli.com/
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "Request
|
|
3
|
+
"$id": "https://www.codifycli.com/command-request.json",
|
|
4
|
+
"title": "Command request",
|
|
5
|
+
"description": "Request the core CLI to perform a command. This is required for sudo and interactive",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"command": {
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"argv0": {
|
|
21
21
|
"type": "string",
|
|
22
22
|
"description": "Arguments to pass in"
|
|
23
|
+
},
|
|
24
|
+
"requiresRoot": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "Whether or not this command needs to be run in root"
|
|
27
|
+
},
|
|
28
|
+
"interactive": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Whether or not this command needs to be run in interactive mode"
|
|
31
|
+
},
|
|
32
|
+
"stdin": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "Whether or not this command requires stdin"
|
|
23
35
|
}
|
|
24
36
|
},
|
|
25
37
|
"additionalProperties": true
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/sudo-request-response.json",
|
|
4
4
|
"title": "Sudo request response",
|
|
5
|
-
"description": "Response for a sudo
|
|
5
|
+
"description": "Response for a request to run a command on the base CLI (sudo, interactive, etc)",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"status": {
|
|
9
9
|
"enum": ["success", "error"],
|
|
10
10
|
"description": "Reports if the operation was successful"
|
|
11
11
|
},
|
|
12
|
+
"exitCode": {
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"description": "The exit code of running the command"
|
|
15
|
+
},
|
|
12
16
|
"data": {
|
|
13
17
|
"type": "string",
|
|
14
18
|
"description": "Data returned by the operation"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
|
-
"required": ["status", "data"]
|
|
18
|
-
"additionalProperties": false
|
|
21
|
+
"required": ["status", "exitCode", "data"]
|
|
19
22
|
}
|
|
@@ -3,7 +3,7 @@ export declare enum MessageCmd {
|
|
|
3
3
|
VALIDATE = "validate",
|
|
4
4
|
PLAN = "plan",
|
|
5
5
|
APPLY = "apply",
|
|
6
|
-
|
|
6
|
+
COMMAND_REQUEST = "command_request",
|
|
7
7
|
PRESS_KEY_TO_CONTINUE_REQUEST = "press_key_to_continue_request",
|
|
8
8
|
CODIFY_CREDENTIALS_REQUEST = "codify_credentials_request"
|
|
9
9
|
}
|
|
@@ -4,7 +4,7 @@ export var MessageCmd;
|
|
|
4
4
|
MessageCmd["VALIDATE"] = "validate";
|
|
5
5
|
MessageCmd["PLAN"] = "plan";
|
|
6
6
|
MessageCmd["APPLY"] = "apply";
|
|
7
|
-
MessageCmd["
|
|
7
|
+
MessageCmd["COMMAND_REQUEST"] = "command_request";
|
|
8
8
|
MessageCmd["PRESS_KEY_TO_CONTINUE_REQUEST"] = "press_key_to_continue_request";
|
|
9
9
|
MessageCmd["CODIFY_CREDENTIALS_REQUEST"] = "codify_credentials_request";
|
|
10
10
|
})(MessageCmd || (MessageCmd = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/messages/commands.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,uCAAyB,CAAA;IACzB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/messages/commands.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,uCAAyB,CAAA;IACzB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,iDAAmC,CAAA;IACnC,6EAA+D,CAAA;IAC/D,uEAAyD,CAAA;AAC3D,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/sudo-request-response.json",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Press key to continue response",
|
|
5
5
|
"description": "Response for press key to continue prompt",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"properties": {}
|
|
8
|
-
"additionalProperties": false
|
|
7
|
+
"properties": {}
|
|
9
8
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/set-verbosity-request.json",
|
|
4
|
+
"title": "Set Verbosity Request",
|
|
5
|
+
"description": "Request the plugin to set its verbosity level",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"verbosityLevel": {
|
|
9
|
+
"type": "number",
|
|
10
|
+
"description": "The verbosity level to set for the plugin"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
"type": "string",
|
|
10
10
|
"pattern": "^[a-zA-Z][\\w-]+$"
|
|
11
11
|
},
|
|
12
|
+
"os": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"enum": ["linux", "macOS", "windows"]
|
|
16
|
+
},
|
|
17
|
+
"uniqueItems": true
|
|
18
|
+
},
|
|
12
19
|
"name": {
|
|
13
20
|
"description": "Optional name. Useful for specifying multiple resources of the same type",
|
|
14
21
|
"type": "string",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SpawnOptions } from "node:child_process";
|
|
2
|
-
import { ErrorObject } from "ajv";
|
|
1
|
+
import type { SpawnOptions } from "node:child_process";
|
|
2
|
+
import type { ErrorObject } from "ajv";
|
|
3
3
|
export interface StringIndexedObject {
|
|
4
4
|
[x: string]: unknown;
|
|
5
5
|
}
|
|
@@ -11,9 +11,15 @@ export interface ProjectConfig extends Config {
|
|
|
11
11
|
plugins?: Record<string, string>;
|
|
12
12
|
description?: string;
|
|
13
13
|
}
|
|
14
|
+
export declare enum ResourceOs {
|
|
15
|
+
LINUX = "linux",
|
|
16
|
+
MACOS = "macOS",
|
|
17
|
+
WINDOWS = "windows"
|
|
18
|
+
}
|
|
14
19
|
export interface ResourceConfig extends Config {
|
|
15
20
|
name?: string;
|
|
16
21
|
dependsOn?: string[];
|
|
22
|
+
os?: Array<ResourceOs>;
|
|
17
23
|
}
|
|
18
24
|
export declare enum MessageStatus {
|
|
19
25
|
SUCCESS = "success",
|
|
@@ -97,7 +103,7 @@ export interface GetResourceInfoResponseData {
|
|
|
97
103
|
import?: {
|
|
98
104
|
requiredParameters: string[] | null;
|
|
99
105
|
};
|
|
100
|
-
operatingSystems?: OS;
|
|
106
|
+
operatingSystems?: OS[];
|
|
101
107
|
importAndDestroy?: {
|
|
102
108
|
requiredParameters: string[] | null;
|
|
103
109
|
preventImport?: boolean;
|
|
@@ -149,7 +155,7 @@ export interface ApplyRequestData {
|
|
|
149
155
|
export interface ResourceDefinition {
|
|
150
156
|
type: string;
|
|
151
157
|
dependencies: string[];
|
|
152
|
-
operatingSystems?: OS;
|
|
158
|
+
operatingSystems?: OS[];
|
|
153
159
|
sensitiveParameters?: string[];
|
|
154
160
|
}
|
|
155
161
|
export interface InitializeRequestData {
|
|
@@ -158,14 +164,18 @@ export interface InitializeRequestData {
|
|
|
158
164
|
export interface InitializeResponseData {
|
|
159
165
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
160
166
|
}
|
|
161
|
-
export interface
|
|
167
|
+
export interface CommandRequestData {
|
|
162
168
|
command: string;
|
|
163
169
|
options: {
|
|
164
170
|
cwd?: string;
|
|
171
|
+
interactive?: boolean;
|
|
172
|
+
requiresRoot?: boolean;
|
|
173
|
+
stdin?: boolean;
|
|
165
174
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>;
|
|
166
175
|
}
|
|
167
|
-
export interface
|
|
176
|
+
export interface CommandRequestResponseData {
|
|
168
177
|
status: SpawnStatus;
|
|
178
|
+
exitCode: number;
|
|
169
179
|
data: string;
|
|
170
180
|
}
|
|
171
181
|
export interface PressKeyToContinueRequestData {
|
|
@@ -173,6 +183,11 @@ export interface PressKeyToContinueRequestData {
|
|
|
173
183
|
}
|
|
174
184
|
export interface PressKeyToContinueResponseData {
|
|
175
185
|
}
|
|
186
|
+
export interface SetVerbosityRequestData {
|
|
187
|
+
verbosityLevel: number;
|
|
188
|
+
}
|
|
189
|
+
export interface EmptyResponseData {
|
|
190
|
+
}
|
|
176
191
|
export declare enum SpawnStatus {
|
|
177
192
|
SUCCESS = "success",
|
|
178
193
|
ERROR = "error"
|
package/dist/types/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export var ResourceOs;
|
|
2
|
+
(function (ResourceOs) {
|
|
3
|
+
ResourceOs["LINUX"] = "linux";
|
|
4
|
+
ResourceOs["MACOS"] = "macOS";
|
|
5
|
+
ResourceOs["WINDOWS"] = "windows";
|
|
6
|
+
})(ResourceOs || (ResourceOs = {}));
|
|
1
7
|
export var MessageStatus;
|
|
2
8
|
(function (MessageStatus) {
|
|
3
9
|
MessageStatus["SUCCESS"] = "success";
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,6BAAe,CAAA;IACf,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAQD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AA6CD,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;AAkID,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,MAAM,CAAN,IAAY,EAIX;AAJD,WAAY,EAAE;IACZ,uBAAiB,CAAA;IACjB,qBAAe,CAAA;IACf,4BAAsB,CAAA;AACxB,CAAC,EAJW,EAAE,KAAF,EAAE,QAIb"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ import ResourceSchema from './resource-schema.json' with {type: 'json'}
|
|
|
4
4
|
import IpcMessageSchema from './ipc-message-schema.json' with {type: 'json'}
|
|
5
5
|
import IpcMessageV2Schema from './ipc-message-schema-v2.json' with {type: 'json'}
|
|
6
6
|
import ApplyRequestDataSchema from './messages/apply-request-data-schema.json' with {type: 'json'}
|
|
7
|
-
import ApplyResponseDataSchema from './messages/apply-response-data-schema.json' with {type: 'json'}
|
|
8
7
|
import ErrorResponseDataSchema from './messages/error-response-data-schema.json' with {type: 'json'}
|
|
9
8
|
import GetResourceInfoRequestDataSchema from './messages/get-resource-info-request-data-schema.json' with {type: 'json'}
|
|
10
9
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json' with {type: 'json'}
|
|
@@ -18,10 +17,12 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
17
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' with {type: 'json'}
|
|
19
18
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' with {type: 'json'}
|
|
20
19
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with {type: 'json'}
|
|
21
|
-
import
|
|
22
|
-
import
|
|
20
|
+
import CommandRequestDataSchema from './messages/command-request-data-schema.json' with {type: 'json'};
|
|
21
|
+
import CommandRequestResponseDataSchema from './messages/command-response-data-schema.json' with {type: 'json'};
|
|
23
22
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json' with {type: 'json'};
|
|
24
23
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with {type: 'json'};
|
|
24
|
+
import SetVerbosityRequestDataSchema from './messages/set-verbosity-request-data-schema.json' with {type: 'json'};
|
|
25
|
+
import EmptyResponseDataSchema from './messages/empty-response-data-schema.json' with {type: 'json'};
|
|
25
26
|
|
|
26
27
|
export {
|
|
27
28
|
ConfigFileSchema,
|
|
@@ -30,7 +31,6 @@ export {
|
|
|
30
31
|
IpcMessageSchema,
|
|
31
32
|
IpcMessageV2Schema,
|
|
32
33
|
ApplyRequestDataSchema,
|
|
33
|
-
ApplyResponseDataSchema,
|
|
34
34
|
ErrorResponseDataSchema,
|
|
35
35
|
GetResourceInfoRequestDataSchema,
|
|
36
36
|
GetResourceInfoResponseDataSchema,
|
|
@@ -44,10 +44,12 @@ export {
|
|
|
44
44
|
ValidateResponseDataSchema,
|
|
45
45
|
InitializeRequestDataSchema,
|
|
46
46
|
InitializeResponseDataSchema,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
CommandRequestDataSchema,
|
|
48
|
+
CommandRequestResponseDataSchema,
|
|
49
49
|
PressKeyToContinueRequestDataSchema,
|
|
50
50
|
PressKeyToContinueResponseDataSchema,
|
|
51
|
+
SetVerbosityRequestDataSchema,
|
|
52
|
+
EmptyResponseDataSchema,
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export * from './types/index.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://www.codifycli.com/
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "Request
|
|
3
|
+
"$id": "https://www.codifycli.com/command-request.json",
|
|
4
|
+
"title": "Command request",
|
|
5
|
+
"description": "Request the core CLI to perform a command. This is required for sudo and interactive",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"command": {
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"argv0": {
|
|
21
21
|
"type": "string",
|
|
22
22
|
"description": "Arguments to pass in"
|
|
23
|
+
},
|
|
24
|
+
"requiresRoot": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "Whether or not this command needs to be run in root"
|
|
27
|
+
},
|
|
28
|
+
"interactive": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Whether or not this command needs to be run in interactive mode"
|
|
31
|
+
},
|
|
32
|
+
"stdin": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "Whether or not this command requires stdin"
|
|
23
35
|
}
|
|
24
36
|
},
|
|
25
37
|
"additionalProperties": true
|
package/src/messages/{sudo-request-data-schema.test.ts → command-request-data-schema.test.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import schema from './
|
|
1
|
+
import schema from './command-request-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
3
|
import Ajv from 'ajv'
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ describe('Get resources response data schema', () => {
|
|
|
14
14
|
it("Passes a command in the body", () => {
|
|
15
15
|
const validate = ajv.compile(schema);
|
|
16
16
|
expect(validate({
|
|
17
|
-
command: 'abc def'
|
|
17
|
+
command: 'abc def',
|
|
18
18
|
})).to.be.true;
|
|
19
19
|
})
|
|
20
20
|
|
|
@@ -24,6 +24,7 @@ describe('Get resources response data schema', () => {
|
|
|
24
24
|
command: 'abc def',
|
|
25
25
|
options: {
|
|
26
26
|
cwd: '.',
|
|
27
|
+
interactive: true,
|
|
27
28
|
}
|
|
28
29
|
})).to.be.true;
|
|
29
30
|
})
|
|
@@ -46,6 +47,7 @@ describe('Get resources response data schema', () => {
|
|
|
46
47
|
command: 'abc def',
|
|
47
48
|
options: {
|
|
48
49
|
cwd: '.',
|
|
50
|
+
requiresRoot: true,
|
|
49
51
|
},
|
|
50
52
|
additional: {}
|
|
51
53
|
})).to.be.false;
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/sudo-request-response.json",
|
|
4
4
|
"title": "Sudo request response",
|
|
5
|
-
"description": "Response for a sudo
|
|
5
|
+
"description": "Response for a request to run a command on the base CLI (sudo, interactive, etc)",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"status": {
|
|
9
9
|
"enum": ["success", "error"],
|
|
10
10
|
"description": "Reports if the operation was successful"
|
|
11
11
|
},
|
|
12
|
+
"exitCode": {
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"description": "The exit code of running the command"
|
|
15
|
+
},
|
|
12
16
|
"data": {
|
|
13
17
|
"type": "string",
|
|
14
18
|
"description": "Data returned by the operation"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
|
-
"required": ["status", "data"]
|
|
18
|
-
"additionalProperties": false
|
|
21
|
+
"required": ["status", "exitCode", "data"]
|
|
19
22
|
}
|
package/src/messages/{sudo-response-data-schema.test.ts → command-response-data-schema.test.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import schema from './
|
|
1
|
+
import schema from './command-response-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
3
|
import Ajv from 'ajv'
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ describe('Get resources response data schema', () => {
|
|
|
15
15
|
const validate = ajv.compile(schema);
|
|
16
16
|
expect(validate({
|
|
17
17
|
status: 'success',
|
|
18
|
+
exitCode: 0,
|
|
18
19
|
data: 'sudo: was a success'
|
|
19
20
|
})).to.be.true;
|
|
20
21
|
})
|
|
@@ -23,6 +24,7 @@ describe('Get resources response data schema', () => {
|
|
|
23
24
|
const validate = ajv.compile(schema);
|
|
24
25
|
expect(validate({
|
|
25
26
|
status: 'error',
|
|
27
|
+
exitCode: 100,
|
|
26
28
|
data: 'sudo: failed'
|
|
27
29
|
})).to.be.true;
|
|
28
30
|
})
|
package/src/messages/commands.ts
CHANGED
|
@@ -3,7 +3,7 @@ export enum MessageCmd {
|
|
|
3
3
|
VALIDATE = 'validate',
|
|
4
4
|
PLAN = 'plan',
|
|
5
5
|
APPLY = 'apply',
|
|
6
|
-
|
|
6
|
+
COMMAND_REQUEST = 'command_request',
|
|
7
7
|
PRESS_KEY_TO_CONTINUE_REQUEST = 'press_key_to_continue_request',
|
|
8
8
|
CODIFY_CREDENTIALS_REQUEST = 'codify_credentials_request'
|
|
9
9
|
}
|
package/src/messages/{apply-response-data-schema.test.ts → empty-response-data-schema.test.ts}
RENAMED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import schema from './
|
|
1
|
+
import schema from './empty-response-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
|
-
import
|
|
4
|
-
import Ajv from 'ajv';
|
|
3
|
+
import Ajv from 'ajv'
|
|
5
4
|
|
|
6
5
|
const ajv = new Ajv({
|
|
7
6
|
strict: true,
|
|
8
7
|
})
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
describe('Apply request data schema', () => {
|
|
9
|
+
describe('Empty Response Data Schema', () => {
|
|
13
10
|
it('compiles', () => {
|
|
14
11
|
ajv.compile(schema);
|
|
15
12
|
})
|
|
16
13
|
|
|
17
|
-
it("
|
|
14
|
+
it("Only empty object", () => {
|
|
18
15
|
const validate = ajv.compile(schema);
|
|
19
16
|
expect(validate(null)).to.be.true;
|
|
20
17
|
})
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/sudo-request-response.json",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Press key to continue response",
|
|
5
5
|
"description": "Response for press key to continue prompt",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"properties": {}
|
|
8
|
-
"additionalProperties": false
|
|
7
|
+
"properties": {}
|
|
9
8
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/set-verbosity-request.json",
|
|
4
|
+
"title": "Set Verbosity Request",
|
|
5
|
+
"description": "Request the plugin to set its verbosity level",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"verbosityLevel": {
|
|
9
|
+
"type": "number",
|
|
10
|
+
"description": "The verbosity level to set for the plugin"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import schema from './set-verbosity-request-data-schema.json';
|
|
2
|
+
import {describe, expect, it} from 'vitest'
|
|
3
|
+
import Ajv from 'ajv'
|
|
4
|
+
|
|
5
|
+
const ajv = new Ajv({
|
|
6
|
+
strict: true,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
describe('Set Verbosity Request Data Schema', () => {
|
|
10
|
+
it('compiles', () => {
|
|
11
|
+
ajv.compile(schema);
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it("Sets a verbosity level", () => {
|
|
15
|
+
const validate = ajv.compile(schema);
|
|
16
|
+
expect(validate({
|
|
17
|
+
verbosityLevel: 2,
|
|
18
|
+
})).to.be.true;
|
|
19
|
+
})
|
|
20
|
+
})
|
package/src/resource-schema.json
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
"type": "string",
|
|
10
10
|
"pattern": "^[a-zA-Z][\\w-]+$"
|
|
11
11
|
},
|
|
12
|
+
"os": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"enum": ["linux", "macOS", "windows"]
|
|
16
|
+
},
|
|
17
|
+
"uniqueItems": true
|
|
18
|
+
},
|
|
12
19
|
"name": {
|
|
13
20
|
"description": "Optional name. Useful for specifying multiple resources of the same type",
|
|
14
21
|
"type": "string",
|
|
@@ -36,4 +36,12 @@ describe("Resource schema tests", () => {
|
|
|
36
36
|
expect(validate({ type: "type", dependsOn: "item1" })).to.be.false;
|
|
37
37
|
expect(validate({ type: "type", dependsOn: [6] })).to.be.false;
|
|
38
38
|
})
|
|
39
|
+
|
|
40
|
+
it("os supports linux, macOS, and windows", () => {
|
|
41
|
+
const validate = ajv.compile(schema);
|
|
42
|
+
expect(validate({ type: "type", os: ["macOS", "windows", "linux"] })).to.be.true;
|
|
43
|
+
expect(validate({ type: "type", os: ["item1", "item1"] })).to.be.false;
|
|
44
|
+
expect(validate({ type: "type", os: ["macOS"] })).to.be.true;
|
|
45
|
+
expect(validate({ type: "type", os: ["macOS", "macOS"] })).to.be.false;
|
|
46
|
+
})
|
|
39
47
|
});
|
package/src/types/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type {SpawnOptions} from "node:child_process";
|
|
2
|
+
import type {ErrorObject} from "ajv";
|
|
3
3
|
|
|
4
4
|
export interface StringIndexedObject {
|
|
5
5
|
[x: string]: unknown;
|
|
@@ -15,9 +15,16 @@ export interface ProjectConfig extends Config {
|
|
|
15
15
|
description?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export enum ResourceOs {
|
|
19
|
+
LINUX = 'linux',
|
|
20
|
+
MACOS = 'macOS',
|
|
21
|
+
WINDOWS = 'windows',
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export interface ResourceConfig extends Config {
|
|
19
25
|
name?: string;
|
|
20
26
|
dependsOn?: string[];
|
|
27
|
+
os?: Array<ResourceOs>;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
export enum MessageStatus {
|
|
@@ -113,7 +120,7 @@ export interface GetResourceInfoResponseData {
|
|
|
113
120
|
import?: {
|
|
114
121
|
requiredParameters: string[] | null;
|
|
115
122
|
},
|
|
116
|
-
operatingSystems?: OS;
|
|
123
|
+
operatingSystems?: OS[];
|
|
117
124
|
importAndDestroy?: {
|
|
118
125
|
requiredParameters: string[] | null;
|
|
119
126
|
preventImport?: boolean;
|
|
@@ -171,7 +178,7 @@ export interface ApplyRequestData {
|
|
|
171
178
|
export interface ResourceDefinition {
|
|
172
179
|
type: string;
|
|
173
180
|
dependencies: string[];
|
|
174
|
-
operatingSystems?: OS;
|
|
181
|
+
operatingSystems?: OS[];
|
|
175
182
|
sensitiveParameters?: string[];
|
|
176
183
|
}
|
|
177
184
|
|
|
@@ -183,15 +190,19 @@ export interface InitializeResponseData {
|
|
|
183
190
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
184
191
|
}
|
|
185
192
|
|
|
186
|
-
export interface
|
|
193
|
+
export interface CommandRequestData {
|
|
187
194
|
command: string;
|
|
188
195
|
options: {
|
|
189
196
|
cwd?: string;
|
|
197
|
+
interactive?: boolean;
|
|
198
|
+
requiresRoot?: boolean;
|
|
199
|
+
stdin?: boolean;
|
|
190
200
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>
|
|
191
201
|
}
|
|
192
202
|
|
|
193
|
-
export interface
|
|
203
|
+
export interface CommandRequestResponseData {
|
|
194
204
|
status: SpawnStatus,
|
|
205
|
+
exitCode: number;
|
|
195
206
|
data: string;
|
|
196
207
|
}
|
|
197
208
|
|
|
@@ -201,6 +212,12 @@ export interface PressKeyToContinueRequestData {
|
|
|
201
212
|
|
|
202
213
|
export interface PressKeyToContinueResponseData {}
|
|
203
214
|
|
|
215
|
+
export interface SetVerbosityRequestData {
|
|
216
|
+
verbosityLevel: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface EmptyResponseData {}
|
|
220
|
+
|
|
204
221
|
export enum SpawnStatus {
|
|
205
222
|
SUCCESS = 'success',
|
|
206
223
|
ERROR = 'error',
|
package/tsconfig.json
CHANGED