@taqueria/protocol 0.16.0 → 0.19.2
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.d.ts +42 -0
- package/Alias.d.ts.map +1 -0
- package/Alias.js +70 -0
- package/Alias.js.map +1 -0
- package/Alias.mjs +34 -0
- package/Alias.mjs.map +1 -0
- package/Base.d.ts +48 -0
- package/Base.d.ts.map +1 -0
- package/Base.js +83 -0
- package/Base.js.map +1 -0
- package/Base.mjs +57 -0
- package/Base.mjs.map +1 -0
- package/Command.d.ts +24 -0
- package/Command.d.ts.map +1 -0
- package/Command.js +61 -0
- package/Command.js.map +1 -0
- package/Command.mjs +25 -0
- package/Command.mjs.map +1 -0
- package/Config.d.ts +2055 -0
- package/Config.d.ts.map +1 -0
- package/Config.js +175 -0
- package/Config.js.map +1 -0
- package/Config.mjs +135 -0
- package/Config.mjs.map +1 -0
- package/Contract.d.ts +82 -0
- package/Contract.d.ts.map +1 -0
- package/Contract.js +68 -0
- package/Contract.js.map +1 -0
- package/Contract.mjs +32 -0
- package/Contract.mjs.map +1 -0
- package/Crypto.d.ts +4 -0
- package/Crypto.d.ts.map +1 -0
- package/Crypto.js +35 -0
- package/Crypto.js.map +1 -0
- package/Crypto.mjs +10 -0
- package/Crypto.mjs.map +1 -0
- package/EconomicalProtocolHash.d.ts +41 -0
- package/EconomicalProtocolHash.d.ts.map +1 -0
- package/EconomicalProtocolHash.js +64 -0
- package/EconomicalProtocolHash.js.map +1 -0
- package/EconomicalProtocolHash.mjs +27 -0
- package/EconomicalProtocolHash.mjs.map +1 -0
- package/Environment.d.ts +134 -0
- package/Environment.d.ts.map +1 -0
- package/Environment.js +78 -0
- package/Environment.js.map +1 -0
- package/Environment.mjs +40 -0
- package/Environment.mjs.map +1 -0
- package/EphemeralState.d.ts +4556 -0
- package/EphemeralState.d.ts.map +1 -0
- package/EphemeralState.js +268 -0
- package/EphemeralState.js.map +1 -0
- package/EphemeralState.mjs +228 -0
- package/EphemeralState.mjs.map +1 -0
- package/Faucet.d.ts +203 -0
- package/Faucet.d.ts.map +1 -0
- package/Faucet.js +84 -0
- package/Faucet.js.map +1 -0
- package/Faucet.mjs +47 -0
- package/Faucet.mjs.map +1 -0
- package/HumanReadableIdentifier.d.ts +24 -0
- package/HumanReadableIdentifier.d.ts.map +1 -0
- package/HumanReadableIdentifier.js +61 -0
- package/HumanReadableIdentifier.js.map +1 -0
- package/HumanReadableIdentifier.mjs +25 -0
- package/HumanReadableIdentifier.mjs.map +1 -0
- package/InstalledPlugin.d.ts +92 -0
- package/InstalledPlugin.d.ts.map +1 -0
- package/InstalledPlugin.js +67 -0
- package/InstalledPlugin.js.map +1 -0
- package/InstalledPlugin.mjs +30 -0
- package/InstalledPlugin.mjs.map +1 -0
- package/LoadedConfig.d.ts +2318 -0
- package/LoadedConfig.d.ts.map +1 -0
- package/LoadedConfig.js +80 -0
- package/LoadedConfig.js.map +1 -0
- package/LoadedConfig.mjs +41 -0
- package/LoadedConfig.mjs.map +1 -0
- package/MetadataConfig.d.ts +155 -0
- package/MetadataConfig.d.ts.map +1 -0
- package/MetadataConfig.js +75 -0
- package/MetadataConfig.js.map +1 -0
- package/MetadataConfig.mjs +38 -0
- package/MetadataConfig.mjs.map +1 -0
- package/NetworkConfig.d.ts +424 -0
- package/NetworkConfig.d.ts.map +1 -0
- package/NetworkConfig.js +77 -0
- package/NetworkConfig.js.map +1 -0
- package/NetworkConfig.mjs +40 -0
- package/NetworkConfig.mjs.map +1 -0
- package/Operation.d.ts +1470 -0
- package/Operation.d.ts.map +1 -0
- package/Operation.js +98 -0
- package/Operation.js.map +1 -0
- package/Operation.mjs +60 -0
- package/Operation.mjs.map +1 -0
- package/Option.d.ts +309 -0
- package/Option.d.ts.map +1 -0
- package/Option.js +103 -0
- package/Option.js.map +1 -0
- package/Option.mjs +65 -0
- package/Option.mjs.map +1 -0
- package/ParsedOperation.d.ts +880 -0
- package/ParsedOperation.d.ts.map +1 -0
- package/ParsedOperation.js +63 -0
- package/ParsedOperation.js.map +1 -0
- package/ParsedOperation.mjs +26 -0
- package/ParsedOperation.mjs.map +1 -0
- package/ParsedTemplate.d.ts +1024 -0
- package/ParsedTemplate.d.ts.map +1 -0
- package/ParsedTemplate.js +71 -0
- package/ParsedTemplate.js.map +1 -0
- package/ParsedTemplate.mjs +34 -0
- package/ParsedTemplate.mjs.map +1 -0
- package/PersistentState.d.ts +575 -0
- package/PersistentState.d.ts.map +1 -0
- package/PersistentState.js +98 -0
- package/PersistentState.js.map +1 -0
- package/PersistentState.mjs +60 -0
- package/PersistentState.mjs.map +1 -0
- package/PluginActionName.d.ts +22 -0
- package/PluginActionName.d.ts.map +1 -0
- package/PluginActionName.js +48 -0
- package/PluginActionName.js.map +1 -0
- package/PluginActionName.mjs +23 -0
- package/PluginActionName.mjs.map +1 -0
- package/PluginDependenciesResponse.d.ts +152 -0
- package/PluginDependenciesResponse.d.ts.map +1 -0
- package/PluginDependenciesResponse.js +63 -0
- package/PluginDependenciesResponse.js.map +1 -0
- package/PluginDependenciesResponse.mjs +28 -0
- package/PluginDependenciesResponse.mjs.map +1 -0
- package/PluginInfo.d.ts +3418 -0
- package/PluginInfo.d.ts.map +1 -0
- package/PluginInfo.js +113 -0
- package/PluginInfo.js.map +1 -0
- package/PluginInfo.mjs +76 -0
- package/PluginInfo.mjs.map +1 -0
- package/PluginJsonResponse.d.ts +99 -0
- package/PluginJsonResponse.d.ts.map +1 -0
- package/PluginJsonResponse.js +59 -0
- package/PluginJsonResponse.js.map +1 -0
- package/PluginJsonResponse.mjs +25 -0
- package/PluginJsonResponse.mjs.map +1 -0
- package/PluginProxyResponse.d.ts +16 -0
- package/PluginProxyResponse.d.ts.map +1 -0
- package/PluginProxyResponse.js +61 -0
- package/PluginProxyResponse.js.map +1 -0
- package/PluginProxyResponse.mjs +25 -0
- package/PluginProxyResponse.mjs.map +1 -0
- package/PluginResponseEncoding.d.ts +32 -0
- package/PluginResponseEncoding.d.ts.map +1 -0
- package/PluginResponseEncoding.js +63 -0
- package/PluginResponseEncoding.js.map +1 -0
- package/PluginResponseEncoding.mjs +27 -0
- package/PluginResponseEncoding.mjs.map +1 -0
- package/PluginSchema.d.ts +7324 -0
- package/PluginSchema.d.ts.map +1 -0
- package/PluginSchema.js +107 -0
- package/PluginSchema.js.map +1 -0
- package/PluginSchema.mjs +70 -0
- package/PluginSchema.mjs.map +1 -0
- package/PositionalArg.d.ts +183 -0
- package/PositionalArg.d.ts.map +1 -0
- package/PositionalArg.js +78 -0
- package/PositionalArg.js.map +1 -0
- package/PositionalArg.mjs +41 -0
- package/PositionalArg.mjs.map +1 -0
- package/Provisioner.d.ts +269 -0
- package/Provisioner.d.ts.map +1 -0
- package/Provisioner.js +86 -0
- package/Provisioner.js.map +1 -0
- package/Provisioner.mjs +48 -0
- package/Provisioner.mjs.map +1 -0
- package/ProvisionerID.d.ts +41 -0
- package/ProvisionerID.d.ts.map +1 -0
- package/ProvisionerID.js +61 -0
- package/ProvisionerID.js.map +1 -0
- package/ProvisionerID.mjs +24 -0
- package/ProvisionerID.mjs.map +1 -0
- package/Provisions.d.ts +237 -0
- package/Provisions.d.ts.map +1 -0
- package/Provisions.js +93 -0
- package/Provisions.js.map +1 -0
- package/Provisions.mjs +57 -0
- package/Provisions.mjs.map +1 -0
- package/PublicKeyHash.d.ts +42 -0
- package/PublicKeyHash.d.ts.map +1 -0
- package/PublicKeyHash.js +65 -0
- package/PublicKeyHash.js.map +1 -0
- package/PublicKeyHash.mjs +28 -0
- package/PublicKeyHash.mjs.map +1 -0
- package/RequestArgs.d.ts +5548 -0
- package/RequestArgs.d.ts.map +1 -0
- package/RequestArgs.js +136 -0
- package/RequestArgs.js.map +1 -0
- package/RequestArgs.mjs +89 -0
- package/RequestArgs.mjs.map +1 -0
- package/SHA256.d.ts +29 -0
- package/SHA256.d.ts.map +1 -0
- package/SHA256.js +79 -0
- package/SHA256.js.map +1 -0
- package/SHA256.mjs +42 -0
- package/SHA256.mjs.map +1 -0
- package/SandboxAccountConfig.d.ts +145 -0
- package/SandboxAccountConfig.d.ts.map +1 -0
- package/SandboxAccountConfig.js +72 -0
- package/SandboxAccountConfig.js.map +1 -0
- package/SandboxAccountConfig.mjs +35 -0
- package/SandboxAccountConfig.mjs.map +1 -0
- package/SandboxConfig.d.ts +543 -0
- package/SandboxConfig.d.ts.map +1 -0
- package/SandboxConfig.js +103 -0
- package/SandboxConfig.js.map +1 -0
- package/SandboxConfig.mjs +66 -0
- package/SandboxConfig.mjs.map +1 -0
- package/SanitizedAbsPath.d.ts +41 -0
- package/SanitizedAbsPath.d.ts.map +1 -0
- package/SanitizedAbsPath.js +64 -0
- package/SanitizedAbsPath.js.map +1 -0
- package/SanitizedAbsPath.mjs +27 -0
- package/SanitizedAbsPath.mjs.map +1 -0
- package/SanitizedArgs.d.ts +2900 -0
- package/SanitizedArgs.d.ts.map +1 -0
- package/SanitizedArgs.js +269 -0
- package/SanitizedArgs.js.map +1 -0
- package/SanitizedArgs.mjs +197 -0
- package/SanitizedArgs.mjs.map +1 -0
- package/SanitizedPath.d.ts +24 -0
- package/SanitizedPath.d.ts.map +1 -0
- package/SanitizedPath.js +64 -0
- package/SanitizedPath.js.map +1 -0
- package/SanitizedPath.mjs +28 -0
- package/SanitizedPath.mjs.map +1 -0
- package/ScaffoldConfig.d.ts +5 -0
- package/ScaffoldConfig.d.ts.map +1 -0
- package/ScaffoldConfig.js +19 -0
- package/ScaffoldConfig.js.map +1 -0
- package/ScaffoldConfig.mjs +1 -0
- package/ScaffoldConfig.mjs.map +1 -0
- package/Settings.d.ts +75 -0
- package/Settings.d.ts.map +1 -0
- package/Settings.js +66 -0
- package/Settings.js.map +1 -0
- package/Settings.mjs +29 -0
- package/Settings.mjs.map +1 -0
- package/SingleChar.d.ts +41 -0
- package/SingleChar.d.ts.map +1 -0
- package/SingleChar.js +62 -0
- package/SingleChar.js.map +1 -0
- package/SingleChar.mjs +25 -0
- package/SingleChar.mjs.map +1 -0
- package/TaqError.d.ts +21 -0
- package/TaqError.d.ts.map +1 -0
- package/TaqError.js +65 -0
- package/TaqError.js.map +1 -0
- package/TaqError.mjs +35 -0
- package/TaqError.mjs.map +1 -0
- package/Task.d.ts +818 -0
- package/Task.d.ts.map +1 -0
- package/Task.js +95 -0
- package/Task.js.map +1 -0
- package/Task.mjs +58 -0
- package/Task.mjs.map +1 -0
- package/Template.d.ts +1738 -0
- package/Template.d.ts.map +1 -0
- package/Template.js +117 -0
- package/Template.js.map +1 -0
- package/Template.mjs +79 -0
- package/Template.mjs.map +1 -0
- package/Timestamp.d.ts +44 -0
- package/Timestamp.d.ts.map +1 -0
- package/Timestamp.js +65 -0
- package/Timestamp.js.map +1 -0
- package/Timestamp.mjs +27 -0
- package/Timestamp.mjs.map +1 -0
- package/Tz.d.ts +40 -0
- package/Tz.d.ts.map +1 -0
- package/Tz.js +62 -0
- package/Tz.js.map +1 -0
- package/Tz.mjs +25 -0
- package/Tz.mjs.map +1 -0
- package/Url.d.ts +42 -0
- package/Url.d.ts.map +1 -0
- package/Url.js +68 -0
- package/Url.js.map +1 -0
- package/Url.mjs +30 -0
- package/Url.mjs.map +1 -0
- package/Verb.d.ts +41 -0
- package/Verb.d.ts.map +1 -0
- package/Verb.js +62 -0
- package/Verb.js.map +1 -0
- package/Verb.mjs +25 -0
- package/Verb.mjs.map +1 -0
- package/VersionNumber.d.ts +24 -0
- package/VersionNumber.d.ts.map +1 -0
- package/VersionNumber.js +61 -0
- package/VersionNumber.js.map +1 -0
- package/VersionNumber.mjs +25 -0
- package/VersionNumber.mjs.map +1 -0
- package/i18n.d.ts +7 -0
- package/i18n.d.ts.map +1 -0
- package/i18n.js +96 -0
- package/i18n.js.map +1 -0
- package/i18n.mjs +67 -0
- package/i18n.mjs.map +1 -0
- package/package.json +31 -3
- package/{taqueria-protocol-types.ts → taqueria-protocol-types.d.ts} +1 -0
- package/taqueria-protocol-types.d.ts.map +1 -0
- package/taqueria-protocol-types.js +142 -0
- package/taqueria-protocol-types.js.map +1 -0
- package/taqueria-protocol-types.mjs +76 -0
- package/taqueria-protocol-types.mjs.map +1 -0
- package/tzkt-config.d.ts +109 -0
- package/tzkt-config.d.ts.map +1 -0
- package/tzkt-config.js +65 -0
- package/tzkt-config.js.map +1 -0
- package/tzkt-config.mjs +28 -0
- package/tzkt-config.mjs.map +1 -0
- package/Alias.ts +0 -38
- package/Base.ts +0 -105
- package/Command.ts +0 -26
- package/Config.ts +0 -163
- package/Contract.ts +0 -35
- package/Crypto.ts +0 -3
- package/EconomicalProtocolHash.ts +0 -26
- package/Environment.ts +0 -40
- package/EphemeralState.ts +0 -282
- package/Faucet.ts +0 -46
- package/HumanReadableIdentifier.ts +0 -26
- package/InstalledPlugin.ts +0 -28
- package/LoadedConfig.ts +0 -45
- package/MetadataConfig.ts +0 -37
- package/NetworkConfig.ts +0 -39
- package/Operation.ts +0 -70
- package/Option.ts +0 -64
- package/ParsedOperation.ts +0 -33
- package/ParsedTemplate.ts +0 -40
- package/PersistentState.ts +0 -69
- package/PluginActionName.ts +0 -28
- package/PluginDependenciesResponse.ts +0 -33
- package/PluginInfo.ts +0 -76
- package/PluginJsonResponse.ts +0 -26
- package/PluginProxyResponse.ts +0 -24
- package/PluginResponseEncoding.ts +0 -27
- package/PluginSchema.ts +0 -81
- package/PositionalArg.ts +0 -41
- package/Provisioner.ts +0 -61
- package/ProvisionerID.ts +0 -25
- package/Provisions.ts +0 -70
- package/PublicKeyHash.ts +0 -28
- package/RequestArgs.ts +0 -97
- package/SHA256.ts +0 -42
- package/SandboxAccountConfig.ts +0 -35
- package/SandboxConfig.ts +0 -66
- package/SanitizedAbsPath.ts +0 -23
- package/SanitizedArgs.ts +0 -213
- package/SanitizedPath.ts +0 -28
- package/ScaffoldConfig.ts +0 -6
- package/Settings.ts +0 -27
- package/SingleChar.ts +0 -23
- package/TaqError.ts +0 -78
- package/Task.ts +0 -57
- package/Template.ts +0 -77
- package/Timestamp.ts +0 -25
- package/Tz.ts +0 -22
- package/Url.ts +0 -28
- package/Verb.ts +0 -23
- package/VersionNumber.ts +0 -25
- package/i18n.ts +0 -74
- package/tzkt-config.ts +0 -27
package/Config.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import createType, { Flatten } from '@taqueria/protocol/Base';
|
|
2
|
-
import * as Contract from '@taqueria/protocol/Contract';
|
|
3
|
-
import * as Environment from '@taqueria/protocol/Environment';
|
|
4
|
-
import * as InstalledPlugin from '@taqueria/protocol/InstalledPlugin';
|
|
5
|
-
import * as MetadataConfig from '@taqueria/protocol/MetadataConfig';
|
|
6
|
-
import * as NetworkConfig from '@taqueria/protocol/NetworkConfig';
|
|
7
|
-
import * as SandboxConfig from '@taqueria/protocol/SandboxConfig';
|
|
8
|
-
import * as Tz from '@taqueria/protocol/Tz';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
|
|
11
|
-
export const pluginsRawSchema = z.preprocess(
|
|
12
|
-
val => val ?? [],
|
|
13
|
-
z.array(
|
|
14
|
-
InstalledPlugin.rawSchema,
|
|
15
|
-
{ description: 'config.plugins' },
|
|
16
|
-
),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export const pluginsInternalSchema = z.preprocess(
|
|
20
|
-
val => val ?? [],
|
|
21
|
-
z.array(
|
|
22
|
-
InstalledPlugin.schemas.schema,
|
|
23
|
-
{ description: 'config.plugins' },
|
|
24
|
-
),
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const networkMap = z
|
|
28
|
-
.record(
|
|
29
|
-
z.union([
|
|
30
|
-
NetworkConfig.schemas.schema,
|
|
31
|
-
z.string({ description: 'config.network' })
|
|
32
|
-
.nonempty('Default network must reference the name of an existing network configuration.'),
|
|
33
|
-
]),
|
|
34
|
-
{ description: 'Network configurations' },
|
|
35
|
-
)
|
|
36
|
-
.optional();
|
|
37
|
-
|
|
38
|
-
const sandboxMap = z
|
|
39
|
-
.record(
|
|
40
|
-
z.union([
|
|
41
|
-
SandboxConfig.schemas.schema,
|
|
42
|
-
z.string({ description: 'config.sandbox' })
|
|
43
|
-
.min(1, 'Default sandbox must reference the name of an existing sandbox configuration.'),
|
|
44
|
-
]),
|
|
45
|
-
{ description: 'Sandbox configurations' },
|
|
46
|
-
)
|
|
47
|
-
.optional();
|
|
48
|
-
|
|
49
|
-
const environmentMap = z
|
|
50
|
-
.record(
|
|
51
|
-
z.union([
|
|
52
|
-
Environment.schemas.schema,
|
|
53
|
-
z.string().min(1, 'Default environment must reference the name of an existing environment.'),
|
|
54
|
-
]),
|
|
55
|
-
{ description: 'Environment configurations' },
|
|
56
|
-
)
|
|
57
|
-
.optional();
|
|
58
|
-
|
|
59
|
-
const accountsMap = z.preprocess(
|
|
60
|
-
(val: unknown) =>
|
|
61
|
-
val ?? {
|
|
62
|
-
'bob': '5_000_000_000',
|
|
63
|
-
'alice': '5_000_000_000',
|
|
64
|
-
'john': '5_000_000_000',
|
|
65
|
-
},
|
|
66
|
-
z.record(
|
|
67
|
-
z.union([Tz.rawSchema, z.number()]),
|
|
68
|
-
{ description: 'config.accounts' },
|
|
69
|
-
),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const commonSchema = z.object({
|
|
73
|
-
language: z.preprocess(
|
|
74
|
-
val => val ?? 'en',
|
|
75
|
-
z.union([
|
|
76
|
-
z.literal('en'),
|
|
77
|
-
z.literal('fr'),
|
|
78
|
-
], { description: 'config.language' })
|
|
79
|
-
.optional(),
|
|
80
|
-
),
|
|
81
|
-
plugins: pluginsInternalSchema.optional(),
|
|
82
|
-
contractsDir: z
|
|
83
|
-
.preprocess(
|
|
84
|
-
(val: unknown) => val ?? 'contracts',
|
|
85
|
-
z.string({ description: 'config.contractsDir' })
|
|
86
|
-
.min(1, 'config.contractsDir must have a value'),
|
|
87
|
-
),
|
|
88
|
-
artifactsDir: z
|
|
89
|
-
.preprocess(
|
|
90
|
-
(val: unknown) => val ?? 'artifacts',
|
|
91
|
-
z.string({ description: 'config.artifactsDir' })
|
|
92
|
-
.min(1, 'config.artifactsDir must have a value'),
|
|
93
|
-
),
|
|
94
|
-
contracts: z.record(
|
|
95
|
-
Contract.rawSchema,
|
|
96
|
-
).optional(),
|
|
97
|
-
}).describe('config');
|
|
98
|
-
|
|
99
|
-
export const internalSchema = commonSchema.extend({
|
|
100
|
-
network: networkMap,
|
|
101
|
-
sandbox: sandboxMap,
|
|
102
|
-
environment: environmentMap,
|
|
103
|
-
accounts: accountsMap,
|
|
104
|
-
contracts: z.record(Contract.schemas.schema).optional(),
|
|
105
|
-
metadata: MetadataConfig.schemas.schema.optional(),
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
export const rawSchema = commonSchema.extend({
|
|
109
|
-
plugins: pluginsRawSchema.optional(),
|
|
110
|
-
network: z
|
|
111
|
-
.record(
|
|
112
|
-
z.union([
|
|
113
|
-
NetworkConfig.rawSchema,
|
|
114
|
-
z.string({ description: 'config.network' })
|
|
115
|
-
.min(1, 'Default network must reference the name of an existing network configuration.'),
|
|
116
|
-
]),
|
|
117
|
-
)
|
|
118
|
-
.optional(),
|
|
119
|
-
sandbox: z
|
|
120
|
-
.record(
|
|
121
|
-
z.union([
|
|
122
|
-
SandboxConfig.rawSchema,
|
|
123
|
-
z.string({ description: 'config.sandbox' })
|
|
124
|
-
.min(1, 'Default sandbox must reference the name of an existing sandbox configuration.'),
|
|
125
|
-
]),
|
|
126
|
-
)
|
|
127
|
-
.optional(),
|
|
128
|
-
environment: z
|
|
129
|
-
.record(
|
|
130
|
-
z.union([
|
|
131
|
-
Environment.rawSchema,
|
|
132
|
-
z.string({ description: 'config.environment' })
|
|
133
|
-
.min(1, 'Default environment must reference the name of an existing environment.'),
|
|
134
|
-
]),
|
|
135
|
-
)
|
|
136
|
-
.optional(),
|
|
137
|
-
accounts: z
|
|
138
|
-
.record(
|
|
139
|
-
z.union([Tz.rawSchema, z.number()]),
|
|
140
|
-
{ description: 'config.accounts' },
|
|
141
|
-
)
|
|
142
|
-
.optional(),
|
|
143
|
-
metadata: MetadataConfig.rawSchema.optional(),
|
|
144
|
-
}).describe('config');
|
|
145
|
-
|
|
146
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
147
|
-
type Input = z.infer<typeof internalSchema>;
|
|
148
|
-
|
|
149
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, Input>({
|
|
150
|
-
rawSchema,
|
|
151
|
-
internalSchema,
|
|
152
|
-
parseErrMsg: (value: unknown) => `${value} is not a configuration`,
|
|
153
|
-
unknownErrMsg: 'Something went wrong trying to parse your configuration',
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export const { create, of, make } = factory;
|
|
157
|
-
export type Config = z.infer<typeof generatedSchemas.schema>;
|
|
158
|
-
export type t = Config;
|
|
159
|
-
|
|
160
|
-
export const schemas = {
|
|
161
|
-
...generatedSchemas,
|
|
162
|
-
schema: generatedSchemas.schema.transform(val => val as Config),
|
|
163
|
-
};
|
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 internalSchema>;
|
|
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
|
-
};
|
package/Crypto.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import createType from '@taqueria/protocol/Base';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
export const rawSchema = z
|
|
5
|
-
.string({ description: 'Protocol hash' })
|
|
6
|
-
.refine(
|
|
7
|
-
value => (value.length === 51 && value[0] === 'P' && /[A-Za-z0-9]+/.test(value)),
|
|
8
|
-
value => ({ message: `${value} is an invalid hash for an economical protocol` }),
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
12
|
-
|
|
13
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
14
|
-
rawSchema,
|
|
15
|
-
parseErrMsg: (value: unknown) => `${value} is an invalid economical protocol hash`,
|
|
16
|
-
unknownErrMsg: 'Somethign went wrong trying to parse the economical protocol hash',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export type EconomicalPrototypeHash = z.infer<typeof generatedSchemas.schema>;
|
|
20
|
-
export type t = EconomicalPrototypeHash;
|
|
21
|
-
|
|
22
|
-
export const { create, of, make } = factory;
|
|
23
|
-
export const schemas = {
|
|
24
|
-
...generatedSchemas,
|
|
25
|
-
schema: generatedSchemas.schema.transform(val => val as EconomicalPrototypeHash),
|
|
26
|
-
};
|
package/Environment.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import createType, { Flatten } from '@taqueria/protocol/Base';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
export const rawSchema = z.object({
|
|
5
|
-
networks: z.array(
|
|
6
|
-
z.string({ description: 'Environment network' })
|
|
7
|
-
.min(1, 'Must reference the name of an existing network configuration'),
|
|
8
|
-
),
|
|
9
|
-
sandboxes: z.array(
|
|
10
|
-
z.string({ description: 'Environment sandbox' })
|
|
11
|
-
.min(1, 'Must reference the name of an existing sandbox configuration'),
|
|
12
|
-
),
|
|
13
|
-
storage: z.record(
|
|
14
|
-
z.any({ description: 'Environment storage value' }),
|
|
15
|
-
{ description: 'Environment storage' },
|
|
16
|
-
)
|
|
17
|
-
.optional(),
|
|
18
|
-
aliases: z.record(
|
|
19
|
-
z.any({ description: 'Environment address alias' }),
|
|
20
|
-
{ description: 'Environment alias' },
|
|
21
|
-
).optional(),
|
|
22
|
-
}).describe('Environment Config');
|
|
23
|
-
|
|
24
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
25
|
-
|
|
26
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
27
|
-
rawSchema,
|
|
28
|
-
parseErrMsg: (value: unknown) => `${value} is not an valid environment configuration`,
|
|
29
|
-
unknownErrMsg: 'Something went wrong trying to parse the environment configuration',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export type Environment = Flatten<z.infer<typeof generatedSchemas.schema>>;
|
|
33
|
-
export type t = Environment;
|
|
34
|
-
|
|
35
|
-
export const { create, make, of, from } = factory;
|
|
36
|
-
|
|
37
|
-
export const schemas = {
|
|
38
|
-
...generatedSchemas,
|
|
39
|
-
schema: generatedSchemas.schema.transform(val => val as Environment),
|
|
40
|
-
};
|
package/EphemeralState.ts
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import createType from '@taqueria/protocol/Base';
|
|
2
|
-
import * as Command from '@taqueria/protocol/Command';
|
|
3
|
-
import * as Config from '@taqueria/protocol/Config';
|
|
4
|
-
import type { i18n } from '@taqueria/protocol/i18n';
|
|
5
|
-
import * as InstalledPlugin from '@taqueria/protocol/InstalledPlugin';
|
|
6
|
-
import * as Option from '@taqueria/protocol/Option';
|
|
7
|
-
import * as ParsedOperation from '@taqueria/protocol/ParsedOperation';
|
|
8
|
-
import * as ParsedTemplate from '@taqueria/protocol/ParsedTemplate';
|
|
9
|
-
import * as PluginInfo from '@taqueria/protocol/PluginInfo';
|
|
10
|
-
import * as PluginResponseEncoding from '@taqueria/protocol/PluginResponseEncoding';
|
|
11
|
-
import { E_TaqError, TaqError } from '@taqueria/protocol/TaqError';
|
|
12
|
-
import * as Task from '@taqueria/protocol/Task';
|
|
13
|
-
import * as Verb from '@taqueria/protocol/Verb';
|
|
14
|
-
import { attemptP, FutureInstance as Future, mapRej, promise } from 'fluture';
|
|
15
|
-
import { z } from 'zod';
|
|
16
|
-
|
|
17
|
-
const eager = <T>(f: Future<TaqError, T>) =>
|
|
18
|
-
promise(
|
|
19
|
-
mapRej((err: TaqError) => new E_TaqError(err))(f),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const taskToPluginMap = z.record(
|
|
23
|
-
z.union([
|
|
24
|
-
InstalledPlugin.schemas.schema,
|
|
25
|
-
Task.schemas.schema,
|
|
26
|
-
], { description: 'Task/Plugin Mapping' }),
|
|
27
|
-
);
|
|
28
|
-
const operationToPluginMap = z.record(
|
|
29
|
-
z.union([
|
|
30
|
-
InstalledPlugin.schemas.schema,
|
|
31
|
-
ParsedOperation.schemas.schema,
|
|
32
|
-
], { description: 'Operation/Plugin Mapping' }),
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const templateToPluginMap = z.record(
|
|
36
|
-
z.union([
|
|
37
|
-
InstalledPlugin.schemas.schema,
|
|
38
|
-
ParsedTemplate.schemas.schema,
|
|
39
|
-
]),
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const rawSchema = z.object({
|
|
43
|
-
build: z.string({ description: 'cache.build' }),
|
|
44
|
-
configHash: z.string({ description: 'cache.configHash' }),
|
|
45
|
-
tasks: taskToPluginMap,
|
|
46
|
-
operations: operationToPluginMap,
|
|
47
|
-
templates: templateToPluginMap,
|
|
48
|
-
plugins: z.array(PluginInfo.schemas.schema, { description: 'cache.plugins' }),
|
|
49
|
-
}).describe('Ephemeral State');
|
|
50
|
-
|
|
51
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
52
|
-
|
|
53
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
54
|
-
rawSchema,
|
|
55
|
-
parseErrMsg: (value: unknown) => `${value} is not a valid representation of ephemeral state`,
|
|
56
|
-
unknownErrMsg: 'Something went wrong when parsing the ephemeral state',
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
export type EphemeralState = z.infer<typeof generatedSchemas.schema>;
|
|
60
|
-
export type t = EphemeralState;
|
|
61
|
-
export type TaskToPluginMap = z.infer<typeof taskToPluginMap>;
|
|
62
|
-
export type OpToPluginMap = z.infer<typeof operationToPluginMap>;
|
|
63
|
-
export type TemplateToPluginMap = z.infer<typeof templateToPluginMap>;
|
|
64
|
-
|
|
65
|
-
export const { create, of, make } = factory;
|
|
66
|
-
|
|
67
|
-
export const schemas = {
|
|
68
|
-
...generatedSchemas,
|
|
69
|
-
schema: generatedSchemas.schema.transform(val => val as EphemeralState),
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Private functions
|
|
74
|
-
*/
|
|
75
|
-
type Counts = Record<Verb.t, PluginInfo.t[]>;
|
|
76
|
-
const getTaskCounts = (pluginInfo: PluginInfo.t[]): Counts => {
|
|
77
|
-
return pluginInfo.reduce(
|
|
78
|
-
(retval, pluginInfo) =>
|
|
79
|
-
pluginInfo.tasks === undefined
|
|
80
|
-
? {}
|
|
81
|
-
: pluginInfo.tasks.reduce(
|
|
82
|
-
(retval: Counts, task: Task.t) => {
|
|
83
|
-
const taskName = task.task;
|
|
84
|
-
const providers: PluginInfo.t[] = retval[taskName]
|
|
85
|
-
? [...retval[taskName], pluginInfo]
|
|
86
|
-
: [pluginInfo];
|
|
87
|
-
const mapping: Counts = {};
|
|
88
|
-
mapping[taskName] = providers.filter(provider => provider !== undefined);
|
|
89
|
-
return { ...retval, ...mapping };
|
|
90
|
-
},
|
|
91
|
-
retval,
|
|
92
|
-
),
|
|
93
|
-
{} as Counts,
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const getTemplateCounts = (pluginInfo: PluginInfo.t[]): Counts => {
|
|
98
|
-
return pluginInfo.reduce(
|
|
99
|
-
(retval, pluginInfo) =>
|
|
100
|
-
!pluginInfo.templates
|
|
101
|
-
? retval
|
|
102
|
-
: pluginInfo.templates.reduce(
|
|
103
|
-
(retval: Counts, template: ParsedTemplate.t) => {
|
|
104
|
-
const templateName = template.template;
|
|
105
|
-
const providers = retval[templateName]
|
|
106
|
-
? [...retval[templateName], pluginInfo]
|
|
107
|
-
: [pluginInfo];
|
|
108
|
-
const mapping: Counts = {};
|
|
109
|
-
mapping[templateName] = providers.filter(provider => provider !== undefined);
|
|
110
|
-
return { ...retval, ...mapping };
|
|
111
|
-
},
|
|
112
|
-
retval,
|
|
113
|
-
),
|
|
114
|
-
{} as Counts,
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const getOperationCounts = (pluginInfo: PluginInfo.t[]): Counts => {
|
|
119
|
-
return pluginInfo.reduce(
|
|
120
|
-
(retval, pluginInfo) =>
|
|
121
|
-
pluginInfo.operations === undefined
|
|
122
|
-
? retval
|
|
123
|
-
: pluginInfo.operations.reduce(
|
|
124
|
-
(retval: Counts, operation: ParsedOperation.t) => {
|
|
125
|
-
const operationName = operation.operation;
|
|
126
|
-
const providers = retval[operationName]
|
|
127
|
-
? [...retval[operationName], pluginInfo]
|
|
128
|
-
: [pluginInfo];
|
|
129
|
-
const mapping: Counts = {};
|
|
130
|
-
mapping[operationName] = providers.filter(provider => provider !== undefined);
|
|
131
|
-
return { ...retval, ...mapping };
|
|
132
|
-
},
|
|
133
|
-
retval,
|
|
134
|
-
),
|
|
135
|
-
{} as Counts,
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const toChoices = (plugins: PluginInfo.t[]) =>
|
|
140
|
-
plugins.reduce(
|
|
141
|
-
(retval, pluginInfo) => {
|
|
142
|
-
return [...retval, pluginInfo.name as string, pluginInfo.alias as string];
|
|
143
|
-
},
|
|
144
|
-
[] as string[],
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const isComposite = (name: Verb.t, counts: Counts) => counts[name] && counts[name].length > 1;
|
|
148
|
-
|
|
149
|
-
const getInstalledPlugin = (config: Config.t, name: string) =>
|
|
150
|
-
config.plugins?.find(
|
|
151
|
-
(plugin: InstalledPlugin.t) => [`taqueria-plugin-${name}`, name].includes(plugin.name),
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
export const mapTasksToPlugins = (config: Config.t, pluginInfo: PluginInfo.t[], i18n: i18n) => {
|
|
155
|
-
const taskCounts = getTaskCounts(pluginInfo);
|
|
156
|
-
return attemptP<TaqError, TaskToPluginMap>(async () =>
|
|
157
|
-
await pluginInfo.reduce(
|
|
158
|
-
async (retval, pluginInfo) =>
|
|
159
|
-
!pluginInfo.tasks
|
|
160
|
-
? Promise.resolve({} as TaskToPluginMap)
|
|
161
|
-
: await pluginInfo.tasks.reduce(
|
|
162
|
-
async (retval, { task }) => {
|
|
163
|
-
if (isComposite(task, taskCounts)) {
|
|
164
|
-
const command = await eager(Command.make(task));
|
|
165
|
-
const compositeTask = await eager(Task.make({
|
|
166
|
-
task,
|
|
167
|
-
command,
|
|
168
|
-
description: i18n.__('providedByMany'),
|
|
169
|
-
hidden: false,
|
|
170
|
-
options: [
|
|
171
|
-
await eager(Option.make({
|
|
172
|
-
flag: await eager(Verb.make('plugin')),
|
|
173
|
-
description: 'Specify which plugin should be used to execute this task',
|
|
174
|
-
choices: toChoices(taskCounts[task]),
|
|
175
|
-
required: true,
|
|
176
|
-
})),
|
|
177
|
-
],
|
|
178
|
-
handler: 'proxy',
|
|
179
|
-
}));
|
|
180
|
-
return { ...await retval, [task]: compositeTask };
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Task is provided by just a single plugin
|
|
184
|
-
const installedPlugin = getInstalledPlugin(config, pluginInfo.name);
|
|
185
|
-
return installedPlugin
|
|
186
|
-
? { ...await retval, [task]: installedPlugin }
|
|
187
|
-
: retval;
|
|
188
|
-
},
|
|
189
|
-
retval,
|
|
190
|
-
),
|
|
191
|
-
Promise.resolve({} as TaskToPluginMap),
|
|
192
|
-
)
|
|
193
|
-
).pipe(mapRej(rej => rej as TaqError));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const mapOperationsToPlugins = (config: Config.t, pluginInfo: PluginInfo.t[], i18n: i18n) => {
|
|
197
|
-
const opCounts = getOperationCounts(pluginInfo);
|
|
198
|
-
return attemptP(async () =>
|
|
199
|
-
await pluginInfo.reduce(
|
|
200
|
-
async (retval, pluginInfo) =>
|
|
201
|
-
!pluginInfo.operations
|
|
202
|
-
? Promise.resolve({} as OpToPluginMap)
|
|
203
|
-
: await pluginInfo.operations.reduce(
|
|
204
|
-
async (retval, { operation }) => {
|
|
205
|
-
if (isComposite(operation, opCounts)) {
|
|
206
|
-
const command = await eager(Command.make(operation));
|
|
207
|
-
const compositeOp = await eager(ParsedOperation.make({
|
|
208
|
-
operation,
|
|
209
|
-
command,
|
|
210
|
-
description: i18n.__('providedByMany'),
|
|
211
|
-
options: [
|
|
212
|
-
await eager(Option.make({
|
|
213
|
-
flag: await eager(Verb.make('plugin')),
|
|
214
|
-
description: 'Specify which plugin should be used to execute this operation',
|
|
215
|
-
choices: toChoices(opCounts[operation]),
|
|
216
|
-
required: true,
|
|
217
|
-
})),
|
|
218
|
-
],
|
|
219
|
-
}));
|
|
220
|
-
return { ...await retval, [operation]: compositeOp };
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Operation is provided by just a single plugin
|
|
224
|
-
const installedPlugin = getInstalledPlugin(config, pluginInfo.name);
|
|
225
|
-
return installedPlugin
|
|
226
|
-
? { ...await retval, [operation]: installedPlugin }
|
|
227
|
-
: retval;
|
|
228
|
-
},
|
|
229
|
-
retval,
|
|
230
|
-
),
|
|
231
|
-
Promise.resolve({} as OpToPluginMap),
|
|
232
|
-
)
|
|
233
|
-
).pipe(mapRej(rej => rej as TaqError));
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export const mapTemplatesToPlugins = (config: Config.t, pluginInfo: PluginInfo.t[], i18n: i18n) => {
|
|
237
|
-
const tmplCounts = getTemplateCounts(pluginInfo);
|
|
238
|
-
return attemptP<TaqError, TemplateToPluginMap>(async () =>
|
|
239
|
-
await pluginInfo.reduce(
|
|
240
|
-
async (retval, pluginInfo) =>
|
|
241
|
-
!pluginInfo.templates
|
|
242
|
-
? Promise.resolve({} as TemplateToPluginMap)
|
|
243
|
-
: await pluginInfo.templates!.reduce(
|
|
244
|
-
async (retval, { template }) => {
|
|
245
|
-
if (isComposite(template, tmplCounts)) {
|
|
246
|
-
const command = await eager(Command.make(template));
|
|
247
|
-
const compositeTmpl = await eager(ParsedTemplate.make({
|
|
248
|
-
template,
|
|
249
|
-
command,
|
|
250
|
-
description: i18n.__('providedByMany'),
|
|
251
|
-
options: [
|
|
252
|
-
await eager(Option.make({
|
|
253
|
-
flag: await eager(Verb.make('plugin')),
|
|
254
|
-
description: 'Specify which plugin should be used to execute this task',
|
|
255
|
-
choices: toChoices(tmplCounts[template]),
|
|
256
|
-
required: true,
|
|
257
|
-
})),
|
|
258
|
-
],
|
|
259
|
-
handler: 'proxy',
|
|
260
|
-
encoding: PluginResponseEncoding.create('none'),
|
|
261
|
-
}));
|
|
262
|
-
return { ...await retval, [template]: compositeTmpl };
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Template is provided by just a single plugin
|
|
266
|
-
const installedPlugin = getInstalledPlugin(config, pluginInfo.name);
|
|
267
|
-
return installedPlugin
|
|
268
|
-
? { ...await retval, [template]: installedPlugin }
|
|
269
|
-
: retval;
|
|
270
|
-
},
|
|
271
|
-
retval,
|
|
272
|
-
),
|
|
273
|
-
Promise.resolve({} as TemplateToPluginMap),
|
|
274
|
-
)
|
|
275
|
-
).pipe(mapRej(rej => rej as TaqError));
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export const getTasks = (pluginInfo: PluginInfo.t[]) =>
|
|
279
|
-
pluginInfo.reduce(
|
|
280
|
-
(retval: Task.t[], pluginInfo) => [...retval, ...(pluginInfo.tasks ?? [])],
|
|
281
|
-
[],
|
|
282
|
-
);
|
package/Faucet.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import createType, { Flatten } from '@taqueria/protocol/Base';
|
|
2
|
-
import * as PublicKeyHash from '@taqueria/protocol/PublicKeyHash';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
export const rawSchema = z.object({
|
|
6
|
-
pkh: z.string({ description: 'Faucet Public Key Hash' }).min(1),
|
|
7
|
-
mnemonic: z.array(
|
|
8
|
-
z.string({ description: 'Faucet Mnemonic Word' }).min(1),
|
|
9
|
-
{ description: 'Faucet Mnemonic' },
|
|
10
|
-
),
|
|
11
|
-
email: z.string({ description: 'Faucet E-mail' }).regex(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/),
|
|
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
|
-
}).describe('Faucet');
|
|
16
|
-
|
|
17
|
-
const internalSchema = z.object({
|
|
18
|
-
pkh: PublicKeyHash.schemas.schema,
|
|
19
|
-
mnemonic: z.array(
|
|
20
|
-
z.string({ description: 'Faucet Mnemonic Word' }).nonempty().regex(/^[a-z]{2,}$/),
|
|
21
|
-
{ description: 'Faucet Mnemonic' },
|
|
22
|
-
),
|
|
23
|
-
email: z.string({ description: 'Faucet E-mail' }).regex(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/),
|
|
24
|
-
password: z.string({ description: 'Faucet Password' }).nonempty(),
|
|
25
|
-
amount: z.string({ description: 'Faucet Account' }).nonempty().regex(/^\d+$/),
|
|
26
|
-
activation_code: z.string({ description: 'Faucet Activation Code' }).nonempty(),
|
|
27
|
-
}).describe('Faucet');
|
|
28
|
-
|
|
29
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
30
|
-
type Input = z.infer<typeof internalSchema>;
|
|
31
|
-
|
|
32
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, Input>({
|
|
33
|
-
rawSchema,
|
|
34
|
-
internalSchema,
|
|
35
|
-
parseErrMsg: (value: unknown) => `${value} is not a valid faucet configuration`,
|
|
36
|
-
unknownErrMsg: 'Something went wrong trying to parse the faucet',
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export type Faucet = Flatten<z.infer<typeof generatedSchemas.schema>>;
|
|
40
|
-
export type t = Faucet;
|
|
41
|
-
export const { create, of, make } = factory;
|
|
42
|
-
|
|
43
|
-
export const schemas = {
|
|
44
|
-
...generatedSchemas,
|
|
45
|
-
schema: generatedSchemas.schema.transform(val => val as Faucet),
|
|
46
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import createType from '@taqueria/protocol/Base';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
export const rawSchema = z
|
|
5
|
-
.string({ description: 'Human Readable Identifier' })
|
|
6
|
-
.regex(/^[A-Za-z]+[A-Za-z0-9-_ ]*$/, 'Must be a valid human-readable identifier');
|
|
7
|
-
|
|
8
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
9
|
-
|
|
10
|
-
const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
11
|
-
isStringLike: true,
|
|
12
|
-
rawSchema,
|
|
13
|
-
parseErrMsg: (value: unknown) => `${value} is not a valid human-readable identifier`,
|
|
14
|
-
unknownErrMsg: 'Something went wrong trying to parse the human readable identifier',
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const internalSchema = generatedSchemas.schema;
|
|
18
|
-
|
|
19
|
-
export type HumanReadableIdentifier = z.infer<typeof internalSchema>;
|
|
20
|
-
export type t = HumanReadableIdentifier;
|
|
21
|
-
export const { create, of, make } = factory;
|
|
22
|
-
|
|
23
|
-
export const schemas = {
|
|
24
|
-
...generatedSchemas,
|
|
25
|
-
schema: generatedSchemas.schema.transform(val => val as HumanReadableIdentifier),
|
|
26
|
-
};
|
package/InstalledPlugin.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import createType from '@taqueria/protocol/Base';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
export const rawSchema = z.object({
|
|
5
|
-
name: z.string({ description: 'Plugin Name' }).min(1),
|
|
6
|
-
type: z.union(
|
|
7
|
-
[z.literal('npm'), z.literal('binary'), z.literal('deno')],
|
|
8
|
-
{ description: 'Plugin Type' },
|
|
9
|
-
),
|
|
10
|
-
}).describe('InstalledPlugin');
|
|
11
|
-
|
|
12
|
-
type RawInput = z.infer<typeof rawSchema>;
|
|
13
|
-
|
|
14
|
-
export const { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({
|
|
15
|
-
rawSchema,
|
|
16
|
-
parseErrMsg: (value: unknown) => `${value} is not a valid installed plugin`,
|
|
17
|
-
unknownErrMsg: 'Something went wrong when parsing the installed plugin',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export type InstalledPlugin = z.infer<typeof generatedSchemas.schema>;
|
|
21
|
-
export type t = InstalledPlugin;
|
|
22
|
-
|
|
23
|
-
export const { create, of, make } = factory;
|
|
24
|
-
|
|
25
|
-
export const schemas = {
|
|
26
|
-
...generatedSchemas,
|
|
27
|
-
schema: generatedSchemas.schema.transform(val => val as InstalledPlugin),
|
|
28
|
-
};
|