@ix-xs/node-comfort 1.0.3 → 1.0.5

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.
Files changed (41) hide show
  1. package/index.js +12 -14
  2. package/package.json +17 -17
  3. package/src/checker.js +76 -0
  4. package/src/cli.js +86 -0
  5. package/{core/FS.js → src/fs.js} +121 -230
  6. package/src/localStorage.js +242 -0
  7. package/{core/Logger.js → src/logger.js} +23 -97
  8. package/src/utils.js +225 -0
  9. package/tsconfig.json +1 -1
  10. package/types/index.d.ts +73 -50
  11. package/types/src/checker.d.ts +49 -0
  12. package/types/src/checker.d.ts.map +1 -0
  13. package/types/src/cli.d.ts +26 -0
  14. package/types/src/cli.d.ts.map +1 -0
  15. package/types/src/fs.d.ts +210 -0
  16. package/types/src/fs.d.ts.map +1 -0
  17. package/types/src/localStorage.d.ts +97 -0
  18. package/types/src/localStorage.d.ts.map +1 -0
  19. package/types/src/logger.d.ts +132 -0
  20. package/types/src/logger.d.ts.map +1 -0
  21. package/types/src/utils.d.ts +92 -0
  22. package/types/src/utils.d.ts.map +1 -0
  23. package/core/CLI.js +0 -95
  24. package/core/Checker.js +0 -127
  25. package/core/Stepper.js +0 -115
  26. package/core/Storage.js +0 -348
  27. package/core/Utils.js +0 -206
  28. package/types/core/CLI.d.ts +0 -25
  29. package/types/core/CLI.d.ts.map +0 -1
  30. package/types/core/Checker.d.ts +0 -73
  31. package/types/core/Checker.d.ts.map +0 -1
  32. package/types/core/FS.d.ts +0 -211
  33. package/types/core/FS.d.ts.map +0 -1
  34. package/types/core/Logger.d.ts +0 -253
  35. package/types/core/Logger.d.ts.map +0 -1
  36. package/types/core/Stepper.d.ts +0 -49
  37. package/types/core/Stepper.d.ts.map +0 -1
  38. package/types/core/Storage.d.ts +0 -111
  39. package/types/core/Storage.d.ts.map +0 -1
  40. package/types/core/Utils.d.ts +0 -55
  41. package/types/core/Utils.d.ts.map +0 -1
