codify-schemas 1.0.86-beta1 → 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 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 SudoRequestDataSchema from './messages/command-request-data-schema.json';
22
- import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json';
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
- 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, };
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 SudoRequestDataSchema from './messages/command-request-data-schema.json' with { type: 'json' };
22
- import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json' with { type: 'json' };
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
- 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, };
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,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,uBAAuB,MAAM,4CAA4C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACpG,OAAO,gCAAgC,MAAM,uDAAuD,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACxH,OAAO,iCAAiC,MAAM,wDAAwD,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAC1H,OAAO,uBAAuB,MAAM,4CAA4C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACpG,OAAO,wBAAwB,MAAM,6CAA6C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACtG,OAAO,sBAAsB,MAAM,2CAA2C,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,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AAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://www.codifycli.com/sudo-request.json",
3
+ "$id": "https://www.codifycli.com/command-request.json",
4
4
  "title": "Command request",
5
5
  "description": "Request the core CLI to perform a command. This is required for sudo and interactive",
6
6
  "type": "object",
@@ -9,10 +9,6 @@
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",
@@ -24,11 +20,23 @@
24
20
  "argv0": {
25
21
  "type": "string",
26
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"
27
35
  }
28
36
  },
29
37
  "additionalProperties": true
30
38
  }
31
39
  },
32
- "required": ["command", "type"],
40
+ "required": ["command"],
33
41
  "additionalProperties": false
34
42
  }
@@ -3,7 +3,7 @@ export declare enum MessageCmd {
3
3
  VALIDATE = "validate",
4
4
  PLAN = "plan",
5
5
  APPLY = "apply",
6
- SUDO_REQUEST = "sudo_request",
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["SUDO_REQUEST"] = "sudo_request";
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,2CAA6B,CAAA;IAC7B,6EAA+D,CAAA;IAC/D,uEAAyD,CAAA;AAC3D,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
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"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://www.codifycli.com/empty-response-data-schema.json",
4
+ "title": "Empty Response Schema Data",
5
+ "description": "An empty response",
6
+ "type": "null"
7
+ }
@@ -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",
@@ -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",
@@ -158,15 +164,13 @@ export interface InitializeRequestData {
158
164
  export interface InitializeResponseData {
159
165
  resourceDefinitions: Array<ResourceDefinition>;
160
166
  }
161
- export declare enum CommandRequestType {
162
- SUDO = "sudo",
163
- INTERACTIVE = "interactive"
164
- }
165
167
  export interface CommandRequestData {
166
168
  command: string;
167
- type: CommandRequestType;
168
169
  options: {
169
170
  cwd?: string;
171
+ interactive?: boolean;
172
+ requiresRoot?: boolean;
173
+ stdin?: boolean;
170
174
  } & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>;
171
175
  }
172
176
  export interface CommandRequestResponseData {
@@ -179,6 +183,11 @@ export interface PressKeyToContinueRequestData {
179
183
  }
180
184
  export interface PressKeyToContinueResponseData {
181
185
  }
186
+ export interface SetVerbosityRequestData {
187
+ verbosityLevel: number;
188
+ }
189
+ export interface EmptyResponseData {
190
+ }
182
191
  export declare enum SpawnStatus {
183
192
  SUCCESS = "success",
184
193
  ERROR = "error"
@@ -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";
@@ -18,11 +24,6 @@ export var ParameterOperation;
18
24
  ParameterOperation["MODIFY"] = "modify";
19
25
  ParameterOperation["NOOP"] = "noop";
20
26
  })(ParameterOperation || (ParameterOperation = {}));
21
- export var CommandRequestType;
22
- (function (CommandRequestType) {
23
- CommandRequestType["SUDO"] = "sudo";
24
- CommandRequestType["INTERACTIVE"] = "interactive";
25
- })(CommandRequestType || (CommandRequestType = {}));
26
27
  export var SpawnStatus;
27
28
  (function (SpawnStatus) {
28
29
  SpawnStatus["SUCCESS"] = "success";
@@ -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,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;AAsGD,MAAM,CAAN,IAAY,kBAGX;A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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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-schemas",
3
- "version": "1.0.86-beta1",
3
+ "version": "1.0.86-beta10",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
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 SudoRequestDataSchema from './messages/command-request-data-schema.json' with {type: 'json'};
22
- import SudoRequestResponseDataSchema from './messages/command-response-data-schema.json' with {type: 'json'};
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
- SudoRequestDataSchema,
48
- SudoRequestResponseDataSchema,
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,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://www.codifycli.com/sudo-request.json",
3
+ "$id": "https://www.codifycli.com/command-request.json",
4
4
  "title": "Command request",
5
5
  "description": "Request the core CLI to perform a command. This is required for sudo and interactive",
6
6
  "type": "object",
@@ -9,10 +9,6 @@
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",
@@ -24,11 +20,23 @@
24
20
  "argv0": {
25
21
  "type": "string",
26
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"
27
35
  }
28
36
  },
29
37
  "additionalProperties": true
30
38
  }
31
39
  },
