feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Thomas Aribart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=deserializationPattern.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"deserializationPattern.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=extendedJsonSchema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"extendedJsonSchema.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=fromSchemaOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"fromSchemaOptions.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"index.js"}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.$JSONSchema = void 0;
var $JSONSchema = Symbol("$JSONSchema");
/**
* Symbol used to make extended JSON schemas actually extend the JSONSchema type constraint at all time
*/
/**
* JSON Schema type
*/
/**
* JSON Schema type constraint
*/
/**
* JSON Schema with reference type constraint
*/
exports.$JSONSchema = $JSONSchema;
//# sourceMappingURL=jsonSchema.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "asConst", {
enumerable: true,
get: function get() {
return _utils.asConst;
}
});
Object.defineProperty(exports, "wrapCompilerAsTypeGuard", {
enumerable: true,
get: function get() {
return _utils.wrapCompilerAsTypeGuard;
}
});
Object.defineProperty(exports, "wrapValidatorAsTypeGuard", {
enumerable: true,
get: function get() {
return _utils.wrapValidatorAsTypeGuard;
}
});
var _utils = require("./utils");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA","sourcesContent":["import type { M } from \"ts-algebra\";\n\nimport type {\n ExtendedJSONSchema,\n FromExtendedSchemaOptions,\n FromSchemaDefaultOptions,\n FromSchemaOptions,\n JSONSchema,\n JSONSchemaExtension,\n UnextendJSONSchema,\n} from \"./definitions\";\nimport type { ParseOptions } from \"./parse-options\";\nimport type { ParseSchema } from \"./parse-schema\";\n\nexport type {\n ExtendedJSONSchema,\n DeserializationPattern,\n FromSchemaOptions,\n FromExtendedSchemaOptions,\n FromSchemaDefaultOptions,\n JSONSchemaExtension,\n JSONSchema,\n} from \"./definitions\";\nexport type { $Compiler, Compiler, $Validator, Validator } from \"./utils\";\nexport {\n wrapCompilerAsTypeGuard,\n wrapValidatorAsTypeGuard,\n asConst,\n} from \"./utils\";\n\n/**\n * Given a JSON schema defined with the `as const` statement, infers the type of valid instances\n * @param SCHEMA JSON schema\n */\nexport type FromSchema<\n SCHEMA extends JSONSchema,\n OPTIONS extends FromSchemaOptions = FromSchemaDefaultOptions,\n> = M.$Resolve<ParseSchema<SCHEMA, ParseOptions<SCHEMA, OPTIONS>>>;\n\n/**\n * Given an extended JSON schema defined with the `as const` statement, infers the type of valid instances\n * @param SCHEMA JSON schema\n */\nexport type FromExtendedSchema<\n EXTENSION extends JSONSchemaExtension,\n SCHEMA extends ExtendedJSONSchema<EXTENSION>,\n OPTIONS extends\n FromExtendedSchemaOptions<EXTENSION> = FromSchemaDefaultOptions,\n UNEXTENDED_SCHEMA = UnextendJSONSchema<EXTENSION, SCHEMA>,\n> = UNEXTENDED_SCHEMA extends JSONSchema\n ? FromSchema<UNEXTENDED_SCHEMA, OPTIONS>\n : never;\n"],"file":"index.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=parse-options.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"parse-options.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=allOf.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"allOf.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=anyOf.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"anyOf.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=array.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"array.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=const.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"const.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=deserialize.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"deserialize.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=enum.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"enum.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=ifThenElse.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"ifThenElse.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"index.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=multipleTypes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"multipleTypes.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=not.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"not.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=nullable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"nullable.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=object.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"object.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=oneOf.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"oneOf.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=external.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"external.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"index.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=internal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"internal.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"utils.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=singleType.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"singleType.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"utils.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=and.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"and.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=extends.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"extends.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=get.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"get.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=if.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"if.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"index.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=join.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"join.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=key.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"key.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=narrow.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"narrow.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=not.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"not.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=pop.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"pop.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=split.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"split.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=tail.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"tail.js"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=writable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"writable.js"}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.asConst = void 0;
/**
* Returns the input parameter without muting it, but narrowing its inferred type. Similar to using the `as const` statement functionnally.
* @param input Input
* @returns Input, narrowly typed
*
* ```ts
* const object = { foo: "bar" }
* // { foo: string }
*
* const narrowedObject = asConst({ foo: "bar "})
* // => { foo: "bar" }
* ```
*/
var asConst = function asConst(input) {
return input;
};
exports.asConst = asConst;
//# sourceMappingURL=asConst.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/utils/asConst.ts"],"names":["asConst","input"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAAQC,KAAR;AAAA,SAAgDA,KAAhD;AAAA,CAAhB","sourcesContent":["import type { Narrow } from \"~/type-utils\";\n\n/**\n * Returns the input parameter without muting it, but narrowing its inferred type. Similar to using the `as const` statement functionnally.\n * @param input Input\n * @returns Input, narrowly typed\n *\n * ```ts\n * const object = { foo: \"bar\" }\n * // { foo: string }\n *\n * const narrowedObject = asConst({ foo: \"bar \"})\n * // => { foo: \"bar\" }\n * ```\n */\nexport const asConst = <INPUT>(input: Narrow<INPUT>): Narrow<INPUT> => input;\n"],"file":"asConst.js"}

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "asConst", {
enumerable: true,
get: function get() {
return _asConst.asConst;
}
});
Object.defineProperty(exports, "wrapCompilerAsTypeGuard", {
enumerable: true,
get: function get() {
return _typeGuards.wrapCompilerAsTypeGuard;
}
});
Object.defineProperty(exports, "wrapValidatorAsTypeGuard", {
enumerable: true,
get: function get() {
return _typeGuards.wrapValidatorAsTypeGuard;
}
});
var _typeGuards = require("./type-guards");
var _asConst = require("./asConst");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAIA","sourcesContent":["export type { $Compiler, Compiler, $Validator, Validator } from \"./type-guards\";\nexport {\n wrapCompilerAsTypeGuard,\n wrapValidatorAsTypeGuard,\n} from \"./type-guards\";\nexport { asConst } from \"./asConst\";\n"],"file":"index.js"}