package/types/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  declare const _exports: {
2
- getEnv(env: any): string;
3
- wait(ms: number): Promise<void>;
4
- when(predicate: boolean | Promise<boolean>, handler: any, options?: {
2
+ wait(ms: number): Promise<any>;
3
+ when(predicate: boolean | Promise<boolean> | (() => boolean | Promise<boolean>), payload?: any, options?: {
5
4
  interval?: number;
6
5
  timeout?: number | null;
7
6
  max?: number | null;
8
7
  }): {
9
8
  start(): /*elided*/ any;
10
9
  stop(): /*elided*/ any;
11
- on(event: "error" | "trigger" | "timeout", fn: (payload: any) => void): /*elided*/ any;
12
- off(event: "error" | "trigger" | "timeout", fn: (payload: any) => void): /*elided*/ any;
10
+ on<E extends "error" | "trigger" | "timeout">(event: E, handler: {
11
+ error: (error: any) => void | Promise<void>;
12
+ trigger: (payload: any) => void | Promise<void>;
13
+ timeout: (payload: any) => void | Promise<void>;
14
+ }[E]): /*elided*/ any;
13
15
  };
14
16
  dontCrash(): {
15
17
  on<E extends "error" | "exit" | "sig" | "beforeExit">(event: E, handler: {
@@ -19,16 +21,8 @@ declare const _exports: {
19
21
  beforeExit: (code: number) => void | Promise<void>;
20
22
  }[E]): /*elided*/ any;
21
23
  };
22
- step(steps: Array<() => void>): {
23
- currentIndex: number;
24
- currentStep: () => void;
25
- next(): /*elided*/ any;
26
- back(): /*elided*/ any;
27
- at(index: number): /*elided*/ any;
28
- ignore(): /*elided*/ any;
29
- reset(): /*elided*/ any;
30
- all(): /*elided*/ any;
31
- };
24
+ JSONString(value: any): string;
25
+ JSONParse(value: any): any;
32
26
  log(content: any): {
33
27
  log(content: any): /*elided*/ any;
34
28
  logify(content: any): string;
@@ -88,17 +82,18 @@ declare const _exports: {
88
82
  timestamp?: boolean;
89
83
  }): /*elided*/ any;
90
84
  };
85
+ getEnv(value: string, envFilePath: any): string;
91
86
  createPath(path?: string): string;
92
- getFoldersIn(path?: string, recursive?: boolean): string[] | undefined;
93
- getFolder(path?: string): string | undefined;
94
- getFilesIn(path?: string, recursive?: boolean): string[] | undefined;
95
- getFile(path: string): string | undefined;
96
- createFolder(path: string, force?: boolean): boolean | undefined;
97
- createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean | undefined;
98
- deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number | undefined;
99
- deleteFolder(path: string): boolean | undefined;
100
- deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number | undefined;
101
- deleteFile(path: string): boolean | undefined;
87
+ getFoldersIn(path?: string, recursive?: boolean): string[];
88
+ getFolder(path?: string): string;
89
+ getFilesIn(path?: string, recursive?: boolean): string[];
90
+ getFile(path: string): string;
91
+ createFolder(path: string, force?: boolean): boolean;
92
+ createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean;
93
+ deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number;
94
+ deleteFolder(path: string): boolean;
95
+ deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number;
96
+ deleteFile(path: string): boolean;
102
97
  copyFoldersIn(options: {
103
98
  dest: string;
104
99
  path?: string;
@@ -106,65 +101,93 @@ declare const _exports: {
106
101
  withFiles?: boolean;
107
102
  force?: boolean;
108
103
  filter?: (folder: string) => boolean;
109
- }): number | undefined;
104
+ }): number;
110
105
  copyFolder(options: {
111
106
  dest: string;
112
107
  path?: string;
113
108
  recursive?: boolean;
114
109
  withFiles?: boolean;
115
110
  force?: boolean;
116
- }): boolean | undefined;
111
+ }): boolean;
117
112
  copyFilesIn(options: {
118
113
  dest: string;
119
114
  path?: string;
120
115
  recursive?: boolean;
121
116
  force?: boolean;
122
117
  filter?: (file: string) => boolean;
123
- }): number | undefined;
118
+ }): number;
124
119
  copyFile(options: {
125
120
  path: string;
126
121
  dest: string;
127
122
  force?: boolean;
128
- }): boolean | undefined;
129
- moveFoldersIn(options: any): number | undefined;
130
- moveFolder(options: any): boolean | undefined;
131
- moveFilesIn(options: any): number | undefined;
132
- moveFile(options: any): boolean | undefined;
133
- readFile(path: string): string | undefined;
123
+ }): boolean;
124
+ moveFoldersIn(options: {
125
+ dest: string;
126
+ path?: string;
127
+ recursive?: boolean;
128
+ withFiles?: boolean;
129
+ force?: boolean;
130
+ filter?: (folder: string) => boolean;
131
+ }): number;
132
+ moveFolder(options: {
133
+ path: string;
134
+ dest: string;
135
+ recursive?: boolean;
136
+ withFiles?: boolean;
137
+ force?: boolean;
138
+ }): boolean;
139
+ moveFilesIn(options: {
140
+ dest: string;
141
+ path?: string;
142
+ recursive?: boolean;
143
+ force?: boolean;
144
+ filter?: (file: string) => boolean;
145
+ }): number;
146
+ moveFile(options: {
147
+ path: string;
148
+ dest: string;
149
+ force?: boolean;
150
+ }): boolean;
151
+ readFile(path: string): string;
134
152
  watch(options?: {
135
153
  path?: string;
136
154
  recursive?: boolean;
137
155
  filter?: (event: string, file: string) => boolean;
138
- }): any | undefined;
139
- Storage: {
140
- new (path?: string): Storage;
156
+ }): {
157
+ on<E extends "change" | "rename" | "all">(event: E, callback: {
158
+ change: (file: string) => void | Promise<void>;
159
+ rename: (file: string) => void | Promise<void>;
160
+ all: (event: "change" | "rename" | "all", file: string) => void | Promise<void>;
161
+ }[E]): /*elided*/ any;
162
+ stop(): void;
163
+ pause(): /*elided*/ any;
164
+ resume(): /*elided*/ any;
141
165
  };