32
- "required": ["command", "type"],
40
+ "required": ["command"],
33
41
  "additionalProperties": false
34
42
  }
@@ -15,7 +15,6 @@ describe('Get resources response data schema', () => {
15
15
  const validate = ajv.compile(schema);
16
16
  expect(validate({
17
17
  command: 'abc def',
18
- type: 'sudo'
19
18
  })).to.be.true;
20
19
  })
21
20
 
@@ -23,9 +22,9 @@ 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: '.',
27
+ interactive: true,
29
28
  }
30
29
  })).to.be.true;
31
30
  })
@@ -34,7 +33,6 @@ describe('Get resources response data schema', () => {
34
33
  const validate = ajv.compile(schema);
35
34
  expect(validate({
36
35
  command: 'abc def',
37
- type: 'sudo',
38
36
  options: {
39
37
  cwd: '.',
40
38
  requiresRoot: true,
@@ -47,9 +45,9 @@ describe('Get resources response data schema', () => {
47
45
  const validate = ajv.compile(schema);
48
46
  expect(validate({
49
47
  command: 'abc def',
50
- type: 'interactive',
51
48
  options: {
52
49
  cwd: '.',
50
+ requiresRoot: true,
53
51
  },
54
52
  additional: {}
55
53
  })).to.be.false;
@@ -3,7 +3,7 @@ export enum MessageCmd {
3
3
  VALIDATE = 'validate',
4
4
  PLAN = 'plan',
5
5
  APPLY = 'apply',
6
- SUDO_REQUEST = 'sudo_request',
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
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://www.codifycli.com/empty-response-data-schema.json",
4
+ "title": "Empty Response Schema Data",
5
+ "description": "An empty response",
6
+ "type": "null"
7
+ }
@@ -1,20 +1,17 @@
1
- import schema from './apply-response-data-schema.json';
1
+ import schema from './empty-response-data-schema.json';
2
2
  import {describe, expect, it} from 'vitest'
3
- import addFormats from 'ajv-formats';
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
- addFormats.default(ajv);
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("validates an empty config", () => {
14
+ it("Only empty object", () => {
18
15
  const validate = ajv.compile(schema);
19
16
  expect(validate(null)).to.be.true;
20
17
  })
@@ -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
+ })
@@ -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
  });
@@ -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
 
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 {
@@ -183,16 +190,13 @@ export interface InitializeResponseData {
183
190
  resourceDefinitions: Array<ResourceDefinition>;
184
191
  }
185
192
 
186
- export enum CommandRequestType {
187
- SUDO = 'sudo',
188
- INTERACTIVE = 'interactive'
189
- }
190
-
191
193
  export interface CommandRequestData {
192
194
  command: string;
193
- type: CommandRequestType,
194
195
  options: {
195
196
  cwd?: string;
197
+ interactive?: boolean;
198
+ requiresRoot?: boolean;
199
+ stdin?: boolean;
196
200
  } & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>
197
201
  }
198
202
 
@@ -208,6 +212,12 @@ export interface PressKeyToContinueRequestData {
208
212
 
209
213
  export interface PressKeyToContinueResponseData {}
210
214
 
215
+ export interface SetVerbosityRequestData {
216
+ verbosityLevel: number;
217
+ }
218
+
219
+ export interface EmptyResponseData {}
220
+
211
221
  export enum SpawnStatus {
212
222
  SUCCESS = 'success',
213
223
  ERROR = 'error',
package/tsconfig.json CHANGED
@@ -11,6 +11,7 @@
11
11
  "declaration": true,
12
12
  "emitDecoratorMetadata": true,
13
13
  "experimentalDecorators": true,
14
+ "verbatimModuleSyntax": true,
14
15
  "rootDir": "src",
15
16
  "outDir": "./dist"
16
17
  },
@@ -1,30 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://www.codifycli.com/sudo-request.json",
4
- "title": "Sudo request",
5
- "description": "Request sudo from the core CLI",
6
- "type": "object",
7
- "properties": {
8
- "command": {
9
- "type": "string",
10
- "description": "The command that is requesting sudo"
11
- },
12
- "options": {
13
- "type": "object",
14
- "description": "The options for codifySpawn that is needed to run the command",
15
- "properties": {
16
- "cwd": {
17
- "type": "string",
18
- "description": "Current working directory to run codifySpawn in"
19
- },
20
- "argv0": {
21
- "type": "string",
22
- "description": "Arguments to pass in"
23
- }
24
- },
25
- "additionalProperties": true
26
- }
27
- },
28
- "required": ["command"],
29
- "additionalProperties": false
30
- }
@@ -1,19 +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 sudo request",
6
- "type": "object",
7
- "properties": {
8
- "status": {
9
- "enum": ["success", "error"],
10
- "description": "Reports if the operation was successful"
11
- },
12
- "data": {
13
- "type": "string",
14
- "description": "Data returned by the operation"
15
- }
16
- },
17
- "required": ["status", "data"],
18
- "additionalProperties": false
19
- }
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://www.codifycli.com/apply-response-data-schema.json",
4
- "title": "Apply Response Schema Data",
5
- "type": "null"
6
- }