@taqueria/protocol 0.0.0-pr-908-834404c0 → 0.0.0-pr-910-0fa26acf
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/Config.ts +0 -5
- package/SanitizedArgs.ts +0 -28
- package/TaqError.ts +0 -1
- package/i18n.ts +0 -2
- package/package.json +1 -1
- package/Contract.ts +0 -35
package/Config.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import createType, { Flatten } from '@taqueria/protocol/Base';
|
|
2
|
-
import * as Contract from '@taqueria/protocol/Contract';
|
|
3
2
|
import * as Environment from '@taqueria/protocol/Environment';
|
|
4
3
|
import * as InstalledPlugin from '@taqueria/protocol/InstalledPlugin';
|
|
5
4
|
import * as NetworkConfig from '@taqueria/protocol/NetworkConfig';
|
|
@@ -90,9 +89,6 @@ const commonSchema = z.object({
|
|
|
90
89
|
z.string({ description: 'config.artifactsDir' })
|
|
91
90
|
.min(1, 'config.artifactsDir must have a value'),
|
|
92
91
|
),
|
|
93
|
-
contracts: z.record(
|
|
94
|
-
Contract.rawSchema,
|
|
95
|
-
).optional(),
|
|
96
92
|
}).describe('config');
|
|
97
93
|
|
|
98
94
|
export const internalSchema = commonSchema.extend({
|
|
@@ -100,7 +96,6 @@ export const internalSchema = commonSchema.extend({
|
|
|
100
96
|
sandbox: sandboxMap,
|
|
101
97
|
environment: environmentMap,
|
|
102
98
|
accounts: accountsMap,
|
|
103
|
-
contracts: z.record(Contract.schemas.schema).optional(),
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
export const rawSchema = commonSchema.extend({
|
package/SanitizedArgs.ts
CHANGED
|
@@ -86,28 +86,11 @@ export const versionRawSchema = rawSchema.extend({
|
|
|
86
86
|
version: z.boolean().default(true),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
export const manageContractsRawSchema = z.preprocess(
|
|
90
|
-
val => {
|
|
91
|
-
const obj: {
|
|
92
|
-
contractName?: string;
|
|
93
|
-
sourceFile?: string;
|
|
94
|
-
} = typeof val === 'object' ? Object(val) : ({ contractName: '', sourceFile: '' });
|
|
95
|
-
return !obj.contractName && obj.sourceFile
|
|
96
|
-
? { ...obj, contractName: obj['sourceFile'] }
|
|
97
|
-
: obj;
|
|
98
|
-
},
|
|
99
|
-
rawSchema.extend({
|
|
100
|
-
sourceFile: z.string().min(1),
|
|
101
|
-
contractName: z.string().min(1),
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
89
|
type RawInput = z.infer<typeof rawSchema>;
|
|
106
90
|
type RawScaffoldInput = z.infer<typeof scaffoldRawSchema>;
|
|
107
91
|
type RawProvisionInput = z.infer<typeof provisionRawSchema>;
|
|
108
92
|
type RawManagePluginInput = z.infer<typeof managePluginRawSchema>;
|
|
109
93
|
type RawVersionInput = z.infer<typeof versionRawSchema>;
|
|
110
|
-
type RawManageContractsInput = z.infer<typeof manageContractsRawSchema>;
|
|
111
94
|
|
|
112
95
|
export const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
113
96
|
rawSchema,
|
|
@@ -149,17 +132,10 @@ export const uninstallTaskArgs = createType<RawManagePluginInput, RawManagePlugi
|
|
|
149
132
|
unknownErrMsg: 'Something went wrong parsing the arguments for the uninstall task',
|
|
150
133
|
});
|
|
151
134
|
|
|
152
|
-
export const manageContractsArgs = createType<RawManageContractsInput, RawManageContractsInput>({
|
|
153
|
-
rawSchema: manageContractsRawSchema,
|
|
154
|
-
parseErrMsg: "You're missing the sourceFile argument for this task",
|
|
155
|
-
unknownErrMsg: 'Something went wrong parsing the arguments for this task',
|
|
156
|
-
});
|
|
157
|
-
|
|
158
135
|
export type ScaffoldTaskArgs = z.infer<typeof scaffoldTaskArgs.schemas.schema>;
|
|
159
136
|
export type ProvisionTaskArgs = z.infer<typeof provisionTaskArgs.schemas.schema>;
|
|
160
137
|
export type InstallTaskArgs = z.infer<typeof installTaskArgs.schemas.schema>;
|
|
161
138
|
export type UninstallTaskArgs = z.infer<typeof uninstallTaskArgs.schemas.schema>;
|
|
162
|
-
export type ManageContractsArgs = z.infer<typeof manageContractsArgs.schemas.schema>;
|
|
163
139
|
|
|
164
140
|
export const createScaffoldTaskArgs = scaffoldTaskArgs.factory.from;
|
|
165
141
|
export const makeScaffoldTaskArgs = scaffoldTaskArgs.factory.make;
|
|
@@ -176,7 +152,3 @@ export const ofInstallTaskArgs = installTaskArgs.factory.of;
|
|
|
176
152
|
export const createUninstallTaskArgs = uninstallTaskArgs.factory.create;
|
|
177
153
|
export const makeUninstallTaskArgs = uninstallTaskArgs.factory.make;
|
|
178
154
|
export const ofUninstallTaskArgs = uninstallTaskArgs.factory.of;
|
|
179
|
-
|
|
180
|
-
export const createManageContractsArgs = manageContractsArgs.factory.create;
|
|
181
|
-
export const makeManageContractsArgs = manageContractsArgs.factory.make;
|
|
182
|
-
export const ofManageContractArgs = manageContractsArgs.factory.of;
|
package/TaqError.ts
CHANGED
package/i18n.ts
CHANGED
|
@@ -54,8 +54,6 @@ export default async (): Promise<i18n> => {
|
|
|
54
54
|
'buildDesc': 'Display build information about the current version',
|
|
55
55
|
'pluginOption': "Use to specify what plugin you'd like when running this task.",
|
|
56
56
|
'yesOptionDesc': 'Select "yes" to any prompt',
|
|
57
|
-
'addContractDesc': 'Add a contract to the contract registry',
|
|
58
|
-
'addSourceFileDesc': 'Source file to add to the contract registry',
|
|
59
57
|
},
|
|
60
58
|
},
|
|
61
59
|
},
|
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-910-0fa26acf",
|
|
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/Contract.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import createType, { Flatten } from '@taqueria/protocol/Base';
|
|
2
|
-
import * as SHA256 from '@taqueria/protocol/SHA256';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
export const rawSchema = z.object({
|
|
6
|
-
sourceFile: z.string().min(1),
|
|
7
|
-
hash: SHA256.rawSchema,
|
|
8
|
-
// TODO: Should plugin also be provided here?
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const internalSchema = z.object({
|
|
12
|
-
sourceFile: z.string().min(1),
|
|
13
|
-
hash: SHA256.schemas.schema,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
17
|
-
type Input = z.infer<typeof internalSchema>;
|
|
18
|
-
|
|
19
|
-
const { schemas: generatedSchemas, factory } = createType<RawInput, Input>({
|
|
20
|
-
rawSchema,
|
|
21
|
-
internalSchema,
|
|
22
|
-
parseErrMsg: (value: unknown) => `${value} is not a valid contract`,
|
|
23
|
-
unknownErrMsg: 'Something went wrong trying to parse a contract',
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export type Contract = z.infer<typeof generatedSchemas.schema>;
|
|
27
|
-
|
|
28
|
-
export type t = Contract;
|
|
29
|
-
|
|
30
|
-
export const { create, of, make } = factory;
|
|
31
|
-
|
|
32
|
-
export const schemas = {
|
|
33
|
-
...generatedSchemas,
|
|
34
|
-
schema: generatedSchemas.schema.transform(val => val as Contract),
|
|
35
|
-
};
|