142
- cli_run: (command: string) => NonSharedBuffer & string;
143
- cli_stream: {
166
+ exec(command: any): NonSharedBuffer & string;
167
+ stream: {
144
168
  new (command: any, args: any): {
145
169
  "__#private@#processus": import("node:child_process").ChildProcessByStdio<null, import("node:stream").Readable, import("node:stream").Readable>;
146
170
  "__#private@#events": import("node:events")<any>;
147
171
  on<E extends "data" | "error" | "stopped">(event: E, handler: {
148
172
  error: (error: Error) => void | Promise<void>;
149
- data: (message: string) => void | Promise<void>;
150
- stopped: (code: number, signal: keyof import("node:child_process").ChildProcessEventMap) => void | Promise<void>;
173
+ data: (chunk: string) => void | Promise<void>;
174
+ stopped: (code: number | null, signal: keyof import("node:child_process").ChildProcessEventMap) => void | Promise<void>;
151
175
  }[E]): /*elided*/ any;
152
176
  stop(): Promise<any>;
153
177
  };
154
178
  };
155
- isArray(value: any): boolean;
179
+ isArray(value: any): value is any[];
156
180
  isNumber(value: any): boolean;
157
181
  isFunction(value: any): boolean;
158
182
  isObject(value: any): boolean;
159
- isBoolean(value: any): boolean;
160
- isString(value: any): boolean;
161
- isUndefined(value: any): boolean;
183
+ isBoolean(value: any): value is boolean;
184
+ isString(value: any): value is string;
185
+ isUndefined(value: any): value is undefined;
162
186
  isNull(value: any): boolean;
163
- isDate(value: any): boolean;
164
- isMap(value: any): boolean;
165
- isSet(value: any): boolean;
166
- isError(value: any): boolean;
187
+ isDate(value: any): value is Date;
188
+ isMap(value: any): value is Map<unknown, unknown>;
189
+ isSet(value: any): value is Set<unknown>;
190
+ isError(value: any): value is Error;
167
191
  };
168
192
  export = _exports;
