@luminix/core 0.0.1-beta.9 → 0.1.0-beta.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.
Files changed (95) hide show
  1. package/dist/core.js +1034 -1922
  2. package/package.json +5 -9
  3. package/types/contracts/Builder.d.ts +46 -0
  4. package/types/contracts/ModelCollection.d.ts +7 -0
  5. package/{dist → types}/contracts/Plugin.d.ts +3 -3
  6. package/{dist → types}/contracts/Relation/BelongsTo.d.ts +3 -5
  7. package/{dist → types}/contracts/Relation/BelongsToMany.d.ts +7 -9
  8. package/{dist → types}/contracts/Relation/HasMany.d.ts +6 -7
  9. package/{dist → types}/contracts/Relation/HasOne.d.ts +3 -4
  10. package/{dist → types}/contracts/Relation/HasOneOrMany.d.ts +0 -1
  11. package/{dist → types}/contracts/Relation/MorphMany.d.ts +6 -7
  12. package/{dist → types}/contracts/Relation/MorphOne.d.ts +3 -4
  13. package/{dist → types}/contracts/Relation/MorphOneOrMany.d.ts +0 -1
  14. package/{dist → types}/contracts/Relation/MorphTo.d.ts +0 -1
  15. package/types/contracts/Relation/MorphToMany.d.ts +8 -0
  16. package/{dist → types}/contracts/Relation.d.ts +12 -9
  17. package/types/facades/App.d.ts +12 -0
  18. package/types/facades/Auth.d.ts +7 -0
  19. package/types/facades/Config.d.ts +7 -0
  20. package/types/facades/Error.d.ts +10 -0
  21. package/types/facades/Http.d.ts +8 -0
  22. package/types/facades/Log.d.ts +7 -0
  23. package/types/facades/Model.d.ts +8 -0
  24. package/types/facades/Route.d.ts +7 -0
  25. package/types/helpers/app.d.ts +4 -0
  26. package/{dist → types}/helpers/auth.d.ts +0 -1
  27. package/types/helpers/collect.d.ts +2 -0
  28. package/{dist → types}/helpers/config.d.ts +0 -1
  29. package/{dist → types}/helpers/error.d.ts +0 -1
  30. package/types/helpers/log.d.ts +5 -0
  31. package/{dist → types}/helpers/model.d.ts +2 -3
  32. package/{dist → types}/helpers/route.d.ts +2 -2
  33. package/{dist → types}/index.d.ts +10 -10
  34. package/types/mixins/BaseModel.d.ts +7 -0
  35. package/types/providers/LuminixServiceProvider.d.ts +9 -0
  36. package/types/services/AuthService.d.ts +18 -0
  37. package/{dist/facades/Error.d.ts → types/services/ErrorService.d.ts} +2 -6
  38. package/types/services/HttpService.d.ts +21 -0
  39. package/{dist/facades/Log.d.ts → types/services/LogService.d.ts} +2 -4
  40. package/types/services/ModelService.d.ts +21 -0
  41. package/types/services/RouteService.d.ts +21 -0
  42. package/{dist → types}/support/model.d.ts +0 -1
  43. package/types/types/App.d.ts +88 -0
  44. package/{dist → types}/types/Auth.d.ts +0 -1
  45. package/types/types/Builder.d.ts +46 -0
  46. package/{dist → types}/types/Config.d.ts +4 -2
  47. package/types/types/Error.d.ts +17 -0
  48. package/types/types/Http.d.ts +20 -0
  49. package/{dist → types}/types/Model.d.ts +61 -43
  50. package/{dist → types}/types/Relation.d.ts +1 -2
  51. package/types/types/Route.d.ts +27 -0
  52. package/{dist → types}/types/Support.d.ts +3 -2
  53. package/vite.config.js +2 -2
  54. package/dist/contracts/Builder.d.ts +0 -53
  55. package/dist/contracts/Collection.d.ts +0 -190
  56. package/dist/contracts/ModelCollection.d.ts +0 -9
  57. package/dist/contracts/PropertyBag.d.ts +0 -21
  58. package/dist/contracts/Relation/MorphToMany.d.ts +0 -16
  59. package/dist/facades/App.d.ts +0 -37
  60. package/dist/facades/Auth.d.ts +0 -14
  61. package/dist/facades/Model.d.ts +0 -41
  62. package/dist/facades/Route.d.ts +0 -32
  63. package/dist/helpers/app.d.ts +0 -5
  64. package/dist/helpers/collect.d.ts +0 -1
  65. package/dist/helpers/log.d.ts +0 -5
  66. package/dist/mixins/BaseModel.d.ts +0 -5
  67. package/dist/mixins/HasEvents.d.ts +0 -15
  68. package/dist/mixins/Reducible.d.ts +0 -17
  69. package/dist/support/collection.d.ts +0 -4
  70. package/dist/support/reader.d.ts +0 -2
  71. package/dist/support/searchParams.d.ts +0 -1
  72. package/dist/types/App.d.ts +0 -79
  73. package/dist/types/Builder.d.ts +0 -51
  74. package/dist/types/Collection.d.ts +0 -1804
  75. package/dist/types/Error.d.ts +0 -31
  76. package/dist/types/Event.d.ts +0 -14
  77. package/dist/types/PropertyBag.d.ts +0 -25
  78. package/dist/types/Reducer.d.ts +0 -17
  79. package/dist/types/Route.d.ts +0 -22
  80. /package/{dist → types}/exceptions/AttributeNotFillableException.d.ts +0 -0
  81. /package/{dist → types}/exceptions/FacadeNotFoundException.d.ts +0 -0
  82. /package/{dist → types}/exceptions/MethodNotImplementedException.d.ts +0 -0
  83. /package/{dist → types}/exceptions/ModelInvalidRelatedTypeException.d.ts +0 -0
  84. /package/{dist → types}/exceptions/ModelNotFoundException.d.ts +0 -0
  85. /package/{dist → types}/exceptions/ModelNotPersistedException.d.ts +0 -0
  86. /package/{dist → types}/exceptions/ModelWithoutPrimaryKeyException.d.ts +0 -0
  87. /package/{dist → types}/exceptions/NoEmbedException.d.ts +0 -0
  88. /package/{dist → types}/exceptions/NoInverseRelationException.d.ts +0 -0
  89. /package/{dist → types}/exceptions/NotModelException.d.ts +0 -0
  90. /package/{dist → types}/exceptions/NotReducibleException.d.ts +0 -0
  91. /package/{dist → types}/exceptions/ReducerOverrideException.d.ts +0 -0
  92. /package/{dist → types}/exceptions/RouteNotFoundException.d.ts +0 -0
  93. /package/{dist → types}/exceptions/UnsupportedRelationException.d.ts +0 -0
  94. /package/{dist → types}/types/Log.d.ts +0 -0
  95. /package/{dist → types}/types/Plugin.d.ts +0 -0
