@taqueria/protocol 0.0.0-pr-777-5c993a93 → 0.0.0-pr-779-eaf2ca6a
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/Base.ts +4 -8
- package/Config.ts +16 -25
- package/Environment.ts +1 -1
- package/LoadedConfig.ts +10 -18
- package/PersistentState.ts +5 -33
- package/RequestArgs.ts +4 -4
- package/SanitizedArgs.ts +1 -1
- package/Task.ts +2 -5
- package/i18n.ts +1 -1
- package/package.json +1 -1
- package/Timestamp.ts +0 -25
package/Base.ts
CHANGED
|
@@ -58,7 +58,7 @@ export const createType = <R, I>(params: CreateTypeParams) => {
|
|
|
58
58
|
|
|
59
59
|
type T = z.infer<typeof schemas.schema>
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const of = (input: R | I | unknown) => {
|
|
62
62
|
try {
|
|
63
63
|
return resolve<T>(schemas.schema.parse(input))
|
|
64
64
|
}
|
|
@@ -77,19 +77,15 @@ export const createType = <R, I>(params: CreateTypeParams) => {
|
|
|
77
77
|
return toFutureParseUnknownErr<T>(previous, unknownMsg, input)
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
const of = internalOf
|
|
81
80
|
|
|
82
|
-
const make = (input: I) =>
|
|
81
|
+
const make = (input: I) => of(input)
|
|
83
82
|
|
|
84
|
-
const create = (input: R | I) => schemas.schema.parse(input) as T
|
|
85
|
-
|
|
86
|
-
const from = (input: unknown) => schemas.schema.parse(input) as T
|
|
83
|
+
const create = (input: R | I | unknown) => schemas.schema.parse(input) as T
|
|
87
84
|
|
|
88
85
|
const factory = {
|
|
89
86
|
make,
|
|
90
87
|
of,
|
|
91
|
-
create
|
|
92
|
-
from
|
|
88
|
+
create
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
return {
|
package/Config.ts
CHANGED
|
@@ -6,20 +6,6 @@ import * as Environment from "@taqueria/protocol/Environment"
|
|
|
6
6
|
import * as Tz from "@taqueria/protocol/Tz"
|
|
7
7
|
import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
8
8
|
|
|
9
|
-
export const pluginsRawSchema = z.preprocess(
|
|
10
|
-
val => val ?? [],
|
|
11
|
-
z.array(
|
|
12
|
-
InstalledPlugin.rawSchema, {description: "config.plugins"}
|
|
13
|
-
)
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export const pluginsInternalSchema = z.preprocess(
|
|
17
|
-
val => val ?? [],
|
|
18
|
-
z.array(
|
|
19
|
-
InstalledPlugin.schemas.schema, {description: "config.plugins"}
|
|
20
|
-
)
|
|
21
|
-
)
|
|
22
|
-
|
|
23
9
|
const networkMap = z
|
|
24
10
|
.record(
|
|
25
11
|
z.union([
|
|
@@ -46,7 +32,8 @@ const environmentMap = z
|
|
|
46
32
|
.record(
|
|
47
33
|
z.union([
|
|
48
34
|
Environment.schemas.schema,
|
|
49
|
-
z.string(
|
|
35
|
+
z.string({description: "config.environment"})
|
|
36
|
+
.min(1, "Default environment must reference the name of an existing environment.")
|
|
50
37
|
]),
|
|
51
38
|
{description: "Environment configurations"}
|
|
52
39
|
)
|
|
@@ -65,15 +52,20 @@ const accountsMap = z.preprocess(
|
|
|
65
52
|
)
|
|
66
53
|
|
|
67
54
|
const commonSchema = z.object({
|
|
68
|
-
language: z
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
language: z
|
|
56
|
+
.union([z.literal('en'), z.literal('fr')], {description: "config.language"})
|
|
57
|
+
.optional()
|
|
58
|
+
.transform((val?: 'en' | 'fr' | string) => val ?? 'en'),
|
|
59
|
+
plugins: z
|
|
60
|
+
.array(InstalledPlugin.schemas.schema, {description: "config.plugins"})
|
|
74
61
|
.optional()
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
.transform((val: unknown) => (val ?? []) as InstalledPlugin.t[]),
|
|
63
|
+
testsDir: z
|
|
64
|
+
.preprocess(
|
|
65
|
+
(val: unknown) => val ?? "tests",
|
|
66
|
+
z.string({description: "config.testsDir"})
|
|
67
|
+
.min(1, "config.testsDir must have a value")
|
|
68
|
+
),
|
|
77
69
|
contractsDir: z
|
|
78
70
|
.preprocess(
|
|
79
71
|
(val: unknown) => val ?? "contracts",
|
|
@@ -96,7 +88,6 @@ export const internalSchema = commonSchema.extend({
|
|
|
96
88
|
})
|
|
97
89
|
|
|
98
90
|
export const rawSchema = commonSchema.extend({
|
|
99
|
-
plugins: pluginsRawSchema.optional(),
|
|
100
91
|
network: z
|
|
101
92
|
.record(
|
|
102
93
|
z.union([
|
|
@@ -132,7 +123,7 @@ export const rawSchema = commonSchema.extend({
|
|
|
132
123
|
.optional()
|
|
133
124
|
}).describe("config")
|
|
134
125
|
|
|
135
|
-
type RawInput = z.infer<typeof rawSchema
|
|
126
|
+
type RawInput = Flatten<z.infer<typeof rawSchema>>
|
|
136
127
|
type Input = z.infer<typeof internalSchema>
|
|
137
128
|
|
|
138
129
|
export const {schemas, factory} = createType<RawInput, Input>({
|
package/Environment.ts
CHANGED
|
@@ -28,6 +28,6 @@ export const {schemas, factory} = createType<RawInput, RawInput>({
|
|
|
28
28
|
export type Environment = Flatten<z.infer<typeof schemas.schema>>
|
|
29
29
|
export type t = Environment
|
|
30
30
|
|
|
31
|
-
export const {create, make, of
|
|
31
|
+
export const {create, make, of} = factory
|
|
32
32
|
|
|
33
33
|
export const {internalSchema} = schemas
|
package/LoadedConfig.ts
CHANGED
|
@@ -4,25 +4,17 @@ import * as SanitizedAbsPath from '@taqueria/protocol/SanitizedAbsPath'
|
|
|
4
4
|
import * as SHA256 from '@taqueria/protocol/SHA256'
|
|
5
5
|
import createType, {Flatten} from "@taqueria/protocol/Base"
|
|
6
6
|
|
|
7
|
-
export const rawSchema = Config.rawSchema
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
configFile: SanitizedAbsPath.rawSchema.describe("loadedConfig.configFile"),
|
|
13
|
-
hash: SHA256.rawSchema.describe("loadedConfig.hash")
|
|
14
|
-
})
|
|
15
|
-
.describe("LoadedConfig")
|
|
7
|
+
export const rawSchema = Config.rawSchema.extend({
|
|
8
|
+
projectDir: SanitizedAbsPath.rawSchema.describe("loadedConfig.projectDir"),
|
|
9
|
+
configFile: SanitizedAbsPath.rawSchema.describe("loadedConfig.configFile"),
|
|
10
|
+
hash: SHA256.rawSchema.describe("loadedConfig.hash")
|
|
11
|
+
}).describe("LoadedConfig")
|
|
16
12
|
|
|
17
|
-
export const internalSchema = Config.internalSchema
|
|
18
|
-
.
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
configFile: SanitizedAbsPath.schemas.schema.describe("loadedConfig.configFile"),
|
|
23
|
-
hash: SHA256.schemas.schema.describe("loadedConfig.hash")
|
|
24
|
-
})
|
|
25
|
-
.describe("LoadedConfig")
|
|
13
|
+
export const internalSchema = Config.internalSchema.extend({
|
|
14
|
+
projectDir: SanitizedAbsPath.schemas.schema.describe("loadedConfig.projectDir"),
|
|
15
|
+
configFile: SanitizedAbsPath.schemas.schema.describe("loadedConfig.configFile"),
|
|
16
|
+
hash: SHA256.schemas.schema.describe("loadedConfig.hash")
|
|
17
|
+
}).describe("LoadedConfig")
|
|
26
18
|
|
|
27
19
|
type RawInput = z.infer<typeof rawSchema>
|
|
28
20
|
type Input = Flatten<z.infer<typeof internalSchema>>
|
package/PersistentState.ts
CHANGED
|
@@ -1,50 +1,22 @@
|
|
|
1
1
|
import {z} from "zod"
|
|
2
|
-
import * as Verb from "@taqueria/protocol/Verb"
|
|
3
2
|
import * as SHA256 from "@taqueria/protocol/SHA256"
|
|
4
|
-
import * as Timestamp from "@taqueria/protocol/Timestamp"
|
|
5
3
|
import createType from "@taqueria/protocol/Base"
|
|
6
4
|
|
|
7
5
|
const rawOpSchema = z.object({
|
|
8
6
|
hash: SHA256.rawSchema.describe("state.op.hash"),
|
|
9
|
-
time:
|
|
7
|
+
time: z.number().min(1651846877).describe("state.op.time"),
|
|
10
8
|
output: z.unknown().describe("state.op.output")
|
|
11
|
-
}).describe("Persistent State Operation")
|
|
12
|
-
|
|
13
|
-
const rawTaskSchema = z.object({
|
|
14
|
-
time: Timestamp.rawSchema.describe("state.task.time"),
|
|
15
|
-
output: z.unknown().describe('state.task.output')
|
|
16
|
-
})
|
|
9
|
+
}).describe("Persistent State Operation")
|
|
17
10
|
|
|
18
11
|
const internalOpSchema = z.object({
|
|
19
12
|
hash: SHA256.schemas.schema.describe("state.op.hash"),
|
|
20
|
-
time:
|
|
21
|
-
output: z.unknown().describe("state.op.output")
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const internalTaskSchema = z.object({
|
|
25
|
-
task: Verb.schemas.schema,
|
|
26
|
-
plugin: z.string().min(1),
|
|
27
|
-
time: Timestamp.schemas.schema.describe("state.task.time"),
|
|
13
|
+
time: z.number().min(1651846877).describe("state.op.time"),
|
|
28
14
|
output: z.unknown().describe("state.op.output")
|
|
29
15
|
})
|
|
30
16
|
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
export type PersistedOperation = z.infer<typeof internalOpSchema>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export const rawSchema = z.object({
|
|
37
|
-
operations: z.record(rawOpSchema),
|
|
38
|
-
tasks: z.record(rawTaskSchema)
|
|
39
|
-
})
|
|
17
|
+
export const rawSchema = z.record(rawOpSchema)
|
|
40
18
|
|
|
41
|
-
export const internalSchema = z.
|
|
42
|
-
operations: z.record(internalOpSchema),
|
|
43
|
-
tasks: z.record(internalTaskSchema)
|
|
44
|
-
}).transform(val => ({
|
|
45
|
-
operations: val.operations as unknown as Record<string, PersistedOperation>,
|
|
46
|
-
tasks: val.tasks as unknown as Record<string, PersistedTask>
|
|
47
|
-
}))
|
|
19
|
+
export const internalSchema = z.record(internalOpSchema)
|
|
48
20
|
|
|
49
21
|
type RawInput = z.infer<typeof rawSchema>
|
|
50
22
|
|
package/RequestArgs.ts
CHANGED
|
@@ -43,11 +43,11 @@ export type RequestArgs = z.infer<typeof schemas.schema>
|
|
|
43
43
|
export type t = RequestArgs
|
|
44
44
|
|
|
45
45
|
const rawProxySchema = rawSchema.extend({
|
|
46
|
-
task: z.string().
|
|
46
|
+
task: z.string().nonempty()
|
|
47
47
|
}).describe("ProxyRequestArgs").passthrough()
|
|
48
48
|
|
|
49
49
|
const internalProxySchema = internalSchema.extend({
|
|
50
|
-
task: z.string().
|
|
50
|
+
task: z.string().nonempty()
|
|
51
51
|
}).describe("ProxyRequestArgs").passthrough()
|
|
52
52
|
|
|
53
53
|
type RawProxyInput = z.infer<typeof rawProxySchema>
|
|
@@ -65,7 +65,7 @@ export const proxyFactory = proxy.factory
|
|
|
65
65
|
|
|
66
66
|
export type ProxyRequestArgs = z.infer<typeof proxySchemas.schema>
|
|
67
67
|
|
|
68
|
-
export const createProxyRequestArgs = proxyFactory.
|
|
68
|
+
export const createProxyRequestArgs = proxyFactory.create
|
|
69
69
|
export const makeProxyRequestArgs = proxyFactory.make
|
|
70
70
|
export const ofProxyRequestArgs = proxyFactory.of
|
|
71
|
-
export const {create,
|
|
71
|
+
export const {create, of, make} = factory
|
package/SanitizedArgs.ts
CHANGED
|
@@ -125,7 +125,7 @@ export type ProvisionTaskArgs = z.infer<typeof provisionTaskArgs.schemas.schema>
|
|
|
125
125
|
export type InstallTaskArgs = z.infer<typeof installTaskArgs.schemas.schema>
|
|
126
126
|
export type UninstallTaskArgs = z.infer<typeof uninstallTaskArgs.schemas.schema>
|
|
127
127
|
|
|
128
|
-
export const createScaffoldTaskArgs = scaffoldTaskArgs.factory.
|
|
128
|
+
export const createScaffoldTaskArgs = scaffoldTaskArgs.factory.create
|
|
129
129
|
export const makeScaffoldTaskArgs = scaffoldTaskArgs.factory.make
|
|
130
130
|
export const ofScaffoldTaskArgs = scaffoldTaskArgs.factory.of
|
|
131
131
|
|
package/Task.ts
CHANGED
|
@@ -18,10 +18,7 @@ const taskEncodingSchema = z.preprocess(
|
|
|
18
18
|
.optional()
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
-
const taskHandlerSchema = z.union([
|
|
22
|
-
z.literal('proxy'),
|
|
23
|
-
z.string().min(1),
|
|
24
|
-
])
|
|
21
|
+
const taskHandlerSchema = z.union([z.literal('proxy'), z.string()])
|
|
25
22
|
|
|
26
23
|
export const rawSchema = z.object({
|
|
27
24
|
task: Verb.rawSchema.describe("Task Name"),
|
|
@@ -67,5 +64,5 @@ export type t = Task
|
|
|
67
64
|
export const {create, make, of} = factory
|
|
68
65
|
export const schemas = {
|
|
69
66
|
...generatedSchemas,
|
|
70
|
-
schema: generatedSchemas.schema.transform(val => val as unknown as Task)
|
|
67
|
+
// schema: generatedSchemas.schema.transform(val => val as unknown as Task)
|
|
71
68
|
}
|
package/i18n.ts
CHANGED
|
@@ -19,7 +19,7 @@ export default async (): Promise<i18n> => {
|
|
|
19
19
|
"appName": "Taqueria",
|
|
20
20
|
"appDesc": "Taqueria is an integrated environment for compiling, testing, and deploying Tezos software.",
|
|
21
21
|
"versionDesc": "Display the verison number of the Taqueria program",
|
|
22
|
-
"betaWarning": "Taqueria is currently in BETA. You've been warned
|
|
22
|
+
"betaWarning": "🚧 Taqueria is currently in BETA. You've been warned! 🚧",
|
|
23
23
|
"configDirDesc": "Config directory (default ./.taq)",
|
|
24
24
|
"initDesc": "Initialize a new project",
|
|
25
25
|
"initPathDesc": "Path to your project directory",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/protocol",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-779-eaf2ca6a",
|
|
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": {
|
package/Timestamp.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {z} from 'zod'
|
|
2
|
-
import createType from "@taqueria/protocol/Base"
|
|
3
|
-
|
|
4
|
-
export const rawSchema = z
|
|
5
|
-
.number({description: "Timestamp"})
|
|
6
|
-
.min(1651846877)
|
|
7
|
-
|
|
8
|
-
type Input = z.infer<typeof rawSchema>
|
|
9
|
-
|
|
10
|
-
export const {factory, schemas: generatedSchemas} = createType<Input, Input>({
|
|
11
|
-
isStringLike: true,
|
|
12
|
-
rawSchema,
|
|
13
|
-
parseErrMsg: (value: unknown) => `${value} is an invalid timestamp`,
|
|
14
|
-
unknownErrMsg: `Something went wrong trying to parse a timestamp`
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export type Timestamp = z.infer<typeof generatedSchemas.schema>
|
|
18
|
-
export type t = Timestamp
|
|
19
|
-
export const {create, make, of} = factory
|
|
20
|
-
export const schemas = {
|
|
21
|
-
...generatedSchemas,
|
|
22
|
-
schema: generatedSchemas.schema.transform(val => val as Timestamp)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const now = () => Date.now() as Timestamp
|