View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.wrapCompilerAsTypeGuard = void 0;
/**
* Any compiler function type (non type-guarding)
*/
/**
* Adds type guarding to a validator function
*
* ```ts
* const compiler: Compiler = <S extends JSONSchema, T = FromSchema<S>>(
* schema: S,
* ) => (data: unknown): data is T => {
* const isDataValid: boolean = ... // Implement validation here
* return isDataValid;
* };
* ```
*/
/**
* Type definition for `wrapCompilerAsTypeGuard`
*/
/**
* Adds type guarding to any compiler function (doesn't modify it)
* @param compiler Compiler function
* @returns Compiler function with type guarding
*/
var wrapCompilerAsTypeGuard = function wrapCompilerAsTypeGuard(compiler) {
return function (schema) {
for (var _len = arguments.length, compilingOptions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
compilingOptions[_key - 1] = arguments[_key];
}
var validator = compiler.apply(void 0, [schema].concat(compilingOptions));
return function (data) {
for (var _len2 = arguments.length, validationOptions = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
validationOptions[_key2 - 1] = arguments[_key2];
}
return validator.apply(void 0, [data].concat(validationOptions));
};
};
};
exports.wrapCompilerAsTypeGuard = wrapCompilerAsTypeGuard;
//# sourceMappingURL=compiler.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/utils/type-guards/compiler.ts"],"names":["wrapCompilerAsTypeGuard","compiler","schema","compilingOptions","validator","data","validationOptions"],"mappings":";;;;;;;AAOA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACO,IAAMA,uBAAwC,GACnD,SADWA,uBACX,CAKEC,QALF;AAAA,SAOA,UACEC,MADF,EAGK;AAAA,sCADAC,gBACA;AADAA,MAAAA,gBACA;AAAA;;AACH,QAAMC,SAAS,GAAGH,QAAQ,MAAR,UAASC,MAAT,SAAoBC,gBAApB,EAAlB;AAEA,WAAO,UAACE,IAAD;AAAA,yCAAmBC,iBAAnB;AAAmBA,QAAAA,iBAAnB;AAAA;;AAAA,aACLF,SAAS,MAAT,UAAUC,IAAV,SAAmBC,iBAAnB,EADK;AAAA,KAAP;AAED,GAfD;AAAA,CADK","sourcesContent":["import type {\n FromSchema,\n FromSchemaDefaultOptions,\n FromSchemaOptions,\n JSONSchema,\n} from \"~/index\";\n\n/**\n * Any compiler function type (non type-guarding)\n */\nexport type $Compiler<C extends unknown[] = [], V extends unknown[] = []> = (\n schema: JSONSchema,\n ...compilingOptions: C\n) => (data: unknown, ...validationOptions: V) => boolean;\n\n/**\n * Adds type guarding to a validator function\n *\n * ```ts\n * const compiler: Compiler = <S extends JSONSchema, T = FromSchema<S>>(\n * schema: S,\n * ) => (data: unknown): data is T => {\n * const isDataValid: boolean = ... // Implement validation here\n * return isDataValid;\n * };\n * ```\n */\nexport type Compiler<\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n C extends unknown[] = [],\n V extends unknown[] = [],\n> = <S extends JSONSchema, T = FromSchema<S, O>>(\n schema: S,\n ...compilingOptions: C\n) => (data: unknown, ...validationOptions: V) => data is T;\n\n/**\n * Type definition for `wrapCompilerAsTypeGuard`\n */\ntype CompilerWrapper = <\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n C extends unknown[] = [],\n V extends unknown[] = [],\n>(\n compiler: $Compiler<C, V>,\n) => Compiler<O, C, V>;\n\n/**\n * Adds type guarding to any compiler function (doesn't modify it)\n * @param compiler Compiler function\n * @returns Compiler function with type guarding\n */\nexport const wrapCompilerAsTypeGuard: CompilerWrapper =\n <\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n C extends unknown[] = [],\n V extends unknown[] = [],\n >(\n compiler: $Compiler<C, V>,\n ) =>\n <S extends JSONSchema, T = FromSchema<S, O>>(\n schema: S,\n ...compilingOptions: C\n ) => {\n const validator = compiler(schema, ...compilingOptions);\n\n return (data: unknown, ...validationOptions: V): data is T =>\n validator(data, ...validationOptions);\n };\n"],"file":"compiler.js"}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapCompilerAsTypeGuard", {
enumerable: true,
get: function get() {
return _compiler.wrapCompilerAsTypeGuard;
}
});
Object.defineProperty(exports, "wrapValidatorAsTypeGuard", {
enumerable: true,
get: function get() {
return _validator.wrapValidatorAsTypeGuard;
}
});
var _compiler = require("./compiler");
var _validator = require("./validator");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/utils/type-guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA;;AAEA","sourcesContent":["export type { $Compiler, Compiler } from \"./compiler\";\nexport { wrapCompilerAsTypeGuard } from \"./compiler\";\nexport type { $Validator, Validator } from \"./validator\";\nexport { wrapValidatorAsTypeGuard } from \"./validator\";\n"],"file":"index.js"}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.wrapValidatorAsTypeGuard = void 0;
/**
* Any validator function type (non type-guarding)
*/
/**
* Adds type guarding to a validator function
*
* ```ts
* const validate: Validator = <S extends JSONSchema, T = FromSchema<S>>(
* schema: S,
* data: unknown
* ): data is T => {
* const isDataValid: boolean = ... // Implement validation here
* return isDataValid;
* };
* ```
*/
/**
* Type definition for wrapValidatorAsTypeGuard
*/
/**
* Adds type guarding to any validator function (doesn't modify it)
* @param validator Validator function
* @returns Validator function with type guarding
*/
var wrapValidatorAsTypeGuard = function wrapValidatorAsTypeGuard(validator) {
return function (schema, data) {
for (var _len = arguments.length, validationOptions = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
validationOptions[_key - 2] = arguments[_key];
}
return validator.apply(void 0, [schema, data].concat(validationOptions));
};
};
exports.wrapValidatorAsTypeGuard = wrapValidatorAsTypeGuard;
//# sourceMappingURL=validator.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/utils/type-guards/validator.ts"],"names":["wrapValidatorAsTypeGuard","validator","schema","data","validationOptions"],"mappings":";;;;;;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACO,IAAMA,wBAA0C,GACrD,SADWA,wBACX,CAIEC,SAJF;AAAA,SAMA,UACEC,MADF,EAEEC,IAFF;AAAA,sCAGKC,iBAHL;AAGKA,MAAAA,iBAHL;AAAA;;AAAA,WAKEH,SAAS,MAAT,UAAUC,MAAV,EAAkBC,IAAlB,SAA2BC,iBAA3B,EALF;AAAA,GANA;AAAA,CADK","sourcesContent":["import type {\n FromSchema,\n FromSchemaDefaultOptions,\n FromSchemaOptions,\n JSONSchema,\n} from \"~/index\";\n\n/**\n * Any validator function type (non type-guarding)\n */\nexport type $Validator<V extends unknown[] = []> = (\n schema: JSONSchema,\n data: unknown,\n ...validationOptions: V\n) => boolean;\n\n/**\n * Adds type guarding to a validator function\n *\n * ```ts\n * const validate: Validator = <S extends JSONSchema, T = FromSchema<S>>(\n * schema: S,\n * data: unknown\n * ): data is T => {\n * const isDataValid: boolean = ... // Implement validation here\n * return isDataValid;\n * };\n * ```\n */\nexport type Validator<\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n V extends unknown[] = [],\n> = <S extends JSONSchema, T = FromSchema<S, O>>(\n schema: S,\n data: unknown,\n ...validationOptions: V\n) => data is T;\n\n/**\n * Type definition for wrapValidatorAsTypeGuard\n */\ntype ValidatorWrapper = <\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n V extends unknown[] = [],\n>(\n validator: $Validator<V>,\n) => Validator<O, V>;\n\n/**\n * Adds type guarding to any validator function (doesn't modify it)\n * @param validator Validator function\n * @returns Validator function with type guarding\n */\nexport const wrapValidatorAsTypeGuard: ValidatorWrapper =\n <\n O extends FromSchemaOptions = FromSchemaDefaultOptions,\n V extends unknown[] = [],\n >(\n validator: $Validator<V>,\n ) =>\n <S extends JSONSchema, T = FromSchema<S, O>>(\n schema: S,\n data: unknown,\n ...validationOptions: V\n ): data is T =>\n validator(schema, data, ...validationOptions);\n"],"file":"validator.js"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=deserializationPattern.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"deserializationPattern.js"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=extendedJsonSchema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"extendedJsonSchema.js"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=fromSchemaOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"fromSchemaOptions.js"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"index.js"}

View File

@@ -0,0 +1,17 @@
export var $JSONSchema = Symbol("$JSONSchema");
/**
* Symbol used to make extended JSON schemas actually extend the JSONSchema type constraint at all time
*/
/**
* JSON Schema type
*/
/**
* JSON Schema type constraint
*/
/**
* JSON Schema with reference type constraint
*/
//# sourceMappingURL=jsonSchema.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More