@@ -1,190 +0,0 @@
1
- import { CollectionEvents, Operator, Collection as CollectionInterface, CollectionIteratorCallback, CollectionPipeCallback, CollectionSortCallback } from '../types/Collection';
2
- import { JsonValue, Constructor, TypeOf } from '../types/Support';
3
- import { Unsubscribe } from 'nanoevents';
4
-
5
- export declare function collect<T = unknown, C extends typeof Collection<T> = typeof Collection<T>>(items?: T[], constructor?: C): CollectionInterface<T>;
6
- export declare class Collection<T> implements CollectionInterface<T> {
7
- #private;
8
- constructor(items?: Array<T>);
9
- get items(): T[];
10
- [Symbol.iterator](): IterableIterator<T>;
11
- [Symbol.toStringTag]: string;
12
- all(): T[];
13
- average(): number;
14
- average<K extends keyof T>(key: K): number;
15
- avg(): number;
16
- avg<K extends keyof T>(key: K): number;
17
- chunk(size: number): CollectionInterface<CollectionInterface<T>>;
18
- chunkWhile(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<CollectionInterface<T>>;
19
- collapse(): CollectionInterface<unknown>;
20
- collect(): CollectionInterface<T>;
21
- combine(values: CollectionInterface<JsonValue> | JsonValue[]): Record<string, JsonValue>;
22
- concat(collection: CollectionInterface<unknown> | unknown[]): CollectionInterface<unknown>;
23
- contains(value: T): boolean;
24
- contains(key: keyof T, value: T): boolean;
25
- contains(callback: CollectionIteratorCallback<T, boolean>): boolean;
26
- containsOneItem(): boolean;
27
- containsStrict(value: T): boolean;
28
- containsStrict(key: keyof T, value: T): boolean;
29
- containsStrict(callback: CollectionIteratorCallback<T, boolean>): boolean;
30
- count(): number;
31
- countBy(callback?: CollectionIteratorCallback<T, string | number>): Record<string | number, number>;
32
- crossJoin<V>(...collections: (CollectionInterface<V> | V[])[]): CollectionInterface<Array<V | T>>;
33
- diff(collection: CollectionInterface<T> | T[]): CollectionInterface<T>;
34
- doesntContain(value: T): boolean;
35
- doesntContain(key: keyof T, value: T): boolean;
36
- doesntContain(callback: CollectionIteratorCallback<T, boolean>): boolean;
37
- dump(): void;
38
- duplicates(): CollectionInterface<T>;
39
- duplicates<K extends keyof T>(key: K): CollectionInterface<T[K]>;
40
- duplicatesStrict(): CollectionInterface<T>;
41
- duplicatesStrict<K extends keyof T>(key: K): CollectionInterface<T[K]>;
42
- each(callback: CollectionIteratorCallback<T, void | false>): this;
43
- eachSpread(callback: (...args: unknown[]) => void | false): this;
44
- ensure(type: TypeOf | Constructor | (TypeOf | Constructor)[]): this;
45
- every(callback: CollectionIteratorCallback<T, boolean>): boolean;
46
- except(indexes: Array<number>): CollectionInterface<T>;
47
- filter(callback?: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
48
- first(callback?: CollectionIteratorCallback<T, boolean>): T | null;
49
- firstOrFail(callback?: CollectionIteratorCallback<T, boolean>): T;
50
- firstWhere(key: keyof T): T | null;
51
- firstWhere(key: keyof T, value: T): T | null;
52
- firstWhere(key: keyof T, operator: Operator, value: T): T | null;
53
- flatMap<R>(callback: CollectionIteratorCallback<T, R | R[]>): CollectionInterface<R>;
54
- forget(key: number): this;
55
- forPage(page: number, perPage: number): CollectionInterface<T>;
56
- get(key: number): T | null;
57
- get<R>(key: number, defaultValue: R): T | R;
58
- get<R>(key: number, defaultValue: () => R): T | R;
59
- groupBy(key: keyof T): Record<string, T[]>;
60
- groupBy(callback: CollectionIteratorCallback<T, string | string[]>): Record<string, T[]>;
61
- groupBy(keys: (keyof T | CollectionIteratorCallback<T, string | string[]>)[]): Record<string, unknown>;
62
- has(index: number): boolean;
63
- hasAny(indexes: number[]): boolean;
64
- implode(glue: string): string;
65
- implode(key: keyof T, glue: string): string;
66
- implode(callback: CollectionIteratorCallback<T, string>, glue: string): string;
67
- intersect(values: Collection<T> | T[]): CollectionInterface<T>;
68
- isEmpty(): boolean;
69
- isNotEmpty(): boolean;
70
- join(glue: string): string;
71
- join(glue: string, final: string): string;
72
- keyBy(key: keyof T): Record<string, T>;
73
- keyBy(callback: CollectionIteratorCallback<T, string>): Record<string, T>;
74
- last(callback?: CollectionIteratorCallback<T, boolean> | undefined): T | null;
75
- map<R>(callback: CollectionIteratorCallback<T, R>): CollectionInterface<R>;
76
- mapInto<R extends Constructor<InstanceType<R>>>(constructor: R): CollectionInterface<InstanceType<R>>;
77
- mapSpread<R>(callback: (...args: unknown[]) => R): CollectionInterface<R>;
78
- mapToGroups<R>(callback: CollectionIteratorCallback<T, Record<string, R>>): Record<string, R[]>;
79
- mapWithKeys<R>(callback: CollectionIteratorCallback<T, Record<string, R>>): Record<string, R>;
80
- max(): T | null;
81
- max<K extends keyof T>(key: K): T[K] | null;
82
- median(): T | null;
83
- median<K extends keyof T>(key: K): T[K] | null;
84
- merge(values: CollectionInterface<T> | T[]): CollectionInterface<T>;
85
- merge<R>(values: CollectionInterface<R> | R[]): CollectionInterface<T | R>;
86
- min(): T | null;
87
- min<K extends keyof T>(key: K): T[K] | null;
88
- mode(): T[];
89
- mode<K extends keyof T>(key: K): T[K][];
90
- nth(n: number, offset?: number): CollectionInterface<T>;
91
- only(indexes: Array<number>): CollectionInterface<T>;
92
- pad<R>(size: number, value?: R | null): CollectionInterface<T | R | null>;
93
- partition(callback: CollectionIteratorCallback<T, boolean>): [CollectionInterface<T>, CollectionInterface<T>];
94
- percentage(callback: CollectionIteratorCallback<T, boolean>, precision?: number): number;
95
- pipe<R>(callback: CollectionPipeCallback<T, R>): R;
96
- pipeInto<R extends Constructor<InstanceType<R>>>(constructor: R): InstanceType<R>;
97
- pipeThrough<R>(pipeline: CollectionPipeCallback<unknown, CollectionInterface<unknown> | R>[]): R;
98
- pluck<K extends keyof T>(key: K): CollectionInterface<T[K]>;
99
- pop(): T | null;
100
- pop(amount: number): CollectionInterface<T>;
101
- prepend(value: T): number;
102
- pull(index: number): T | null;
103
- push(...items: T[]): number;
104
- put(index: number, value: T): this;
105
- random(): T | null;
106
- random(amount: number): CollectionInterface<T>;
107
- reduce<R>(callback: (carry: R | null, item: T, index: number, collection: this) => R, initialValue?: R | null): R | null;
108
- reject(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
109
- replace(data: Record<number, T>): CollectionInterface<T>;
110
- reverse(): CollectionInterface<T>;
111
- search(value: T): number | false;
112
- search(value: T, strict: boolean): number | false;
113
- search(callback: CollectionIteratorCallback<T, boolean>): number | false;
114
- select<K extends Array<keyof T>>(keys: K): CollectionInterface<Pick<T, K[number]>>;
115
- shift(): T | null;
116
- shift(count: number): CollectionInterface<T>;
117
- shuffle(): CollectionInterface<T>;
118
- skip(amount: number): CollectionInterface<T>;
119
- skipUntil(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
120
- skipUntil(value: T): CollectionInterface<T>;
121
- skipWhile(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
122
- skipWhile(value: T): CollectionInterface<T>;
123
- slice(start?: number, size?: number): CollectionInterface<T>;
124
- sliding(size: number, step?: number): CollectionInterface<CollectionInterface<T>>;
125
- sole(): T | null;
126
- sole<K extends keyof T>(key: K, value: T[K]): T | null;
127
- sole(callback: CollectionIteratorCallback<T, boolean>): T | null;
128
- some(value: T): boolean;
129
- some(key: keyof T, value: T): boolean;
130
- some(callback: CollectionIteratorCallback<T, boolean>): boolean;
131
- sort(compareFn?: CollectionSortCallback<T>): CollectionInterface<T>;
132
- sortBy<K extends keyof T>(key: K, order?: 'asc' | 'desc'): CollectionInterface<T>;
133
- sortBy<K extends keyof T>(columns: [K, 'asc' | 'desc'][]): CollectionInterface<T>;
134
- sortBy(callback: CollectionIteratorCallback<T, number>): CollectionInterface<T>;
135
- sortBy(stack: ((a: T, b: T) => number)[]): CollectionInterface<T>;
136
- sortDesc(): CollectionInterface<T>;
137
- splice(start: number): CollectionInterface<T>;
138
- splice(start: number, deleteCount: number): CollectionInterface<T>;
139
- splice(start: number, deleteCount: number, ...items: T[]): CollectionInterface<T>;
140
- split(groups: number): CollectionInterface<CollectionInterface<T>>;
141
- splitIn(groups: number): CollectionInterface<CollectionInterface<T>>;
142
- sum(): number;
143
- sum<K extends keyof T>(key: K): number;
144
- take(amount: number): CollectionInterface<T>;
145
- takeUntil(value: T): CollectionInterface<T>;
146
- takeUntil(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
147
- takeWhile(value: T): CollectionInterface<T>;
148
- takeWhile(callback: CollectionIteratorCallback<T, boolean>): CollectionInterface<T>;
149
- tap(callback: CollectionPipeCallback<T, void>): this;
150
- toArray(): T[];
151
- toJson(): string;
152
- transform<R>(callback: CollectionIteratorCallback<T, R>): CollectionInterface<T | R>;
153
- unique(): CollectionInterface<T>;
154
- unique<K extends keyof T>(key: K): CollectionInterface<T>;
155
- uniqueStrict(): CollectionInterface<T>;
156
- uniqueStrict<K extends keyof T>(key: K): CollectionInterface<T>;
157
- unless(condition: boolean, callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
158
- unlessEmpty(callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
159
- unlessNotEmpty(callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
160
- value<K extends keyof T>(key: K): T[K] | null;
161
- when(condition: boolean, callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
162
- whenEmpty(callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
163
- whenNotEmpty(callback: CollectionPipeCallback<T, void>, otherwise?: CollectionPipeCallback<T, void>): this;
164
- where<K extends keyof T>(key: K, value: T[K]): CollectionInterface<T>;
165
- where<K extends keyof T>(key: K, operator: Operator, value: T[K]): CollectionInterface<T>;
166
- whereStrict<K extends keyof T>(key: K, value: T[K]): CollectionInterface<T>;
167
- whereStrict<K extends keyof T>(key: K, operator: Operator, value: T[K]): CollectionInterface<T>;
168
- whereBetween<K extends keyof T>(key: K, [min, max]: [T[K], T[K]]): CollectionInterface<T>;
169
- whereIn<K extends keyof T>(key: K, values: T[K][]): CollectionInterface<T>;
170
- whereInstanceOf<R extends Constructor<T>>(constructor: R): CollectionInterface<T>;
171
- whereNotBetween<K extends keyof T>(key: K, [min, max]: [T[K], T[K]]): CollectionInterface<T>;
172
- whereNotIn<K extends keyof T>(key: K, values: T[K][]): CollectionInterface<T>;
173
- whereNotNull<K extends keyof T>(key: K): CollectionInterface<T>;
174
- whereNull<K extends keyof T>(key: K): CollectionInterface<T>;
175
- zip<R>(items: CollectionInterface<R> | R[]): CollectionInterface<[T, R | null]>;
176
- on<K extends keyof CollectionEvents<T>>(_: K, __: CollectionEvents<T>[K]): Unsubscribe;
177
- once<K extends keyof CollectionEvents<T>>(_: K, __: CollectionEvents<T>[K]): void;
178
- emit<K extends keyof CollectionEvents<T>>(_: K, __?: Omit<Parameters<CollectionEvents<T>[K]>[0], 'source'>): void;
179
- }
180
- declare const _default: {
181
- new (...args: any[]): {
182
- emitter: import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
183
- "__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
184
- on<E extends "change">(event: E, callback: CollectionEvents<unknown>[E]): Unsubscribe;
185
- once<E_1 extends "change">(event: E_1, callback: CollectionEvents<unknown>[E_1]): void;
186
- emit<E_2 extends "change">(event: E_2, data?: Omit<Parameters<CollectionEvents<unknown>[E_2]>[0], "source">): void;
187
- [Symbol.toStringTag]: string;
188
- };
189
- } & typeof Collection;
190
- export default _default;
@@ -1,9 +0,0 @@
1
- import { Collection } from './Collection';
2
- import { Model } from '../types/Model';
3
- import { Collection as CollectionInterface } from '../types/Collection';
4
-
5
- declare class ModelCollection extends Collection<Model> {
6
- [Symbol.toStringTag]: string;
7
- intersect(values: Collection<Model> | Model[]): CollectionInterface<Model>;
8
- }
9
- export default ModelCollection;
@@ -1,21 +0,0 @@
1
- import { PropertyBag as PropertyBagInterface, PropertyBagEventMap } from '../types/PropertyBag';
2
- import { Unsubscribe } from 'nanoevents';
3
-
4
- declare class PropertyBag<T extends object> implements PropertyBagInterface<T> {
5
- private bag;
6
- private locked;
7
- constructor(bag: T);
8
- get(path: string, defaultValue?: unknown): unknown;
9
- set(path: string, value: unknown): void;
10
- merge(path: string, value: unknown): void;
11
- has(path: string): boolean;
12
- delete(path: string): void;
13
- lock(path: string): void;
14
- clone(): PropertyBagInterface<T>;
15
- all(): T;
16
- isEmpty(): boolean;
17
- on<K extends keyof PropertyBagEventMap<T>>(_: K, __: PropertyBagEventMap[K]): Unsubscribe;
18
- once<K extends keyof PropertyBagEventMap<T>>(_: K, __: PropertyBagEventMap[K]): void;
19
- emit<K extends keyof PropertyBagEventMap<T>>(_: K, __: Omit<Parameters<PropertyBagEventMap[K]>[0], 'source'>): void;
20
- }
21
- export default PropertyBag;
@@ -1,16 +0,0 @@
1
- import { AppFacades } from '../../types/App';
2
- import { BuilderInterface as Builder } from '../../types/Builder';
3
- import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
4
- import { Collection } from '../../types/Collection';
5
- import { default as BelongsToMany } from './BelongsToMany';
6
-
7
- type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
8
- export default class MorphToMany extends BelongsToMany {
9
- protected meta: RelationMetaData;
10
- protected facades: AppFacades;
11
- protected parent: Model;
12
- protected items: Collection<Model> | null;
13
- constructor(meta: RelationMetaData, facades: AppFacades, parent: Model, items?: Collection<Model> | null);
14
- query(): BuilderInterface;
15
- }
16
- export {};
@@ -1,37 +0,0 @@
1
- import { AppFacades, AppFacade, AppEvents } from '../types/App';
2
- import { default as Plugin } from '../contracts/Plugin';
3
- import { AppConfiguration } from '../types/Config';
4
- import { Unsubscribe } from 'nanoevents';
5
- import { Constructor } from '../types/Support';
6
-
7
- declare class App implements AppFacade {
8
- private facades;
9
- private booted;
10
- private _plugins;
11
- make(): AppFacades;
12
- make<K extends keyof AppFacades>(key: K): AppFacades[K];
13
- has(key: string): boolean;
14
- bind<K extends keyof AppFacades>(key: K, facade: AppFacades[K]): void;
15
- plugins(): Plugin[];
16
- boot(configObject?: AppConfiguration): Promise<AppFacades>;
17
- environment(): string;
18
- environment(...environments: string[]): boolean;
19
- getPlugin<T extends Plugin>(abstract: Constructor<T>): T | undefined;
20
- hasDebugModeEnabled(): boolean;
21
- isLocal(): boolean;
22
- isProduction(): boolean;
23
- on<E extends keyof AppEvents>(_: E, __: AppEvents[E]): Unsubscribe;
24
- once<E extends keyof AppEvents>(_: E, __: AppEvents[E]): void;
25
- emit<E extends keyof AppEvents>(_: E, __?: Omit<Parameters<AppEvents[E]>[0], 'source'>): void;
26
- }
27
- declare const _default: {
28
- new (...args: any[]): {
29
- emitter: import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
30
- "__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
31
- on<E extends keyof AppEvents>(event: E, callback: AppEvents[E]): Unsubscribe;
32
- once<E_1 extends keyof AppEvents>(event: E_1, callback: AppEvents[E_1]): void;
33
- emit<E_2 extends keyof AppEvents>(event: E_2, data?: Omit<Parameters<AppEvents[E_2]>[0], "source">): void;
34
- [Symbol.toStringTag]: string;
35
- };
36
- } & typeof App;
37
- export default _default;
@@ -1,14 +0,0 @@
1
- import { AppFacade } from '../types/App';
2
- import { AuthCredentials, AuthFacade } from '../types/Auth';
3
- import { Model } from '../types/Model';
4
-
5
- export default class Auth implements AuthFacade {
6
- private readonly app;
7
- private _user;
8
- constructor(app: AppFacade);
9
- attempt(credentials: AuthCredentials, remember?: boolean, onSubmit?: (e: Event) => void): void;
10
- check(): boolean;
11
- logout(onSubmit?: (e: Event) => void): void;
12
- user(): Model | null;
13
- id(): number | string | null;
14
- }
@@ -1,41 +0,0 @@
1
- import { ModelSchema, ModelSchemaAttributes, Model } from '../types/Model';
2
- import { AppFacade, GlobalModelEvents, ModelFacade as ModelFacadeInterface } from '../types/App';
3
- import { Unsubscribe } from 'nanoevents';
4
- import { Reducer, ReducerCallback, Unsubscribe as UnsubscribeReducer } from '../types/Reducer';
5
- import { Collection } from '../contracts/Collection';
6
-
7
- declare class ModelFacade implements ModelFacadeInterface {
8
- private readonly _schema;
9
- private _models;
10
- [Symbol.toStringTag]: string;
11
- constructor(_schema: ModelSchema);
12
- boot(app: AppFacade): void;
13
- schema(): ModelSchema;
14
- schema(abstract: string): ModelSchemaAttributes;
15
- make(): {
16
- [abstract: string]: typeof Model;
17
- };
18
- make(abstract: string): typeof Model;
19
- toString(): string;
20
- on<K extends keyof GlobalModelEvents>(_: K, __: GlobalModelEvents[K]): Unsubscribe;
21
- once<K extends keyof GlobalModelEvents>(_: K, __: GlobalModelEvents[K]): void;
22
- emit<K extends keyof GlobalModelEvents>(_: K, __?: Omit<Parameters<GlobalModelEvents[K]>[0], 'source'>): void;
23
- reducer(_: string, __: ReducerCallback, ___?: number): UnsubscribeReducer;
24
- removeReducer(_: string): void;
25
- getReducer(_: string): Collection<Reducer>;
26
- hasReducer(_: string): boolean;
27
- clearReducer(_: string): void;
28
- flushReducers(): void;
29
- [reducer: string]: unknown;
30
- }
31
- declare const _default: {
32
- new (...args: any[]): {
33
- emitter: import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
34
- "__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
35
- on<E extends keyof GlobalModelEvents>(event: E, callback: GlobalModelEvents[E]): Unsubscribe;
36
- once<E_1 extends keyof GlobalModelEvents>(event: E_1, callback: GlobalModelEvents[E_1]): void;
37
- emit<E_2 extends keyof GlobalModelEvents>(event: E_2, data?: Omit<Parameters<GlobalModelEvents[E_2]>[0], "source">): void;
38
- [Symbol.toStringTag]: string;
39
- };
40
- } & typeof ModelFacade;
41
- export default _default;
@@ -1,32 +0,0 @@
1
- import { RouteDefinition, RouteTuple as RouteTuple, HttpMethod, RouteGenerator, RouteCallConfig } from '../types/Route';
2
- import { ErrorFacade } from '../types/Error';
3
-
4
- declare class Route {
5
- private routes;
6
- private error;
7
- private appUrl;
8
- constructor(routes: RouteDefinition, error: ErrorFacade, appUrl?: string);
9
- private isRouteTuple;
10
- private extractGenerator;
11
- get(name: string): RouteTuple;
12
- url(generator: RouteGenerator): string;
13
- methods(generator: RouteGenerator): HttpMethod[];
14
- exists(name: string): boolean;
15
- call(generator: RouteGenerator, config?: RouteCallConfig): Promise<import('axios').AxiosResponse<any, any>>;
16
- toString(): string;
17
- [reducer: string]: unknown;
18
- }
19
- declare const _default: {
20
- new (...args: any[]): {
21
- reducers: {
22
- [name: string]: import('../types/Collection').Collection<import('../types/Reducer').Reducer>;
23
- };
24
- reducer(name: string, callback: import('../types/Reducer').ReducerCallback, priority?: number): () => void;
25
- removeReducer(name: string, callback: import('../types/Reducer').ReducerCallback): void;
26
- getReducer(name: string): import('../types/Collection').Collection<import('../types/Reducer').Reducer>;
27
- hasReducer(name: string): boolean;
28
- clearReducer(name: string): void;
29
- flushReducers(): void;
30
- };
31
- } & typeof Route;
32
- export default _default;
@@ -1,5 +0,0 @@
1
- import { AppExternal, AppFacades } from '../types/App';
2
-
3
- declare function app(): AppExternal;
4
- declare function app<T extends keyof AppFacades>(facade: T): AppFacades[T];
5
- export default app;
@@ -1 +0,0 @@
1
- export default function collect<T = unknown>(items: T[]): import('../types/Collection').Collection<T>;
@@ -1,5 +0,0 @@
1
- import { LogFacade } from '../types/Log';
2
-
3
- declare function log(): LogFacade;
4
- declare function log(...data: any[]): void;
5
- export default log;
@@ -1,5 +0,0 @@
1
- import { BaseModel, Model as ModelInterface } from '../types/Model';
2
- import { AppFacade, AppFacades } from '../types/App';
3
-
4
- export declare function BaseModelFactory(app: AppFacade, abstract: string): typeof BaseModel;
5
- export declare function ModelFactory(facades: AppFacades, abstract: string, CustomModel: typeof BaseModel): typeof ModelInterface;
@@ -1,15 +0,0 @@
1
- import { Emitter } from 'nanoevents';
2
- import { EventSourceEvents, EventSource } from '../types/Event';
3
- import { Constructor } from '../types/Support';
4
-
5
- export declare function isEventSource<T>(value: T): value is T & EventSource<any>;
6
- export declare function HasEvents<T extends EventSourceEvents, U extends Constructor>(Base: U): {
7
- new (...args: any[]): {
8
- emitter: Emitter<EventSourceEvents>;
9
- "__#1@#createNanoEvents"(): Emitter<EventSourceEvents>;
10
- on<E extends keyof T>(event: E, callback: T[E]): import('nanoevents').Unsubscribe;
11
- once<E_1 extends keyof T>(event: E_1, callback: T[E_1]): void;
12
- emit<E_2 extends keyof T>(event: E_2, data?: Omit<Parameters<T[E_2]>[0], "source">): void;
13
- [Symbol.toStringTag]: string;
14
- };
15
- } & U;
@@ -1,17 +0,0 @@
1
- import { ReducerCallback, Reducer } from '../types/Reducer';
2
- import { Constructor } from '../types/Support';
3
- import { Collection } from '../types/Collection';
4
-
5
- export declare function Reducible<T extends Constructor>(Base: T): {
6
- new (...args: any[]): {
7
- reducers: {
8
- [name: string]: Collection<Reducer>;
9
- };
10
- reducer(name: string, callback: ReducerCallback, priority?: number): () => void;
11
- removeReducer(name: string, callback: ReducerCallback): void;
12
- getReducer(name: string): Collection<Reducer>;
13
- hasReducer(name: string): boolean;
14
- clearReducer(name: string): void;
15
- flushReducers(): void;
16
- };
17
- } & T;
@@ -1,4 +0,0 @@
1
- import { Collection } from '../types/Collection';
2
-
3
- export declare function cartesian<T>(...arrays: T[][]): T[][];
4
- export declare function isCollection(instance: unknown): instance is Collection;
@@ -1,2 +0,0 @@
1
- declare const reader: (name: string, type?: 'data' | 'error') => any;
2
- export default reader;
@@ -1 +0,0 @@
1
- export declare const createMergedSearchParams: (...urls: string[]) => URLSearchParams;
@@ -1,79 +0,0 @@
1
- import { AppConfiguration, ConfigFacade } from './Config';
2
- import { PluginInterface } from './Plugin';
3
- import { LogFacade } from './Log';
4
- import { AuthFacade } from './Auth';
5
- import { BaseModel, Model, ModelSchema, ModelSchemaAttributes } from './Model';
6
- import { RouteFacade } from './Route';
7
- import { EventSource, Event } from './Event';
8
- import { ErrorFacade } from './Error';
9
- import { ReducibleInterface } from './Reducer';
10
- import { Constructor } from './Support';
11
-
12
- type Plugin = PluginInterface<AppFacade, AppFacades>;
13
- export type GlobalModelEvents = {
14
- 'save': (e: ModelGlobalEvent) => void;
15
- 'delete': (e: ModelGlobalEvent) => void;
16
- 'restore': (e: ModelGlobalEvent) => void;
17
- 'create': (e: ModelGlobalEvent) => void;
18
- 'update': (e: ModelGlobalEvent) => void;
19
- 'fetch': (e: ModelGlobalEvent) => void;
20
- 'error': (e: ModelGlobalErrorEvent) => void;
21
- };
22
- export type ModelGlobalEvent = Event<ModelFacade> & {
23
- class: string;
24
- model: BaseModel;
25
- force?: boolean;
26
- };
27
- export type ModelGlobalErrorEvent = ModelGlobalEvent & {
28
- error: unknown;
29
- operation: 'save' | 'delete' | 'restore' | 'forceDelete';
30
- };
31
- export type ModelFacade = EventSource<GlobalModelEvents> & ReducibleInterface & {
32
- schema(): ModelSchema;
33
- schema(abstract: string): ModelSchemaAttributes;
34
- make(): Record<string, typeof Model>;
35
- make(abstract: string): typeof Model;
36
- boot(app: AppFacade): void;
37
- };
38
- export type AppEvents = {
39
- 'init': (e: InitEvent) => void;
40
- 'booted': (e: Event<AppFacade>) => void;
41
- 'booting': (e: Event<AppFacade>) => void;
42
- };
43
- export type InitEvent = Event<AppFacade> & {
44
- register(plugin: Plugin): void;
45
- };
46
- export type AppExternal = {
47
- boot: (config?: AppConfiguration) => Promise<AppFacades>;
48
- make(): AppFacades;
49
- make<T extends keyof AppFacades>(key: T): AppFacades[T];
50
- plugins: () => Plugin[];
51
- on: EventSource<AppEvents>['once'];
52
- environment(): string;
53
- environment(...environments: string[]): boolean;
54
- getPlugin<T extends Plugin>(abstract: Constructor<T>): T | undefined;
55
- hasDebugModeEnabled(): boolean;
56
- isLocal(): boolean;
57
- isProduction(): boolean;
58
- };
59
- export type AppFacade = AppExternal & {
60
- has(key: string): boolean;
61
- bind<T extends keyof AppFacades>(key: T, facade: AppFacades[T]): void;
62
- emit: EventSource<AppEvents>['emit'];
63
- once: EventSource<AppEvents>['once'];
64
- on: EventSource<AppEvents>['on'];
65
- };
66
- export type AppFacades = {
67
- auth: AuthFacade;
68
- config: ConfigFacade;
69
- error: ErrorFacade;
70
- log: LogFacade;
71
- model: ModelFacade;
72
- route: RouteFacade;
73
- [key: string]: any;
74
- };
75
- export type BootOptions = {
76
- config?: AppConfiguration;
77
- skipBootRequest?: boolean;
78
- };
79
- export {};
@@ -1,51 +0,0 @@
1
- import { default as PropertyBag } from '../contracts/PropertyBag';
2
- import { Event, EventSource } from './Event';
3
- import { JsonObject, JsonValue } from './Support';
4
- import { Operator, Collection } from './Collection';
5
- import { PropertyBagEventMap } from './PropertyBag';
6
-
7
- export type Scope<R, C> = (builder: BuilderInterface<R, C>) => BuilderInterface<R, C> | void;
8
- export type ExtendedOperator = Operator | 'like' | 'notLike' | 'between' | 'notBetween' | 'isNull' | 'isNotNull';
9
- export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
10
- lock(path: string): void;
11
- where(scope: Scope<R, C>): BuilderInterface<R, C>;
12
- where(key: string, value: JsonValue): BuilderInterface<R, C>;
13
- where(key: string, operator: ExtendedOperator, value: JsonValue): BuilderInterface<R, C>;
14
- where(key: string | Scope<R, C>, operatorOrValue?: ExtendedOperator | JsonValue, value?: JsonValue): BuilderInterface<R, C>;
15
- with(relation: string | string[]): BuilderInterface<R, C>;
16
- withOnly(relation: string | string[]): BuilderInterface<R, C>;
17
- without(relation: string | string[]): BuilderInterface<R, C>;
18
- whereNull(key: string): BuilderInterface<R, C>;
19
- whereNotNull(key: string): BuilderInterface<R, C>;
20
- whereBetween(key: string, value: [JsonValue, JsonValue]): BuilderInterface<R, C>;
21
- whereNotBetween(key: string, value: [JsonValue, JsonValue]): BuilderInterface<R, C>;
22
- orderBy(column: string, direction?: 'asc' | 'desc'): BuilderInterface<R, C>;
23
- searchBy(term: string): BuilderInterface<R, C>;
24
- minified(): BuilderInterface<R, C>;
25
- limit(value: number): BuilderInterface<R, C>;
26
- include(searchParams: URLSearchParams): BuilderInterface<R, C>;
27
- get(page?: number, replaceLinksWith?: string): Promise<C>;
28
- all(): Promise<Collection<R>>;
29
- first(): Promise<R | null>;
30
- find(id: string | number): Promise<R | null>;
31
- unset(key: string): BuilderInterface<R, C>;
32
- };
33
- export type BuilderEventMap<R, C> = PropertyBagEventMap & {
34
- 'change': (e: BuilderChangeEvent<R, C>) => void;
35
- 'submit': (e: BuilderSubmitEvent<R, C>) => void;
36
- 'success': (e: BuilderSuccessEvent<R, C>) => void;
37
- 'error': (e: BuilderErrorEvent<R, C>) => void;
38
- };
39
- export type BuilderChangeEvent<R, C> = Event<BuilderInterface<R, C>> & {
40
- data: PropertyBag<JsonObject>;
41
- };
42
- export type BuilderSubmitEvent<R, C> = Event<BuilderInterface<R, C>> & {
43
- data: PropertyBag<JsonObject>;
44
- };
45
- export type BuilderSuccessEvent<R, C> = Event<BuilderInterface<R, C>> & {
46
- response: C;
47
- items: Collection<R> | R | null;
48
- };
49
- export type BuilderErrorEvent<R, C> = Event<BuilderInterface<R, C>> & {
50
- error: unknown;
51
- };