@luminix/core 0.0.1-beta.0 → 0.0.1-beta.2

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 (50) hide show
  1. package/dist/contracts/Builder.d.ts +3 -2
  2. package/dist/contracts/Collection.d.ts +3 -3
  3. package/dist/contracts/ModelCollection.d.ts +1 -0
  4. package/dist/contracts/Plugin.d.ts +1 -0
  5. package/dist/contracts/PropertyBag.d.ts +4 -11
  6. package/dist/contracts/Relation/BelongsTo.d.ts +2 -1
  7. package/dist/contracts/Relation/BelongsToMany.d.ts +3 -2
  8. package/dist/contracts/Relation/HasMany.d.ts +3 -2
  9. package/dist/contracts/Relation/HasOne.d.ts +2 -1
  10. package/dist/contracts/Relation/HasOneOrMany.d.ts +2 -1
  11. package/dist/contracts/Relation/MorphMany.d.ts +3 -2
  12. package/dist/contracts/Relation/MorphOne.d.ts +2 -1
  13. package/dist/contracts/Relation/MorphOneOrMany.d.ts +2 -1
  14. package/dist/contracts/Relation/MorphTo.d.ts +2 -1
  15. package/dist/contracts/Relation/MorphToMany.d.ts +2 -1
  16. package/dist/contracts/Relation.d.ts +1 -0
  17. package/dist/core.js +1317 -1322
  18. package/dist/facades/App.d.ts +4 -3
  19. package/dist/facades/Auth.d.ts +1 -0
  20. package/dist/facades/Error.d.ts +2 -1
  21. package/dist/facades/Log.d.ts +1 -0
  22. package/dist/facades/Model.d.ts +3 -2
  23. package/dist/facades/Route.d.ts +6 -5
  24. package/dist/helpers/app.d.ts +1 -0
  25. package/dist/helpers/auth.d.ts +3 -1
  26. package/dist/helpers/collect.d.ts +1 -1
  27. package/dist/helpers/config.d.ts +1 -0
  28. package/dist/helpers/error.d.ts +1 -0
  29. package/dist/helpers/log.d.ts +1 -0
  30. package/dist/helpers/model.d.ts +1 -0
  31. package/dist/helpers/route.d.ts +1 -0
  32. package/dist/index.d.ts +11 -10
  33. package/dist/mixins/BaseModel.d.ts +1 -0
  34. package/dist/mixins/HasEvents.d.ts +2 -1
  35. package/dist/mixins/Reducible.d.ts +1 -0
  36. package/dist/support/collection.d.ts +1 -0
  37. package/dist/support/model.d.ts +1 -0
  38. package/dist/types/App.d.ts +1 -0
  39. package/dist/types/Auth.d.ts +1 -0
  40. package/dist/types/Builder.d.ts +3 -1
  41. package/dist/types/Collection.d.ts +1 -0
  42. package/dist/types/Config.d.ts +2 -1
  43. package/dist/types/Error.d.ts +3 -1
  44. package/dist/types/Event.d.ts +1 -0
  45. package/dist/types/Model.d.ts +2 -1
  46. package/dist/types/PropertyBag.d.ts +25 -0
  47. package/dist/types/Reducer.d.ts +1 -0
  48. package/dist/types/Relation.d.ts +1 -0
  49. package/dist/types/Route.d.ts +1 -0
  50. package/package.json +2 -2
@@ -5,6 +5,7 @@ import { EventData } from '../types/Event';
5
5
  import { Model, ModelPaginatedResponse, ModelQuery } from '../types/Model';
6
6
  import { JsonValue } from '../types/Support';
7
7
  import { Collection as CollectionInterface } from '../types/Collection';
8
+
8
9
  type BuilderInterface = BuilderBase<Model, ModelPaginatedResponse>;
9
10
  type BuilderEventMap = BuilderEvents<Model, ModelPaginatedResponse>;