169
- import Storage = require("./core/Storage");
170
193
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @param {*} value
3
+ */
4
+ export function isArray(value: any): value is any[];
5
+ /**
6
+ * @param {*} value
7
+ */
8
+ export function isNumber(value: any): boolean;
9
+ /**
10
+ * @param {*} value
11
+ */
12
+ export function isFunction(value: any): boolean;
13
+ /**
14
+ * @param {*} value
15
+ */
16
+ export function isObject(value: any): boolean;
17
+ /**
18
+ * @param {*} value
19
+ */
20
+ export function isBoolean(value: any): value is boolean;
21
+ /**
22
+ * @param {*} value
23
+ */
24
+ export function isString(value: any): value is string;
25
+ /**
26
+ * @param {*} value
27
+ */
28
+ export function isUndefined(value: any): value is undefined;
29
+ /**
30
+ * @param {*} value
31
+ */
32
+ export function isNull(value: any): boolean;
33
+ /**
34
+ * @param {*} value
35
+ */
36
+ export function isDate(value: any): value is Date;
37
+ /**
38
+ * @param {*} value
39
+ */
40
+ export function isMap(value: any): value is Map<unknown, unknown>;
41
+ /**
42
+ * @param {*} value
43
+ */
44
+ export function isSet(value: any): value is Set<unknown>;
45
+ /**
46
+ * @param {*} value
47
+ */
48
+ export function isError(value: any): value is Error;
49
+ //# sourceMappingURL=checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../src/checker.js"],"names":[],"mappings":"AAGE;;KAEE;AACF,+BAFU,GAAC,kBAIV;AACD;;KAEE;AACF,gCAFU,GAAC,WAIV;AACD;;KAEE;AACF,kCAFU,GAAC,WAIV;AACD;;KAEE;AACF,gCAFU,GAAC,WAIV;AACD;;KAEE;AACF,iCAFU,GAAC,oBAIV;AACD;;KAEE;AACF,gCAFU,GAAC,mBAIV;AACD;;KAEE;AACF,mCAFU,GAAC,sBAIV;AACD;;KAEE;AACF,8BAFU,GAAC,WAIV;AACD;;KAEE;AACF,8BAFU,GAAC,iBAIV;AACD;;KAEE;AACF,6BAFU,GAAC,kCAIV;AACD;;KAEE;AACF,6BAFU,GAAC,yBAIV;AACD;;KAEE;AACF,+BAFU,GAAC,kBAIV"}
@@ -0,0 +1,26 @@
1
+ export class stream {
2
+ constructor(command: any, args: any);
3
+ /**
4
+ * @typedef {"error"|"data"|"stopped"} EventName
5
+ * @typedef {{
6
+ * error: (error: Error) => void|Promise<void>,
7
+ * data: (chunk: string) => void|Promise<void>,
8
+ * stopped: (code: number|null, signal: keyof import("node:child_process").ChildProcessEventMap) => void|Promise<void>,
9
+ * }} EventHandler
10
+ */
11
+ /**
12
+ * @template {EventName} E
13
+ * @param {E} event
14
+ * @param {EventHandler[E]} handler
15
+ */
16
+ on<E extends "data" | "error" | "stopped">(event: E, handler: {
17
+ error: (error: Error) => void | Promise<void>;
18
+ data: (chunk: string) => void | Promise<void>;
19
+ stopped: (code: number | null, signal: keyof import("node:child_process").ChildProcessEventMap) => void | Promise<void>;
20
+ }[E]): this;
21
+ stop(): Promise<any>;
22
+ #private;
23
+ }
24
+ import EventEmitter = require("node:events");
25
+ export declare function exec(command: any): NonSharedBuffer & string;
26
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.js"],"names":[],"mappings":"AAUU;IAIN,qCAqBC;IAED;;;;;;;OAOA;IACA;;;;OAIA;IACA,GAJsB,CAAC,SAAb,4BAAW,SACb,CAAC;eAPF,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC;cACrC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC;iBAClC,CAAC,IAAI,EAAE,MAAM,GAAC,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,oBAAoB,EAAE,oBAAoB,KAAK,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC;gBAWlH;IAED,qBA4BC;;CACF;;AAhFD,qEAKC"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * @param {string} value
3
+ */
4
+ export function getEnv(value: string, envFilePath: any): string;
5
+ /**
6
+ * @param {string} [path=process.cwd()]
7
+ */
8
+ export function createPath(path?: string): string;
9
+ /**
10
+ * @param {string} [path]
11
+ * @param {boolean} [recursive]
12
+ */
13
+ export function getFoldersIn(path?: string, recursive?: boolean): string[];
14
+ /**
15
+ * @param {string} [path]
16
+ */
17
+ export function getFolder(path?: string): string;
18
+ /**
19
+ * @param {string} [path]
20
+ * @param {boolean} [recursive]
21
+ */
22
+ export function getFilesIn(path?: string, recursive?: boolean): string[];
23
+ /**
24
+ * @param {string} path
25
+ */
26
+ export function getFile(path: string): string;
27
+ /**
28
+ * @param {string} path
29
+ * @param {boolean} [force]
30
+ */
31
+ export function createFolder(path: string, force?: boolean): boolean;
32
+ /**
33
+ * @param {string} path
34
+ * @param {boolean} [force]
35
+ * @param {string|object|null|undefined} [data]
36
+ */
37
+ export function createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean;
38
+ /**
39
+ * @param {string} [path]
40
+ * @param {(folder: string) => boolean} [filter]
41
+ */
42
+ export function deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number;
43
+ /**
44
+ * @param {string} path
45
+ */
46
+ export function deleteFolder(path: string): boolean;
47
+ /**
48
+ * @param {string} [path=process.cwd()]
49
+ * @param {boolean} [recursive=false]
50
+ * @param {(file: string) => boolean} [filter]
51
+ */
52
+ export function deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number;
53
+ /**
54
+ * @param {string} path
55
+ */
56
+ export function deleteFile(path: string): boolean;
57
+ /**
58
+ * @param {Object} options
59
+ * @param {string} options.dest
60
+ * @param {string} [options.path]
61
+ * @param {boolean} [options.recursive=true]
62
+ * @param {boolean} [options.withFiles=false]
63
+ * @param {boolean} [options.force=false]
64
+ * @param {(folder: string) => boolean} [options.filter]
65
+ */
66
+ export function copyFoldersIn(options: {
67
+ dest: string;
68
+ path?: string;
69
+ recursive?: boolean;
70
+ withFiles?: boolean;
71
+ force?: boolean;
72
+ filter?: (folder: string) => boolean;
73
+ }): number;
74
+ /**
75
+ * @param {Object} options
76
+ * @param {string} options.dest
77
+ * @param {string} [options.path]
78
+ * @param {boolean} [options.recursive=false]
79
+ * @param {boolean} [options.withFiles=false]
80
+ * @param {boolean} [options.force=false]
81
+ */
82
+ export function copyFolder(options: {
83
+ dest: string;
84
+ path?: string;
85
+ recursive?: boolean;
86
+ withFiles?: boolean;
87
+ force?: boolean;
88
+ }): boolean;
89
+ /**
90
+ * @param {Object} options
91
+ * @param {string} options.dest
92
+ * @param {string} [options.path]
93
+ * @param {boolean} [options.recursive=true]
94
+ * @param {boolean} [options.force=false]
95
+ * @param {(file: string) => boolean} [options.filter]
96
+ */
97
+ export function copyFilesIn(options: {
98
+ dest: string;
99
+ path?: string;
100
+ recursive?: boolean;
101
+ force?: boolean;
102
+ filter?: (file: string) => boolean;
103
+ }): number;
104
+ /**
105
+ * @param {Object} options
106
+ * @param {string} options.path
107
+ * @param {string} options.dest
108
+ * @param {boolean} [options.force=false]
109
+ */
110
+ export function copyFile(options: {
111
+ path: string;
112
+ dest: string;
113
+ force?: boolean;
114
+ }): boolean;
115
+ /**
116
+ * @param {Object} options
117
+ * @param {string} options.dest
118
+ * @param {string} [options.path]
119
+ * @param {boolean} [options.recursive=true]
120
+ * @param {boolean} [options.withFiles=false]
121
+ * @param {boolean} [options.force=false]
122
+ * @param {(folder: string) => boolean} [options.filter]
123
+ */
124
+ export function moveFoldersIn(options: {
125
+ dest: string;
126
+ path?: string;
127
+ recursive?: boolean;
128
+ withFiles?: boolean;
129
+ force?: boolean;
130
+ filter?: (folder: string) => boolean;
131
+ }): number;
132
+ /**
133
+ * @param {Object} options
134
+ * @param {string} options.path
135
+ * @param {string} options.dest
136
+ * @param {boolean} [options.recursive=false]
137
+ * @param {boolean} [options.withFiles=false]
138
+ * @param {boolean} [options.force=false]
139
+ */
140
+ export function moveFolder(options: {
141
+ path: string;
142
+ dest: string;
143
+ recursive?: boolean;
144
+ withFiles?: boolean;
145
+ force?: boolean;
146
+ }): boolean;
147
+ /**
148
+ * @param {Object} options
149
+ * @param {string} options.dest
150
+ * @param {string} [options.path]
151
+ * @param {boolean} [options.recursive=true]
152
+ * @param {boolean} [options.force=false]
153
+ * @param {(file: string) => boolean} [options.filter]
154
+ */
155
+ export function moveFilesIn(options: {
156
+ dest: string;
157
+ path?: string;
158
+ recursive?: boolean;
159
+ force?: boolean;
160
+ filter?: (file: string) => boolean;
161
+ }): number;
162
+ /**
163
+ * @param {Object} options
164
+ * @param {string} options.path
165
+ * @param {string} options.dest
166
+ * @param {boolean} [options.force=false]
167
+ */
168
+ export function moveFile(options: {
169
+ path: string;
170
+ dest: string;
171
+ force?: boolean;
172
+ }): boolean;
173
+ /**
174
+ * @param {string} path
175
+ */
176
+ export function readFile(path: string): string;
177
+ /**
178
+ * @param {Object} [options]
179
+ * @param {string} [options.path=process.cwd()]
180
+ * @param {boolean} [options.recursive=false]
181
+ * @param {(event: string, file: string) => boolean} [options.filter]
182
+ */
183
+ export function watch(options?: {
184
+ path?: string;
185
+ recursive?: boolean;
186
+ filter?: (event: string, file: string) => boolean;
187
+ }): {
188
+ /**
189
+ * @typedef { "change" | "rename" | "all" } EventNames
190
+ * @typedef {{
191
+ * change: (file: string) => void|Promise<void>,
192
+ * rename: (file: string) => void|Promise<void>,
193
+ * all: (event: EventNames, file: string) => void|Promise<void>,
194
+ * }} EventHandlers
195
+ */
196
+ /**
197
+ * @template {EventNames} E
198
+ * @param {E} event
199
+ * @param {EventHandlers[E]} callback
200
+ */
201
+ on<E extends "change" | "rename" | "all">(event: E, callback: {
202
+ change: (file: string) => void | Promise<void>;
203
+ rename: (file: string) => void | Promise<void>;
204
+ all: (event: "change" | "rename" | "all", file: string) => void | Promise<void>;
205
+ }[E]): /*elided*/ any;
206
+ stop(): void;
207
+ pause(): /*elided*/ any;
208
+ resume(): /*elided*/ any;
209
+ };
210
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/fs.js"],"names":[],"mappings":"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"}
@@ -0,0 +1,97 @@
1
+ export = localStorage;
2
+ declare class localStorage {
3
+ constructor(path?: string);
4
+ /**
5
+ * @param {{name: string, options: Record<string, {
6
+ * type: "TEXT"|"INTEGER"|"REAL"|"BLOB"|"NUMERIC"|"DATE"|"DATETIME"|"TIMESTAMP"|"TIME"|"VARCHAR"|"CHAR"|"CLOB",
7
+ * primaryKey?: boolean,
8
+ * unique?: boolean,
9
+ * notNull: boolean,
10
+ * defaultValue?: any,
11
+ * values?: Array<string>
12
+ * autoincrement?: boolean,
13
+ * }>}} table
14
+ */
15
+ createTable(table: {
16
+ name: string;
17
+ options: Record<string, {
18
+ type: "TEXT" | "INTEGER" | "REAL" | "BLOB" | "NUMERIC" | "DATE" | "DATETIME" | "TIMESTAMP" | "TIME" | "VARCHAR" | "CHAR" | "CLOB";
19
+ primaryKey?: boolean;
20
+ unique?: boolean;
21
+ notNull: boolean;
22
+ defaultValue?: any;
23
+ values?: Array<string>;
24
+ autoincrement?: boolean;
25
+ }>;
26
+ }): Promise<{
27
+ ok: boolean;
28
+ error?: undefined;
29
+ } | {
30
+ error: any;
31
+ ok?: undefined;
32
+ }>;
33
+ /**
34
+ * @param {string} tableName
35
+ */
36
+ deleteTable(tableName: string): Promise<{
37
+ ok: boolean;
38
+ error?: undefined;
39
+ } | {
40
+ error: any;
41
+ ok?: undefined;
42
+ }>;
43
+ /**
44
+ * @param {string} tableName
45
+ */
46
+ clearTable(tableName: string): Promise<{
47
+ ok: boolean;
48
+ error?: undefined;
49
+ } | {
50
+ error: any;
51
+ ok?: undefined;
52
+ }>;
53
+ /**
54
+ * @param {string} tableName
55
+ * @param {object} [where]
56
+ */
57
+ get(tableName: string, where?: object): Promise<any>;
58
+ /**
59
+ * @param {string} tableName
60
+ * @param {object} [where]
61
+ * @param {number} [limit]
62
+ * @param {number} [offset]
63
+ */
64
+ getAll(tableName: string, where?: object, limit?: number, offset?: number): Promise<any>;
65
+ /**
66
+ * @param {string} tableName
67
+ * @param {*} data
68
+ * @param {object} [where]
69
+ */
70
+ set(tableName: string, data: any, where?: object): Promise<{
71
+ ok: boolean;
72
+ error?: undefined;
73
+ } | {
74
+ error: any;
75
+ ok?: undefined;
76
+ }>;
77
+ /**
78
+ * @param {string} tableName
79
+ * @param {object} where
80
+ */
81
+ delete(tableName: string, where: object): Promise<{
82
+ ok: boolean;
83
+ changes: any;
84
+ error?: undefined;
85
+ } | {
86
+ error: any;
87
+ ok?: undefined;
88
+ changes?: undefined;
89
+ }>;
90
+ /**
91
+ * @param {string} tableName
92
+ * @param {object} where
93
+ */
94
+ count(tableName: string, where?: object): Promise<any>;
95
+ #private;
96
+ }
97
+ //# sourceMappingURL=localStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/localStorage.js"],"names":[],"mappings":";AAciB;IAIf,2BAWC;IAkED;;;;;;;;;;OAUG;IACH,mBAVW;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;YAC/C,IAAI,EAAE,MAAM,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,GAAC,MAAM,GAAC,UAAU,GAAC,WAAW,GAAC,MAAM,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,CAAC;YAC5G,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,OAAO,EAAE,OAAO,CAAC;YACjB,YAAY,CAAC,EAAE,GAAG,CAAC;YACnB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;YACtB,aAAa,CAAC,EAAE,OAAO,CAAC;SACvB,CAAC,CAAA;KAAC;;;;;;OASL;IACD;;OAEG;IACH,uBAFW,MAAM;;;;;;OAYhB;IACD;;OAEG;IACH,sBAFW,MAAM;;;;;;OAWhB;IACD;;;OAGG;IACH,eAHW,MAAM,UACN,MAAM,gBAchB;IACD;;;;;OAKG;IACH,kBALW,MAAM,UACN,MAAM,UACN,MAAM,WACN,MAAM,gBAchB;IACD;;;;OAIG;IACH,eAJW,MAAM,QACN,GAAC,UACD,MAAM;;;;;;OA0BhB;IACD;;;OAGG;IACH,kBAHW,MAAM,SACN,MAAM;;;;;;;;OAchB;IACD;;;OAGG;IACH,iBAHW,MAAM,UACN,MAAM,gBAchB;;CACF"}