@effect-ts-app/core
Advanced tools
Comparing version 0.15.8 to 0.15.9
{ | ||
"name": "@effect-ts-app/core", | ||
"version": "0.15.8", | ||
"version": "0.15.9", | ||
"main": "./index.js", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "d15b1026c1ed0a3b994b4dec701ac4d64937716c" | ||
"gitHead": "cfbabe53cd82e03c1a1c35a999d40107aa4dc95e" | ||
} |
@@ -53,4 +53,2 @@ import * as A from "@effect-ts/core/Collections/Immutable/Array"; | ||
export declare function defaultProp<ParserError extends MO.AnyError, ParsedShape extends SupportedDefaults, ConstructorInput, ConstructorError extends MO.AnyError, Encoded, Api>(schema: MO.Schema<unknown, ParserError, ParsedShape, ConstructorInput, ConstructorError, Encoded, Api>): MO.Property<MO.Schema<unknown, ParserError, ParsedShape, ConstructorInput, ConstructorError, Encoded, Api>, "required", O.None, O.Some<["constructor", () => ParsedShape]>>; | ||
export declare function include<Props extends Record<string, MO.AnyProperty>>(props: Props): <NewProps extends Record<string, MO.AnyProperty>>(fnc: (props: Props) => NewProps) => NewProps; | ||
export declare function include_<Props extends Record<string, MO.AnyProperty>, NewProps extends Record<string, MO.AnyProperty>>(props: Props, fnc: (props: Props) => NewProps): NewProps; | ||
export declare function makeOptional<NER extends Record<string, MO.AnyProperty>>(t: NER): { | ||
@@ -57,0 +55,0 @@ [K in keyof NER]: MO.Property<NER[K]["_schema"], "optional", NER[K]["_as"], NER[K]["_def"]>; |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Model = exports.constArray = exports.makeContramappedSet = exports.makeUnorderedSet = exports.makeUnorderedStringSet = exports.makeUnorderedContramappedStringSet = exports.makeSet = exports.createUnorder = exports.makeRequired = exports.makeOptional = exports.include_ = exports.include = exports.defaultProp = exports.withDefault = exports.allWithDefault = exports.findAnnotation = exports.defaultConstructor = exports.makeCurrentDate = exports.withDefaultConstructorFields = exports.makeUuid = exports.derivePartialConstructor_ = exports.derivePartialConstructor = exports.partialConstructor_ = exports.partialConstructor = void 0; | ||
exports.Model = exports.constArray = exports.makeContramappedSet = exports.makeUnorderedSet = exports.makeUnorderedStringSet = exports.makeUnorderedContramappedStringSet = exports.makeSet = exports.createUnorder = exports.makeRequired = exports.makeOptional = exports.defaultProp = exports.withDefault = exports.allWithDefault = exports.findAnnotation = exports.defaultConstructor = exports.makeCurrentDate = exports.withDefaultConstructorFields = exports.makeUuid = exports.derivePartialConstructor_ = exports.derivePartialConstructor = exports.partialConstructor_ = exports.partialConstructor = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -135,10 +135,2 @@ const A = __importStar(require("@effect-ts/core/Collections/Immutable/Array")); | ||
exports.defaultProp = defaultProp; | ||
function include(props) { | ||
return (fnc) => include_(props, fnc); | ||
} | ||
exports.include = include; | ||
function include_(props, fnc) { | ||
return fnc(props); | ||
} | ||
exports.include_ = include_; | ||
function makeOptional(t // TODO: enforce non empty | ||
@@ -145,0 +137,0 @@ ) { |
@@ -129,3 +129,6 @@ import * as Lens from "@effect-ts/monocle/Lens"; | ||
export declare type IfPathPropsProvided<Path extends string, B extends MO.PropertyRecord, C> = PathParams<Path> extends never ? C : PathParams<Path> extends keyof B ? C : ["You must specify the properties that you expect in the path", never]; | ||
export declare function Model<M>(__name?: string): <Props extends MO.PropertyRecord = {}>(props: Props) => Model<M, MO.SchemaProperties<Props>>; | ||
export declare type PropsExtensions<Props extends MO.PropertyRecord> = { | ||
include: <NewProps extends Record<string, MO.AnyProperty>>(fnc: (props: Props) => NewProps) => NewProps; | ||
}; | ||
export declare function Model<M>(__name?: string): <Props extends MO.PropertyRecord = {}>(props: Props) => Model<M, MO.SchemaProperties<Props>> & PropsExtensions<Props extends MO.PropertyRecord ? Props : never>; | ||
/** | ||
@@ -234,3 +237,12 @@ * See {@link Req} but with Props | ||
export declare function useClassNameForSchema(cls: any): any; | ||
export declare function ModelSpecial<M>(__name?: string): <Self extends MO.SchemaAny>(self: Self) => Model<M, Self>; | ||
declare type GetProps<Self> = Self extends { | ||
Api: { | ||
props: infer Props; | ||
}; | ||
} ? Props extends MO.PropertyRecord ? Props : never : never; | ||
export declare function ModelSpecial<M>(__name?: string): <Self extends MO.SchemaAny & { | ||
Api: { | ||
props: any; | ||
}; | ||
}>(self: Self) => Model<M, Self> & PropsExtensions<GetProps<Self>>; | ||
export declare type ReqRes<E, A> = MO.Schema<unknown, //ParserInput, | ||
@@ -237,0 +249,0 @@ any, // MO.AnyError //ParserError, |
@@ -30,2 +30,3 @@ "use strict"; | ||
const path_parser_1 = require("path-parser"); | ||
const Model_1 = require("../Model"); | ||
const MO = __importStar(require("./_schema")); | ||
@@ -281,2 +282,6 @@ const _schema_1 = require("./_schema"); | ||
// }) | ||
Object.defineProperty(schemed, "include", { | ||
value: Model_1.include(self.Api.props), | ||
configurable: true, | ||
}); | ||
Object.defineProperty(schemed, "lenses", { | ||
@@ -407,2 +412,3 @@ value: lensFromProps()(self.Api.props), | ||
_d.lenses = lensFromProps()(schema.Api.props), | ||
_d.include = Model_1.include(schema.Api.props), | ||
_d.annotate = (identifier, meta) => new MO.SchemaAnnotated(self, identifier, meta), | ||
@@ -409,0 +415,0 @@ _d; |
import * as MO from "./_schema"; | ||
import { These as Th } from "./_schema"; | ||
export declare function include<Props extends Record<string, MO.AnyProperty>>(props: Props): <NewProps extends Record<string, MO.AnyProperty>>(fnc: (props: Props) => NewProps) => NewProps; | ||
export declare function include_<Props extends Record<string, MO.AnyProperty>, NewProps extends Record<string, MO.AnyProperty>>(props: Props, fnc: (props: Props) => NewProps): NewProps; | ||
export declare function onParseOrConstruct<ParserError extends MO.AnyError, ParsedShape, ConstructorInput, ConstructorError extends MO.AnyError, Encoded, Api, Errors extends MO.AnyError>(mod: (i: ParsedShape) => Th.These<Errors, ParsedShape>): (self: MO.Schema<unknown, ParserError, ParsedShape, ConstructorInput, ConstructorError, Encoded, Api>) => MO.Schema<unknown, ParserError | Errors, ParsedShape, ConstructorInput, ConstructorError | Errors, Encoded, Api>; | ||
@@ -4,0 +6,0 @@ export declare function onParseOrConstruct_<ParserError extends MO.AnyError, ParsedShape, ConstructorInput, ConstructorError extends MO.AnyError, Encoded, Api, Errors extends MO.AnyError>(self: MO.Schema<unknown, ParserError, ParsedShape, ConstructorInput, ConstructorError, Encoded, Api>, mod: (i: ParsedShape) => Th.These<Errors, ParsedShape>): MO.Schema<unknown, ParserError | Errors, ParsedShape, ConstructorInput, ConstructorError | Errors, Encoded, Api>; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.domainEE = exports.domainE = exports.domainError = exports.domainResponse2 = exports.domainResponse = exports.onConstruct_ = exports.onConstruct = exports.onParse_ = exports.onParse = exports.onParseOrConstruct_ = exports.onParseOrConstruct = void 0; | ||
exports.domainEE = exports.domainE = exports.domainError = exports.domainResponse2 = exports.domainResponse = exports.onConstruct_ = exports.onConstruct = exports.onParse_ = exports.onParse = exports.onParseOrConstruct_ = exports.onParseOrConstruct = exports.include_ = exports.include = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -29,2 +29,10 @@ const CNK = __importStar(require("@effect-ts/core/Collections/Immutable/Chunk")); | ||
const _schema_1 = require("./_schema"); | ||
function include(props) { | ||
return (fnc) => include_(props, fnc); | ||
} | ||
exports.include = include; | ||
function include_(props, fnc) { | ||
return fnc(props); | ||
} | ||
exports.include_ = include_; | ||
function onParseOrConstruct(mod) { | ||
@@ -31,0 +39,0 @@ return (self) => onParseOrConstruct_(self, mod); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
324976
4172