@luminix/support 0.4.3 → 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.
@@ -0,0 +1,5 @@
1
+
2
+ {
3
+ "presets": [[ "@babel/preset-env", { "targets": { "node": "current"}} ]],
4
+ "plugins": [ "transform-es2015-modules-commonjs" ]
5
+ }
package/dist/support.js CHANGED
@@ -4262,18 +4262,16 @@ class Sm extends yr {
4262
4262
  this.emit("flushing"), this.singletons = {}, this.loaders = {}, this._configuration = {}, this.providers = [], this.emit("flushed"), this.flushEvents();
4263
4263
  }
4264
4264
  dump(r = !1) {
4265
- const n = this.make("log");
4266
- if (n) {
4267
- const s = {
4268
- configuration: this.configuration,
4269
- services: this.services,
4270
- providers: this.providers,
4271
- singletons: this.singletons
4272
- };
4273
- if (r === !0)
4274
- return s;
4275
- r === !1 && n.info(s), n.info(r, s);
4276
- }
4265
+ const n = {
4266
+ configuration: this.configuration,
4267
+ services: this.services,
4268
+ providers: this.providers,
4269
+ singletons: this.singletons
4270
+ };
4271
+ if (r === !0)
4272
+ return n;
4273
+ const s = this.make("log");
4274
+ r === !1 && s.info(n), s.info(r, n);
4277
4275
  }
4278
4276
  }
4279
4277
  function Re(e) {
@@ -4301,15 +4299,6 @@ function Re(e) {
4301
4299
  };
4302
4300
  }
4303
4301
  class Qp {
4304
- fromQuery(t) {
4305
- const r = {};
4306
- for (const [n, s] of t.entries())
4307
- this.set(r, n, s);
4308
- return r;
4309
- }
4310
- fromFormData(t) {
4311
- return this.fromQuery(t);
4312
- }
4313
4302
  get(t, r, n) {
4314
4303
  return cc(t, r, n);
4315
4304
  }
@@ -4340,15 +4329,24 @@ class Qp {
4340
4329
  set(t, r, n) {
4341
4330
  Bp(t, r, n);
4342
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
+ }
4343
4344
  toQuery(t) {
4344
4345
  return Qr(t, new URLSearchParams());
4345
4346
  }
4346
4347
  toFormData(t) {
4347
4348
  return Qr(t, new FormData());
4348
4349
  }
4349
- unset(t, r) {
4350
- Xp(t, r);
4351
- }
4352
4350
  }
4353
4351
  const O = new (Re(Qp))();
4354
4352
  let lr = class {
@@ -5230,23 +5228,23 @@ const b = class b extends yr {
5230
5228
  whereBetween(r, [n, s]) {
5231
5229
  return new b(l(this, c).filter((i) => i[r] >= n && i[r] <= s));
5232
5230
  }
5233
- whereIn(r, n) {
5234
- return new b(l(this, c).filter((s) => n.includes(s[r])));
5235
- }
5236
- whereInstanceOf(r) {
5237
- return new b(l(this, c).filter((n) => n instanceof r));
5238
- }
5239
5231
  whereNotBetween(r, [n, s]) {
5240
5232
  return new b(l(this, c).filter((i) => i[r] < n || i[r] > s));
5241
5233
  }
5234
+ whereIn(r, n) {
5235
+ return new b(l(this, c).filter((s) => n.includes(s[r])));
5236
+ }
5242
5237
  whereNotIn(r, n) {
5243
5238
  return new b(l(this, c).filter((s) => !n.includes(s[r])));
5244
5239
  }
5240
+ whereNull(r) {
5241
+ return new b(l(this, c).filter((n) => n[r] === null));
5242
+ }
5245
5243
  whereNotNull(r) {
5246
5244
  return new b(l(this, c).filter((n) => n[r] !== null));
5247
5245
  }
5248
- whereNull(r) {
5249
- return new b(l(this, c).filter((n) => n[r] === null));
5246
+ whereInstanceOf(r) {
5247
+ return new b(l(this, c).filter((n) => n instanceof r));
5250
5248
  }
5251
5249
  zip(r) {
5252
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",
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": "echo \"Error: no test specified\" && exit 1"
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): Object;
31
+ dump($return: true): ApplicationDump;
26
32
  dump($return: false | string): void;
27
33
  }
@@ -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
- skipWhile(callback: CollectionIteratorCallback<T, boolean>): Collection<T>;
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
  }
@@ -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;