10
11
  declare class Builder implements BuilderInterface {
@@ -37,8 +38,8 @@ declare class Builder implements BuilderInterface {
37
38
  }
38
39
  declare const _default: {
39
40
  new (...args: any[]): {
40
- "__#1@#emitter": import("nanoevents").Emitter<import("../types/Event").EventSourceEvents>;
41
- "__#1@#createNanoEvents"(): import("nanoevents").Emitter<import("../types/Event").EventSourceEvents>;
41
+ "__#1@#emitter": import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
42
+ "__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
42
43
  on<E extends "change" | "submit" | "success" | "error">(event: E, callback: BuilderEventMap[E]): Unsubscribe;
43
44
  once<E_1 extends "change" | "submit" | "success" | "error">(event: E_1, callback: BuilderEventMap[E_1]): void;
44
45
  emit<E_2 extends "change" | "submit" | "success" | "error">(event: E_2, data?: Omit<Parameters<BuilderEventMap[E_2]>[0], "source">): void;
@@ -1,10 +1,10 @@
1
1
  import { CollectionEvents, Operator, Collection as CollectionInterface, CollectionIteratorCallback, CollectionPipeCallback, CollectionSortCallback } from '../types/Collection';
2
2
  import { JsonValue, Constructor, TypeOf } from '../types/Support';
3
3
  import { Unsubscribe } from 'nanoevents';
4
+
4
5
  export declare function collect<T = unknown, C extends typeof Collection<T> = typeof Collection<T>>(items?: T[], constructor?: C): CollectionInterface<T>;
5
6
  export declare class Collection<T> implements CollectionInterface<T> {
6
7
  #private;
7
- static name: string;
8
8
  constructor(items?: Array<T>);
9
9
  get items(): T[];
10
10
  [Symbol.iterator](): IterableIterator<T>;
@@ -179,8 +179,8 @@ export declare class Collection<T> implements CollectionInterface<T> {
179
179
  }
180
180
  declare const _default: {
181
181
  new (...args: any[]): {
182
- "__#1@#emitter": import("nanoevents").Emitter<import("../types/Event").EventSourceEvents>;
183
- "__#1@#createNanoEvents"(): import("nanoevents").Emitter<import("../types/Event").EventSourceEvents>;
182
+ "__#1@#emitter": import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
183
+ "__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
184
184
  on<E extends "change">(event: E, callback: CollectionEvents<unknown>[E]): Unsubscribe;
185
185
  once<E_1 extends "change">(event: E_1, callback: CollectionEvents<unknown>[E_1]): void;
186
186
  emit<E_2 extends "change">(event: E_2, data?: Omit<Parameters<CollectionEvents<unknown>[E_2]>[0], "source">): void;
@@ -1,6 +1,7 @@
1
1
  import { Collection } from './Collection';
2
2
  import { Model } from '../types/Model';
3
3
  import { Collection as CollectionInterface } from '../types/Collection';
4
+
4
5
  declare class ModelCollection extends Collection<Model> {
5
6
  static name: string;
6
7
  intersect(values: Collection<Model> | Model[]): CollectionInterface<Model>;
@@ -1,4 +1,5 @@
1
1
  import { AppFacade, AppFacades } from '../types/App';
2
+
2
3
  export default abstract class Plugin {
3
4
  readonly name?: string;
4
5
  readonly version?: string;
@@ -1,14 +1,7 @@
1
- import { Event } from '../types/Event';
1
+ import { PropertyBag as PropertyBagInterface, PropertyBagEventMap } from '../types/PropertyBag';
2
2
  import { Unsubscribe } from 'nanoevents';
3
- export type PropertyBagEventMap<T extends object = any> = {
4
- 'change': (e: PropertyBagChangeEvent<T>) => void;
5
- };
6
- export type PropertyBagChangeEvent<T extends object> = Event<PropertyBag<T>> & {
7
- path: string;
8
- value: unknown;
9
- type: 'set' | 'merge' | 'delete';
10
- };
11
- declare class PropertyBag<T extends object> {
3
+
4
+ declare class PropertyBag<T extends object> implements PropertyBagInterface<T> {
12
5
  private bag;
13
6
  private locked;
14
7
  constructor(bag: T);
@@ -18,7 +11,7 @@ declare class PropertyBag<T extends object> {
18
11
  has(path: string): boolean;
19
12
  delete(path: string): void;
20
13
  lock(path: string): void;
21
- clone(): PropertyBag<T>;
14
+ clone(): PropertyBagInterface<T>;
22
15
  all(): T;
23
16
  isEmpty(): boolean;
24
17
  on<K extends keyof PropertyBagEventMap<T>>(_: K, __: PropertyBagEventMap[K]): Unsubscribe;
@@ -1,7 +1,8 @@
1
- import Relation from '../Relation';
1
+ import { default as Relation } from '../Relation';
2
2
  import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
3
3
  import { AppFacades } from '../../types/App';
4
4
  import { BuilderInterface as Builder } from '../../types/Builder';
5
+
5
6
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
6
7
  export default class BelongsTo extends Relation {
7
8
  protected meta: RelationMetaData;
@@ -1,9 +1,10 @@
1
- import Relation from '../Relation';
1
+ import { default as Relation } from '../Relation';
2
2
  import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
3
3
  import { AppFacades } from '../../types/App';
4
4
  import { BuilderInterface as Builder } from '../../types/Builder';
5
5
  import { Collection as CollectionInterface } from '../../types/Collection';
6
6
  import { JsonObject } from '../../types/Support';
7
+
7
8
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
8
9
  export default class BelongsToMany extends Relation {
9
10
  protected meta: RelationMetaData;
@@ -18,7 +19,7 @@ export default class BelongsToMany extends Relation {
18
19
  all(): Promise<CollectionInterface<Model>>;
19
20
  first(): Promise<Model | null>;
20
21
  find(id: string | number): Promise<Model | null>;
21
- attachQuietly(id: string | number, pivot?: JsonObject): Promise<import("axios").AxiosResponse<any, any>>;
22
+ attachQuietly(id: string | number, pivot?: JsonObject): Promise<import('axios').AxiosResponse<any, any>>;
22
23
  attach(id: string | number, pivot?: JsonObject): Promise<void>;
23
24
  detachQuietly(id: string | number): Promise<void>;
24
25
  detach(id: string | number): Promise<void>;
@@ -1,7 +1,8 @@
1
1
  import { AppFacades } from '../../types/App';
2
2
  import { Model, RelationMetaData } from '../../types/Model';
3
- import HasOneOrMany from './HasOneOrMany';
3
+ import { default as HasOneOrMany } from './HasOneOrMany';
4
4
  import { Collection as CollectionInterface } from '../../types/Collection';
5
+
5
6
  export default class HasMany extends HasOneOrMany {
6
7
  protected meta: RelationMetaData;
7
8
  protected facades: AppFacades;
@@ -10,7 +11,7 @@ export default class HasMany extends HasOneOrMany {
10
11
  constructor(meta: RelationMetaData, facades: AppFacades, parent: Model, items?: CollectionInterface<Model> | null);
11
12
  isSingle(): boolean;
12
13
  isMultiple(): boolean;
13
- get(page?: number, replaceLinksWith?: string): Promise<import("../../types/Model").ModelPaginatedResponse>;
14
+ get(page?: number, replaceLinksWith?: string): Promise<import('../../types/Model').ModelPaginatedResponse>;
14
15
  all(): Promise<CollectionInterface<Model>>;
15
16
  first(): Promise<Model | null>;
16
17
  find(id: string | number): Promise<Model | null>;
@@ -1,6 +1,7 @@
1
1
  import { Model, RelationMetaData } from '../../types/Model';
2
2
  import { AppFacades } from '../../types/App';
3
- import HasOneOrMany from './HasOneOrMany';
3
+ import { default as HasOneOrMany } from './HasOneOrMany';
4
+
4
5
  export default class HasOne extends HasOneOrMany {
5
6
  protected meta: RelationMetaData;
6
7
  protected facades: AppFacades;
@@ -1,6 +1,7 @@
1
1
  import { BuilderInterface as Builder } from '../../types/Builder';
2
2
  import { Model, ModelPaginatedResponse } from '../../types/Model';
3
- import Relation from '../Relation';
3
+ import { default as Relation } from '../Relation';
4
+
4
5
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
5
6
  export default class HasOneOrMany extends Relation {
6
7
  query(): BuilderInterface;
@@ -1,7 +1,8 @@
1
1
  import { AppFacades } from '../../types/App';
2
2
  import { Model, RelationMetaData } from '../../types/Model';
3
- import MorphOneOrMany from './MorphOneOrMany';
3
+ import { default as MorphOneOrMany } from './MorphOneOrMany';
4
4
  import { Collection as CollectionInterface } from '../../types/Collection';
5
+
5
6
  export default class MorphMany extends MorphOneOrMany {
6
7
  protected meta: RelationMetaData;
7
8
  protected facades: AppFacades;
@@ -10,7 +11,7 @@ export default class MorphMany extends MorphOneOrMany {
10
11
  constructor(meta: RelationMetaData, facades: AppFacades, parent: Model, items?: CollectionInterface<Model> | null);
11
12
  isSingle(): boolean;
12
13
  isMultiple(): boolean;
13
- get(page?: number, replaceLinksWith?: string): Promise<import("../../types/Model").ModelPaginatedResponse>;
14
+ get(page?: number, replaceLinksWith?: string): Promise<import('../../types/Model').ModelPaginatedResponse>;
14
15
  all(): Promise<CollectionInterface<Model>>;
15
16
  first(): Promise<Model | null>;
16
17
  find(id: string | number): Promise<Model | null>;
@@ -1,6 +1,7 @@
1
1
  import { AppFacades } from '../../types/App';
2
2
  import { Model, RelationMetaData } from '../../types/Model';
3
- import MorphOneOrMany from './MorphOneOrMany';
3
+ import { default as MorphOneOrMany } from './MorphOneOrMany';
4
+
4
5
  export default class MorphOne extends MorphOneOrMany {
5
6
  protected meta: RelationMetaData;
6
7
  protected facades: AppFacades;
@@ -1,6 +1,7 @@
1
1
  import { BuilderInterface as Builder } from '../../types/Builder';
2
2
  import { Model, ModelPaginatedResponse } from '../../types/Model';
3
- import HasOneOrMany from './HasOneOrMany';
3
+ import { default as HasOneOrMany } from './HasOneOrMany';
4
+
4
5
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
5
6
  export default class MorphOneOrMany extends HasOneOrMany {
6
7
  query(): BuilderInterface;
@@ -1,5 +1,6 @@
1
1
  import { Model } from '../../types/Model';
2
- import BelongsTo from './BelongsTo';
2
+ import { default as BelongsTo } from './BelongsTo';
3
+
3
4
  export default class MorphTo extends BelongsTo {
4
5
  getRelated(): typeof Model;
5
6
  associate(item: Model): Promise<void>;
@@ -2,7 +2,8 @@ import { AppFacades } from '../../types/App';
2
2
  import { BuilderInterface as Builder } from '../../types/Builder';
3
3
  import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
4
4
  import { Collection } from '../../types/Collection';
5
- import BelongsToMany from './BelongsToMany';
5
+ import { default as BelongsToMany } from './BelongsToMany';
6
+
6
7
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
7
8
  export default class MorphToMany extends BelongsToMany {
8
9
  protected meta: RelationMetaData;
@@ -4,6 +4,7 @@ import { BuilderInterface as Builder, Scope as ScopeBase, ExtendedOperator } fro
4
4
  import { Collection as CollectionInterface } from '../types/Collection';
5
5
  import { RelationInterface as RelationBase } from '../types/Relation';
6
6
  import { JsonValue } from '../types/Support';
7
+
7
8
  type RelationInterface = RelationBase<Model, ModelPaginatedResponse>;
8
9
  type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
9
10
  type Scope = ScopeBase<Model, ModelPaginatedResponse>;