Skip to content

Commit fad88ef

Browse files
committed
feat: Add press key to continue schemas
1 parent 2d7098a commit fad88ef

7 files changed

Lines changed: 65 additions & 6 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-schemas",
3-
"version": "1.0.73",
3+
"version": "1.0.75",
44
"description": "",
55
"type": "module",
66
"main": "dist/index.js",

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import InitializeRequestDataSchema from './messages/initialize-request-data-sche
2020
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with {type: 'json'}
2121
import SudoRequestDataSchema from './messages/sudo-request-data-schema.json' with {type: 'json'};
2222
import SudoRequestResponseDataSchema from './messages/sudo-response-data-schema.json' with {type: 'json'};
23+
import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continue-request-data-schema.json' with {type: 'json'};
24+
import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with {type: 'json'};
2325

2426
export {
2527
ConfigFileSchema,
@@ -44,6 +46,8 @@ export {
4446
InitializeResponseDataSchema,
4547
SudoRequestDataSchema,
4648
SudoRequestResponseDataSchema,
49+
PressKeyToContinueRequestDataSchema,
50+
PressKeyToContinueResponseDataSchema,
4751
}
4852

4953
export * from './types/index.js';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"$id": "https://www.codifycli.com/press-key-to-continue-request.json",
4+
"title": "Sudo request",
5+
"description": "Request a press key to continue prompt from the CLI",
6+
"type": "object",
7+
"properties": {
8+
"promptMessage": {
9+
"type": "string",
10+
"description": "A message to display when prompting"
11+
}
12+
},
13+
"additionalProperties": false
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import schema from './press-key-to-continue-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('Get resources response data schema', () => {
10+
it('compiles', () => {
11+
ajv.compile(schema);
12+
})
13+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 press key to continue prompt",
6+
"type": "object",
7+
"properties": {},
8+
"additionalProperties": false
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import schema from './press-key-to-continue-response-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('Get resources response data schema', () => {
10+
it('compiles', () => {
11+
ajv.compile(schema);
12+
})
13+
})

src/types/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,18 @@ export interface SudoRequestData {
184184
} & Omit<SpawnOptions, 'stdio' | 'shell' | 'detached'>
185185
}
186186

187-
export enum SpawnStatus {
188-
SUCCESS = 'success',
189-
ERROR = 'error',
190-
}
191-
192187
export interface SudoRequestResponseData {
193188
status: SpawnStatus,
194189
data: string;
195190
}
191+
192+
export interface PressKeyToContinueRequestData {
193+
promptMessage?: string;
194+
}
195+
196+
export interface PressKeyToContinueResponseData {}
197+
198+
export enum SpawnStatus {
199+
SUCCESS = 'success',
200+
ERROR = 'error',
201+
}

0 commit comments

Comments
 (0)