@taqueria/protocol 0.14.4 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Alias.d.ts +48 -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 +50 -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 +30 -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 +2062 -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 +88 -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 +5 -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 +48 -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 +142 -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 +4561 -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 +210 -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 +30 -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 +99 -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 +2325 -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 +162 -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 +431 -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 +1476 -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 +316 -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 +888 -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 +1032 -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 +581 -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 +23 -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 +158 -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 +3425 -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 +104 -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 +23 -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 +39 -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 +7332 -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 +190 -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 +276 -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 +48 -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 +244 -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 +49 -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 +5557 -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 +33 -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 +152 -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 +550 -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 +48 -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 +2907 -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 +30 -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 +6 -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 +82 -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 +48 -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 +24 -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 +825 -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 +1746 -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 +51 -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 +47 -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 +49 -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 +48 -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 +30 -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.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.d.ts +72 -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 +116 -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 -63
- 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/taqueria-protocol-types.ts +0 -36
package/Alias.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as fluture from 'fluture';
|
|
2
|
+
import { TaqError } from './TaqError.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const rawSchema: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
6
|
+
declare const internalSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, string & {
|
|
7
|
+
readonly __kind: any;
|
|
8
|
+
}, any>, string & {
|
|
9
|
+
readonly __kind: any;
|
|
10
|
+
}, any>, z.ZodEffects<z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, string & {
|
|
11
|
+
readonly __kind: any;
|
|
12
|
+
}, any>, string & {
|
|
13
|
+
readonly __kind: any;
|
|
14
|
+
}, any>]>;
|
|
15
|
+
declare type Alias = z.infer<typeof internalSchema>;
|
|
16
|
+
declare type t = Alias;
|
|
17
|
+
declare const create: (input: string | (string & {
|
|
18
|
+
readonly __kind: any;
|
|
19
|
+
})) => string & {
|
|
20
|
+
readonly __kind: any;
|
|
21
|
+
} & {
|
|
22
|
+
readonly __kind: any;
|
|
23
|
+
};
|
|
24
|
+
declare const of: (input: unknown) => fluture.FutureInstance<TaqError, string & {
|
|
25
|
+
readonly __kind: any;
|
|
26
|
+
} & {
|
|
27
|
+
readonly __kind: any;
|
|
28
|
+
}>;
|
|
29
|
+
declare const make: (input: string & {
|
|
30
|
+
readonly __kind: any;
|
|
31
|
+
}) => fluture.FutureInstance<TaqError, string & {
|
|
32
|
+
readonly __kind: any;
|
|
33
|
+
} & {
|
|
34
|
+
readonly __kind: any;
|
|
35
|
+
}>;
|
|
36
|
+
declare const schemas: {
|
|
37
|
+
schema: z.ZodEffects<z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, string & {
|
|
38
|
+
readonly __kind: any;
|
|
39
|
+
} & {
|
|
40
|
+
readonly __kind: any;
|
|
41
|
+
}, any>, string & {
|
|
42
|
+
readonly __kind: any;
|
|
43
|
+
}, any>;
|
|
44
|
+
rawSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
45
|
+
internalSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { Alias, create, internalSchema, make, of, rawSchema, schemas, t };
|
package/Alias.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// Alias.ts
|
|
27
|
+
var Alias_exports = {};
|
|
28
|
+
__export(Alias_exports, {
|
|
29
|
+
create: () => create,
|
|
30
|
+
internalSchema: () => internalSchema,
|
|
31
|
+
make: () => make,
|
|
32
|
+
of: () => of,
|
|
33
|
+
rawSchema: () => rawSchema3,
|
|
34
|
+
schemas: () => schemas3
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Alias_exports);
|
|
37
|
+
var import_Base = __toESM(require("@taqueria/protocol/Base"));
|
|
38
|
+
var SingleChar = __toESM(require("@taqueria/protocol/SingleChar"));
|
|
39
|
+
var Verb = __toESM(require("@taqueria/protocol/Verb"));
|
|
40
|
+
var import_zod = require("zod");
|
|
41
|
+
var rawSchema3 = import_zod.z.union([
|
|
42
|
+
Verb.rawSchema,
|
|
43
|
+
SingleChar.rawSchema
|
|
44
|
+
], { description: "Alias" });
|
|
45
|
+
var internalSchema = import_zod.z.union([
|
|
46
|
+
Verb.schemas.schema,
|
|
47
|
+
SingleChar.schemas.schema
|
|
48
|
+
], { description: "Alias" });
|
|
49
|
+
var { schemas: generatedSchemas, factory } = (0, import_Base.default)({
|
|
50
|
+
isStringLike: true,
|
|
51
|
+
rawSchema: rawSchema3,
|
|
52
|
+
internalSchema,
|
|
53
|
+
parseErrMsg: (value) => `${value} is not a valid alias`,
|
|
54
|
+
unknownErrMsg: "Something went wrong trying to parse an alias"
|
|
55
|
+
});
|
|
56
|
+
var { create, of, make } = factory;
|
|
57
|
+
var schemas3 = {
|
|
58
|
+
...generatedSchemas,
|
|
59
|
+
schema: generatedSchemas.schema.transform((val) => val)
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
create,
|
|
64
|
+
internalSchema,
|
|
65
|
+
make,
|
|
66
|
+
of,
|
|
67
|
+
rawSchema,
|
|
68
|
+
schemas
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=Alias.js.map
|
package/Alias.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Alias.ts"],"sourcesContent":["import createType from '@taqueria/protocol/Base';\nimport * as SingleChar from '@taqueria/protocol/SingleChar';\nimport * as Verb from '@taqueria/protocol/Verb';\nimport { z } from 'zod';\n\nexport const rawSchema = z\n\t.union([\n\t\tVerb.rawSchema,\n\t\tSingleChar.rawSchema,\n\t], { description: 'Alias' });\n\nexport const internalSchema = z\n\t.union([\n\t\tVerb.schemas.schema,\n\t\tSingleChar.schemas.schema,\n\t], { description: 'Alias' });\n\ntype RawInput = z.infer<typeof rawSchema>;\ntype Input = z.infer<typeof internalSchema>;\n\nconst { schemas: generatedSchemas, factory } = createType<RawInput, Input>({\n\tisStringLike: true,\n\trawSchema,\n\tinternalSchema,\n\tparseErrMsg: (value: unknown) => `${value} is not a valid alias`,\n\tunknownErrMsg: 'Something went wrong trying to parse an alias',\n});\n\nexport type Alias = z.infer<typeof internalSchema>;\n\nexport type t = Alias;\n\nexport const { create, of, make } = factory;\n\nexport const schemas = {\n\t...generatedSchemas,\n\tschema: generatedSchemas.schema.transform(val => val as Alias),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAAA;AAAA,EAAA,eAAAC;AAAA;AAAA;AAAA,kBAAuB;AACvB,iBAA4B;AAC5B,WAAsB;AACtB,iBAAkB;AAEX,IAAMD,aAAY,aACvB,MAAM;AAAA,EACD;AAAA,EACM;AACZ,GAAG,EAAE,aAAa,QAAQ,CAAC;AAErB,IAAM,iBAAiB,aAC5B,MAAM;AAAA,EACD,aAAQ;AAAA,EACF,mBAAQ;AACpB,GAAG,EAAE,aAAa,QAAQ,CAAC;AAK5B,IAAM,EAAE,SAAS,kBAAkB,QAAQ,QAAI,YAAAE,SAA4B;AAAA,EAC1E,cAAc;AAAA,EACd,WAAAF;AAAA,EACA;AAAA,EACA,aAAa,CAAC,UAAmB,GAAG;AAAA,EACpC,eAAe;AAChB,CAAC;AAMM,IAAM,EAAE,QAAQ,IAAI,KAAK,IAAI;AAE7B,IAAMC,WAAU;AAAA,EACtB,GAAG;AAAA,EACH,QAAQ,iBAAiB,OAAO,UAAU,SAAO,GAAY;AAC9D;","names":["rawSchema","schemas","createType"]}
|
package/Alias.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Alias.ts
|
|
2
|
+
import createType from "@taqueria/protocol/Base";
|
|
3
|
+
import * as SingleChar from "@taqueria/protocol/SingleChar";
|
|
4
|
+
import * as Verb from "@taqueria/protocol/Verb";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
var rawSchema3 = z.union([
|
|
7
|
+
Verb.rawSchema,
|
|
8
|
+
SingleChar.rawSchema
|
|
9
|
+
], { description: "Alias" });
|
|
10
|
+
var internalSchema = z.union([
|
|
11
|
+
Verb.schemas.schema,
|
|
12
|
+
SingleChar.schemas.schema
|
|
13
|
+
], { description: "Alias" });
|
|
14
|
+
var { schemas: generatedSchemas, factory } = createType({
|
|
15
|
+
isStringLike: true,
|
|
16
|
+
rawSchema: rawSchema3,
|
|
17
|
+
internalSchema,
|
|
18
|
+
parseErrMsg: (value) => `${value} is not a valid alias`,
|
|
19
|
+
unknownErrMsg: "Something went wrong trying to parse an alias"
|
|
20
|
+
});
|
|
21
|
+
var { create, of, make } = factory;
|
|
22
|
+
var schemas3 = {
|
|
23
|
+
...generatedSchemas,
|
|
24
|
+
schema: generatedSchemas.schema.transform((val) => val)
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
create,
|
|
28
|
+
internalSchema,
|
|
29
|
+
make,
|
|
30
|
+
of,
|
|
31
|
+
rawSchema3 as rawSchema,
|
|
32
|
+
schemas3 as schemas
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=Alias.mjs.map
|
package/Alias.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Alias.ts"],"sourcesContent":["import createType from '@taqueria/protocol/Base';\nimport * as SingleChar from '@taqueria/protocol/SingleChar';\nimport * as Verb from '@taqueria/protocol/Verb';\nimport { z } from 'zod';\n\nexport const rawSchema = z\n\t.union([\n\t\tVerb.rawSchema,\n\t\tSingleChar.rawSchema,\n\t], { description: 'Alias' });\n\nexport const internalSchema = z\n\t.union([\n\t\tVerb.schemas.schema,\n\t\tSingleChar.schemas.schema,\n\t], { description: 'Alias' });\n\ntype RawInput = z.infer<typeof rawSchema>;\ntype Input = z.infer<typeof internalSchema>;\n\nconst { schemas: generatedSchemas, factory } = createType<RawInput, Input>({\n\tisStringLike: true,\n\trawSchema,\n\tinternalSchema,\n\tparseErrMsg: (value: unknown) => `${value} is not a valid alias`,\n\tunknownErrMsg: 'Something went wrong trying to parse an alias',\n});\n\nexport type Alias = z.infer<typeof internalSchema>;\n\nexport type t = Alias;\n\nexport const { create, of, make } = factory;\n\nexport const schemas = {\n\t...generatedSchemas,\n\tschema: generatedSchemas.schema.transform(val => val as Alias),\n};\n"],"mappings":";AAAA,OAAO,gBAAgB;AACvB,YAAY,gBAAgB;AAC5B,YAAY,UAAU;AACtB,SAAS,SAAS;AAEX,IAAMA,aAAY,EACvB,MAAM;AAAA,EACD;AAAA,EACM;AACZ,GAAG,EAAE,aAAa,QAAQ,CAAC;AAErB,IAAM,iBAAiB,EAC5B,MAAM;AAAA,EACD,aAAQ;AAAA,EACF,mBAAQ;AACpB,GAAG,EAAE,aAAa,QAAQ,CAAC;AAK5B,IAAM,EAAE,SAAS,kBAAkB,QAAQ,IAAI,WAA4B;AAAA,EAC1E,cAAc;AAAA,EACd,WAAAA;AAAA,EACA;AAAA,EACA,aAAa,CAAC,UAAmB,GAAG;AAAA,EACpC,eAAe;AAChB,CAAC;AAMM,IAAM,EAAE,QAAQ,IAAI,KAAK,IAAI;AAE7B,IAAMC,WAAU;AAAA,EACtB,GAAG;AAAA,EACH,QAAQ,iBAAiB,OAAO,UAAU,SAAO,GAAY;AAC9D;","names":["rawSchema","schemas"]}
|
package/Base.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as _taqueria_protocol_TaqError from '@taqueria/protocol/TaqError';
|
|
2
|
+
import { FutureInstance } from 'fluture';
|
|
3
|
+
import { z, ZodSchema } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare type ErrMsg = string | ((value: unknown) => string);
|
|
6
|
+
interface CreateSchemaParams {
|
|
7
|
+
rawSchema: ZodSchema;
|
|
8
|
+
internalSchema?: ZodSchema;
|
|
9
|
+
transformer?: (value: unknown) => unknown;
|
|
10
|
+
isStringLike?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface CreateTypeParams extends CreateSchemaParams {
|
|
13
|
+
parseErrMsg: ErrMsg;
|
|
14
|
+
unknownErrMsg: ErrMsg;
|
|
15
|
+
}
|
|
16
|
+
declare type Flatten<T> = {
|
|
17
|
+
[k in keyof T]: T[k];
|
|
18
|
+
};
|
|
19
|
+
declare const createSchema: <I>(params: CreateSchemaParams) => {
|
|
20
|
+
rawSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
21
|
+
internalSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
22
|
+
schema: z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, I & {
|
|
23
|
+
readonly __kind: any;
|
|
24
|
+
}, any>;
|
|
25
|
+
};
|
|
26
|
+
declare const createType: <R, I>(params: CreateTypeParams) => {
|
|
27
|
+
schemas: {
|
|
28
|
+
rawSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
29
|
+
internalSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
30
|
+
schema: z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, I & {
|
|
31
|
+
readonly __kind: any;
|
|
32
|
+
}, any>;
|
|
33
|
+
};
|
|
34
|
+
factory: {
|
|
35
|
+
make: (input: I) => FutureInstance<_taqueria_protocol_TaqError.TaqError, I & {
|
|
36
|
+
readonly __kind: any;
|
|
37
|
+
}>;
|
|
38
|
+
of: (input: unknown) => FutureInstance<_taqueria_protocol_TaqError.TaqError, I & {
|
|
39
|
+
readonly __kind: any;
|
|
40
|
+
}>;
|
|
41
|
+
create: (input: R | I) => I & {
|
|
42
|
+
readonly __kind: any;
|
|
43
|
+
};
|
|
44
|
+
from: (input: unknown) => I & {
|
|
45
|
+
readonly __kind: any;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { Flatten, createSchema, createType, createType as default };
|
package/Base.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// Base.ts
|
|
21
|
+
var Base_exports = {};
|
|
22
|
+
__export(Base_exports, {
|
|
23
|
+
createSchema: () => createSchema,
|
|
24
|
+
createType: () => createType,
|
|
25
|
+
default: () => Base_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Base_exports);
|
|
28
|
+
var import_TaqError = require("@taqueria/protocol/TaqError");
|
|
29
|
+
var import_fluture = require("fluture");
|
|
30
|
+
var import_zod = require("zod");
|
|
31
|
+
var createSchema = (params) => {
|
|
32
|
+
const { rawSchema, isStringLike } = params;
|
|
33
|
+
const internalSchema = params.internalSchema ?? params.rawSchema;
|
|
34
|
+
const noop = (val) => val;
|
|
35
|
+
const transformer = params.transformer ?? noop;
|
|
36
|
+
const schema = isStringLike ? internalSchema.transform(
|
|
37
|
+
(val) => transformer(val)
|
|
38
|
+
) : internalSchema.transform(
|
|
39
|
+
(val) => transformer(val)
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
rawSchema,
|
|
43
|
+
internalSchema,
|
|
44
|
+
schema
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var createType = (params) => {
|
|
48
|
+
const schemas = createSchema(params);
|
|
49
|
+
const { parseErrMsg, unknownErrMsg } = params;
|
|
50
|
+
const internalOf = (input) => {
|
|
51
|
+
try {
|
|
52
|
+
return (0, import_fluture.resolve)(schemas.schema.parse(input));
|
|
53
|
+
} catch (previous) {
|
|
54
|
+
const parseMsg = typeof parseErrMsg === "string" ? parseErrMsg : parseErrMsg(input);
|
|
55
|
+
const unknownMsg = typeof unknownErrMsg === "string" ? unknownErrMsg : unknownErrMsg(input);
|
|
56
|
+
if (previous instanceof import_zod.ZodError) {
|
|
57
|
+
return (0, import_TaqError.toFutureParseErr)(previous, parseMsg, input);
|
|
58
|
+
}
|
|
59
|
+
return (0, import_TaqError.toFutureParseUnknownErr)(previous, unknownMsg, input);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const of = internalOf;
|
|
63
|
+
const make = (input) => internalOf(input);
|
|
64
|
+
const create = (input) => schemas.schema.parse(input);
|
|
65
|
+
const from = (input) => schemas.schema.parse(input);
|
|
66
|
+
const factory = {
|
|
67
|
+
make,
|
|
68
|
+
of,
|
|
69
|
+
create,
|
|
70
|
+
from
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
schemas,
|
|
74
|
+
factory
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
var Base_default = createType;
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
createSchema,
|
|
81
|
+
createType
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=Base.js.map
|
package/Base.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Base.ts"],"sourcesContent":["import { toFutureParseErr, toFutureParseUnknownErr } from '@taqueria/protocol/TaqError';\nimport { FutureInstance, resolve } from 'fluture';\nimport { z, ZodError, ZodSchema } from 'zod';\n\ntype Future<L, R> = FutureInstance<L, R>;\n\ntype ErrMsg = string | ((value: unknown) => string);\n\ninterface CreateSchemaParams {\n\trawSchema: ZodSchema;\n\tinternalSchema?: ZodSchema;\n\ttransformer?: (value: unknown) => unknown;\n\tisStringLike?: boolean;\n}\n\ninterface CreateTypeParams extends CreateSchemaParams {\n\tparseErrMsg: ErrMsg;\n\tunknownErrMsg: ErrMsg;\n}\nexport type Flatten<T> = { [k in keyof T]: T[k] };\n\nexport const createSchema = <I>(params: CreateSchemaParams) => {\n\tconst { rawSchema, isStringLike } = params;\n\tconst internalSchema = params.internalSchema ?? params.rawSchema;\n\tconst noop = (val: unknown) => val;\n\tconst transformer = params.transformer ?? noop;\n\n\tconst schema = isStringLike\n\t\t? internalSchema\n\t\t\t.transform((val: unknown) =>\n\t\t\t\ttransformer(val) as I & {\n\t\t\t\t\treadonly __kind: 'generated' & z.infer<typeof internalSchema>;\n\t\t\t\t}\n\t\t\t)\n\t\t: internalSchema\n\t\t\t.transform((val: unknown) =>\n\t\t\t\ttransformer(val) as Flatten<\n\t\t\t\t\tI & {\n\t\t\t\t\t\treadonly __kind: 'generated' & z.infer<typeof internalSchema>;\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t);\n\n\ttype GeneratedSchema = typeof schema;\n\n\treturn {\n\t\trawSchema,\n\t\tinternalSchema,\n\t\tschema,\n\t};\n};\n\n// TODO:\n// TypeScript appears to have a bug with default generic values\n// For instance, I'd like to use this:\n// export const createType = <R, I = R>(params: CreateTypeParams) => {\n//\n// However, I == unknown when having I default to R if no I was given.\n// So, we need to require R and I explicitly\nexport const createType = <R, I>(params: CreateTypeParams) => {\n\tconst schemas = createSchema<I>(params);\n\tconst { parseErrMsg, unknownErrMsg } = params;\n\n\ttype T = z.infer<typeof schemas.schema>;\n\n\tconst internalOf = (input: unknown) => {\n\t\ttry {\n\t\t\treturn resolve<T>(schemas.schema.parse(input));\n\t\t} catch (previous) {\n\t\t\tconst parseMsg = typeof parseErrMsg === 'string'\n\t\t\t\t? parseErrMsg\n\t\t\t\t: parseErrMsg(input);\n\n\t\t\tconst unknownMsg = typeof unknownErrMsg === 'string'\n\t\t\t\t? unknownErrMsg\n\t\t\t\t: unknownErrMsg(input);\n\n\t\t\tif (previous instanceof ZodError) {\n\t\t\t\treturn toFutureParseErr<T>(previous, parseMsg, input);\n\t\t\t}\n\t\t\treturn toFutureParseUnknownErr<T>(previous, unknownMsg, input);\n\t\t}\n\t};\n\tconst of = internalOf;\n\n\tconst make = (input: I) => internalOf(input);\n\n\tconst create = (input: R | I) => schemas.schema.parse(input) as T;\n\n\tconst from = (input: unknown) => schemas.schema.parse(input) as T;\n\n\tconst factory = {\n\t\tmake,\n\t\tof,\n\t\tcreate,\n\t\tfrom,\n\t};\n\n\treturn {\n\t\tschemas,\n\t\tfactory,\n\t};\n};\n\nexport default createType;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0D;AAC1D,qBAAwC;AACxC,iBAAuC;AAmBhC,IAAM,eAAe,CAAI,WAA+B;AAC9D,QAAM,EAAE,WAAW,aAAa,IAAI;AACpC,QAAM,iBAAiB,OAAO,kBAAkB,OAAO;AACvD,QAAM,OAAO,CAAC,QAAiB;AAC/B,QAAM,cAAc,OAAO,eAAe;AAE1C,QAAM,SAAS,eACZ,eACA;AAAA,IAAU,CAAC,QACX,YAAY,GAAG;AAAA,EAGhB,IACC,eACA;AAAA,IAAU,CAAC,QACX,YAAY,GAAG;AAAA,EAKhB;AAIF,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AASO,IAAM,aAAa,CAAO,WAA6B;AAC7D,QAAM,UAAU,aAAgB,MAAM;AACtC,QAAM,EAAE,aAAa,cAAc,IAAI;AAIvC,QAAM,aAAa,CAAC,UAAmB;AACtC,QAAI;AACH,iBAAO,wBAAW,QAAQ,OAAO,MAAM,KAAK,CAAC;AAAA,IAC9C,SAAS,UAAP;AACD,YAAM,WAAW,OAAO,gBAAgB,WACrC,cACA,YAAY,KAAK;AAEpB,YAAM,aAAa,OAAO,kBAAkB,WACzC,gBACA,cAAc,KAAK;AAEtB,UAAI,oBAAoB,qBAAU;AACjC,mBAAO,kCAAoB,UAAU,UAAU,KAAK;AAAA,MACrD;AACA,iBAAO,yCAA2B,UAAU,YAAY,KAAK;AAAA,IAC9D;AAAA,EACD;AACA,QAAM,KAAK;AAEX,QAAM,OAAO,CAAC,UAAa,WAAW,KAAK;AAE3C,QAAM,SAAS,CAAC,UAAiB,QAAQ,OAAO,MAAM,KAAK;AAE3D,QAAM,OAAO,CAAC,UAAmB,QAAQ,OAAO,MAAM,KAAK;AAE3D,QAAM,UAAU;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEA,IAAO,eAAQ;","names":[]}
|
package/Base.mjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Base.ts
|
|
2
|
+
import { toFutureParseErr, toFutureParseUnknownErr } from "@taqueria/protocol/TaqError";
|
|
3
|
+
import { resolve } from "fluture";
|
|
4
|
+
import { ZodError } from "zod";
|
|
5
|
+
var createSchema = (params) => {
|
|
6
|
+
const { rawSchema, isStringLike } = params;
|
|
7
|
+
const internalSchema = params.internalSchema ?? params.rawSchema;
|
|
8
|
+
const noop = (val) => val;
|
|
9
|
+
const transformer = params.transformer ?? noop;
|
|
10
|
+
const schema = isStringLike ? internalSchema.transform(
|
|
11
|
+
(val) => transformer(val)
|
|
12
|
+
) : internalSchema.transform(
|
|
13
|
+
(val) => transformer(val)
|
|
14
|
+
);
|
|
15
|
+
return {
|
|
16
|
+
rawSchema,
|
|
17
|
+
internalSchema,
|
|
18
|
+
schema
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
var createType = (params) => {
|
|
22
|
+
const schemas = createSchema(params);
|
|
23
|
+
const { parseErrMsg, unknownErrMsg } = params;
|
|
24
|
+
const internalOf = (input) => {
|
|
25
|
+
try {
|
|
26
|
+
return resolve(schemas.schema.parse(input));
|
|
27
|
+
} catch (previous) {
|
|
28
|
+
const parseMsg = typeof parseErrMsg === "string" ? parseErrMsg : parseErrMsg(input);
|
|
29
|
+
const unknownMsg = typeof unknownErrMsg === "string" ? unknownErrMsg : unknownErrMsg(input);
|
|
30
|
+
if (previous instanceof ZodError) {
|
|
31
|
+
return toFutureParseErr(previous, parseMsg, input);
|
|
32
|
+
}
|
|
33
|
+
return toFutureParseUnknownErr(previous, unknownMsg, input);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const of = internalOf;
|
|
37
|
+
const make = (input) => internalOf(input);
|
|
38
|
+
const create = (input) => schemas.schema.parse(input);
|
|
39
|
+
const from = (input) => schemas.schema.parse(input);
|
|
40
|
+
const factory = {
|
|
41
|
+
make,
|
|
42
|
+
of,
|
|
43
|
+
create,
|
|
44
|
+
from
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
schemas,
|
|
48
|
+
factory
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
var Base_default = createType;
|
|
52
|
+
export {
|
|
53
|
+
createSchema,
|
|
54
|
+
createType,
|
|
55
|
+
Base_default as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=Base.mjs.map
|
package/Base.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Base.ts"],"sourcesContent":["import { toFutureParseErr, toFutureParseUnknownErr } from '@taqueria/protocol/TaqError';\nimport { FutureInstance, resolve } from 'fluture';\nimport { z, ZodError, ZodSchema } from 'zod';\n\ntype Future<L, R> = FutureInstance<L, R>;\n\ntype ErrMsg = string | ((value: unknown) => string);\n\ninterface CreateSchemaParams {\n\trawSchema: ZodSchema;\n\tinternalSchema?: ZodSchema;\n\ttransformer?: (value: unknown) => unknown;\n\tisStringLike?: boolean;\n}\n\ninterface CreateTypeParams extends CreateSchemaParams {\n\tparseErrMsg: ErrMsg;\n\tunknownErrMsg: ErrMsg;\n}\nexport type Flatten<T> = { [k in keyof T]: T[k] };\n\nexport const createSchema = <I>(params: CreateSchemaParams) => {\n\tconst { rawSchema, isStringLike } = params;\n\tconst internalSchema = params.internalSchema ?? params.rawSchema;\n\tconst noop = (val: unknown) => val;\n\tconst transformer = params.transformer ?? noop;\n\n\tconst schema = isStringLike\n\t\t? internalSchema\n\t\t\t.transform((val: unknown) =>\n\t\t\t\ttransformer(val) as I & {\n\t\t\t\t\treadonly __kind: 'generated' & z.infer<typeof internalSchema>;\n\t\t\t\t}\n\t\t\t)\n\t\t: internalSchema\n\t\t\t.transform((val: unknown) =>\n\t\t\t\ttransformer(val) as Flatten<\n\t\t\t\t\tI & {\n\t\t\t\t\t\treadonly __kind: 'generated' & z.infer<typeof internalSchema>;\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t);\n\n\ttype GeneratedSchema = typeof schema;\n\n\treturn {\n\t\trawSchema,\n\t\tinternalSchema,\n\t\tschema,\n\t};\n};\n\n// TODO:\n// TypeScript appears to have a bug with default generic values\n// For instance, I'd like to use this:\n// export const createType = <R, I = R>(params: CreateTypeParams) => {\n//\n// However, I == unknown when having I default to R if no I was given.\n// So, we need to require R and I explicitly\nexport const createType = <R, I>(params: CreateTypeParams) => {\n\tconst schemas = createSchema<I>(params);\n\tconst { parseErrMsg, unknownErrMsg } = params;\n\n\ttype T = z.infer<typeof schemas.schema>;\n\n\tconst internalOf = (input: unknown) => {\n\t\ttry {\n\t\t\treturn resolve<T>(schemas.schema.parse(input));\n\t\t} catch (previous) {\n\t\t\tconst parseMsg = typeof parseErrMsg === 'string'\n\t\t\t\t? parseErrMsg\n\t\t\t\t: parseErrMsg(input);\n\n\t\t\tconst unknownMsg = typeof unknownErrMsg === 'string'\n\t\t\t\t? unknownErrMsg\n\t\t\t\t: unknownErrMsg(input);\n\n\t\t\tif (previous instanceof ZodError) {\n\t\t\t\treturn toFutureParseErr<T>(previous, parseMsg, input);\n\t\t\t}\n\t\t\treturn toFutureParseUnknownErr<T>(previous, unknownMsg, input);\n\t\t}\n\t};\n\tconst of = internalOf;\n\n\tconst make = (input: I) => internalOf(input);\n\n\tconst create = (input: R | I) => schemas.schema.parse(input) as T;\n\n\tconst from = (input: unknown) => schemas.schema.parse(input) as T;\n\n\tconst factory = {\n\t\tmake,\n\t\tof,\n\t\tcreate,\n\t\tfrom,\n\t};\n\n\treturn {\n\t\tschemas,\n\t\tfactory,\n\t};\n};\n\nexport default createType;\n"],"mappings":";AAAA,SAAS,kBAAkB,+BAA+B;AAC1D,SAAyB,eAAe;AACxC,SAAY,gBAA2B;AAmBhC,IAAM,eAAe,CAAI,WAA+B;AAC9D,QAAM,EAAE,WAAW,aAAa,IAAI;AACpC,QAAM,iBAAiB,OAAO,kBAAkB,OAAO;AACvD,QAAM,OAAO,CAAC,QAAiB;AAC/B,QAAM,cAAc,OAAO,eAAe;AAE1C,QAAM,SAAS,eACZ,eACA;AAAA,IAAU,CAAC,QACX,YAAY,GAAG;AAAA,EAGhB,IACC,eACA;AAAA,IAAU,CAAC,QACX,YAAY,GAAG;AAAA,EAKhB;AAIF,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AASO,IAAM,aAAa,CAAO,WAA6B;AAC7D,QAAM,UAAU,aAAgB,MAAM;AACtC,QAAM,EAAE,aAAa,cAAc,IAAI;AAIvC,QAAM,aAAa,CAAC,UAAmB;AACtC,QAAI;AACH,aAAO,QAAW,QAAQ,OAAO,MAAM,KAAK,CAAC;AAAA,IAC9C,SAAS,UAAP;AACD,YAAM,WAAW,OAAO,gBAAgB,WACrC,cACA,YAAY,KAAK;AAEpB,YAAM,aAAa,OAAO,kBAAkB,WACzC,gBACA,cAAc,KAAK;AAEtB,UAAI,oBAAoB,UAAU;AACjC,eAAO,iBAAoB,UAAU,UAAU,KAAK;AAAA,MACrD;AACA,aAAO,wBAA2B,UAAU,YAAY,KAAK;AAAA,IAC9D;AAAA,EACD;AACA,QAAM,KAAK;AAEX,QAAM,OAAO,CAAC,UAAa,WAAW,KAAK;AAE3C,QAAM,SAAS,CAAC,UAAiB,QAAQ,OAAO,MAAM,KAAK;AAE3D,QAAM,OAAO,CAAC,UAAmB,QAAQ,OAAO,MAAM,KAAK;AAE3D,QAAM,UAAU;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEA,IAAO,eAAQ;","names":[]}
|
package/Command.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as fluture from 'fluture';
|
|
2
|
+
import { TaqError } from './TaqError.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const rawSchema: z.ZodString;
|
|
6
|
+
declare const internalSchema: z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, string & {
|
|
7
|
+
readonly __kind: any;
|
|
8
|
+
}, any>;
|
|
9
|
+
declare type Command = z.infer<typeof internalSchema>;
|
|
10
|
+
declare type t = Command;
|
|
11
|
+
declare const create: (input: string) => string & {
|
|
12
|
+
readonly __kind: any;
|
|
13
|
+
};
|
|
14
|
+
declare const make: (input: string) => fluture.FutureInstance<TaqError, string & {
|
|
15
|
+
readonly __kind: any;
|
|
16
|
+
}>;
|
|
17
|
+
declare const of: (input: unknown) => fluture.FutureInstance<TaqError, string & {
|
|
18
|
+
readonly __kind: any;
|
|
19
|
+
}>;
|
|
20
|
+
declare const schemas: {
|
|
21
|
+
schema: z.ZodEffects<z.ZodEffects<z.ZodType<any, z.ZodTypeDef, any>, string & {
|
|
22
|
+
readonly __kind: any;
|
|
23
|
+
}, any>, string & {
|
|
24
|
+
readonly __kind: any;
|
|
25
|
+
}, any>;
|
|
26
|
+
rawSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
27
|
+
internalSchema: z.ZodType<any, z.ZodTypeDef, any>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { Command, create, internalSchema, make, of, rawSchema, schemas, t };
|
package/Command.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// Command.ts
|
|
27
|
+
var Command_exports = {};
|
|
28
|
+
__export(Command_exports, {
|
|
29
|
+
create: () => create,
|
|
30
|
+
internalSchema: () => internalSchema,
|
|
31
|
+
make: () => make,
|
|
32
|
+
of: () => of,
|
|
33
|
+
rawSchema: () => rawSchema,
|
|
34
|
+
schemas: () => schemas
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Command_exports);
|
|
37
|
+
var import_Base = __toESM(require("@taqueria/protocol/Base"));
|
|
38
|
+
var import_zod = require("zod");
|
|
39
|
+
var rawSchema = import_zod.z.string({ description: "Command" }).min(1).regex(/^([A-Za-z-_ ]+ ?)((\[.+\] ?)|(\<.+\>) ?)*$/, "Must be a command that can be interpreted using yargs");
|
|
40
|
+
var { schemas: generatedSchemas, factory } = (0, import_Base.default)({
|
|
41
|
+
isStringLike: true,
|
|
42
|
+
rawSchema,
|
|
43
|
+
parseErrMsg: (value) => `${value} is an invalid command. Expected format is: taskName [optional] <required>`,
|
|
44
|
+
unknownErrMsg: "Something went wrong when parsing the command"
|
|
45
|
+
});
|
|
46
|
+
var internalSchema = generatedSchemas.schema;
|
|
47
|
+
var { create, make, of } = factory;
|
|
48
|
+
var schemas = {
|
|
49
|
+
...generatedSchemas,
|
|
50
|
+
schema: generatedSchemas.schema.transform((val) => val)
|
|
51
|
+
};
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
create,
|
|
55
|
+
internalSchema,
|
|
56
|
+
make,
|
|
57
|
+
of,
|
|
58
|
+
rawSchema,
|
|
59
|
+
schemas
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=Command.js.map
|
package/Command.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Command.ts"],"sourcesContent":["import createType from '@taqueria/protocol/Base';\nimport { z } from 'zod';\n\nexport const rawSchema = z\n\t.string({ description: 'Command' })\n\t.min(1)\n\t.regex(/^([A-Za-z-_ ]+ ?)((\\[.+\\] ?)|(\\<.+\\>) ?)*$/, 'Must be a command that can be interpreted using yargs');\n\ntype RawInput = z.infer<typeof rawSchema>;\n\nconst { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({\n\tisStringLike: true,\n\trawSchema,\n\tparseErrMsg: (value: unknown) => `${value} is an invalid command. Expected format is: taskName [optional] <required>`,\n\tunknownErrMsg: 'Something went wrong when parsing the command',\n});\n\nexport const internalSchema = generatedSchemas.schema;\n\nexport type Command = z.infer<typeof internalSchema>;\nexport type t = Command;\nexport const { create, make, of } = factory;\nexport const schemas = {\n\t...generatedSchemas,\n\tschema: generatedSchemas.schema.transform(val => val as Command),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,iBAAkB;AAEX,IAAM,YAAY,aACvB,OAAO,EAAE,aAAa,UAAU,CAAC,EACjC,IAAI,CAAC,EACL,MAAM,8CAA8C,uDAAuD;AAI7G,IAAM,EAAE,SAAS,kBAAkB,QAAQ,QAAI,YAAAA,SAA+B;AAAA,EAC7E,cAAc;AAAA,EACd;AAAA,EACA,aAAa,CAAC,UAAmB,GAAG;AAAA,EACpC,eAAe;AAChB,CAAC;AAEM,IAAM,iBAAiB,iBAAiB;AAIxC,IAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;AAC7B,IAAM,UAAU;AAAA,EACtB,GAAG;AAAA,EACH,QAAQ,iBAAiB,OAAO,UAAU,SAAO,GAAc;AAChE;","names":["createType"]}
|
package/Command.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Command.ts
|
|
2
|
+
import createType from "@taqueria/protocol/Base";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
var rawSchema = z.string({ description: "Command" }).min(1).regex(/^([A-Za-z-_ ]+ ?)((\[.+\] ?)|(\<.+\>) ?)*$/, "Must be a command that can be interpreted using yargs");
|
|
5
|
+
var { schemas: generatedSchemas, factory } = createType({
|
|
6
|
+
isStringLike: true,
|
|
7
|
+
rawSchema,
|
|
8
|
+
parseErrMsg: (value) => `${value} is an invalid command. Expected format is: taskName [optional] <required>`,
|
|
9
|
+
unknownErrMsg: "Something went wrong when parsing the command"
|
|
10
|
+
});
|
|
11
|
+
var internalSchema = generatedSchemas.schema;
|
|
12
|
+
var { create, make, of } = factory;
|
|
13
|
+
var schemas = {
|
|
14
|
+
...generatedSchemas,
|
|
15
|
+
schema: generatedSchemas.schema.transform((val) => val)
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
create,
|
|
19
|
+
internalSchema,
|
|
20
|
+
make,
|
|
21
|
+
of,
|
|
22
|
+
rawSchema,
|
|
23
|
+
schemas
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Command.mjs.map
|
package/Command.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Command.ts"],"sourcesContent":["import createType from '@taqueria/protocol/Base';\nimport { z } from 'zod';\n\nexport const rawSchema = z\n\t.string({ description: 'Command' })\n\t.min(1)\n\t.regex(/^([A-Za-z-_ ]+ ?)((\\[.+\\] ?)|(\\<.+\\>) ?)*$/, 'Must be a command that can be interpreted using yargs');\n\ntype RawInput = z.infer<typeof rawSchema>;\n\nconst { schemas: generatedSchemas, factory } = createType<RawInput, RawInput>({\n\tisStringLike: true,\n\trawSchema,\n\tparseErrMsg: (value: unknown) => `${value} is an invalid command. Expected format is: taskName [optional] <required>`,\n\tunknownErrMsg: 'Something went wrong when parsing the command',\n});\n\nexport const internalSchema = generatedSchemas.schema;\n\nexport type Command = z.infer<typeof internalSchema>;\nexport type t = Command;\nexport const { create, make, of } = factory;\nexport const schemas = {\n\t...generatedSchemas,\n\tschema: generatedSchemas.schema.transform(val => val as Command),\n};\n"],"mappings":";AAAA,OAAO,gBAAgB;AACvB,SAAS,SAAS;AAEX,IAAM,YAAY,EACvB,OAAO,EAAE,aAAa,UAAU,CAAC,EACjC,IAAI,CAAC,EACL,MAAM,8CAA8C,uDAAuD;AAI7G,IAAM,EAAE,SAAS,kBAAkB,QAAQ,IAAI,WAA+B;AAAA,EAC7E,cAAc;AAAA,EACd;AAAA,EACA,aAAa,CAAC,UAAmB,GAAG;AAAA,EACpC,eAAe;AAChB,CAAC;AAEM,IAAM,iBAAiB,iBAAiB;AAIxC,IAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;AAC7B,IAAM,UAAU;AAAA,EACtB,GAAG;AAAA,EACH,QAAQ,iBAAiB,OAAO,UAAU,SAAO,GAAc;AAChE;","names":[]}
|