@midwayjs/decorator 3.4.11 → 3.7.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.ts +3 -7
- package/dist/index.js +14 -12
- package/package.json +3 -3
- package/dist/constant.d.ts +0 -54
- package/dist/constant.js +0 -85
- package/dist/decorator/common/aspect.d.ts +0 -20
- package/dist/decorator/common/aspect.js +0 -22
- package/dist/decorator/common/autoload.d.ts +0 -2
- package/dist/decorator/common/autoload.js +0 -13
- package/dist/decorator/common/configuration.d.ts +0 -24
- package/dist/decorator/common/configuration.js +0 -11
- package/dist/decorator/common/filter.d.ts +0 -6
- package/dist/decorator/common/filter.js +0 -31
- package/dist/decorator/common/framework.d.ts +0 -2
- package/dist/decorator/common/framework.js +0 -13
- package/dist/decorator/common/index.d.ts +0 -11
- package/dist/decorator/common/index.js +0 -27
- package/dist/decorator/common/inject.d.ts +0 -3
- package/dist/decorator/common/inject.js +0 -11
- package/dist/decorator/common/middleware.d.ts +0 -2
- package/dist/decorator/common/middleware.js +0 -12
- package/dist/decorator/common/objectDef.d.ts +0 -7
- package/dist/decorator/common/objectDef.js +0 -25
- package/dist/decorator/common/pipeline.d.ts +0 -3
- package/dist/decorator/common/pipeline.js +0 -11
- package/dist/decorator/common/provide.d.ts +0 -3
- package/dist/decorator/common/provide.js +0 -11
- package/dist/decorator/faas/serverlessTrigger.d.ts +0 -13
- package/dist/decorator/faas/serverlessTrigger.js +0 -29
- package/dist/decorator/framework/index.d.ts +0 -7
- package/dist/decorator/framework/index.js +0 -33
- package/dist/decorator/framework/schedule.d.ts +0 -21
- package/dist/decorator/framework/schedule.js +0 -15
- package/dist/decorator/index.d.ts +0 -19
- package/dist/decorator/index.js +0 -43
- package/dist/decorator/microservice/consumer.d.ts +0 -5
- package/dist/decorator/microservice/consumer.js +0 -18
- package/dist/decorator/microservice/kafkaListener.d.ts +0 -24
- package/dist/decorator/microservice/kafkaListener.js +0 -13
- package/dist/decorator/microservice/provider.d.ts +0 -16
- package/dist/decorator/microservice/provider.js +0 -48
- package/dist/decorator/microservice/rabbitmqListener.d.ts +0 -50
- package/dist/decorator/microservice/rabbitmqListener.js +0 -13
- package/dist/decorator/rpc/hsf.d.ts +0 -12
- package/dist/decorator/rpc/hsf.js +0 -19
- package/dist/decorator/task/queue.d.ts +0 -2
- package/dist/decorator/task/queue.js +0 -17
- package/dist/decorator/task/task.d.ts +0 -2
- package/dist/decorator/task/task.js +0 -18
- package/dist/decorator/task/taskLocal.d.ts +0 -2
- package/dist/decorator/task/taskLocal.js +0 -17
- package/dist/decorator/web/controller.d.ts +0 -20
- package/dist/decorator/web/controller.js +0 -19
- package/dist/decorator/web/paramMapping.d.ts +0 -31
- package/dist/decorator/web/paramMapping.js +0 -50
- package/dist/decorator/web/requestMapping.d.ts +0 -129
- package/dist/decorator/web/requestMapping.js +0 -83
- package/dist/decorator/web/response.d.ts +0 -9
- package/dist/decorator/web/response.js +0 -65
- package/dist/decorator/ws/webSocketController.d.ts +0 -10
- package/dist/decorator/ws/webSocketController.js +0 -21
- package/dist/decorator/ws/webSocketEvent.d.ts +0 -60
- package/dist/decorator/ws/webSocketEvent.js +0 -87
- package/dist/decoratorManager.d.ts +0 -301
- package/dist/decoratorManager.js +0 -708
- package/dist/interface.d.ts +0 -238
- package/dist/interface.js +0 -67
- package/dist/util/camelCase.d.ts +0 -3
- package/dist/util/camelCase.js +0 -88
- package/dist/util/flatted.d.ts +0 -7
- package/dist/util/flatted.js +0 -91
- package/dist/util/format.d.ts +0 -25
- package/dist/util/format.js +0 -38
- package/dist/util/fs.d.ts +0 -5
- package/dist/util/fs.js +0 -15
- package/dist/util/index.d.ts +0 -62
- package/dist/util/index.js +0 -200
- package/dist/util/uuid.d.ts +0 -5
- package/dist/util/uuid.js +0 -64
package/dist/interface.d.ts
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
export declare type MiddlewareParamArray = Array<string | any>;
|
|
2
|
-
export declare type ObjectIdentifier = string | Symbol;
|
|
3
|
-
export declare type GroupModeType = 'one' | 'multi';
|
|
4
|
-
export declare enum ScopeEnum {
|
|
5
|
-
Singleton = "Singleton",
|
|
6
|
-
Request = "Request",
|
|
7
|
-
Prototype = "Prototype"
|
|
8
|
-
}
|
|
9
|
-
export declare enum InjectModeEnum {
|
|
10
|
-
Identifier = "Identifier",
|
|
11
|
-
Class = "Class",
|
|
12
|
-
PropertyName = "PropertyName"
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 内部管理的属性、json、ref等解析实例存储
|
|
16
|
-
*/
|
|
17
|
-
export interface IManagedInstance {
|
|
18
|
-
type: string;
|
|
19
|
-
value?: any;
|
|
20
|
-
args?: any;
|
|
21
|
-
}
|
|
22
|
-
export interface ObjectDefinitionOptions {
|
|
23
|
-
isAsync?: boolean;
|
|
24
|
-
initMethod?: string;
|
|
25
|
-
destroyMethod?: string;
|
|
26
|
-
scope?: ScopeEnum;
|
|
27
|
-
constructorArgs?: any[];
|
|
28
|
-
namespace?: string;
|
|
29
|
-
srcPath?: string;
|
|
30
|
-
allowDowngrade?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface TagPropsMetadata {
|
|
33
|
-
key: string | number | symbol;
|
|
34
|
-
value: any;
|
|
35
|
-
args?: any;
|
|
36
|
-
}
|
|
37
|
-
export interface TagClsMetadata {
|
|
38
|
-
id: string;
|
|
39
|
-
originName: string;
|
|
40
|
-
uuid: string;
|
|
41
|
-
name: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ReflectResult {
|
|
44
|
-
[key: string]: any[];
|
|
45
|
-
}
|
|
46
|
-
export declare enum MSProviderType {
|
|
47
|
-
DUBBO = "dubbo",
|
|
48
|
-
GRPC = "gRPC"
|
|
49
|
-
}
|
|
50
|
-
export declare enum MSListenerType {
|
|
51
|
-
RABBITMQ = "rabbitmq",
|
|
52
|
-
MQTT = "mqtt",
|
|
53
|
-
KAFKA = "kafka",
|
|
54
|
-
REDIS = "redis"
|
|
55
|
-
}
|
|
56
|
-
export declare namespace ConsumerMetadata {
|
|
57
|
-
interface ConsumerMetadata {
|
|
58
|
-
type: MSListenerType;
|
|
59
|
-
metadata: any;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* grpc decorator metadata format
|
|
64
|
-
*/
|
|
65
|
-
export declare namespace GRPCMetadata {
|
|
66
|
-
interface ProviderOptions {
|
|
67
|
-
serviceName?: string;
|
|
68
|
-
package?: string;
|
|
69
|
-
}
|
|
70
|
-
interface ProviderMetadata {
|
|
71
|
-
type: MSProviderType;
|
|
72
|
-
metadata: ProviderOptions;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export declare namespace FaaSMetadata {
|
|
76
|
-
export interface ServerlessFunctionOptions {
|
|
77
|
-
/**
|
|
78
|
-
* function name
|
|
79
|
-
*/
|
|
80
|
-
functionName?: string;
|
|
81
|
-
/**
|
|
82
|
-
* function description
|
|
83
|
-
*/
|
|
84
|
-
description?: string;
|
|
85
|
-
/**
|
|
86
|
-
* function memory size, unit: M
|
|
87
|
-
*/
|
|
88
|
-
memorySize?: number;
|
|
89
|
-
/**
|
|
90
|
-
* function timeout value, unit: seconds
|
|
91
|
-
*/
|
|
92
|
-
timeout?: number;
|
|
93
|
-
/**
|
|
94
|
-
* function init timeout, just for aliyun
|
|
95
|
-
*/
|
|
96
|
-
initTimeout?: number;
|
|
97
|
-
/**
|
|
98
|
-
* function runtime, nodejs10, nodejs12, nodejs14
|
|
99
|
-
*/
|
|
100
|
-
runtime?: string;
|
|
101
|
-
/**
|
|
102
|
-
* invoke concurrency, just for aliyun
|
|
103
|
-
*/
|
|
104
|
-
concurrency?: number;
|
|
105
|
-
/**
|
|
106
|
-
* function invoke stage, like env, just for tencent
|
|
107
|
-
*/
|
|
108
|
-
stage?: string;
|
|
109
|
-
/**
|
|
110
|
-
* environment variable, key-value
|
|
111
|
-
*/
|
|
112
|
-
environment?: any;
|
|
113
|
-
/**
|
|
114
|
-
* deploy or not
|
|
115
|
-
*/
|
|
116
|
-
isDeploy?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* function handler name, like 'index.handler'
|
|
119
|
-
*/
|
|
120
|
-
handlerName?: string;
|
|
121
|
-
}
|
|
122
|
-
interface TriggerCommonOptions {
|
|
123
|
-
/**
|
|
124
|
-
* function name
|
|
125
|
-
*/
|
|
126
|
-
functionName?: string;
|
|
127
|
-
/**
|
|
128
|
-
* serverless event name
|
|
129
|
-
*/
|
|
130
|
-
name?: string;
|
|
131
|
-
/**
|
|
132
|
-
* function invoke role, just for aliyun
|
|
133
|
-
*/
|
|
134
|
-
role?: string;
|
|
135
|
-
/**
|
|
136
|
-
* function publish version, just for aliyun
|
|
137
|
-
*/
|
|
138
|
-
version?: string;
|
|
139
|
-
/**
|
|
140
|
-
* deploy or not
|
|
141
|
-
*/
|
|
142
|
-
isDeploy?: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* function middleware
|
|
145
|
-
*/
|
|
146
|
-
middleware?: any[];
|
|
147
|
-
}
|
|
148
|
-
export interface EventTriggerOptions extends TriggerCommonOptions {
|
|
149
|
-
}
|
|
150
|
-
export interface HTTPTriggerOptions extends TriggerCommonOptions {
|
|
151
|
-
path: string;
|
|
152
|
-
method?: 'get' | 'post' | 'delete' | 'put' | 'head' | 'patch' | 'all';
|
|
153
|
-
}
|
|
154
|
-
export interface APIGatewayTriggerOptions extends HTTPTriggerOptions {
|
|
155
|
-
}
|
|
156
|
-
export interface OSTriggerOptions extends TriggerCommonOptions {
|
|
157
|
-
bucket: string;
|
|
158
|
-
events: string | string[];
|
|
159
|
-
filter?: {
|
|
160
|
-
prefix: string;
|
|
161
|
-
suffix: string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export interface LogTriggerOptions extends TriggerCommonOptions {
|
|
165
|
-
source: string;
|
|
166
|
-
project: string;
|
|
167
|
-
log: string;
|
|
168
|
-
retryTime?: number;
|
|
169
|
-
interval?: number;
|
|
170
|
-
}
|
|
171
|
-
export interface TimerTriggerOptions extends TriggerCommonOptions {
|
|
172
|
-
type: 'cron' | 'every' | 'interval';
|
|
173
|
-
value: string;
|
|
174
|
-
payload?: string;
|
|
175
|
-
enable?: boolean;
|
|
176
|
-
}
|
|
177
|
-
export interface MQTriggerOptions extends TriggerCommonOptions {
|
|
178
|
-
topic: string;
|
|
179
|
-
tags?: string;
|
|
180
|
-
region?: string;
|
|
181
|
-
strategy?: 'BACKOFF_RETRY' | 'EXPONENTIAL_DECAY_RETRY';
|
|
182
|
-
}
|
|
183
|
-
export interface HSFTriggerOptions extends TriggerCommonOptions {
|
|
184
|
-
}
|
|
185
|
-
export interface MTopTriggerOptions extends TriggerCommonOptions {
|
|
186
|
-
}
|
|
187
|
-
export interface CDNTriggerOptions extends TriggerCommonOptions {
|
|
188
|
-
}
|
|
189
|
-
export type EventTriggerUnionOptions = EventTriggerOptions | HTTPTriggerOptions | APIGatewayTriggerOptions | OSTriggerOptions | CDNTriggerOptions | LogTriggerOptions | TimerTriggerOptions | MQTriggerOptions | HSFTriggerOptions | MTopTriggerOptions;
|
|
190
|
-
export interface TriggerMetadata {
|
|
191
|
-
type: ServerlessTriggerType;
|
|
192
|
-
functionName?: string;
|
|
193
|
-
handlerName?: string;
|
|
194
|
-
methodName?: string;
|
|
195
|
-
metadata: EventTriggerUnionOptions;
|
|
196
|
-
}
|
|
197
|
-
export {};
|
|
198
|
-
}
|
|
199
|
-
export declare abstract class FrameworkType {
|
|
200
|
-
abstract name: string;
|
|
201
|
-
}
|
|
202
|
-
export declare class MidwayFrameworkType extends FrameworkType {
|
|
203
|
-
name: string;
|
|
204
|
-
static WEB: MidwayFrameworkType;
|
|
205
|
-
static WEB_KOA: MidwayFrameworkType;
|
|
206
|
-
static WEB_EXPRESS: MidwayFrameworkType;
|
|
207
|
-
static FAAS: MidwayFrameworkType;
|
|
208
|
-
static MS_GRPC: MidwayFrameworkType;
|
|
209
|
-
static MS_RABBITMQ: MidwayFrameworkType;
|
|
210
|
-
static MS_KAFKA: MidwayFrameworkType;
|
|
211
|
-
static WS_IO: MidwayFrameworkType;
|
|
212
|
-
static WS: MidwayFrameworkType;
|
|
213
|
-
static SERVERLESS_APP: MidwayFrameworkType;
|
|
214
|
-
static CUSTOM: MidwayFrameworkType;
|
|
215
|
-
static EMPTY: MidwayFrameworkType;
|
|
216
|
-
static LIGHT: MidwayFrameworkType;
|
|
217
|
-
static TASK: MidwayFrameworkType;
|
|
218
|
-
constructor(name: string);
|
|
219
|
-
}
|
|
220
|
-
export declare enum ServerlessTriggerType {
|
|
221
|
-
EVENT = "event",
|
|
222
|
-
HTTP = "http",
|
|
223
|
-
API_GATEWAY = "apigw",
|
|
224
|
-
OS = "os",
|
|
225
|
-
CDN = "cdn",
|
|
226
|
-
LOG = "log",
|
|
227
|
-
TIMER = "timer",
|
|
228
|
-
MQ = "mq",
|
|
229
|
-
KAFKA = "kafka",
|
|
230
|
-
HSF = "hsf",
|
|
231
|
-
MTOP = "mtop"
|
|
232
|
-
}
|
|
233
|
-
export interface IModuleStore {
|
|
234
|
-
listModule(key: string): any;
|
|
235
|
-
saveModule(key: string, module: any): any;
|
|
236
|
-
transformModule?(moduleMap: Map<string, Set<any>>): any;
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=interface.d.ts.map
|
package/dist/interface.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerlessTriggerType = exports.MidwayFrameworkType = exports.FrameworkType = exports.MSListenerType = exports.MSProviderType = exports.InjectModeEnum = exports.ScopeEnum = void 0;
|
|
4
|
-
var ScopeEnum;
|
|
5
|
-
(function (ScopeEnum) {
|
|
6
|
-
ScopeEnum["Singleton"] = "Singleton";
|
|
7
|
-
ScopeEnum["Request"] = "Request";
|
|
8
|
-
ScopeEnum["Prototype"] = "Prototype";
|
|
9
|
-
})(ScopeEnum = exports.ScopeEnum || (exports.ScopeEnum = {}));
|
|
10
|
-
var InjectModeEnum;
|
|
11
|
-
(function (InjectModeEnum) {
|
|
12
|
-
InjectModeEnum["Identifier"] = "Identifier";
|
|
13
|
-
InjectModeEnum["Class"] = "Class";
|
|
14
|
-
InjectModeEnum["PropertyName"] = "PropertyName";
|
|
15
|
-
})(InjectModeEnum = exports.InjectModeEnum || (exports.InjectModeEnum = {}));
|
|
16
|
-
var MSProviderType;
|
|
17
|
-
(function (MSProviderType) {
|
|
18
|
-
MSProviderType["DUBBO"] = "dubbo";
|
|
19
|
-
MSProviderType["GRPC"] = "gRPC";
|
|
20
|
-
})(MSProviderType = exports.MSProviderType || (exports.MSProviderType = {}));
|
|
21
|
-
var MSListenerType;
|
|
22
|
-
(function (MSListenerType) {
|
|
23
|
-
MSListenerType["RABBITMQ"] = "rabbitmq";
|
|
24
|
-
MSListenerType["MQTT"] = "mqtt";
|
|
25
|
-
MSListenerType["KAFKA"] = "kafka";
|
|
26
|
-
MSListenerType["REDIS"] = "redis";
|
|
27
|
-
})(MSListenerType = exports.MSListenerType || (exports.MSListenerType = {}));
|
|
28
|
-
class FrameworkType {
|
|
29
|
-
}
|
|
30
|
-
exports.FrameworkType = FrameworkType;
|
|
31
|
-
class MidwayFrameworkType extends FrameworkType {
|
|
32
|
-
constructor(name) {
|
|
33
|
-
super();
|
|
34
|
-
this.name = name;
|
|
35
|
-
}
|
|
36
|
-
;
|
|
37
|
-
}
|
|
38
|
-
exports.MidwayFrameworkType = MidwayFrameworkType;
|
|
39
|
-
MidwayFrameworkType.WEB = new MidwayFrameworkType('@midwayjs/web');
|
|
40
|
-
MidwayFrameworkType.WEB_KOA = new MidwayFrameworkType('@midwayjs/web-koa');
|
|
41
|
-
MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
|
|
42
|
-
MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
|
|
43
|
-
MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
|
|
44
|
-
MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
|
|
45
|
-
MidwayFrameworkType.MS_KAFKA = new MidwayFrameworkType('@midwayjs/kafka');
|
|
46
|
-
MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
|
|
47
|
-
MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
|
|
48
|
-
MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
|
|
49
|
-
MidwayFrameworkType.CUSTOM = new MidwayFrameworkType('');
|
|
50
|
-
MidwayFrameworkType.EMPTY = new MidwayFrameworkType('empty');
|
|
51
|
-
MidwayFrameworkType.LIGHT = new MidwayFrameworkType('light');
|
|
52
|
-
MidwayFrameworkType.TASK = new MidwayFrameworkType('@midwayjs/task');
|
|
53
|
-
var ServerlessTriggerType;
|
|
54
|
-
(function (ServerlessTriggerType) {
|
|
55
|
-
ServerlessTriggerType["EVENT"] = "event";
|
|
56
|
-
ServerlessTriggerType["HTTP"] = "http";
|
|
57
|
-
ServerlessTriggerType["API_GATEWAY"] = "apigw";
|
|
58
|
-
ServerlessTriggerType["OS"] = "os";
|
|
59
|
-
ServerlessTriggerType["CDN"] = "cdn";
|
|
60
|
-
ServerlessTriggerType["LOG"] = "log";
|
|
61
|
-
ServerlessTriggerType["TIMER"] = "timer";
|
|
62
|
-
ServerlessTriggerType["MQ"] = "mq";
|
|
63
|
-
ServerlessTriggerType["KAFKA"] = "kafka";
|
|
64
|
-
ServerlessTriggerType["HSF"] = "hsf";
|
|
65
|
-
ServerlessTriggerType["MTOP"] = "mtop";
|
|
66
|
-
})(ServerlessTriggerType = exports.ServerlessTriggerType || (exports.ServerlessTriggerType = {}));
|
|
67
|
-
//# sourceMappingURL=interface.js.map
|
package/dist/util/camelCase.d.ts
DELETED
package/dist/util/camelCase.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pascalCase = exports.camelCase = void 0;
|
|
4
|
-
const UPPERCASE = /[\p{Lu}]/u;
|
|
5
|
-
const LOWERCASE = /[\p{Ll}]/u;
|
|
6
|
-
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
7
|
-
const SEPARATORS = /[_.\- ]+/;
|
|
8
|
-
const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
|
|
9
|
-
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
|
|
10
|
-
const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
|
|
11
|
-
const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
|
12
|
-
let isLastCharLower = false;
|
|
13
|
-
let isLastCharUpper = false;
|
|
14
|
-
let isLastLastCharUpper = false;
|
|
15
|
-
for (let i = 0; i < string.length; i++) {
|
|
16
|
-
const character = string[i];
|
|
17
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
18
|
-
string = string.slice(0, i) + '-' + string.slice(i);
|
|
19
|
-
isLastCharLower = false;
|
|
20
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
21
|
-
isLastCharUpper = true;
|
|
22
|
-
i++;
|
|
23
|
-
}
|
|
24
|
-
else if (isLastCharUpper &&
|
|
25
|
-
isLastLastCharUpper &&
|
|
26
|
-
LOWERCASE.test(character)) {
|
|
27
|
-
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
|
28
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
29
|
-
isLastCharUpper = false;
|
|
30
|
-
isLastCharLower = true;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
isLastCharLower =
|
|
34
|
-
toLowerCase(character) === character &&
|
|
35
|
-
toUpperCase(character) !== character;
|
|
36
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
37
|
-
isLastCharUpper =
|
|
38
|
-
toUpperCase(character) === character &&
|
|
39
|
-
toLowerCase(character) !== character;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return string;
|
|
43
|
-
};
|
|
44
|
-
const postProcess = (input, toUpperCase) => {
|
|
45
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
46
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
47
|
-
return input
|
|
48
|
-
.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier))
|
|
49
|
-
.replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m));
|
|
50
|
-
};
|
|
51
|
-
function camelCaseOrigin(input, options) {
|
|
52
|
-
options = {
|
|
53
|
-
pascalCase: false,
|
|
54
|
-
...options,
|
|
55
|
-
};
|
|
56
|
-
input = input.trim();
|
|
57
|
-
if (input.length === 0) {
|
|
58
|
-
return '';
|
|
59
|
-
}
|
|
60
|
-
const toLowerCase = string => string.toLowerCase();
|
|
61
|
-
const toUpperCase = string => string.toUpperCase();
|
|
62
|
-
if (input.length === 1) {
|
|
63
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
64
|
-
}
|
|
65
|
-
const hasUpperCase = input !== toLowerCase(input);
|
|
66
|
-
if (hasUpperCase) {
|
|
67
|
-
input = preserveCamelCase(input, toLowerCase, toUpperCase);
|
|
68
|
-
}
|
|
69
|
-
input = input.replace(LEADING_SEPARATORS, '');
|
|
70
|
-
input = toLowerCase(input);
|
|
71
|
-
if (options.pascalCase) {
|
|
72
|
-
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
73
|
-
}
|
|
74
|
-
return postProcess(input, toUpperCase);
|
|
75
|
-
}
|
|
76
|
-
function camelCase(input) {
|
|
77
|
-
return camelCaseOrigin(input, {
|
|
78
|
-
pascalCase: false,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
exports.camelCase = camelCase;
|
|
82
|
-
function pascalCase(input) {
|
|
83
|
-
return camelCaseOrigin(input, {
|
|
84
|
-
pascalCase: true,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.pascalCase = pascalCase;
|
|
88
|
-
//# sourceMappingURL=camelCase.js.map
|
package/dist/util/flatted.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* code fork from https://github.com/WebReflection/flatted/blob/main/cjs/index.js
|
|
3
|
-
*/
|
|
4
|
-
/*! (c) 2020 Andrea Giammarchi */
|
|
5
|
-
export declare function safeParse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
|
|
6
|
-
export declare function safeStringify(value: any, replacer?: any, space?: string | number): string;
|
|
7
|
-
//# sourceMappingURL=flatted.d.ts.map
|
package/dist/util/flatted.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* code fork from https://github.com/WebReflection/flatted/blob/main/cjs/index.js
|
|
4
|
-
*/
|
|
5
|
-
/*! (c) 2020 Andrea Giammarchi */
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.safeStringify = exports.safeParse = void 0;
|
|
8
|
-
const { parse: $parse, stringify: $stringify } = JSON;
|
|
9
|
-
const { keys } = Object;
|
|
10
|
-
const Primitive = String; // it could be Number
|
|
11
|
-
const primitive = 'string'; // it could be 'number'
|
|
12
|
-
const ignore = {};
|
|
13
|
-
const object = 'object';
|
|
14
|
-
const noop = (_, value) => value;
|
|
15
|
-
const primitives = value => value instanceof Primitive ? Primitive(value) : value;
|
|
16
|
-
const Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
|
|
17
|
-
const revive = (input, parsed, output, $) => {
|
|
18
|
-
const lazy = [];
|
|
19
|
-
for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
|
|
20
|
-
const k = ke[y];
|
|
21
|
-
const value = output[k];
|
|
22
|
-
if (value instanceof Primitive) {
|
|
23
|
-
const tmp = input[value];
|
|
24
|
-
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
25
|
-
parsed.add(tmp);
|
|
26
|
-
output[k] = ignore;
|
|
27
|
-
lazy.push({ k, a: [input, parsed, tmp, $] });
|
|
28
|
-
}
|
|
29
|
-
else
|
|
30
|
-
output[k] = $.call(output, k, tmp);
|
|
31
|
-
}
|
|
32
|
-
else if (output[k] !== ignore)
|
|
33
|
-
output[k] = $.call(output, k, value);
|
|
34
|
-
}
|
|
35
|
-
for (let { length } = lazy, i = 0; i < length; i++) {
|
|
36
|
-
const { k, a } = lazy[i];
|
|
37
|
-
// eslint-disable-next-line prefer-spread
|
|
38
|
-
output[k] = $.call(output, k, revive.apply(null, a));
|
|
39
|
-
}
|
|
40
|
-
return output;
|
|
41
|
-
};
|
|
42
|
-
const set = (known, input, value) => {
|
|
43
|
-
const index = Primitive(input.push(value) - 1);
|
|
44
|
-
known.set(value, index);
|
|
45
|
-
return index;
|
|
46
|
-
};
|
|
47
|
-
function safeParse(text, reviver) {
|
|
48
|
-
const input = $parse(text, Primitives).map(primitives);
|
|
49
|
-
const value = input[0];
|
|
50
|
-
const $ = reviver || noop;
|
|
51
|
-
const tmp = typeof value === object && value
|
|
52
|
-
? revive(input, new Set(), value, $)
|
|
53
|
-
: value;
|
|
54
|
-
return $.call({ '': tmp }, '', tmp);
|
|
55
|
-
}
|
|
56
|
-
exports.safeParse = safeParse;
|
|
57
|
-
function safeStringify(value, replacer, space) {
|
|
58
|
-
const $ = replacer && typeof replacer === object
|
|
59
|
-
? (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0)
|
|
60
|
-
: replacer || noop;
|
|
61
|
-
const known = new Map();
|
|
62
|
-
const input = [];
|
|
63
|
-
const output = [];
|
|
64
|
-
let i = +set(known, input, $.call({ '': value }, '', value));
|
|
65
|
-
let firstRun = !i;
|
|
66
|
-
while (i < input.length) {
|
|
67
|
-
firstRun = true;
|
|
68
|
-
output[i] = $stringify(input[i++], replace, space);
|
|
69
|
-
}
|
|
70
|
-
return '[' + output.join(',') + ']';
|
|
71
|
-
function replace(key, value) {
|
|
72
|
-
if (firstRun) {
|
|
73
|
-
firstRun = !firstRun;
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
const after = $.call(this, key, value);
|
|
77
|
-
switch (typeof after) {
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
case object:
|
|
81
|
-
if (after === null)
|
|
82
|
-
return after;
|
|
83
|
-
// eslint-disable-next-line no-fallthrough
|
|
84
|
-
case primitive:
|
|
85
|
-
return known.get(after) || set(known, input, after);
|
|
86
|
-
}
|
|
87
|
-
return after;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.safeStringify = safeStringify;
|
|
91
|
-
//# sourceMappingURL=flatted.js.map
|
package/dist/util/format.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare const FORMAT: {
|
|
2
|
-
MS: {
|
|
3
|
-
ONE_SECOND: number;
|
|
4
|
-
ONE_MINUTE: number;
|
|
5
|
-
ONE_HOUR: number;
|
|
6
|
-
ONE_DAY: number;
|
|
7
|
-
ONE_WEEK: number;
|
|
8
|
-
ONE_YEAR: number;
|
|
9
|
-
};
|
|
10
|
-
CRONTAB: {
|
|
11
|
-
EVERY_SECOND: string;
|
|
12
|
-
EVERY_MINUTE: string;
|
|
13
|
-
EVERY_HOUR: string;
|
|
14
|
-
EVERY_DAY: string;
|
|
15
|
-
EVERY_DAY_ZERO_FIFTEEN: string;
|
|
16
|
-
EVERY_DAY_ONE_FIFTEEN: string;
|
|
17
|
-
EVERY_PER_5_SECOND: string;
|
|
18
|
-
EVERY_PER_10_SECOND: string;
|
|
19
|
-
EVERY_PER_30_SECOND: string;
|
|
20
|
-
EVERY_PER_5_MINUTE: string;
|
|
21
|
-
EVERY_PER_10_MINUTE: string;
|
|
22
|
-
EVERY_PER_30_MINUTE: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=format.d.ts.map
|
package/dist/util/format.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORMAT = void 0;
|
|
4
|
-
// value from ms package
|
|
5
|
-
const s = 1000;
|
|
6
|
-
const m = s * 60;
|
|
7
|
-
const h = m * 60;
|
|
8
|
-
const d = h * 24;
|
|
9
|
-
const w = d * 7;
|
|
10
|
-
const y = d * 365.25;
|
|
11
|
-
const MS = {
|
|
12
|
-
ONE_SECOND: s,
|
|
13
|
-
ONE_MINUTE: m,
|
|
14
|
-
ONE_HOUR: h,
|
|
15
|
-
ONE_DAY: d,
|
|
16
|
-
ONE_WEEK: w,
|
|
17
|
-
ONE_YEAR: y,
|
|
18
|
-
};
|
|
19
|
-
// crontab pre format
|
|
20
|
-
const CRONTAB = {
|
|
21
|
-
EVERY_SECOND: '* * * * * *',
|
|
22
|
-
EVERY_MINUTE: '0 * * * * *',
|
|
23
|
-
EVERY_HOUR: '0 0 * * * *',
|
|
24
|
-
EVERY_DAY: '0 0 0 * * *',
|
|
25
|
-
EVERY_DAY_ZERO_FIFTEEN: '0 15 0 * * *',
|
|
26
|
-
EVERY_DAY_ONE_FIFTEEN: '0 15 1 * * *',
|
|
27
|
-
EVERY_PER_5_SECOND: '*/5 * * * * *',
|
|
28
|
-
EVERY_PER_10_SECOND: '*/10 * * * * *',
|
|
29
|
-
EVERY_PER_30_SECOND: '*/30 * * * * *',
|
|
30
|
-
EVERY_PER_5_MINUTE: '0 */5 * * * *',
|
|
31
|
-
EVERY_PER_10_MINUTE: '0 */10 * * * *',
|
|
32
|
-
EVERY_PER_30_MINUTE: '0 */30 * * * *',
|
|
33
|
-
};
|
|
34
|
-
exports.FORMAT = {
|
|
35
|
-
MS,
|
|
36
|
-
CRONTAB,
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=format.js.map
|
package/dist/util/fs.d.ts
DELETED
package/dist/util/fs.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileUtils = exports.exists = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
async function exists(p) {
|
|
6
|
-
return fs_1.promises
|
|
7
|
-
.access(p, fs_1.constants.F_OK)
|
|
8
|
-
.then(() => true)
|
|
9
|
-
.catch(() => false);
|
|
10
|
-
}
|
|
11
|
-
exports.exists = exists;
|
|
12
|
-
exports.FileUtils = {
|
|
13
|
-
exists,
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=fs.js.map
|
package/dist/util/index.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { camelCase, pascalCase } from './camelCase';
|
|
2
|
-
import { randomUUID } from './uuid';
|
|
3
|
-
import { safeStringify, safeParse } from './flatted';
|
|
4
|
-
export declare function isString(value: any): boolean;
|
|
5
|
-
export declare function isClass(fn: any): boolean;
|
|
6
|
-
export declare function isAsyncFunction(value: any): boolean;
|
|
7
|
-
export declare function isGeneratorFunction(value: any): boolean;
|
|
8
|
-
export declare function isPromise(value: any): boolean;
|
|
9
|
-
export declare function isFunction(value: any): boolean;
|
|
10
|
-
export declare function isObject(value: any): boolean;
|
|
11
|
-
export declare function isPlainObject(obj: any): any;
|
|
12
|
-
export declare function isNumber(value: any): boolean;
|
|
13
|
-
export declare function isProxy(value: any): boolean;
|
|
14
|
-
export declare function isMap(value: any): boolean;
|
|
15
|
-
export declare function isSet(value: any): boolean;
|
|
16
|
-
export declare function isRegExp(value: any): boolean;
|
|
17
|
-
export declare function isUndefined(value: any): boolean;
|
|
18
|
-
export declare function isNull(value: any): boolean;
|
|
19
|
-
export declare function isNullOrUndefined(value: any): boolean;
|
|
20
|
-
export declare function sleep(sleepTime?: number): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* get parameter name from function
|
|
23
|
-
* @param func
|
|
24
|
-
*/
|
|
25
|
-
export declare function getParamNames(func: any): string[];
|
|
26
|
-
/**
|
|
27
|
-
* generate a lightweight 32 bit random id, enough for ioc container
|
|
28
|
-
*/
|
|
29
|
-
export declare function generateRandomId(): string;
|
|
30
|
-
export declare function merge(target: any, src: any): any;
|
|
31
|
-
export declare function toAsyncFunction<T extends (...args: any[]) => any>(method: T): (...args: Parameters<T>) => Promise<ReturnType<T>>;
|
|
32
|
-
export declare const Types: {
|
|
33
|
-
isClass: typeof isClass;
|
|
34
|
-
isAsyncFunction: typeof isAsyncFunction;
|
|
35
|
-
isGeneratorFunction: typeof isGeneratorFunction;
|
|
36
|
-
isString: typeof isString;
|
|
37
|
-
isPromise: typeof isPromise;
|
|
38
|
-
isFunction: typeof isFunction;
|
|
39
|
-
isObject: typeof isObject;
|
|
40
|
-
isPlainObject: typeof isPlainObject;
|
|
41
|
-
isNumber: typeof isNumber;
|
|
42
|
-
isProxy: typeof isProxy;
|
|
43
|
-
isMap: typeof isMap;
|
|
44
|
-
isSet: typeof isSet;
|
|
45
|
-
isRegExp: typeof isRegExp;
|
|
46
|
-
isUndefined: typeof isUndefined;
|
|
47
|
-
isNull: typeof isNull;
|
|
48
|
-
isNullOrUndefined: typeof isNullOrUndefined;
|
|
49
|
-
};
|
|
50
|
-
export declare const Utils: {
|
|
51
|
-
sleep: typeof sleep;
|
|
52
|
-
getParamNames: typeof getParamNames;
|
|
53
|
-
generateRandomId: typeof generateRandomId;
|
|
54
|
-
merge: typeof merge;
|
|
55
|
-
camelCase: typeof camelCase;
|
|
56
|
-
pascalCase: typeof pascalCase;
|
|
57
|
-
randomUUID: typeof randomUUID;
|
|
58
|
-
toAsyncFunction: typeof toAsyncFunction;
|
|
59
|
-
safeStringify: typeof safeStringify;
|
|
60
|
-
safeParse: typeof safeParse;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=index.d.ts.map
|