@taqueria/protocol 0.0.0-pr-659-7f58d15b → 0.0.0-pr-659-73dc044f
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/Alias.ts +0 -1
- package/Base.ts +12 -4
- package/Command.ts +2 -1
- package/Config.ts +8 -15
- package/EconomicalProtocolHash.ts +1 -1
- package/Environment.ts +3 -3
- package/EphemeralState.ts +1 -1
- package/Faucet.ts +5 -5
- package/HumanReadableIdentifier.ts +1 -1
- package/InstalledPlugin.ts +2 -2
- package/LoadedConfig.ts +1 -1
- package/NetworkConfig.ts +1 -1
- package/Option.ts +2 -2
- package/PluginInfo.ts +2 -2
- package/PositionalArg.ts +2 -2
- package/Provisioner.ts +2 -2
- package/ProvisionerID.ts +2 -2
- package/PublicKeyHash.ts +2 -2
- package/SHA256.ts +1 -1
- package/SandboxAccountConfig.ts +5 -5
- package/SandboxConfig.ts +4 -4
- package/SanitizedAbsPath.ts +2 -2
- package/SanitizedArgs.ts +17 -17
- package/SanitizedPath.ts +1 -1
- package/SingleChar.ts +1 -1
- package/Task.ts +8 -5
- package/Tz.ts +2 -2
- package/Url.ts +1 -1
- package/Verb.ts +2 -2
- package/VersionNumber.ts +1 -1
- package/package.json +1 -1
package/Alias.ts
CHANGED
package/Base.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {z, ZodError, ZodSchema
|
|
1
|
+
import {z, ZodError, ZodSchema} from 'zod'
|
|
2
2
|
import {toFutureParseErr, toFutureParseUnknownErr} from "@taqueria/protocol/TaqError"
|
|
3
3
|
import {resolve, FutureInstance} from "fluture"
|
|
4
4
|
|
|
@@ -44,13 +44,21 @@ export const createSchema = <I>(params: CreateSchemaParams) => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
// TODO:
|
|
49
|
+
// TypeScript appears to have a bug with default generic values
|
|
50
|
+
// For instance, I'd like to use this:
|
|
51
|
+
// export const createType = <R, I = R>(params: CreateTypeParams) => {
|
|
52
|
+
//
|
|
53
|
+
// However, I == unknown when having I default to R if no I was given.
|
|
54
|
+
// So, we need to require R and I explicitly
|
|
55
|
+
export const createType = <R, I>(params: CreateTypeParams) => {
|
|
48
56
|
const schemas = createSchema<I>(params)
|
|
49
57
|
const {parseErrMsg, unknownErrMsg} = params
|
|
50
58
|
|
|
51
59
|
type T = z.infer<typeof schemas.schema>
|
|
52
60
|
|
|
53
|
-
const of = (input: I | unknown) => {
|
|
61
|
+
const of = (input: R | I | unknown) => {
|
|
54
62
|
try {
|
|
55
63
|
return resolve<T>(schemas.schema.parse(input))
|
|
56
64
|
}
|
|
@@ -72,7 +80,7 @@ export const createType = <R, I = R>(params: CreateTypeParams) => {
|
|
|
72
80
|
|
|
73
81
|
const make = (input: I) => of(input)
|
|
74
82
|
|
|
75
|
-
const create = (input: R | I | unknown) => schemas.schema.parse(input)
|
|
83
|
+
const create = (input: R | I | unknown) => schemas.schema.parse(input) as T
|
|
76
84
|
|
|
77
85
|
const factory = {
|
|
78
86
|
make,
|
package/Command.ts
CHANGED
|
@@ -3,11 +3,12 @@ import createType from "@taqueria/protocol/Base"
|
|
|
3
3
|
|
|
4
4
|
export const rawSchema = z
|
|
5
5
|
.string({description: "Command"})
|
|
6
|
+
.min(1)
|
|
6
7
|
.regex(/^([A-Za-z-_ ]+ ?)((\[.+\] ?)|(\<.+\>) ?)*$/, "Must be a command that can be interpreted using yargs")
|
|
7
8
|
|
|
8
9
|
type RawInput = z.infer<typeof rawSchema>
|
|
9
10
|
|
|
10
|
-
const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
11
|
+
const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
11
12
|
isStringLike: true,
|
|
12
13
|
rawSchema,
|
|
13
14
|
parseErrMsg: (value: unknown) => `${value} is an invalid command. Expected format is: taskName [optional] <required>`,
|
package/Config.ts
CHANGED
|
@@ -22,7 +22,7 @@ const sandboxMap = z
|
|
|
22
22
|
z.union([
|
|
23
23
|
SandboxConfig.schemas.schema,
|
|
24
24
|
z.string({description: "config.sandbox"})
|
|
25
|
-
.
|
|
25
|
+
.min(1, "Default sandbox must reference the name of an existing sandbox configuration.")
|
|
26
26
|
]),
|
|
27
27
|
{description: "Sandbox configurations"}
|
|
28
28
|
)
|
|
@@ -33,7 +33,7 @@ const environmentMap = z
|
|
|
33
33
|
z.union([
|
|
34
34
|
Environment.schemas.schema,
|
|
35
35
|
z.string({description: "config.environment"})
|
|
36
|
-
.
|
|
36
|
+
.min(1, "Default environment must reference the name of an existing environment.")
|
|
37
37
|
]),
|
|
38
38
|
{description: "Environment configurations"}
|
|
39
39
|
)
|
|
@@ -64,26 +64,19 @@ const commonSchema = z.object({
|
|
|
64
64
|
.preprocess(
|
|
65
65
|
(val: unknown) => val ?? "tests",
|
|
66
66
|
z.string({description: "config.testsDir"})
|
|
67
|
-
.
|
|
67
|
+
.min(1, "config.testsDir must have a value")
|
|
68
68
|
),
|
|
69
69
|
contractsDir: z
|
|
70
70
|
.preprocess(
|
|
71
71
|
(val: unknown) => val ?? "contracts",
|
|
72
72
|
z.string({description: "config.contractsDir"})
|
|
73
|
-
.
|
|
73
|
+
.min(1, "config.contractsDir must have a value")
|
|
74
74
|
),
|
|
75
75
|
artifactsDir: z
|
|
76
76
|
.preprocess(
|
|
77
77
|
(val: unknown) => val ?? "artifacts",
|
|
78
78
|
z.string({description: "config.artifactsDir"})
|
|
79
|
-
.
|
|
80
|
-
),
|
|
81
|
-
operationsDir: z
|
|
82
|
-
.preprocess(
|
|
83
|
-
(val: unknown) => val ?? "operations",
|
|
84
|
-
z.string({description: "config.operationsDir"})
|
|
85
|
-
.nonempty("config.operationsDir must have a value")
|
|
86
|
-
.optional()
|
|
79
|
+
.min(1, "config.artifactsDir must have a value")
|
|
87
80
|
)
|
|
88
81
|
}).describe("config")
|
|
89
82
|
|
|
@@ -100,7 +93,7 @@ export const rawSchema = commonSchema.extend({
|
|
|
100
93
|
z.union([
|
|
101
94
|
NetworkConfig.rawSchema,
|
|
102
95
|
z.string({description: "config.network"})
|
|
103
|
-
.
|
|
96
|
+
.min(1, "Default network must reference the name of an existing network configuration.")
|
|
104
97
|
])
|
|
105
98
|
)
|
|
106
99
|
.optional(),
|
|
@@ -109,7 +102,7 @@ export const rawSchema = commonSchema.extend({
|
|
|
109
102
|
z.union([
|
|
110
103
|
SandboxConfig.rawSchema,
|
|
111
104
|
z.string({description: "config.sandbox"})
|
|
112
|
-
.
|
|
105
|
+
.min(1, "Default sandbox must reference the name of an existing sandbox configuration.")
|
|
113
106
|
])
|
|
114
107
|
)
|
|
115
108
|
.optional(),
|
|
@@ -118,7 +111,7 @@ export const rawSchema = commonSchema.extend({
|
|
|
118
111
|
z.union([
|
|
119
112
|
Environment.rawSchema,
|
|
120
113
|
z.string({description: "config.environment"})
|
|
121
|
-
|
|
114
|
+
.min(1, "Default environment must reference the name of an existing environment.")
|
|
122
115
|
])
|
|
123
116
|
)
|
|
124
117
|
.optional(),
|
|
@@ -10,7 +10,7 @@ export const rawSchema = z
|
|
|
10
10
|
|
|
11
11
|
type RawInput = z.infer<typeof rawSchema>
|
|
12
12
|
|
|
13
|
-
export const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
13
|
+
export const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
14
14
|
rawSchema,
|
|
15
15
|
parseErrMsg: (value: unknown) => `${value} is an invalid economical protocol hash`,
|
|
16
16
|
unknownErrMsg: "Somethign went wrong trying to parse the economical protocol hash"
|
package/Environment.ts
CHANGED
|
@@ -4,11 +4,11 @@ import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
|
4
4
|
export const rawSchema = z.object({
|
|
5
5
|
networks: z.array(
|
|
6
6
|
z.string({description: "Environment network"})
|
|
7
|
-
.
|
|
7
|
+
.min(1, "Must reference the name of an existing network configuration")
|
|
8
8
|
),
|
|
9
9
|
sandboxes: z.array(
|
|
10
10
|
z.string({description: "Environment sandbox"})
|
|
11
|
-
.
|
|
11
|
+
.min(1, "Must reference the name of an existing sandbox configuration")
|
|
12
12
|
),
|
|
13
13
|
storage: z.record(
|
|
14
14
|
z.any({description: "Environment storage value"}),
|
|
@@ -19,7 +19,7 @@ export const rawSchema = z.object({
|
|
|
19
19
|
|
|
20
20
|
type RawInput = z.infer<typeof rawSchema>
|
|
21
21
|
|
|
22
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
22
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
23
23
|
rawSchema,
|
|
24
24
|
parseErrMsg: (value: unknown) => `${value} is not an valid environment configuration`,
|
|
25
25
|
unknownErrMsg: "Something went wrong trying to parse the environment configuration"
|
package/EphemeralState.ts
CHANGED
|
@@ -41,7 +41,7 @@ const rawSchema = z.object({
|
|
|
41
41
|
|
|
42
42
|
type RawInput = z.infer<typeof rawSchema>
|
|
43
43
|
|
|
44
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
44
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
45
45
|
rawSchema,
|
|
46
46
|
parseErrMsg: (value: unknown) => `${value} is not a valid representation of ephemeral state`,
|
|
47
47
|
unknownErrMsg: "Something went wrong when parsing the ephemeral state"
|
package/Faucet.ts
CHANGED
|
@@ -3,15 +3,15 @@ import * as PublicKeyHash from "@taqueria/protocol/PublicKeyHash"
|
|
|
3
3
|
import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
4
4
|
|
|
5
5
|
export const rawSchema = z.object({
|
|
6
|
-
pkh: z.string({description: "Faucet Public Key Hash"}).
|
|
6
|
+
pkh: z.string({description: "Faucet Public Key Hash"}).min(1),
|
|
7
7
|
mnemonic: z.array(
|
|
8
|
-
z.string({description: "Faucet Mnemonic Word"}).
|
|
8
|
+
z.string({description: "Faucet Mnemonic Word"}).min(1),
|
|
9
9
|
{description: "Faucet Mnemonic"}
|
|
10
10
|
),
|
|
11
11
|
email: z.string({description: "Faucet E-mail"}).regex(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/),
|
|
12
|
-
password: z.string({description: "Faucet Password"}).
|
|
13
|
-
amount: z.string({description: "Faucet Account"}).
|
|
14
|
-
activation_code: z.string({description: "Faucet Activation Code"}).
|
|
12
|
+
password: z.string({description: "Faucet Password"}).min(1),
|
|
13
|
+
amount: z.string({description: "Faucet Account"}).min(1).regex(/^\d+$/),
|
|
14
|
+
activation_code: z.string({description: "Faucet Activation Code"}).min(1)
|
|
15
15
|
}).describe("Faucet")
|
|
16
16
|
|
|
17
17
|
const internalSchema = z.object({
|
|
@@ -7,7 +7,7 @@ export const rawSchema = z
|
|
|
7
7
|
|
|
8
8
|
type RawInput = z.infer<typeof rawSchema>
|
|
9
9
|
|
|
10
|
-
const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
10
|
+
const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
11
11
|
isStringLike: true,
|
|
12
12
|
rawSchema,
|
|
13
13
|
parseErrMsg: (value: unknown) => `${value} is not a valid human-readable identifier`,
|
package/InstalledPlugin.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {z} from 'zod'
|
|
|
2
2
|
import createType from "@taqueria/protocol/Base"
|
|
3
3
|
|
|
4
4
|
export const rawSchema = z.object({
|
|
5
|
-
name: z.string({description: "Plugin Name"}).
|
|
5
|
+
name: z.string({description: "Plugin Name"}).min(1),
|
|
6
6
|
type: z.union(
|
|
7
7
|
[z.literal('npm'), z.literal('binary'), z.literal('deno')],
|
|
8
8
|
{description: "Plugin Type"}
|
|
@@ -11,7 +11,7 @@ export const rawSchema = z.object({
|
|
|
11
11
|
|
|
12
12
|
type RawInput = z.infer<typeof rawSchema>
|
|
13
13
|
|
|
14
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
14
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
15
15
|
rawSchema,
|
|
16
16
|
parseErrMsg: (value: unknown) => `${value} is not a valid installed plugin`,
|
|
17
17
|
unknownErrMsg: "Something went wrong when parsing the installed plugin"
|
package/LoadedConfig.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const internalSchema = Config.internalSchema.extend({
|
|
|
17
17
|
}).describe("LoadedConfig")
|
|
18
18
|
|
|
19
19
|
type RawInput = z.infer<typeof rawSchema>
|
|
20
|
-
type Input = z.infer<typeof internalSchema
|
|
20
|
+
type Input = Flatten<z.infer<typeof internalSchema>>
|
|
21
21
|
|
|
22
22
|
export const {schemas: generatedSchemas, factory} = createType<RawInput, Input>({
|
|
23
23
|
rawSchema,
|
package/NetworkConfig.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const rawSchema = z.object({
|
|
|
9
9
|
label: HumanReadableIdentifier.rawSchema,
|
|
10
10
|
rpcUrl: Url.rawSchema,
|
|
11
11
|
protocol: EconomicalProtocolHash.rawSchema,
|
|
12
|
-
|
|
12
|
+
faucet: Faucet.rawSchema.describe("Network Faucet")
|
|
13
13
|
}).describe("Network Config")
|
|
14
14
|
|
|
15
15
|
const internalSchema = z.object({
|
package/Option.ts
CHANGED
|
@@ -6,7 +6,7 @@ import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
|
6
6
|
export const internalSchema = z.object({
|
|
7
7
|
shortFlag: SingleChar.schemas.schema.describe("Option Short Flag").optional(),
|
|
8
8
|
flag: Verb.schemas.schema.describe("Option Long Flag"),
|
|
9
|
-
description: z.string({description: "Option Description"}).
|
|
9
|
+
description: z.string({description: "Option Description"}).min(1),
|
|
10
10
|
defaultValue: z.union(
|
|
11
11
|
[z.string(), z.number(), z.boolean()],
|
|
12
12
|
{description: "Option Default Value"}
|
|
@@ -22,7 +22,7 @@ export const internalSchema = z.object({
|
|
|
22
22
|
export const rawSchema = z.object({
|
|
23
23
|
shortFlag: SingleChar.rawSchema.describe("Option Short Flag").optional(),
|
|
24
24
|
flag: Verb.rawSchema.describe("Option Long Flag"),
|
|
25
|
-
description: z.string({description: "Option Description"}).
|
|
25
|
+
description: z.string({description: "Option Description"}).min(1),
|
|
26
26
|
defaultValue: z.union(
|
|
27
27
|
[z.string(), z.number(), z.boolean()],
|
|
28
28
|
{description: "Option Default Value"}
|
package/PluginInfo.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as Operation from '@taqueria/protocol/Operation'
|
|
|
6
6
|
import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
7
7
|
|
|
8
8
|
export const internalSchema = z.object({
|
|
9
|
-
name: z.string({description: "Plugin Name"}).
|
|
9
|
+
name: z.string({description: "Plugin Name"}).min(1),
|
|
10
10
|
version: VersionNumber.schemas.schema.describe("Plugin Version #"),
|
|
11
11
|
schema: VersionNumber.schemas.schema.describe("Plugin Schema Version #"),
|
|
12
12
|
alias: Alias.schemas.schema.describe("Plugin Alias"),
|
|
@@ -27,7 +27,7 @@ export const internalSchema = z.object({
|
|
|
27
27
|
}).describe("Plugin Schema")
|
|
28
28
|
|
|
29
29
|
export const rawSchema = z.object({
|
|
30
|
-
name: z.string({description: "Plugin Name"}).
|
|
30
|
+
name: z.string({description: "Plugin Name"}).min(1),
|
|
31
31
|
version: VersionNumber.rawSchema.describe("Plugin Version #"),
|
|
32
32
|
schema: VersionNumber.rawSchema.describe("Plugin Schema Version #"),
|
|
33
33
|
alias: Alias.rawSchema.describe("Plugin Alias"),
|
package/PositionalArg.ts
CHANGED
|
@@ -4,7 +4,7 @@ import createType from "@taqueria/protocol/Base"
|
|
|
4
4
|
|
|
5
5
|
export const rawSchema = z.object({
|
|
6
6
|
placeholder: HumanReadableIdentifier.rawSchema.describe("Positional Arg Placeholder"),
|
|
7
|
-
description: z.string({description: "Positional Arg Description"}).
|
|
7
|
+
description: z.string({description: "Positional Arg Description"}).min(1),
|
|
8
8
|
defaultValue: z.union(
|
|
9
9
|
[z.string(), z.number(), z.boolean()],
|
|
10
10
|
{description: "Positional Arg Default Value"}
|
|
@@ -17,7 +17,7 @@ export const rawSchema = z.object({
|
|
|
17
17
|
|
|
18
18
|
const internalSchema = z.object({
|
|
19
19
|
placeholder: HumanReadableIdentifier.schemas.schema.describe("Positional Arg Placeholder"),
|
|
20
|
-
description: z.string({description: "Positional Arg Description"}).
|
|
20
|
+
description: z.string({description: "Positional Arg Description"}).min(1),
|
|
21
21
|
defaultValue: z.union(
|
|
22
22
|
[z.string(), z.number(), z.boolean()],
|
|
23
23
|
{description: "Positional Arg Default Value"}
|
package/Provisioner.ts
CHANGED
|
@@ -7,12 +7,12 @@ export const rawSchema = z.object(
|
|
|
7
7
|
id: ProvisionerID.rawSchema,
|
|
8
8
|
plugin: z
|
|
9
9
|
.string()
|
|
10
|
-
.
|
|
10
|
+
.min(1)
|
|
11
11
|
.describe("Provisioner Plugin")
|
|
12
12
|
.optional(),
|
|
13
13
|
operation: z
|
|
14
14
|
.union([
|
|
15
|
-
z.string().
|
|
15
|
+
z.string().min(1),
|
|
16
16
|
z.literal('custom')
|
|
17
17
|
])
|
|
18
18
|
.describe("Provisioner Operation"),
|
package/ProvisionerID.ts
CHANGED
|
@@ -3,13 +3,13 @@ import createType from "@taqueria/protocol/Base"
|
|
|
3
3
|
|
|
4
4
|
export const rawSchema = z
|
|
5
5
|
.string()
|
|
6
|
-
.
|
|
6
|
+
.min(1)
|
|
7
7
|
.regex(/^[A-Za-z0-9]+[A-Za-z0-9-_]+\.[A-Za-z0-9]+[A-Za-z0-9-_]+\.[A-Za-z0-9]+[A-Za-z0-9-_]+$/)
|
|
8
8
|
.describe('Provisioner ID')
|
|
9
9
|
|
|
10
10
|
type RawInput = z.infer<typeof rawSchema>
|
|
11
11
|
|
|
12
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
12
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
13
13
|
rawSchema,
|
|
14
14
|
parseErrMsg: (value: unknown) => `${value} is not a valid provisioner ID`,
|
|
15
15
|
unknownErrMsg: "Something went wrong trying to parse the provision ID"
|
package/PublicKeyHash.ts
CHANGED
|
@@ -3,7 +3,7 @@ import createType from "@taqueria/protocol/Base"
|
|
|
3
3
|
|
|
4
4
|
export const rawSchema = z
|
|
5
5
|
.string({description: "Public Key Hash"})
|
|
6
|
-
.
|
|
6
|
+
.min(1) // TODO: what's the actual minimum length here?
|
|
7
7
|
.refine(
|
|
8
8
|
val => val.startsWith("tz1"),
|
|
9
9
|
val => ({message: `${val} is not a valid public key hash`})
|
|
@@ -11,7 +11,7 @@ export const rawSchema = z
|
|
|
11
11
|
|
|
12
12
|
type RawInput = z.infer<typeof rawSchema>
|
|
13
13
|
|
|
14
|
-
export const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
14
|
+
export const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
15
15
|
isStringLike: true,
|
|
16
16
|
rawSchema,
|
|
17
17
|
parseErrMsg: (value: unknown) => `${value} is an invalid public key hash`,
|
package/SHA256.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const rawSchema = z.string({description: "SHA256"}).length(64)
|
|
|
14
14
|
|
|
15
15
|
type RawInput = z.infer<typeof rawSchema>
|
|
16
16
|
|
|
17
|
-
const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
17
|
+
const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
18
18
|
isStringLike: true,
|
|
19
19
|
rawSchema,
|
|
20
20
|
parseErrMsg: (value: unknown) => `${value} is an invalid SHA256 hash`,
|
package/SandboxAccountConfig.ts
CHANGED
|
@@ -3,15 +3,15 @@ import * as PublicKeyHash from "@taqueria/protocol/PublicKeyHash"
|
|
|
3
3
|
import createType from "@taqueria/protocol/Base"
|
|
4
4
|
|
|
5
5
|
const internalSchema = z.object({
|
|
6
|
-
encryptedKey: z.string({description: "Sandbox Account Encrypted Key"}).
|
|
6
|
+
encryptedKey: z.string({description: "Sandbox Account Encrypted Key"}).min(1),
|
|
7
7
|
publicKeyHash: PublicKeyHash.schemas.schema.describe("Sandbox Account Public Key Hash"),
|
|
8
|
-
secretKey: z.string({description: "Sandbox Account Secret Key"}).
|
|
8
|
+
secretKey: z.string({description: "Sandbox Account Secret Key"}).min(1)
|
|
9
9
|
}, {description: "Sandbox Account Configuration"})
|
|
10
10
|
|
|
11
11
|
export const rawSchema = z.object({
|
|
12
|
-
encryptedKey: z.string({description: "Sandbox Account Encrypted Key"}).
|
|
13
|
-
publicKeyHash: z.string({description: "Sandbox Account Public Key Hash"}).
|
|
14
|
-
secretKey: z.string({description: "Sandbox Account Secret Key"}).
|
|
12
|
+
encryptedKey: z.string({description: "Sandbox Account Encrypted Key"}).min(1),
|
|
13
|
+
publicKeyHash: z.string({description: "Sandbox Account Public Key Hash"}).min(1),
|
|
14
|
+
secretKey: z.string({description: "Sandbox Account Secret Key"}).min(1)
|
|
15
15
|
}, {description: "Sandbox Account Configuration"})
|
|
16
16
|
|
|
17
17
|
type Input = z.infer<typeof internalSchema>
|
package/SandboxConfig.ts
CHANGED
|
@@ -14,9 +14,9 @@ const accountMapSchema = z.record(
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
export const rawSchema = z.object({
|
|
17
|
-
label: z.string({description: "Sandbox Label"}).
|
|
18
|
-
rpcUrl: z.string({description: "Sandbox RPC Url"}).
|
|
19
|
-
protocol: z.string({description: "Sandbox Protocol Hash"}).
|
|
17
|
+
label: z.string({description: "Sandbox Label"}).min(1),
|
|
18
|
+
rpcUrl: z.string({description: "Sandbox RPC Url"}).min(5).url(),
|
|
19
|
+
protocol: z.string({description: "Sandbox Protocol Hash"}).min(8),
|
|
20
20
|
attributes: z.record(
|
|
21
21
|
z.union(
|
|
22
22
|
[z.string(), z.number(), z.boolean()],
|
|
@@ -26,7 +26,7 @@ export const rawSchema = z.object({
|
|
|
26
26
|
).optional(),
|
|
27
27
|
plugin: Verb.rawSchema.describe("Sandbox Plugin").optional(),
|
|
28
28
|
accounts: z.union([
|
|
29
|
-
z.object({default: z.string().
|
|
29
|
+
z.object({default: z.string().min(1)}),
|
|
30
30
|
z.record(SandboxAccountConfig.rawSchema)
|
|
31
31
|
], {description: "Sandbox Accounts"}).optional()
|
|
32
32
|
})
|
package/SanitizedAbsPath.ts
CHANGED
|
@@ -2,11 +2,11 @@ import {z} from "zod"
|
|
|
2
2
|
import * as path from 'path'
|
|
3
3
|
import createType from "@taqueria/protocol/Base"
|
|
4
4
|
|
|
5
|
-
export const rawSchema = z.string({description: "SanitizedAbsPath"}).
|
|
5
|
+
export const rawSchema = z.string({description: "SanitizedAbsPath"}).min(1)
|
|
6
6
|
|
|
7
7
|
type RawInput = z.infer<typeof rawSchema>
|
|
8
8
|
|
|
9
|
-
export const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
9
|
+
export const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
10
10
|
isStringLike: true,
|
|
11
11
|
rawSchema,
|
|
12
12
|
transformer: (value: unknown) => path.resolve(value as string) as unknown,
|
package/SanitizedArgs.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as Url from "@taqueria/protocol/Url"
|
|
|
4
4
|
import createType from "@taqueria/protocol/Base"
|
|
5
5
|
|
|
6
6
|
export const rawSchema = z.object({
|
|
7
|
-
_: z.array(z.union([z.string().
|
|
7
|
+
_: z.array(z.union([z.string().min(1), z.number()])),
|
|
8
8
|
projectDir: SanitizedAbsPath.schemas.schema,
|
|
9
9
|
maxConcurrency: z.preprocess(
|
|
10
10
|
val => typeof val === 'string' ? parseInt(val) : Number(val),
|
|
@@ -42,29 +42,29 @@ import createType from "@taqueria/protocol/Base"
|
|
|
42
42
|
val => Boolean(val),
|
|
43
43
|
z.boolean().optional()
|
|
44
44
|
),
|
|
45
|
-
plugin: z.string().
|
|
45
|
+
plugin: z.string().min(1).optional(),
|
|
46
46
|
env: z.union([z.literal('production'), z.literal('testing'), z.literal('development'), z.string().nonempty()]).default("development"),
|
|
47
|
-
quickstart: z.string().
|
|
48
|
-
setBuild: z.string().
|
|
49
|
-
setVersion: z.string().
|
|
50
|
-
template: z.string().
|
|
51
|
-
pluginName: z.string().
|
|
47
|
+
quickstart: z.string().min(1).optional(),
|
|
48
|
+
setBuild: z.string().min(3),
|
|
49
|
+
setVersion: z.string().min(3),
|
|
50
|
+
template: z.string().min(1).optional(),
|
|
51
|
+
pluginName: z.string().min(1).optional()
|
|
52
52
|
}, {description: "Sanitizied Args"}).passthrough()
|
|
53
53
|
|
|
54
54
|
export const scaffoldRawSchema = rawSchema.extend({
|
|
55
|
-
scaffoldProjectDir: z.string().
|
|
56
|
-
scaffoldUrl: z.string().
|
|
55
|
+
scaffoldProjectDir: z.string().min(1).transform((val: unknown) => val as SanitizedAbsPath.t),
|
|
56
|
+
scaffoldUrl: z.string().min(1).url().transform((val: unknown) => val as Url.t),
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
export const provisionRawSchema = rawSchema
|
|
60
60
|
.extend({
|
|
61
61
|
operation: z
|
|
62
62
|
.string()
|
|
63
|
-
.
|
|
63
|
+
.min(1)
|
|
64
64
|
.describe("Operation name"),
|
|
65
65
|
name: z
|
|
66
66
|
.string()
|
|
67
|
-
.
|
|
67
|
+
.min(1)
|
|
68
68
|
.regex(/^[a-z0-9]+[a-z0-9-_]$/, "Provisioner name must consist of one or more letters/numbers and may not start with an underscore or dash.")
|
|
69
69
|
.describe("Provisioner name")
|
|
70
70
|
.optional()
|
|
@@ -72,7 +72,7 @@ export const provisionRawSchema = rawSchema
|
|
|
72
72
|
.passthrough()
|
|
73
73
|
|
|
74
74
|
export const managePluginRawSchema = rawSchema.omit({pluginName: true}).extend({
|
|
75
|
-
pluginName: z.string().
|
|
75
|
+
pluginName: z.string().min(1)
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
export const versionRawSchema = rawSchema.extend({
|
|
@@ -85,7 +85,7 @@ type RawProvisionInput = z.infer<typeof provisionRawSchema>
|
|
|
85
85
|
type RawManagePluginInput = z.infer<typeof managePluginRawSchema>
|
|
86
86
|
type RawVersionInput = z.infer<typeof versionRawSchema>
|
|
87
87
|
|
|
88
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
88
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
89
89
|
rawSchema,
|
|
90
90
|
parseErrMsg: "The arguments provided are invalid",
|
|
91
91
|
unknownErrMsg: "Something went wrong parsing the command-line arguments"
|
|
@@ -96,25 +96,25 @@ export const {create, of, make} = factory
|
|
|
96
96
|
export type SanitizedArgs = z.infer<typeof schemas.schema>
|
|
97
97
|
export type t = SanitizedArgs
|
|
98
98
|
|
|
99
|
-
export const scaffoldTaskArgs = createType<RawScaffoldInput>({
|
|
99
|
+
export const scaffoldTaskArgs = createType<RawScaffoldInput, RawScaffoldInput>({
|
|
100
100
|
rawSchema: scaffoldRawSchema,
|
|
101
101
|
parseErrMsg: "The arguments provided are invalid for the scaffold task",
|
|
102
102
|
unknownErrMsg: "Something went wrong parsing the arguments for the scaffold task"
|
|
103
103
|
})
|
|
104
104
|
|
|
105
|
-
export const provisionTaskArgs = createType<RawProvisionInput>({
|
|
105
|
+
export const provisionTaskArgs = createType<RawProvisionInput, RawProvisionInput>({
|
|
106
106
|
rawSchema: provisionRawSchema,
|
|
107
107
|
parseErrMsg: "The arguments provided are invalid for the provision task",
|
|
108
108
|
unknownErrMsg: "Something went wrong parsing the arguments for the provision task"
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
export const installTaskArgs = createType<RawManagePluginInput>({
|
|
111
|
+
export const installTaskArgs = createType<RawManagePluginInput, RawManagePluginInput>({
|
|
112
112
|
rawSchema: managePluginRawSchema,
|
|
113
113
|
parseErrMsg: "The arguments provided are invalid for the install task",
|
|
114
114
|
unknownErrMsg: "Something went wrong parsing the arguments for the install task"
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
-
export const uninstallTaskArgs = createType<RawManagePluginInput>({
|
|
117
|
+
export const uninstallTaskArgs = createType<RawManagePluginInput, RawManagePluginInput>({
|
|
118
118
|
rawSchema: managePluginRawSchema,
|
|
119
119
|
parseErrMsg: "The arguments provided are invalid for the uninstall task",
|
|
120
120
|
unknownErrMsg: "Something went wrong parsing the arguments for the uninstall task"
|
package/SanitizedPath.ts
CHANGED
|
@@ -10,7 +10,7 @@ export const rawSchema = z
|
|
|
10
10
|
|
|
11
11
|
type RawInput = z.infer<typeof rawSchema>
|
|
12
12
|
|
|
13
|
-
const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
13
|
+
const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
14
14
|
isStringLike: true,
|
|
15
15
|
rawSchema,
|
|
16
16
|
parseErrMsg: (value: unknown) => `${value} is an invalid filesystem path`,
|
package/SingleChar.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const rawSchema = z
|
|
|
7
7
|
|
|
8
8
|
type RawInput = z.infer<typeof rawSchema>
|
|
9
9
|
|
|
10
|
-
export const {factory, schemas: generatedSchemas} = createType<RawInput>({
|
|
10
|
+
export const {factory, schemas: generatedSchemas} = createType<RawInput, RawInput>({
|
|
11
11
|
isStringLike: true,
|
|
12
12
|
rawSchema,
|
|
13
13
|
parseErrMsg: (value: unknown) => `${value} is not a single character`,
|
package/Task.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as Alias from "@taqueria/protocol/Alias"
|
|
|
4
4
|
import * as Command from '@taqueria/protocol/Command'
|
|
5
5
|
import * as Option from '@taqueria/protocol/Option'
|
|
6
6
|
import * as PositionalArg from '@taqueria/protocol/PositionalArg'
|
|
7
|
-
import createType from "@taqueria/protocol/Base"
|
|
7
|
+
import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
8
8
|
|
|
9
9
|
const taskEncodingSchema = z.preprocess(
|
|
10
10
|
(val: unknown) => val ?? 'none',
|
|
@@ -24,7 +24,7 @@ export const rawSchema = z.object({
|
|
|
24
24
|
task: Verb.rawSchema.describe("Task Name"),
|
|
25
25
|
command: Command.rawSchema.describe("Task Command"),
|
|
26
26
|
aliases: z.array(Alias.rawSchema).default([]).describe("Task Aliases").optional(),
|
|
27
|
-
description: z.string({description: "Task Description"}).
|
|
27
|
+
description: z.string({description: "Task Description"}).min(3),
|
|
28
28
|
example: z.string({description: "Task Example"}).optional(),
|
|
29
29
|
hidden: z.boolean({description: "Task Is Hidden"}).default(false).optional(),
|
|
30
30
|
encoding: taskEncodingSchema.describe("Task Encoding"),
|
|
@@ -37,12 +37,15 @@ const internalSchema = z.object({
|
|
|
37
37
|
task: Verb.schemas.schema.describe("Task Name"),
|
|
38
38
|
command: Command.schemas.schema.describe("Task Command"),
|
|
39
39
|
aliases: z.array(Alias.rawSchema).default([]).describe("Task Aliases").optional(),
|
|
40
|
-
description: z.string({description: "Task Description"}).
|
|
40
|
+
description: z.string({description: "Task Description"}).min(3),
|
|
41
41
|
example: z.string({description: "Task Example"}).optional(),
|
|
42
42
|
hidden: z.boolean({description: "Task Is Hidden"}).default(false).optional(),
|
|
43
43
|
encoding: taskEncodingSchema.describe("Task Encoding"),
|
|
44
44
|
handler: taskHandlerSchema.describe("Task Handler"),
|
|
45
|
-
options: z.
|
|
45
|
+
options: z.preprocess(
|
|
46
|
+
val => val ?? [],
|
|
47
|
+
z.array(Option.schemas.schema).describe("Task Options").optional(),
|
|
48
|
+
),
|
|
46
49
|
positionals: z.array(PositionalArg.schemas.schema).default([]).describe("Task Positional Args").optional()
|
|
47
50
|
}).describe("Task")
|
|
48
51
|
|
|
@@ -61,5 +64,5 @@ export type t = Task
|
|
|
61
64
|
export const {create, make, of} = factory
|
|
62
65
|
export const schemas = {
|
|
63
66
|
...generatedSchemas,
|
|
64
|
-
schema: generatedSchemas.schema.transform(val => val as unknown as Task)
|
|
67
|
+
// schema: generatedSchemas.schema.transform(val => val as unknown as Task)
|
|
65
68
|
}
|
package/Tz.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {z} from 'zod'
|
|
2
2
|
import createType from "@taqueria/protocol/Base"
|
|
3
3
|
|
|
4
|
-
export const rawSchema = z.string({description: "Tz"}).
|
|
4
|
+
export const rawSchema = z.string({description: "Tz"}).min(1).regex(/^\d([\d_]+\d)?$/)
|
|
5
5
|
|
|
6
6
|
type RawInput = z.infer<typeof rawSchema>
|
|
7
7
|
|
|
8
|
-
export const {schemas, factory} = createType<RawInput>({
|
|
8
|
+
export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
9
9
|
isStringLike: true,
|
|
10
10
|
rawSchema,
|
|
11
11
|
parseErrMsg: (value: unknown) => `${value} is an invalid Tz amount`,
|
package/Url.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const rawSchema = z
|
|
|
7
7
|
|
|
8
8
|
type RawInput = z.infer<typeof rawSchema>
|
|
9
9
|
|
|
10
|
-
export const {schemas: generatedSchemas, factory} = createType<RawInput>({
|
|
10
|
+
export const {schemas: generatedSchemas, factory} = createType<RawInput, RawInput>({
|
|
11
11
|
rawSchema,
|
|
12
12
|
isStringLike: true,
|
|
13
13
|
parseErrMsg: (value: unknown) => `${value} is an invalid url`,
|
package/Verb.ts
CHANGED
|
@@ -3,12 +3,12 @@ import createType from "@taqueria/protocol/Base"
|
|
|
3
3
|
|
|
4
4
|
export const rawSchema = z
|
|
5
5
|
.string({description: "Verb"})
|
|
6
|
-
.
|
|
6
|
+
.min(1, "Must be a valid verb")
|
|
7
7
|
.regex(/^[A-Za-z\-\ ]+/, "Must be a valid verb")
|
|
8
8
|
|
|
9
9
|
type Input = z.infer<typeof rawSchema>
|
|
10
10
|
|
|
11
|
-
export const {factory, schemas: generatedSchemas} = createType<Input>({
|
|
11
|
+
export const {factory, schemas: generatedSchemas} = createType<Input, Input>({
|
|
12
12
|
isStringLike: true,
|
|
13
13
|
rawSchema,
|
|
14
14
|
parseErrMsg: (value: unknown) => `${value} is not an invalid verb`,
|
package/VersionNumber.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/protocol",
|
|
3
|
-
"version": "0.0.0-pr-659-
|
|
3
|
+
"version": "0.0.0-pr-659-73dc044f",
|
|
4
4
|
"description": "A TypeScript package which contains types that are to be shared between @taqueria/node-sdk and @taqueria/taqueria.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|