codify-schemas 1.0.84 → 1.0.86-beta1
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 +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/messages/apply-request-data-schema.json +1 -2
- package/dist/messages/command-request-data-schema.json +34 -0
- package/dist/messages/command-response-data-schema.json +22 -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/validate-request-data-schema.json +1 -2
- package/dist/messages/validate-response-data-schema.json +1 -2
- package/dist/types/index.d.ts +15 -4
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/messages/apply-request-data-schema.json +1 -2
- package/src/messages/{sudo-request-data-schema.json → command-request-data-schema.json} +7 -3
- package/src/messages/{sudo-request-data-schema.test.ts → command-request-data-schema.test.ts} +6 -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/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/validate-request-data-schema.json +1 -2
- package/src/messages/validate-response-data-schema.json +1 -2
- package/src/types/index.ts +17 -4
package/dist/index.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
18
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json';
|
|
19
19
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json';
|
|
20
20
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json';
|
|
21
|
-
import SudoRequestDataSchema from './messages/
|
|
22
|
-
import SudoRequestResponseDataSchema from './messages/
|
|
21
|
+
import SudoRequestDataSchema from './messages/command-request-data-schema.json';
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json';
|
|
23
23
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json';
|
|
24
24
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json';
|
|
25
25
|
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, PressKeyToContinueRequestDataSchema, PressKeyToContinueResponseDataSchema, };
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
18
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' with { type: 'json' };
|
|
19
19
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' with { type: 'json' };
|
|
20
20
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with { type: 'json' };
|
|
21
|
-
import SudoRequestDataSchema from './messages/
|
|
22
|
-
import SudoRequestResponseDataSchema from './messages/
|
|
21
|
+
import SudoRequestDataSchema from './messages/command-request-data-schema.json' with { type: 'json' };
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json' with { type: 'json' };
|
|
23
23
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json' with { type: 'json' };
|
|
24
24
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with { type: 'json' };
|
|
25
25
|
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, PressKeyToContinueRequestDataSchema, PressKeyToContinueResponseDataSchema, };
|
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,MAAM,EAAC,CAAA;AAC5E,OAAO,aAAa,MAAM,uBAAuB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACrE,OAAO,cAAc,MAAM,wBAAwB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACvE,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAC5E,OAAO,kBAAkB,MAAM,8BAA8B,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACjF,OAAO,sBAAsB,MAAM,2CAA2C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAClG,OAAO,uBAAuB,MAAM,4CAA4C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACpG,OAAO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EAAC,CAAA;AAC1G,OAAO,2BAA2B,MAAM,gDAAgD,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAC5G,OAAO,4BAA4B,MAAM,iDAAiD,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAC9G,OAAO,qBAAqB,MAAM,6CAA6C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AACpG,OAAO,6BAA6B,MAAM,8CAA8C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC7G,OAAO,mCAAmC,MAAM,2DAA2D,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAChI,OAAO,oCAAoC,MAAM,4DAA4D,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAElI,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,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,qBAAqB,EACrB,6BAA6B,EAC7B,mCAAmC,EACnC,oCAAoC,GACrC,CAAA;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/sudo-request.json",
|
|
4
|
+
"title": "Command request",
|
|
5
|
+
"description": "Request the core CLI to perform a command. This is required for sudo and interactive",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"command": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The command that is requesting sudo"
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"enum": ["sudo", "interactive"],
|
|
14
|
+
"description": "The request type. Right now only sudo and interactive are supported"
|
|
15
|
+
},
|
|
16
|
+
"options": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"description": "The options for codifySpawn that is needed to run the command",
|
|
19
|
+
"properties": {
|
|
20
|
+
"cwd": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Current working directory to run codifySpawn in"
|
|
23
|
+
},
|
|
24
|
+
"argv0": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Arguments to pass in"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"additionalProperties": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["command", "type"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/sudo-request-response.json",
|
|
4
|
+
"title": "Sudo request response",
|
|
5
|
+
"description": "Response for a request to run a command on the base CLI (sudo, interactive, etc)",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"status": {
|
|
9
|
+
"enum": ["success", "error"],
|
|
10
|
+
"description": "Reports if the operation was successful"
|
|
11
|
+
},
|
|
12
|
+
"exitCode": {
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"description": "The exit code of running the command"
|
|
15
|
+
},
|
|
16
|
+
"data": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Data returned by the operation"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["status", "exitCode", "data"]
|
|
22
|
+
}
|
|
@@ -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
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export interface GetResourceInfoResponseData {
|
|
|
97
97
|
import?: {
|
|
98
98
|
requiredParameters: string[] | null;
|
|
99
99
|
};
|
|
100
|
-
operatingSystems?:
|
|
100
|
+
operatingSystems?: OS[];
|
|
101
101
|
importAndDestroy?: {
|
|
102
102
|
requiredParameters: string[] | null;
|
|
103
103
|
preventImport?: boolean;
|
|
@@ -149,7 +149,7 @@ export interface ApplyRequestData {
|
|
|
149
149
|
export interface ResourceDefinition {
|
|
150
150
|
type: string;
|
|
151
151
|
dependencies: string[];
|
|
152
|
-
operatingSystems?:
|
|
152
|
+
operatingSystems?: OS[];
|
|
153
153
|
sensitiveParameters?: string[];
|
|
154
154
|
}
|
|
155
155
|
export interface InitializeRequestData {
|
|
@@ -158,14 +158,20 @@ export interface InitializeRequestData {
|
|
|
158
158
|
export interface InitializeResponseData {
|
|
159
159
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
160
160
|
}
|
|
161
|
-
export
|
|
161
|
+
export declare enum CommandRequestType {
|
|
162
|
+
SUDO = "sudo",
|
|
163
|
+
INTERACTIVE = "interactive"
|
|
164
|
+
}
|
|
165
|
+
export interface CommandRequestData {
|
|
162
166
|
command: string;
|
|
167
|
+
type: CommandRequestType;
|
|
163
168
|
options: {
|
|
164
169
|
cwd?: string;
|
|
165
170
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>;
|
|
166
171
|
}
|
|
167
|
-
export interface
|
|
172
|
+
export interface CommandRequestResponseData {
|
|
168
173
|
status: SpawnStatus;
|
|
174
|
+
exitCode: number;
|
|
169
175
|
data: string;
|
|
170
176
|
}
|
|
171
177
|
export interface PressKeyToContinueRequestData {
|
|
@@ -177,3 +183,8 @@ export declare enum SpawnStatus {
|
|
|
177
183
|
SUCCESS = "success",
|
|
178
184
|
ERROR = "error"
|
|
179
185
|
}
|
|
186
|
+
export declare enum OS {
|
|
187
|
+
Darwin = "Darwin",
|
|
188
|
+
Linux = "Linux",
|
|
189
|
+
Windows = "Windows_NT"
|
|
190
|
+
}
|
package/dist/types/index.js
CHANGED
|
@@ -18,9 +18,20 @@ export var ParameterOperation;
|
|
|
18
18
|
ParameterOperation["MODIFY"] = "modify";
|
|
19
19
|
ParameterOperation["NOOP"] = "noop";
|
|
20
20
|
})(ParameterOperation || (ParameterOperation = {}));
|
|
21
|
+
export var CommandRequestType;
|
|
22
|
+
(function (CommandRequestType) {
|
|
23
|
+
CommandRequestType["SUDO"] = "sudo";
|
|
24
|
+
CommandRequestType["INTERACTIVE"] = "interactive";
|
|
25
|
+
})(CommandRequestType || (CommandRequestType = {}));
|
|
21
26
|
export var SpawnStatus;
|
|
22
27
|
(function (SpawnStatus) {
|
|
23
28
|
SpawnStatus["SUCCESS"] = "success";
|
|
24
29
|
SpawnStatus["ERROR"] = "error";
|
|
25
30
|
})(SpawnStatus || (SpawnStatus = {}));
|
|
31
|
+
export var OS;
|
|
32
|
+
(function (OS) {
|
|
33
|
+
OS["Darwin"] = "Darwin";
|
|
34
|
+
OS["Linux"] = "Linux";
|
|
35
|
+
OS["Windows"] = "Windows_NT";
|
|
36
|
+
})(OS || (OS = {}));
|
|
26
37
|
//# sourceMappingURL=index.js.map
|
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;AA6CD,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,w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e,CAAA;IACf,4BAAsB,CAAA;AACxB,CAAC,EAJW,EAAE,KAAF,EAAE,QAIb"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,8 +18,8 @@ import ValidateRequestDataSchema from './messages/validate-request-data-schema.j
|
|
|
18
18
|
import ValidateResponseDataSchema from './messages/validate-response-data-schema.json' with {type: 'json'}
|
|
19
19
|
import InitializeRequestDataSchema from './messages/initialize-request-data-schema.json' with {type: 'json'}
|
|
20
20
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with {type: 'json'}
|
|
21
|
-
import SudoRequestDataSchema from './messages/
|
|
22
|
-
import SudoRequestResponseDataSchema from './messages/
|
|
21
|
+
import SudoRequestDataSchema from './messages/command-request-data-schema.json' with {type: 'json'};
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json' with {type: 'json'};
|
|
23
23
|
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json' with {type: 'json'};
|
|
24
24
|
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with {type: 'json'};
|
|
25
25
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codifycli.com/sudo-request.json",
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "Request
|
|
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": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"description": "The command that is requesting sudo"
|
|
11
11
|
},
|
|
12
|
+
"type": {
|
|
13
|
+
"enum": ["sudo", "interactive"],
|
|
14
|
+
"description": "The request type. Right now only sudo and interactive are supported"
|
|
15
|
+
},
|
|
12
16
|
"options": {
|
|
13
17
|
"type": "object",
|
|
14
18
|
"description": "The options for codifySpawn that is needed to run the command",
|
|
@@ -25,6 +29,6 @@
|
|
|
25
29
|
"additionalProperties": true
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
|
-
"required": ["command"],
|
|
32
|
+
"required": ["command", "type"],
|
|
29
33
|
"additionalProperties": false
|
|
30
34
|
}
|
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,8 @@ 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
|
+
type: 'sudo'
|
|
18
19
|
})).to.be.true;
|
|
19
20
|
})
|
|
20
21
|
|
|
@@ -22,6 +23,7 @@ describe('Get resources response data schema', () => {
|
|
|
22
23
|
const validate = ajv.compile(schema);
|
|
23
24
|
expect(validate({
|
|
24
25
|
command: 'abc def',
|
|
26
|
+
type: 'interactive',
|
|
25
27
|
options: {
|
|
26
28
|
cwd: '.',
|
|
27
29
|
}
|
|
@@ -32,6 +34,7 @@ describe('Get resources response data schema', () => {
|
|
|
32
34
|
const validate = ajv.compile(schema);
|
|
33
35
|
expect(validate({
|
|
34
36
|
command: 'abc def',
|
|
37
|
+
type: 'sudo',
|
|
35
38
|
options: {
|
|
36
39
|
cwd: '.',
|
|
37
40
|
requiresRoot: true,
|
|
@@ -44,6 +47,7 @@ describe('Get resources response data schema', () => {
|
|
|
44
47
|
const validate = ajv.compile(schema);
|
|
45
48
|
expect(validate({
|
|
46
49
|
command: 'abc def',
|
|
50
|
+
type: 'interactive',
|
|
47
51
|
options: {
|
|
48
52
|
cwd: '.',
|
|
49
53
|
},
|
|
@@ -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
|
})
|
|
@@ -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
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -113,7 +113,7 @@ export interface GetResourceInfoResponseData {
|
|
|
113
113
|
import?: {
|
|
114
114
|
requiredParameters: string[] | null;
|
|
115
115
|
},
|
|
116
|
-
operatingSystems?:
|
|
116
|
+
operatingSystems?: OS[];
|
|
117
117
|
importAndDestroy?: {
|
|
118
118
|
requiredParameters: string[] | null;
|
|
119
119
|
preventImport?: boolean;
|
|
@@ -171,7 +171,7 @@ export interface ApplyRequestData {
|
|
|
171
171
|
export interface ResourceDefinition {
|
|
172
172
|
type: string;
|
|
173
173
|
dependencies: string[];
|
|
174
|
-
operatingSystems?:
|
|
174
|
+
operatingSystems?: OS[];
|
|
175
175
|
sensitiveParameters?: string[];
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -183,15 +183,22 @@ export interface InitializeResponseData {
|
|
|
183
183
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
export
|
|
186
|
+
export enum CommandRequestType {
|
|
187
|
+
SUDO = 'sudo',
|
|
188
|
+
INTERACTIVE = 'interactive'
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface CommandRequestData {
|
|
187
192
|
command: string;
|
|
193
|
+
type: CommandRequestType,
|
|
188
194
|
options: {
|
|
189
195
|
cwd?: string;
|
|
190
196
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
export interface
|
|
199
|
+
export interface CommandRequestResponseData {
|
|
194
200
|
status: SpawnStatus,
|
|
201
|
+
exitCode: number;
|
|
195
202
|
data: string;
|
|
196
203
|
}
|
|
197
204
|
|
|
@@ -205,3 +212,9 @@ export enum SpawnStatus {
|
|
|
205
212
|
SUCCESS = 'success',
|
|
206
213
|
ERROR = 'error',
|
|
207
214
|
}
|
|
215
|
+
|
|
216
|
+
export enum OS {
|
|
217
|
+
Darwin = 'Darwin',
|
|
218
|
+
Linux = 'Linux',
|
|
219
|
+
Windows = 'Windows_NT',
|
|
220
|
+
}
|