@taqueria/protocol 0.0.9 → 0.2.0
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/package.json +1 -1
- package/taqueria-protocol-types.ts +41 -4
package/package.json
CHANGED
|
@@ -226,6 +226,7 @@ export interface UnvalidatedTask {
|
|
|
226
226
|
readonly handler: "proxy" | string | string[]
|
|
227
227
|
readonly hidden?: boolean
|
|
228
228
|
readonly example?: string
|
|
229
|
+
readonly encoding?: "json" | "application/json" | "none"
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
export interface UnvalidatedPluginInfo {
|
|
@@ -372,6 +373,8 @@ export class Option {
|
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
|
|
376
|
+
export type TaskEncoding = "none" | "json" | "application/json"
|
|
377
|
+
|
|
375
378
|
const taskType: unique symbol = Symbol()
|
|
376
379
|
export class Task {
|
|
377
380
|
[taskType]: void
|
|
@@ -384,7 +387,8 @@ export class Option {
|
|
|
384
387
|
readonly handler: TaskHandler
|
|
385
388
|
readonly hidden: boolean
|
|
386
389
|
readonly positionals: PositionalArg[]
|
|
387
|
-
|
|
390
|
+
readonly encoding: TaskEncoding
|
|
391
|
+
protected constructor(name: Verb, command: Command, description: string, handler: TaskHandler, options: Option[]=[], positionals: PositionalArg[]=[], aliases: Alias[]=[], hidden=false, encoding="none", example?: string) {
|
|
388
392
|
this.task = name
|
|
389
393
|
this.command = command
|
|
390
394
|
this.description = description
|
|
@@ -394,6 +398,9 @@ export class Option {
|
|
|
394
398
|
this.hidden = hidden
|
|
395
399
|
this.example = example
|
|
396
400
|
this.positionals = positionals
|
|
401
|
+
this.encoding = ["none", "json", "application/json"].includes(encoding)
|
|
402
|
+
? encoding as TaskEncoding
|
|
403
|
+
: "none"
|
|
397
404
|
}
|
|
398
405
|
static createAlias(value: string): Alias | undefined {
|
|
399
406
|
return Verb.create(value) || SingleChar.create(value)
|
|
@@ -446,7 +453,7 @@ export class Option {
|
|
|
446
453
|
)
|
|
447
454
|
|
|
448
455
|
return name && command
|
|
449
|
-
? new Task(name, command, task.description, task.handler, options, positionals, aliases, task.hidden ? true : false, task.example)
|
|
456
|
+
? new Task(name, command, task.description, task.handler, options, positionals, aliases, task.hidden ? true : false, task.encoding, task.example)
|
|
450
457
|
: undefined
|
|
451
458
|
}
|
|
452
459
|
}
|
|
@@ -454,7 +461,7 @@ export class Option {
|
|
|
454
461
|
export interface AccountKeys {
|
|
455
462
|
alias: string
|
|
456
463
|
encryptedKey: string
|
|
457
|
-
|
|
464
|
+
publicKeyHash: string
|
|
458
465
|
secretKey: string
|
|
459
466
|
}
|
|
460
467
|
|
|
@@ -586,4 +593,34 @@ export interface Environment {
|
|
|
586
593
|
readonly storage: Record<string, unknown>
|
|
587
594
|
}
|
|
588
595
|
|
|
589
|
-
export type
|
|
596
|
+
export type PluginActionName = "checkRuntimeDependencies" | "installRuntimeDependencies" | "proxy" | "pluginInfo" | string
|
|
597
|
+
|
|
598
|
+
export type PluginProxyAction = Task
|
|
599
|
+
|
|
600
|
+
export type PluginAction = "checkRuntimeDependencies" | "installRuntimeDependencies" | "pluginInfo" | PluginProxyAction
|
|
601
|
+
|
|
602
|
+
export interface RuntimeDependencyReport extends RuntimeDependency {
|
|
603
|
+
readonly met: boolean
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export interface CheckRuntimeDependenciesResponse {
|
|
607
|
+
readonly report: RuntimeDependencyReport[]
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface InstallRuntimeDependenciesResponse {
|
|
611
|
+
readonly report: RuntimeDependencyReport[]
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type PluginActionNotSupportedResponse = {
|
|
615
|
+
readonly status: "notSupported",
|
|
616
|
+
readonly msg: string
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export interface PluginJsonResponse {
|
|
620
|
+
readonly data?: unknown
|
|
621
|
+
readonly render?: 'none' | 'string' | 'table'
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export type ActionPluginInfo = UnvalidatedPluginInfo
|
|
625
|
+
|
|
626
|
+
export type PluginResponse = PluginJsonResponse | CheckRuntimeDependenciesResponse | InstallRuntimeDependenciesResponse | ActionPluginInfo | PluginActionNotSupportedResponse | void
|