@luminix/support 0.4.4 → 0.4.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.
- package/babel.config.json +5 -0
- package/dist/support.js +20 -20
- package/jest.config.js +13 -0
- package/package.json +10 -2
- package/types/App/Application.d.ts +7 -1
- package/types/Collection.d.ts +5 -5
- package/types/Http/Client.d.ts +1 -1
- package/types/Obj.d.ts +3 -3
package/dist/support.js
CHANGED
|
@@ -4299,15 +4299,6 @@ function Re(e) {
|
|
|
4299
4299
|
};
|
|
4300
4300
|
}
|
|
4301
4301
|
class Qp {
|
|
4302
|
-
fromQuery(t) {
|
|
4303
|
-
const r = {};
|
|
4304
|
-
for (const [n, s] of t.entries())
|
|
4305
|
-
this.set(r, n, s);
|
|
4306
|
-
return r;
|
|
4307
|
-
}
|
|
4308
|
-
fromFormData(t) {
|
|
4309
|
-
return this.fromQuery(t);
|
|
4310
|
-
}
|
|
4311
4302
|
get(t, r, n) {
|
|
4312
4303
|
return cc(t, r, n);
|
|
4313
4304
|
}
|
|
@@ -4338,15 +4329,24 @@ class Qp {
|
|
|
4338
4329
|
set(t, r, n) {
|
|
4339
4330
|
Bp(t, r, n);
|
|
4340
4331
|
}
|
|
4332
|
+
unset(t, r) {
|
|
4333
|
+
Xp(t, r);
|
|
4334
|
+
}
|
|
4335
|
+
fromQuery(t) {
|
|
4336
|
+
const r = {};
|
|
4337
|
+
for (const [n, s] of t.entries())
|
|
4338
|
+
this.set(r, n, s);
|
|
4339
|
+
return r;
|
|
4340
|
+
}
|
|
4341
|
+
fromFormData(t) {
|
|
4342
|
+
return this.fromQuery(t);
|
|
4343
|
+
}
|
|
4341
4344
|
toQuery(t) {
|
|
4342
4345
|
return Qr(t, new URLSearchParams());
|
|
4343
4346
|
}
|
|
4344
4347
|
toFormData(t) {
|
|
4345
4348
|
return Qr(t, new FormData());
|
|
4346
4349
|
}
|
|
4347
|
-
unset(t, r) {
|
|
4348
|
-
Xp(t, r);
|
|
4349
|
-
}
|
|
4350
4350
|
}
|
|
4351
4351
|
const O = new (Re(Qp))();
|
|
4352
4352
|
let lr = class {
|
|
@@ -5228,23 +5228,23 @@ const b = class b extends yr {
|
|
|
5228
5228
|
whereBetween(r, [n, s]) {
|
|
5229
5229
|
return new b(l(this, c).filter((i) => i[r] >= n && i[r] <= s));
|
|
5230
5230
|
}
|
|
5231
|
-
whereIn(r, n) {
|
|
5232
|
-
return new b(l(this, c).filter((s) => n.includes(s[r])));
|
|
5233
|
-
}
|
|
5234
|
-
whereInstanceOf(r) {
|
|
5235
|
-
return new b(l(this, c).filter((n) => n instanceof r));
|
|
5236
|
-
}
|
|
5237
5231
|
whereNotBetween(r, [n, s]) {
|
|
5238
5232
|
return new b(l(this, c).filter((i) => i[r] < n || i[r] > s));
|
|
5239
5233
|
}
|
|
5234
|
+
whereIn(r, n) {
|
|
5235
|
+
return new b(l(this, c).filter((s) => n.includes(s[r])));
|
|
5236
|
+
}
|
|
5240
5237
|
whereNotIn(r, n) {
|
|
5241
5238
|
return new b(l(this, c).filter((s) => !n.includes(s[r])));
|
|
5242
5239
|
}
|
|
5240
|
+
whereNull(r) {
|
|
5241
|
+
return new b(l(this, c).filter((n) => n[r] === null));
|
|
5242
|
+
}
|
|
5243
5243
|
whereNotNull(r) {
|
|
5244
5244
|
return new b(l(this, c).filter((n) => n[r] !== null));
|
|
5245
5245
|
}
|
|
5246
|
-
|
|
5247
|
-
return new b(l(this, c).filter((n) => n
|
|
5246
|
+
whereInstanceOf(r) {
|
|
5247
|
+
return new b(l(this, c).filter((n) => n instanceof r));
|
|
5248
5248
|
}
|
|
5249
5249
|
zip(r) {
|
|
5250
5250
|
return Array.isArray(r) ? new b(
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
export default {
|
|
3
|
+
moduleFileExtensions: [ 'ts', 'js' ],
|
|
4
|
+
testEnvironment: 'jsdom',
|
|
5
|
+
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.js?$': 'babel-jest',
|
|
8
|
+
'^.+\\.ts?$': 'ts-jest',
|
|
9
|
+
},
|
|
10
|
+
transformIgnorePatterns: [
|
|
11
|
+
'node_modules/(?!nanoevents|lodash-es)',
|
|
12
|
+
],
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luminix/support",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"main": "dist/support.js",
|
|
4
5
|
"module": "dist/support.js",
|
|
5
6
|
"types": "types/index.d.ts",
|
|
6
7
|
"type": "module",
|
|
@@ -9,17 +10,24 @@
|
|
|
9
10
|
"build": "tsc && vite build",
|
|
10
11
|
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
|
11
12
|
"lint:fix": "eslint . --report-unused-disable-directives --max-warnings 0 --fix",
|
|
12
|
-
"test": "
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"test:coverage": "jest --coverage"
|
|
13
15
|
},
|
|
14
16
|
"author": "",
|
|
15
17
|
"license": "MIT",
|
|
16
18
|
"description": "",
|
|
17
19
|
"devDependencies": {
|
|
20
|
+
"@babel/core": "^7.26.0",
|
|
21
|
+
"@babel/preset-env": "^7.26.0",
|
|
22
|
+
"@types/jest": "^29.5.12",
|
|
18
23
|
"@types/lodash-es": "^4.17.12",
|
|
19
24
|
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
20
25
|
"@typescript-eslint/parser": "^8.4.0",
|
|
26
|
+
"babel-jest": "^29.7.0",
|
|
27
|
+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
21
28
|
"eslint": "^9.9.1",
|
|
22
29
|
"jest": "^29.7.0",
|
|
30
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
23
31
|
"lodash-es": "^4.17.21",
|
|
24
32
|
"ts-jest": "^29.2.5",
|
|
25
33
|
"typescript": "^5.5.4",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { default as EventSource } from '../Contracts/EventSource';
|
|
2
2
|
import { ApplicationEvents, ServiceLoader } from './Interfaces';
|
|
3
3
|
import { default as ServiceProvider } from './ServiceProvider';
|
|
4
|
+
export type ApplicationDump = {
|
|
5
|
+
configuration: Record<string, any>;
|
|
6
|
+
services: ServiceLoader[];
|
|
7
|
+
providers: (typeof ServiceProvider)[];
|
|
8
|
+
singletons: Record<string, any>;
|
|
9
|
+
};
|
|
4
10
|
export default class Application<TContainers extends Record<string, any> = Record<string, any>> extends EventSource<ApplicationEvents> {
|
|
5
11
|
protected providers: (typeof ServiceProvider)[];
|
|
6
12
|
protected _configuration: Record<string, any>;
|
|
@@ -22,6 +28,6 @@ export default class Application<TContainers extends Record<string, any> = Recor
|
|
|
22
28
|
create(): void;
|
|
23
29
|
flush(): void;
|
|
24
30
|
dump(): void;
|
|
25
|
-
dump($return: true):
|
|
31
|
+
dump($return: true): ApplicationDump;
|
|
26
32
|
dump($return: false | string): void;
|
|
27
33
|
}
|
package/types/Collection.d.ts
CHANGED
|
@@ -124,10 +124,10 @@ export default class Collection<T> extends EventSource<CollectionEvents<T>> {
|
|
|
124
124
|
shift(count: number): Collection<T>;
|
|
125
125
|
shuffle(): Collection<T>;
|
|
126
126
|
skip(amount: number): Collection<T>;
|
|
127
|
-
skipUntil(callback: CollectionIteratorCallback<T, boolean>): Collection<T>;
|
|
128
127
|
skipUntil(value: T): Collection<T>;
|
|
129
|
-
|
|
128
|
+
skipUntil(callback: CollectionIteratorCallback<T, boolean>): Collection<T>;
|
|
130
129
|
skipWhile(value: T): Collection<T>;
|
|
130
|
+
skipWhile(callback: CollectionIteratorCallback<T, boolean>): Collection<T>;
|
|
131
131
|
slice(start?: number, size?: number): Collection<T>;
|
|
132
132
|
sliding(size: number, step?: number): Collection<Collection<T>>;
|
|
133
133
|
sole(): T | null;
|
|
@@ -174,11 +174,11 @@ export default class Collection<T> extends EventSource<CollectionEvents<T>> {
|
|
|
174
174
|
whereStrict<K extends keyof T>(key: K, value: T[K]): Collection<T>;
|
|
175
175
|
whereStrict<K extends keyof T>(key: K, operator: Operator, value: T[K]): Collection<T>;
|
|
176
176
|
whereBetween<K extends keyof T>(key: K, [min, max]: [T[K], T[K]]): Collection<T>;
|
|
177
|
-
whereIn<K extends keyof T>(key: K, values: T[K][]): Collection<T>;
|
|
178
|
-
whereInstanceOf<R extends Constructor<T>>(constructor: R): Collection<T>;
|
|
179
177
|
whereNotBetween<K extends keyof T>(key: K, [min, max]: [T[K], T[K]]): Collection<T>;
|
|
178
|
+
whereIn<K extends keyof T>(key: K, values: T[K][]): Collection<T>;
|
|
180
179
|
whereNotIn<K extends keyof T>(key: K, values: T[K][]): Collection<T>;
|
|
181
|
-
whereNotNull<K extends keyof T>(key: K): Collection<T>;
|
|
182
180
|
whereNull<K extends keyof T>(key: K): Collection<T>;
|
|
181
|
+
whereNotNull<K extends keyof T>(key: K): Collection<T>;
|
|
182
|
+
whereInstanceOf<R extends Constructor<T>>(constructor: R): Collection<T>;
|
|
183
183
|
zip<R>(items: Collection<R> | R[]): Collection<[T, NonNullable<R> | null]>;
|
|
184
184
|
}
|
package/types/Http/Client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
1
|
import { default as Request } from './Request';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
3
|
export type RequestOptions = Omit<AxiosRequestConfig, 'url' | 'method'>;
|
|
4
4
|
export default class Client {
|
|
5
5
|
protected options: AxiosRequestConfig;
|
package/types/Obj.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ export declare class ObjMacros {
|
|
|
2
2
|
[x: string]: (...args: any[]) => any;
|
|
3
3
|
}
|
|
4
4
|
export declare class ObjStatic {
|
|
5
|
-
fromQuery(searchParams: URLSearchParams): Record<string, any>;
|
|
6
|
-
fromFormData(formData: FormData): Record<string, any>;
|
|
7
5
|
get(object: any, path: string, defaultValue?: any): any;
|
|
8
6
|
has(object: any, path: string): boolean;
|
|
9
7
|
isEmpty(object: any): boolean;
|
|
@@ -12,9 +10,11 @@ export declare class ObjStatic {
|
|
|
12
10
|
omit(object: any, ...paths: string[]): any;
|
|
13
11
|
pick(object: any, ...paths: string[]): any;
|
|
14
12
|
set(object: any, path: string, value: any): void;
|
|
13
|
+
unset(object: any, path: string): void;
|
|
14
|
+
fromQuery(searchParams: URLSearchParams): Record<string, any>;
|
|
15
|
+
fromFormData(formData: FormData): Record<string, any>;
|
|
15
16
|
toQuery(object: any): URLSearchParams;
|
|
16
17
|
toFormData(object: any): FormData;
|
|
17
|
-
unset(object: any, path: string): void;
|
|
18
18
|
}
|
|
19
19
|
declare const Obj: ObjStatic & ObjMacros & import('./Mixins/Macroable').MacroableInterface<ObjMacros>;
|
|
20
20
|
export default Obj;
|