hobots 0.3.0 → 1.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/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/chunk-FW32OR7V.js +75 -0
- package/dist/chunk-FW32OR7V.js.map +1 -0
- package/dist/index.cjs +764 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +691 -0
- package/dist/index.js.map +1 -0
- package/dist/manager/protocol.cjs +19 -0
- package/dist/manager/protocol.cjs.map +1 -0
- package/dist/manager/protocol.d.cts +72 -0
- package/dist/manager/protocol.d.ts +72 -0
- package/dist/manager/protocol.js +1 -0
- package/dist/manager/protocol.js.map +1 -0
- package/dist/manager.cjs +519 -0
- package/dist/manager.cjs.map +1 -0
- package/dist/manager.d.cts +118 -0
- package/dist/manager.d.ts +118 -0
- package/dist/manager.js +464 -0
- package/dist/manager.js.map +1 -0
- package/dist/protocol.cjs +19 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +126 -0
- package/dist/protocol.d.ts +126 -0
- package/dist/protocol.js +1 -0
- package/dist/protocol.js.map +1 -0
- package/dist/utils-LReLqjzN.d.cts +7 -0
- package/dist/utils-LReLqjzN.d.ts +7 -0
- package/docs/README.md +39 -0
- package/docs/api-reference.md +140 -0
- package/docs/getting-started.md +88 -0
- package/docs/manager.md +90 -0
- package/docs/monitor.md +136 -0
- package/docs/protocol.md +87 -0
- package/package.json +50 -2
- package/auth/index.d.ts +0 -10
- package/csv/index.d.ts +0 -9
- package/datasets/index.d.ts +0 -2
- package/db/drizzle.config.d.ts +0 -8
- package/db/index.d.ts +0 -9
- package/db/migrate.d.ts +0 -3
- package/db/schema.d.ts +0 -215
- package/db/storages/base.d.ts +0 -23
- package/db/storages/index.d.ts +0 -3
- package/db/storages/job.d.ts +0 -233
- package/exceptions/break.d.ts +0 -6
- package/exceptions/ignore.d.ts +0 -6
- package/exceptions/index.d.ts +0 -4
- package/exceptions/warning.d.ts +0 -6
- package/foreach/foreach.d.ts +0 -7
- package/foreach/index.d.ts +0 -5
- package/foreach/item.d.ts +0 -13
- package/hobots/samples/bot.d.ts +0 -2
- package/hobots/samples/index.d.ts +0 -2
- package/hobots/src/auth/index.d.ts +0 -10
- package/hobots/src/csv/index.d.ts +0 -9
- package/hobots/src/datasets/index.d.ts +0 -2
- package/hobots/src/db/drizzle.config.d.ts +0 -8
- package/hobots/src/db/index.d.ts +0 -9
- package/hobots/src/db/migrate.d.ts +0 -3
- package/hobots/src/db/schema.d.ts +0 -215
- package/hobots/src/db/storages/base.d.ts +0 -23
- package/hobots/src/db/storages/index.d.ts +0 -3
- package/hobots/src/db/storages/job.d.ts +0 -233
- package/hobots/src/exceptions/break.d.ts +0 -6
- package/hobots/src/exceptions/ignore.d.ts +0 -6
- package/hobots/src/exceptions/index.d.ts +0 -4
- package/hobots/src/exceptions/warning.d.ts +0 -6
- package/hobots/src/foreach/foreach.d.ts +0 -7
- package/hobots/src/foreach/index.d.ts +0 -5
- package/hobots/src/foreach/item.d.ts +0 -13
- package/hobots/src/index.d.ts +0 -9
- package/hobots/src/reports/data-report.d.ts +0 -9
- package/hobots/src/reports/index.d.ts +0 -3
- package/hobots/src/reports/job-report.d.ts +0 -22
- package/hobots/src/setup.d.ts +0 -20
- package/hobots/src/sheets/index.d.ts +0 -13
- package/hobots/src/types/hobots-types.d.ts +0 -20
- package/hobots/src/utils/date.d.ts +0 -117
- package/hobots/src/utils/dist.d.ts +0 -8
- package/hobots/src/utils/garbage.d.ts +0 -2
- package/hobots/src/utils/index.d.ts +0 -10
- package/hobots/src/utils/logger.d.ts +0 -21
- package/hobots/src/utils/manifest.d.ts +0 -2
- package/hobots/src/utils/path.d.ts +0 -13
- package/hobots/src/utils/publish.d.ts +0 -2
- package/hobots/src/utils/retry.d.ts +0 -5
- package/hobots/src/utils/text.d.ts +0 -74
- package/hobots/src/utils/timer.d.ts +0 -3
- package/index.d.ts +0 -9
- package/index.js +0 -131866
- package/index.js.map +0 -1
- package/reports/data-report.d.ts +0 -9
- package/reports/index.d.ts +0 -3
- package/reports/job-report.d.ts +0 -22
- package/setup.d.ts +0 -20
- package/sheets/index.d.ts +0 -13
- package/types/hobots-types.d.ts +0 -20
- package/utils/date.d.ts +0 -117
- package/utils/dist.d.ts +0 -8
- package/utils/garbage.d.ts +0 -2
- package/utils/index.d.ts +0 -10
- package/utils/logger.d.ts +0 -21
- package/utils/manifest.d.ts +0 -2
- package/utils/path.d.ts +0 -13
- package/utils/publish.d.ts +0 -2
- package/utils/retry.d.ts +0 -5
- package/utils/src/path.d.ts +0 -14
- package/utils/text.d.ts +0 -74
- package/utils/timer.d.ts +0 -3
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import Storage from './base';
|
|
2
|
-
export type PageProps = {
|
|
3
|
-
page?: number;
|
|
4
|
-
pageSize?: number;
|
|
5
|
-
};
|
|
6
|
-
export declare class JobStorage extends Storage {
|
|
7
|
-
static model: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
8
|
-
name: "jobs";
|
|
9
|
-
schema: undefined;
|
|
10
|
-
columns: {
|
|
11
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
12
|
-
name: "id";
|
|
13
|
-
tableName: "jobs";
|
|
14
|
-
dataType: "string";
|
|
15
|
-
columnType: "SQLiteText";
|
|
16
|
-
data: string;
|
|
17
|
-
driverParam: string;
|
|
18
|
-
notNull: true;
|
|
19
|
-
hasDefault: false;
|
|
20
|
-
isPrimaryKey: true;
|
|
21
|
-
isAutoincrement: false;
|
|
22
|
-
hasRuntimeDefault: false;
|
|
23
|
-
enumValues: [string, ...string[]];
|
|
24
|
-
baseColumn: never;
|
|
25
|
-
identity: undefined;
|
|
26
|
-
generated: undefined;
|
|
27
|
-
}, {}, {
|
|
28
|
-
length: number | undefined;
|
|
29
|
-
}>;
|
|
30
|
-
job_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
31
|
-
name: "job_id";
|
|
32
|
-
tableName: "jobs";
|
|
33
|
-
dataType: "string";
|
|
34
|
-
columnType: "SQLiteText";
|
|
35
|
-
data: string;
|
|
36
|
-
driverParam: string;
|
|
37
|
-
notNull: true;
|
|
38
|
-
hasDefault: false;
|
|
39
|
-
isPrimaryKey: false;
|
|
40
|
-
isAutoincrement: false;
|
|
41
|
-
hasRuntimeDefault: false;
|
|
42
|
-
enumValues: [string, ...string[]];
|
|
43
|
-
baseColumn: never;
|
|
44
|
-
identity: undefined;
|
|
45
|
-
generated: undefined;
|
|
46
|
-
}, {}, {
|
|
47
|
-
length: number | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
schema: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
50
|
-
name: "schema";
|
|
51
|
-
tableName: "jobs";
|
|
52
|
-
dataType: "string";
|
|
53
|
-
columnType: "SQLiteText";
|
|
54
|
-
data: string;
|
|
55
|
-
driverParam: string;
|
|
56
|
-
notNull: true;
|
|
57
|
-
hasDefault: false;
|
|
58
|
-
isPrimaryKey: false;
|
|
59
|
-
isAutoincrement: false;
|
|
60
|
-
hasRuntimeDefault: false;
|
|
61
|
-
enumValues: [string, ...string[]];
|
|
62
|
-
baseColumn: never;
|
|
63
|
-
identity: undefined;
|
|
64
|
-
generated: undefined;
|
|
65
|
-
}, {}, {
|
|
66
|
-
length: number | undefined;
|
|
67
|
-
}>;
|
|
68
|
-
item_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
69
|
-
name: "item_id";
|
|
70
|
-
tableName: "jobs";
|
|
71
|
-
dataType: "string";
|
|
72
|
-
columnType: "SQLiteText";
|
|
73
|
-
data: string;
|
|
74
|
-
driverParam: string;
|
|
75
|
-
notNull: true;
|
|
76
|
-
hasDefault: false;
|
|
77
|
-
isPrimaryKey: false;
|
|
78
|
-
isAutoincrement: false;
|
|
79
|
-
hasRuntimeDefault: false;
|
|
80
|
-
enumValues: [string, ...string[]];
|
|
81
|
-
baseColumn: never;
|
|
82
|
-
identity: undefined;
|
|
83
|
-
generated: undefined;
|
|
84
|
-
}, {}, {
|
|
85
|
-
length: number | undefined;
|
|
86
|
-
}>;
|
|
87
|
-
data: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
88
|
-
name: "data";
|
|
89
|
-
tableName: "jobs";
|
|
90
|
-
dataType: "json";
|
|
91
|
-
columnType: "SQLiteTextJson";
|
|
92
|
-
data: unknown;
|
|
93
|
-
driverParam: string;
|
|
94
|
-
notNull: true;
|
|
95
|
-
hasDefault: false;
|
|
96
|
-
isPrimaryKey: false;
|
|
97
|
-
isAutoincrement: false;
|
|
98
|
-
hasRuntimeDefault: false;
|
|
99
|
-
enumValues: undefined;
|
|
100
|
-
baseColumn: never;
|
|
101
|
-
identity: undefined;
|
|
102
|
-
generated: undefined;
|
|
103
|
-
}, {}, {}>;
|
|
104
|
-
status: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
105
|
-
name: "status";
|
|
106
|
-
tableName: "jobs";
|
|
107
|
-
dataType: "string";
|
|
108
|
-
columnType: "SQLiteText";
|
|
109
|
-
data: string;
|
|
110
|
-
driverParam: string;
|
|
111
|
-
notNull: true;
|
|
112
|
-
hasDefault: true;
|
|
113
|
-
isPrimaryKey: false;
|
|
114
|
-
isAutoincrement: false;
|
|
115
|
-
hasRuntimeDefault: false;
|
|
116
|
-
enumValues: [string, ...string[]];
|
|
117
|
-
baseColumn: never;
|
|
118
|
-
identity: undefined;
|
|
119
|
-
generated: undefined;
|
|
120
|
-
}, {}, {
|
|
121
|
-
length: number | undefined;
|
|
122
|
-
}>;
|
|
123
|
-
status_text: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
124
|
-
name: "status_text";
|
|
125
|
-
tableName: "jobs";
|
|
126
|
-
dataType: "string";
|
|
127
|
-
columnType: "SQLiteText";
|
|
128
|
-
data: string;
|
|
129
|
-
driverParam: string;
|
|
130
|
-
notNull: false;
|
|
131
|
-
hasDefault: false;
|
|
132
|
-
isPrimaryKey: false;
|
|
133
|
-
isAutoincrement: false;
|
|
134
|
-
hasRuntimeDefault: false;
|
|
135
|
-
enumValues: [string, ...string[]];
|
|
136
|
-
baseColumn: never;
|
|
137
|
-
identity: undefined;
|
|
138
|
-
generated: undefined;
|
|
139
|
-
}, {}, {
|
|
140
|
-
length: number | undefined;
|
|
141
|
-
}>;
|
|
142
|
-
started_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
143
|
-
name: "started_at";
|
|
144
|
-
tableName: "jobs";
|
|
145
|
-
dataType: "string";
|
|
146
|
-
columnType: "SQLiteText";
|
|
147
|
-
data: string;
|
|
148
|
-
driverParam: string;
|
|
149
|
-
notNull: false;
|
|
150
|
-
hasDefault: false;
|
|
151
|
-
isPrimaryKey: false;
|
|
152
|
-
isAutoincrement: false;
|
|
153
|
-
hasRuntimeDefault: false;
|
|
154
|
-
enumValues: [string, ...string[]];
|
|
155
|
-
baseColumn: never;
|
|
156
|
-
identity: undefined;
|
|
157
|
-
generated: undefined;
|
|
158
|
-
}, {}, {
|
|
159
|
-
length: number | undefined;
|
|
160
|
-
}>;
|
|
161
|
-
done_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
162
|
-
name: "done_at";
|
|
163
|
-
tableName: "jobs";
|
|
164
|
-
dataType: "string";
|
|
165
|
-
columnType: "SQLiteText";
|
|
166
|
-
data: string;
|
|
167
|
-
driverParam: string;
|
|
168
|
-
notNull: false;
|
|
169
|
-
hasDefault: false;
|
|
170
|
-
isPrimaryKey: false;
|
|
171
|
-
isAutoincrement: false;
|
|
172
|
-
hasRuntimeDefault: false;
|
|
173
|
-
enumValues: [string, ...string[]];
|
|
174
|
-
baseColumn: never;
|
|
175
|
-
identity: undefined;
|
|
176
|
-
generated: undefined;
|
|
177
|
-
}, {}, {
|
|
178
|
-
length: number | undefined;
|
|
179
|
-
}>;
|
|
180
|
-
created_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
181
|
-
name: "created_at";
|
|
182
|
-
tableName: "jobs";
|
|
183
|
-
dataType: "string";
|
|
184
|
-
columnType: "SQLiteText";
|
|
185
|
-
data: string;
|
|
186
|
-
driverParam: string;
|
|
187
|
-
notNull: true;
|
|
188
|
-
hasDefault: true;
|
|
189
|
-
isPrimaryKey: false;
|
|
190
|
-
isAutoincrement: false;
|
|
191
|
-
hasRuntimeDefault: false;
|
|
192
|
-
enumValues: [string, ...string[]];
|
|
193
|
-
baseColumn: never;
|
|
194
|
-
identity: undefined;
|
|
195
|
-
generated: undefined;
|
|
196
|
-
}, {}, {
|
|
197
|
-
length: number | undefined;
|
|
198
|
-
}>;
|
|
199
|
-
updated_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
200
|
-
name: "updated_at";
|
|
201
|
-
tableName: "jobs";
|
|
202
|
-
dataType: "string";
|
|
203
|
-
columnType: "SQLiteText";
|
|
204
|
-
data: string;
|
|
205
|
-
driverParam: string;
|
|
206
|
-
notNull: true;
|
|
207
|
-
hasDefault: true;
|
|
208
|
-
isPrimaryKey: false;
|
|
209
|
-
isAutoincrement: false;
|
|
210
|
-
hasRuntimeDefault: false;
|
|
211
|
-
enumValues: [string, ...string[]];
|
|
212
|
-
baseColumn: never;
|
|
213
|
-
identity: undefined;
|
|
214
|
-
generated: undefined;
|
|
215
|
-
}, {}, {
|
|
216
|
-
length: number | undefined;
|
|
217
|
-
}>;
|
|
218
|
-
};
|
|
219
|
-
dialect: "sqlite";
|
|
220
|
-
}>;
|
|
221
|
-
static getAll(job_id: string): Promise<any>;
|
|
222
|
-
static getItem(schema: string, id: string, job_id: string): Promise<any>;
|
|
223
|
-
static getItems(schema: string, job_id: string): Promise<any>;
|
|
224
|
-
static searchJobItems(schema: string, q: string | undefined, { page, pageSize, status }: {
|
|
225
|
-
status?: string;
|
|
226
|
-
} & PageProps): Promise<{
|
|
227
|
-
data: any;
|
|
228
|
-
count: number;
|
|
229
|
-
}>;
|
|
230
|
-
static create(data: any): Promise<any>;
|
|
231
|
-
}
|
|
232
|
-
export default JobStorage;
|
|
233
|
-
//# sourceMappingURL=job.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ItemOptions } from './item';
|
|
2
|
-
export type ForeachOptions = {
|
|
3
|
-
throw_errors_on_finish?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare function forEach(fn: (item: any, options?: ItemOptions) => Promise<any>, items: any[], options?: ItemOptions & ForeachOptions): Promise<void>;
|
|
6
|
-
export declare function dispatchErrorsIfExists(schema: string, msg?: string): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=foreach.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type ItemOptions = {
|
|
2
|
-
key?: string;
|
|
3
|
-
schema?: string;
|
|
4
|
-
throw_errors?: boolean;
|
|
5
|
-
throw_errors_on_finish?: boolean;
|
|
6
|
-
default_error_message?: string;
|
|
7
|
-
retry?: {
|
|
8
|
-
retries?: number;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare function forItem(fn: (item: any, options?: ItemOptions) => Promise<any>, item: any, options?: ItemOptions): Promise<void>;
|
|
12
|
-
export default forItem;
|
|
13
|
-
//# sourceMappingURL=item.d.ts.map
|
package/hobots/src/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { HobotsDataProps } from '..';
|
|
2
|
-
import { PageProps } from '../db';
|
|
3
|
-
type Response = {
|
|
4
|
-
data: any[];
|
|
5
|
-
count: number;
|
|
6
|
-
} & PageProps;
|
|
7
|
-
export declare function generateDataReport(props: HobotsDataProps & PageProps, mapper?: (item: any) => any): Promise<Response>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=data-report.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare function generateJobReport(job_id: string, schema?: string, mapper?: (item: any) => any): Promise<{
|
|
2
|
-
status: string;
|
|
3
|
-
payload: {
|
|
4
|
-
done: number;
|
|
5
|
-
warnings: number;
|
|
6
|
-
errors: number;
|
|
7
|
-
total: number;
|
|
8
|
-
done_items: any[];
|
|
9
|
-
warning_items: any[];
|
|
10
|
-
error_items: any[];
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
13
|
-
export declare function generateDevJobReport(bot_id: string, job_id: string, schema?: string): Promise<{
|
|
14
|
-
status: string;
|
|
15
|
-
data: {
|
|
16
|
-
'Done \u2705': number;
|
|
17
|
-
'Warnings \u26A0\uFE0F': number;
|
|
18
|
-
'Errors \u274C': number;
|
|
19
|
-
'Total \uD83D\uDD35': number;
|
|
20
|
-
}[];
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=job-report.d.ts.map
|
package/hobots/src/setup.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LoggerType } from './utils/logger';
|
|
2
|
-
import { Options } from './utils/retry';
|
|
3
|
-
import { HobotsProps, HobotsJobProps, HobotsDataProps } from './types/hobots-types';
|
|
4
|
-
import { Database, JobStorage, schema } from './db';
|
|
5
|
-
export type { HobotsProps, HobotsJobProps, HobotsDataProps };
|
|
6
|
-
declare global {
|
|
7
|
-
var hobots: HobotsProps;
|
|
8
|
-
var retry: (fn: (props: any) => Promise<any>, options?: Options) => Promise<any>;
|
|
9
|
-
var logger: LoggerType;
|
|
10
|
-
var sleep: (ms: number, text?: string) => void;
|
|
11
|
-
var freeze: (text?: string) => Promise<void>;
|
|
12
|
-
var timer: {
|
|
13
|
-
sleep: (ms: number, text?: string) => void;
|
|
14
|
-
freeze: (text?: string) => Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
var db: Database<typeof schema>;
|
|
17
|
-
var jobStorage: typeof JobStorage;
|
|
18
|
-
}
|
|
19
|
-
export declare function setup(bot: (props: HobotsProps) => Promise<any>, props: HobotsProps, options?: any): Promise<any>;
|
|
20
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class SheetData {
|
|
2
|
-
sheet_path: string;
|
|
3
|
-
header: any;
|
|
4
|
-
optional_columns: any[string];
|
|
5
|
-
label: string;
|
|
6
|
-
constructor(sheet_path: string);
|
|
7
|
-
validateHeader(header: any): Promise<void>;
|
|
8
|
-
mapRow(row: any, index: number): any;
|
|
9
|
-
workbook(): Promise<import("xlsx").WorkBook>;
|
|
10
|
-
data(): Promise<any[]>;
|
|
11
|
-
}
|
|
12
|
-
export default SheetData;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type HobotsDataProps = {
|
|
2
|
-
query: string;
|
|
3
|
-
schema?: string;
|
|
4
|
-
status?: string;
|
|
5
|
-
page?: number;
|
|
6
|
-
pageSize?: number;
|
|
7
|
-
bot_id: string;
|
|
8
|
-
};
|
|
9
|
-
export type HobotsProps = {
|
|
10
|
-
bot_id: string;
|
|
11
|
-
job_id: string;
|
|
12
|
-
params: any;
|
|
13
|
-
settings: any;
|
|
14
|
-
dev?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type HobotsJobProps = {
|
|
17
|
-
job_id: string;
|
|
18
|
-
bot_id: string;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=hobots-types.d.ts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { parseISO, isValid, addDays, addMonths, addYears, subDays, subMonths, subYears, differenceInDays, differenceInMonths, differenceInYears, differenceInSeconds, isBefore, isAfter, isEqual, isSameDay, isSameMonth, isSameYear, type Locale } from 'date-fns';
|
|
2
|
-
import { ptBR } from 'date-fns/locale';
|
|
3
|
-
export * from 'date-fns';
|
|
4
|
-
interface DateConfig {
|
|
5
|
-
timezone: string;
|
|
6
|
-
dateFormat: string;
|
|
7
|
-
timeFormat: string;
|
|
8
|
-
dateTimeFormat: string;
|
|
9
|
-
locale: Locale;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Configure global date settings
|
|
13
|
-
*/
|
|
14
|
-
export declare const configureDateSettings: (config: Partial<DateConfig>) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Get current global configuration
|
|
17
|
-
*/
|
|
18
|
-
export declare const getDateConfig: () => DateConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Get current date in the configured timezone
|
|
21
|
-
*/
|
|
22
|
-
export declare const now: () => Date;
|
|
23
|
-
/**
|
|
24
|
-
* Format a date using the configured timezone and format
|
|
25
|
-
*/
|
|
26
|
-
export declare const format: (date: Date | string | number, formatStr?: string, options?: {
|
|
27
|
-
timezone?: string;
|
|
28
|
-
locale?: Locale;
|
|
29
|
-
}) => string;
|
|
30
|
-
/**
|
|
31
|
-
* Format date only (dd/MM/yyyy)
|
|
32
|
-
*/
|
|
33
|
-
export declare const formatDate: (date: Date | string | number, options?: {
|
|
34
|
-
timezone?: string;
|
|
35
|
-
locale?: Locale;
|
|
36
|
-
}) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Format time only (HH:mm)
|
|
39
|
-
*/
|
|
40
|
-
export declare const formatTime: (date: Date | string | number, options?: {
|
|
41
|
-
timezone?: string;
|
|
42
|
-
locale?: Locale;
|
|
43
|
-
}) => string;
|
|
44
|
-
/**
|
|
45
|
-
* Format date and time (dd/MM/yyyy HH:mm)
|
|
46
|
-
*/
|
|
47
|
-
export declare const formatDateTime: (date: Date | string | number, options?: {
|
|
48
|
-
timezone?: string;
|
|
49
|
-
locale?: Locale;
|
|
50
|
-
}) => string;
|
|
51
|
-
/**
|
|
52
|
-
* Format date for human (e.g., "01 de January 2023")
|
|
53
|
-
*/
|
|
54
|
-
export declare const formatHumanDate: (date: Date | string | number, options?: {
|
|
55
|
-
timezone?: string;
|
|
56
|
-
locale?: Locale;
|
|
57
|
-
}) => string;
|
|
58
|
-
export declare const formatMonth: (date: Date | string | number, options?: {
|
|
59
|
-
timezone?: string;
|
|
60
|
-
locale?: Locale;
|
|
61
|
-
}) => string;
|
|
62
|
-
/**
|
|
63
|
-
* Convert date to UTC from configured timezone
|
|
64
|
-
*/
|
|
65
|
-
export declare const toUtc: (date: Date | string | number, timezone?: string) => Date;
|
|
66
|
-
/**
|
|
67
|
-
* Convert UTC date to configured timezone
|
|
68
|
-
*/
|
|
69
|
-
export declare const fromUtc: (date: Date | string | number, timezone?: string) => Date;
|
|
70
|
-
/**
|
|
71
|
-
* Parse ISO string to date in configured timezone
|
|
72
|
-
*/
|
|
73
|
-
export declare const parseISOToZoned: (dateString: string, timezone?: string) => Date;
|
|
74
|
-
/**
|
|
75
|
-
* Get start of day in configured timezone
|
|
76
|
-
*/
|
|
77
|
-
export declare const startOfDayInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
78
|
-
/**
|
|
79
|
-
* Get end of day in configured timezone
|
|
80
|
-
*/
|
|
81
|
-
export declare const endOfDayInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
82
|
-
/**
|
|
83
|
-
* Get start of month in configured timezone
|
|
84
|
-
*/
|
|
85
|
-
export declare const startOfMonthInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
86
|
-
/**
|
|
87
|
-
* Get end of month in configured timezone
|
|
88
|
-
*/
|
|
89
|
-
export declare const endOfMonthInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
90
|
-
/**
|
|
91
|
-
* Get start of year in configured timezone
|
|
92
|
-
*/
|
|
93
|
-
export declare const startOfYearInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
94
|
-
/**
|
|
95
|
-
* Get end of year in configured timezone
|
|
96
|
-
*/
|
|
97
|
-
export declare const endOfYearInTimezone: (date: Date | string | number, timezone?: string) => Date;
|
|
98
|
-
export declare const formatTimeDifference: (startDate: string | Date, endDate: string | Date) => string;
|
|
99
|
-
export { parseISO, isValid, addDays, addMonths, addYears, subDays, subMonths, subYears, differenceInDays, differenceInMonths, differenceInYears, differenceInSeconds, isBefore, isAfter, isEqual, isSameDay, isSameMonth, isSameYear, ptBR as brazilianLocale, };
|
|
100
|
-
export declare const TIMEZONES: {
|
|
101
|
-
readonly FORTALEZA: "America/Fortaleza";
|
|
102
|
-
readonly SAO_PAULO: "America/Sao_Paulo";
|
|
103
|
-
readonly MANAUS: "America/Manaus";
|
|
104
|
-
readonly UTC: "UTC";
|
|
105
|
-
};
|
|
106
|
-
export declare const DATE_FORMATS: {
|
|
107
|
-
readonly BRAZILIAN_DATE: "dd/MM/yyyy";
|
|
108
|
-
readonly BRAZILIAN_TIME: "HH:mm";
|
|
109
|
-
readonly BRAZILIAN_DATETIME: "dd/MM/yyyy HH:mm";
|
|
110
|
-
readonly BRAZILIAN_FULL: "dd/MM/yyyy HH:mm:ss";
|
|
111
|
-
readonly ISO_DATE: "yyyy-MM-dd";
|
|
112
|
-
readonly ISO_DATETIME: "yyyy-MM-dd'T'HH:mm:ss.SSSxxx";
|
|
113
|
-
};
|
|
114
|
-
export type DateInput = Date | string | number;
|
|
115
|
-
export type TimezoneString = string;
|
|
116
|
-
export type DateFormatString = string;
|
|
117
|
-
//# sourceMappingURL=date.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './date';
|
|
2
|
-
export * from './path';
|
|
3
|
-
export * from './text';
|
|
4
|
-
export * from './logger';
|
|
5
|
-
export * from './timer';
|
|
6
|
-
export * from './retry';
|
|
7
|
-
export * from './dist';
|
|
8
|
-
export * from './publish';
|
|
9
|
-
export * from './garbage';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type LoggerType = {
|
|
2
|
-
muted: Function;
|
|
3
|
-
success: Function;
|
|
4
|
-
info: Function;
|
|
5
|
-
warn: Function;
|
|
6
|
-
error: Function;
|
|
7
|
-
log: Function;
|
|
8
|
-
dd: Function;
|
|
9
|
-
};
|
|
10
|
-
export declare class Logger {
|
|
11
|
-
static muted: (...args: unknown[]) => void;
|
|
12
|
-
static success: (...args: unknown[]) => void;
|
|
13
|
-
static info: (...args: unknown[]) => void;
|
|
14
|
-
static warn: (...args: unknown[]) => void;
|
|
15
|
-
static error: (...args: unknown[]) => void;
|
|
16
|
-
static log: (...args: unknown[]) => void;
|
|
17
|
-
static dd: (...args: unknown[]) => never;
|
|
18
|
-
static _simple(tag: string, color: (text: string) => string, ...args: unknown[]): void;
|
|
19
|
-
}
|
|
20
|
-
export default Logger;
|
|
21
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const getPath: () => string;
|
|
2
|
-
export declare const createAppDirectoriesIfNotExists: () => void;
|
|
3
|
-
export declare const getDBPath: () => string;
|
|
4
|
-
export declare const resolveAppPath: (path?: string) => string;
|
|
5
|
-
export declare const resolveBotsPath: (botId?: string) => string;
|
|
6
|
-
export declare const resolveReportPath: (botId: string, fileName: string) => string;
|
|
7
|
-
export declare const resolveDataPath: () => string;
|
|
8
|
-
export declare const resolveLogsPath: () => string;
|
|
9
|
-
export declare const resolveLogPath: (tag: string, id: string) => string;
|
|
10
|
-
export declare const resolveDatasetsPath: (botId: string) => string;
|
|
11
|
-
export declare const resolveDatasetPath: (botId: string, datasetId: string) => string;
|
|
12
|
-
export declare const requireData: (file_path: string, defaultValue?: any) => any;
|
|
13
|
-
//# sourceMappingURL=path.d.ts.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capitalizes the first letter of each word in a string
|
|
3
|
-
*/
|
|
4
|
-
export declare const capitalize: (str: string) => string;
|
|
5
|
-
/**
|
|
6
|
-
* Capitalizes the first letter of the first word in a string
|
|
7
|
-
*/
|
|
8
|
-
export declare const capitalizeFirst: (str: string) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Removes all non-numeric characters from a string
|
|
11
|
-
*/
|
|
12
|
-
export declare const onlyNumbers: (str: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Normalizes text and removes forward slashes for path usage
|
|
15
|
-
*/
|
|
16
|
-
export declare const normalize2Path: (text: string) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Normalizes text by removing accents and trimming whitespace
|
|
19
|
-
*/
|
|
20
|
-
export declare const normalize: (text: string) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Checks if a value is a valid CNPJ format (14 digits)
|
|
23
|
-
*/
|
|
24
|
-
export declare const isCnpj: (value: string) => boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Checks if a string is a valid CPF format (11 digits)
|
|
27
|
-
*/
|
|
28
|
-
export declare const isCpf: (cpf: string) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Formats a string as CPF or CNPJ based on length
|
|
31
|
-
*/
|
|
32
|
-
export declare const formatCpfOrCnpj: (value: string) => string;
|
|
33
|
-
/**
|
|
34
|
-
* Formats a CNPJ string with proper punctuation
|
|
35
|
-
*/
|
|
36
|
-
export declare const formatCnpj: (cnpj: string) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Formats a CPF string with proper punctuation
|
|
39
|
-
*/
|
|
40
|
-
export declare const formatCpf: (cpf: string) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Formats a number as currency in Brazilian format
|
|
43
|
-
*/
|
|
44
|
-
export declare const formatCurrency: (value: number, currency?: string) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Formats account number with leading zeros
|
|
47
|
-
*/
|
|
48
|
-
export declare const formatAccountNumber: (accountNumber?: string) => string;
|
|
49
|
-
export declare const formatPercentage: (value: number, total: number) => string;
|
|
50
|
-
/**
|
|
51
|
-
* Formats a phone number in Brazilian format
|
|
52
|
-
*/
|
|
53
|
-
export declare const formatPhone: (phone: string) => string | null;
|
|
54
|
-
/**
|
|
55
|
-
* Formats a Brazilian phone number to the standard format with country code
|
|
56
|
-
* Handles numbers with or without the leading 9 digit for mobile numbers
|
|
57
|
-
* @param phoneNumber - Phone number string (e.g., "85981925276" or "8581925276")
|
|
58
|
-
* @returns Formatted phone number with country code (e.g., "+5585981925276")
|
|
59
|
-
*/
|
|
60
|
-
export declare const formatBrazilianPhoneNumber: (phoneNumber: string) => string;
|
|
61
|
-
/**
|
|
62
|
-
* Extracts DDD (area code) from a formatted phone number
|
|
63
|
-
*/
|
|
64
|
-
export declare const extractDdd: (phone: string) => string | null;
|
|
65
|
-
/**
|
|
66
|
-
* Converts camelCase string to snake_case
|
|
67
|
-
*/
|
|
68
|
-
export declare const camelToSnake: (str: string) => string;
|
|
69
|
-
export declare const cleanCurrencyFormat: (value: string) => number;
|
|
70
|
-
/**
|
|
71
|
-
* Removes special characters from a string
|
|
72
|
-
*/
|
|
73
|
-
export declare const removeSpecialChars: (str: string) => string;
|
|
74
|
-
//# sourceMappingURL=text.d.ts.map
|