phecda-core 4.5.0 → 5.0.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/dist/index.d.mts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.js +371 -91
- package/dist/index.mjs +363 -91
- package/package.json +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from 'reflect-metadata';
|
|
2
|
+
|
|
1
3
|
declare function Init(proto: any, property: PropertyKey): void;
|
|
2
4
|
declare function Unmount(proto: any, property: PropertyKey): void;
|
|
3
5
|
declare function Expose(proto: any, property?: PropertyKey, index?: any): void;
|
|
@@ -76,10 +78,26 @@ declare function Storage({ key, json, stringify }?: {
|
|
|
76
78
|
key?: string;
|
|
77
79
|
}): (proto: any, property?: PropertyKey) => void;
|
|
78
80
|
|
|
79
|
-
declare function
|
|
81
|
+
declare function Doc(doc: string): (target: any, property: PropertyKey, index?: any) => void;
|
|
82
|
+
|
|
83
|
+
interface RuleArgs {
|
|
84
|
+
model: Construct;
|
|
85
|
+
property: string;
|
|
86
|
+
value: any;
|
|
87
|
+
/**
|
|
88
|
+
* paramIndex work for params' @Rule
|
|
89
|
+
*/
|
|
90
|
+
index?: number;
|
|
91
|
+
meta: any;
|
|
92
|
+
}
|
|
93
|
+
declare function Rule(...rules: ((args: RuleArgs) => void | string | any | true | Promise<void | string | any | true>)[]): (target: any, property?: PropertyKey, index?: any) => void;
|
|
80
94
|
declare function Required(target: any, property: PropertyKey, index?: any): void;
|
|
81
95
|
declare function Optional(target: any, property: PropertyKey, index?: any): void;
|
|
82
|
-
declare function
|
|
96
|
+
declare function Min(min: number): (target: any, property?: PropertyKey, index?: any) => void;
|
|
97
|
+
declare function Max(max: number): (target: any, property?: PropertyKey, index?: any) => void;
|
|
98
|
+
declare function Nested(model: Construct): (target: any, property: string) => void;
|
|
99
|
+
declare function OneOf(...models: Construct[]): (target: any, property: string) => void;
|
|
100
|
+
declare function Enum(map: Record<string, any>): (target: any, property: string) => void;
|
|
83
101
|
|
|
84
102
|
declare function getTag<M extends Construct | AbConstruct>(moduleOrInstance: M | InstanceType<M>): PropertyKey;
|
|
85
103
|
/**
|
|
@@ -115,8 +133,8 @@ declare abstract class Base {
|
|
|
115
133
|
abstract emitter: any;
|
|
116
134
|
constructor();
|
|
117
135
|
get tag(): PropertyKey;
|
|
118
|
-
init(): void;
|
|
119
|
-
then(cb: () => void, reject?: (e: any) => void): Promise<void>;
|
|
136
|
+
protected init(): void;
|
|
137
|
+
protected then(cb: () => void, reject?: (e: any) => void): Promise<void>;
|
|
120
138
|
on<Key extends keyof Events>(type: Key, handler: (arg: Events[Key]) => void): void;
|
|
121
139
|
emit<Key extends keyof Events>(type: Key, param: Events[Key]): void;
|
|
122
140
|
off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
|
|
@@ -124,4 +142,7 @@ declare abstract class Base {
|
|
|
124
142
|
private _unmount;
|
|
125
143
|
}
|
|
126
144
|
|
|
127
|
-
|
|
145
|
+
declare const _createErrorMessage: (type: string, { property, meta }: RuleArgs) => string;
|
|
146
|
+
declare function validate(model: Construct, data: any, collectErrors?: boolean, createErrMsg?: (type: string, { property, meta }: RuleArgs) => string): Promise<any[]>;
|
|
147
|
+
|
|
148
|
+
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Doc, Effect, Empty, Enum, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, Max, Min, type NameSpace, Nested, OneOf, Optional, PHECDA_KEY, type Phecda, Pipeline, Provide, Required, Rule, type RuleArgs, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, _createErrorMessage, activeInstance, addDecoToClass, functionToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, objectToClass, omit, override, partial, pick, set, setInject, setMeta, validate, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from 'reflect-metadata';
|
|
2
|
+
|
|
1
3
|
declare function Init(proto: any, property: PropertyKey): void;
|
|
2
4
|
declare function Unmount(proto: any, property: PropertyKey): void;
|
|
3
5
|
declare function Expose(proto: any, property?: PropertyKey, index?: any): void;
|
|
@@ -76,10 +78,26 @@ declare function Storage({ key, json, stringify }?: {
|
|
|
76
78
|
key?: string;
|
|
77
79
|
}): (proto: any, property?: PropertyKey) => void;
|
|
78
80
|
|
|
79
|
-
declare function
|
|
81
|
+
declare function Doc(doc: string): (target: any, property: PropertyKey, index?: any) => void;
|
|
82
|
+
|
|
83
|
+
interface RuleArgs {
|
|
84
|
+
model: Construct;
|
|
85
|
+
property: string;
|
|
86
|
+
value: any;
|
|
87
|
+
/**
|
|
88
|
+
* paramIndex work for params' @Rule
|
|
89
|
+
*/
|
|
90
|
+
index?: number;
|
|
91
|
+
meta: any;
|
|
92
|
+
}
|
|
93
|
+
declare function Rule(...rules: ((args: RuleArgs) => void | string | any | true | Promise<void | string | any | true>)[]): (target: any, property?: PropertyKey, index?: any) => void;
|
|
80
94
|
declare function Required(target: any, property: PropertyKey, index?: any): void;
|
|
81
95
|
declare function Optional(target: any, property: PropertyKey, index?: any): void;
|
|
82
|
-
declare function
|
|
96
|
+
declare function Min(min: number): (target: any, property?: PropertyKey, index?: any) => void;
|
|
97
|
+
declare function Max(max: number): (target: any, property?: PropertyKey, index?: any) => void;
|
|
98
|
+
declare function Nested(model: Construct): (target: any, property: string) => void;
|
|
99
|
+
declare function OneOf(...models: Construct[]): (target: any, property: string) => void;
|
|
100
|
+
declare function Enum(map: Record<string, any>): (target: any, property: string) => void;
|
|
83
101
|
|
|
84
102
|
declare function getTag<M extends Construct | AbConstruct>(moduleOrInstance: M | InstanceType<M>): PropertyKey;
|
|
85
103
|
/**
|
|
@@ -115,8 +133,8 @@ declare abstract class Base {
|
|
|
115
133
|
abstract emitter: any;
|
|
116
134
|
constructor();
|
|
117
135
|
get tag(): PropertyKey;
|
|
118
|
-
init(): void;
|
|
119
|
-
then(cb: () => void, reject?: (e: any) => void): Promise<void>;
|
|
136
|
+
protected init(): void;
|
|
137
|
+
protected then(cb: () => void, reject?: (e: any) => void): Promise<void>;
|
|
120
138
|
on<Key extends keyof Events>(type: Key, handler: (arg: Events[Key]) => void): void;
|
|
121
139
|
emit<Key extends keyof Events>(type: Key, param: Events[Key]): void;
|
|
122
140
|
off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
|
|
@@ -124,4 +142,7 @@ declare abstract class Base {
|
|
|
124
142
|
private _unmount;
|
|
125
143
|
}
|
|
126
144
|
|
|
127
|
-
|
|
145
|
+
declare const _createErrorMessage: (type: string, { property, meta }: RuleArgs) => string;
|
|
146
|
+
declare function validate(model: Construct, data: any, collectErrors?: boolean, createErrMsg?: (type: string, { property, meta }: RuleArgs) => string): Promise<any[]>;
|
|
147
|
+
|
|
148
|
+
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Doc, Effect, Empty, Enum, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, Max, Min, type NameSpace, Nested, OneOf, Optional, PHECDA_KEY, type Phecda, Pipeline, Provide, Required, Rule, type RuleArgs, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, _createErrorMessage, activeInstance, addDecoToClass, functionToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, objectToClass, omit, override, partial, pick, set, setInject, setMeta, validate, wait };
|