codify-schemas 1.0.86-beta1 → 1.0.86
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 +2 -1
- package/dist/messages/error-response-data-schema.json +2 -1
- package/dist/messages/initialize-request-data-schema.json +2 -1
- package/dist/messages/plan-request-data-schema.json +1 -0
- package/dist/messages/plan-response-data-schema.json +2 -1
- package/dist/messages/press-key-to-continue-request-data-schema.json +2 -1
- package/dist/messages/press-key-to-continue-response-data-schema.json +3 -2
- package/dist/messages/validate-request-data-schema.json +2 -1
- package/dist/messages/validate-response-data-schema.json +2 -1
- package/dist/types/index.d.ts +2 -8
- package/dist/types/index.js +0 -5
- 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 +2 -1
- package/src/messages/error-response-data-schema.json +2 -1
- package/src/messages/initialize-request-data-schema.json +2 -1
- package/src/messages/plan-request-data-schema.json +1 -0
- package/src/messages/plan-response-data-schema.json +2 -1
- package/src/messages/press-key-to-continue-request-data-schema.json +2 -1
- package/src/messages/press-key-to-continue-response-data-schema.json +3 -2
- package/src/messages/{command-request-data-schema.json → sudo-request-data-schema.json} +3 -7
- package/src/messages/{command-request-data-schema.test.ts → sudo-request-data-schema.test.ts} +2 -6
- package/src/messages/{command-response-data-schema.json → sudo-response-data-schema.json} +3 -6
- package/src/messages/{command-response-data-schema.test.ts → sudo-response-data-schema.test.ts} +1 -3
- package/src/messages/validate-request-data-schema.json +2 -1
- package/src/messages/validate-response-data-schema.json +2 -1
- package/src/types/index.ts +2 -9
- package/dist/messages/command-request-data-schema.json +0 -34
- package/dist/messages/command-response-data-schema.json +0 -22
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/sudo-request-data-schema.json';
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/sudo-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/sudo-request-data-schema.json' with { type: 'json' };
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/sudo-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;A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AE,MAAM,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,0CAA0C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AACjG,OAAO,6BAA6B,MAAM,2CAA2C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC1G,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"}
|
|
@@ -1,8 +1,9 @@
|
|
|
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": "Sudo request response",
|
|
5
5
|
"description": "Response for press key to continue prompt",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"properties": {}
|
|
7
|
+
"properties": {},
|
|
8
|
+
"additionalProperties": false
|
|
8
9
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -158,20 +158,14 @@ export interface InitializeRequestData {
|
|
|
158
158
|
export interface InitializeResponseData {
|
|
159
159
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
160
160
|
}
|
|
161
|
-
export
|
|
162
|
-
SUDO = "sudo",
|
|
163
|
-
INTERACTIVE = "interactive"
|
|
164
|
-
}
|
|
165
|
-
export interface CommandRequestData {
|
|
161
|
+
export interface SudoRequestData {
|
|
166
162
|
command: string;
|
|
167
|
-
type: CommandRequestType;
|
|
168
163
|
options: {
|
|
169
164
|
cwd?: string;
|
|
170
165
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>;
|
|
171
166
|
}
|
|
172
|
-
export interface
|
|
167
|
+
export interface SudoRequestResponseData {
|
|
173
168
|
status: SpawnStatus;
|
|
174
|
-
exitCode: number;
|
|
175
169
|
data: string;
|
|
176
170
|
}
|
|
177
171
|
export interface PressKeyToContinueRequestData {
|
package/dist/types/index.js
CHANGED
|
@@ -18,11 +18,6 @@ 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 = {}));
|
|
26
21
|
export var SpawnStatus;
|
|
27
22
|
(function (SpawnStatus) {
|
|
28
23
|
SpawnStatus["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":"AAsBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EA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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/sudo-request-data-schema.json' with {type: 'json'};
|
|
22
|
+
import SudoRequestResponseDataSchema from './messages/sudo-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,8 +1,9 @@
|
|
|
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": "Sudo request response",
|
|
5
5
|
"description": "Response for press key to continue prompt",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"properties": {}
|
|
7
|
+
"properties": {},
|
|
8
|
+
"additionalProperties": false
|
|
8
9
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
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 the core CLI
|
|
4
|
+
"title": "Sudo request",
|
|
5
|
+
"description": "Request sudo from the core CLI",
|
|
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
|
-
},
|
|
16
12
|
"options": {
|
|
17
13
|
"type": "object",
|
|
18
14
|
"description": "The options for codifySpawn that is needed to run the command",
|
|
@@ -29,6 +25,6 @@
|
|
|
29
25
|
"additionalProperties": true
|
|
30
26
|
}
|
|
31
27
|
},
|
|
32
|
-
"required": ["command"
|
|
28
|
+
"required": ["command"],
|
|
33
29
|
"additionalProperties": false
|
|
34
30
|
}
|
package/src/messages/{command-request-data-schema.test.ts → sudo-request-data-schema.test.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import schema from './
|
|
1
|
+
import schema from './sudo-request-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
3
|
import Ajv from 'ajv'
|
|
4
4
|
|
|
@@ -14,8 +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'
|
|
18
|
-
type: 'sudo'
|
|
17
|
+
command: 'abc def'
|
|
19
18
|
})).to.be.true;
|
|
20
19
|
})
|
|
21
20
|
|
|
@@ -23,7 +22,6 @@ describe('Get resources response data schema', () => {
|
|
|
23
22
|
const validate = ajv.compile(schema);
|
|
24
23
|
expect(validate({
|
|
25
24
|
command: 'abc def',
|
|
26
|
-
type: 'interactive',
|
|
27
25
|
options: {
|
|
28
26
|
cwd: '.',
|
|
29
27
|
}
|
|
@@ -34,7 +32,6 @@ describe('Get resources response data schema', () => {
|
|
|
34
32
|
const validate = ajv.compile(schema);
|
|
35
33
|
expect(validate({
|
|
36
34
|
command: 'abc def',
|
|
37
|
-
type: 'sudo',
|
|
38
35
|
options: {
|
|
39
36
|
cwd: '.',
|
|
40
37
|
requiresRoot: true,
|
|
@@ -47,7 +44,6 @@ describe('Get resources response data schema', () => {
|
|
|
47
44
|
const validate = ajv.compile(schema);
|
|
48
45
|
expect(validate({
|
|
49
46
|
command: 'abc def',
|
|
50
|
-
type: 'interactive',
|
|
51
47
|
options: {
|
|
52
48
|
cwd: '.',
|
|
53
49
|
},
|
|
@@ -2,21 +2,18 @@
|
|
|
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
|
|
5
|
+
"description": "Response for a sudo request",
|
|
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
|
-
},
|
|
16
12
|
"data": {
|
|
17
13
|
"type": "string",
|
|
18
14
|
"description": "Data returned by the operation"
|
|
19
15
|
}
|
|
20
16
|
},
|
|
21
|
-
"required": ["status", "
|
|
17
|
+
"required": ["status", "data"],
|
|
18
|
+
"additionalProperties": false
|
|
22
19
|
}
|
package/src/messages/{command-response-data-schema.test.ts → sudo-response-data-schema.test.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import schema from './
|
|
1
|
+
import schema from './sudo-response-data-schema.json';
|
|
2
2
|
import {describe, expect, it} from 'vitest'
|
|
3
3
|
import Ajv from 'ajv'
|
|
4
4
|
|
|
@@ -15,7 +15,6 @@ describe('Get resources response data schema', () => {
|
|
|
15
15
|
const validate = ajv.compile(schema);
|
|
16
16
|
expect(validate({
|
|
17
17
|
status: 'success',
|
|
18
|
-
exitCode: 0,
|
|
19
18
|
data: 'sudo: was a success'
|
|
20
19
|
})).to.be.true;
|
|
21
20
|
})
|
|
@@ -24,7 +23,6 @@ describe('Get resources response data schema', () => {
|
|
|
24
23
|
const validate = ajv.compile(schema);
|
|
25
24
|
expect(validate({
|
|
26
25
|
status: 'error',
|
|
27
|
-
exitCode: 100,
|
|
28
26
|
data: 'sudo: failed'
|
|
29
27
|
})).to.be.true;
|
|
30
28
|
})
|
package/src/types/index.ts
CHANGED
|
@@ -183,22 +183,15 @@ export interface InitializeResponseData {
|
|
|
183
183
|
resourceDefinitions: Array<ResourceDefinition>;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
export
|
|
187
|
-
SUDO = 'sudo',
|
|
188
|
-
INTERACTIVE = 'interactive'
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export interface CommandRequestData {
|
|
186
|
+
export interface SudoRequestData {
|
|
192
187
|
command: string;
|
|
193
|
-
type: CommandRequestType,
|
|
194
188
|
options: {
|
|
195
189
|
cwd?: string;
|
|
196
190
|
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>
|
|
197
191
|
}
|
|
198
192
|
|
|
199
|
-
export interface
|
|
193
|
+
export interface SudoRequestResponseData {
|
|
200
194
|
status: SpawnStatus,
|
|
201
|
-
exitCode: number;
|
|
202
195
|
data: string;
|
|
203
196
|
}
|
|
204
197
|
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|