@orchestr-sh/orchestr 1.0.1 → 1.1.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 (93) hide show
  1. package/dist/Database/Adapters/DrizzleAdapter.d.ts +119 -0
  2. package/dist/Database/Adapters/DrizzleAdapter.d.ts.map +1 -0
  3. package/dist/Database/Adapters/DrizzleAdapter.js +384 -0
  4. package/dist/Database/Adapters/DrizzleAdapter.js.map +1 -0
  5. package/dist/Database/Connection.d.ts +103 -0
  6. package/dist/Database/Connection.d.ts.map +1 -0
  7. package/dist/Database/Connection.js +164 -0
  8. package/dist/Database/Connection.js.map +1 -0
  9. package/dist/Database/Contracts/DatabaseAdapter.d.ts +85 -0
  10. package/dist/Database/Contracts/DatabaseAdapter.d.ts.map +1 -0
  11. package/dist/Database/Contracts/DatabaseAdapter.js +9 -0
  12. package/dist/Database/Contracts/DatabaseAdapter.js.map +1 -0
  13. package/dist/Database/Contracts/QueryBuilderInterface.d.ts +196 -0
  14. package/dist/Database/Contracts/QueryBuilderInterface.d.ts.map +1 -0
  15. package/dist/Database/Contracts/QueryBuilderInterface.js +8 -0
  16. package/dist/Database/Contracts/QueryBuilderInterface.js.map +1 -0
  17. package/dist/Database/Contracts/Schema.d.ts +234 -0
  18. package/dist/Database/Contracts/Schema.d.ts.map +1 -0
  19. package/dist/Database/Contracts/Schema.js +8 -0
  20. package/dist/Database/Contracts/Schema.js.map +1 -0
  21. package/dist/Database/DatabaseManager.d.ts +61 -0
  22. package/dist/Database/DatabaseManager.d.ts.map +1 -0
  23. package/dist/Database/DatabaseManager.js +102 -0
  24. package/dist/Database/DatabaseManager.js.map +1 -0
  25. package/dist/Database/DatabaseServiceProvider.d.ts +17 -0
  26. package/dist/Database/DatabaseServiceProvider.d.ts.map +1 -0
  27. package/dist/Database/DatabaseServiceProvider.js +44 -0
  28. package/dist/Database/DatabaseServiceProvider.js.map +1 -0
  29. package/dist/Database/Eloquent/Builder.d.ts +76 -0
  30. package/dist/Database/Eloquent/Builder.d.ts.map +1 -0
  31. package/dist/Database/Eloquent/Builder.js +154 -0
  32. package/dist/Database/Eloquent/Builder.js.map +1 -0
  33. package/dist/Database/Eloquent/Collection.d.ts +137 -0
  34. package/dist/Database/Eloquent/Collection.d.ts.map +1 -0
  35. package/dist/Database/Eloquent/Collection.js +284 -0
  36. package/dist/Database/Eloquent/Collection.js.map +1 -0
  37. package/dist/Database/Eloquent/Concerns/HasAttributes.d.ts +44 -0
  38. package/dist/Database/Eloquent/Concerns/HasAttributes.d.ts.map +1 -0
  39. package/dist/Database/Eloquent/Concerns/HasAttributes.js +8 -0
  40. package/dist/Database/Eloquent/Concerns/HasAttributes.js.map +1 -0
  41. package/dist/Database/Eloquent/Concerns/HasTimestamps.d.ts +41 -0
  42. package/dist/Database/Eloquent/Concerns/HasTimestamps.d.ts.map +1 -0
  43. package/dist/Database/Eloquent/Concerns/HasTimestamps.js +14 -0
  44. package/dist/Database/Eloquent/Concerns/HasTimestamps.js.map +1 -0
  45. package/dist/Database/Eloquent/Model.d.ts +265 -0
  46. package/dist/Database/Eloquent/Model.d.ts.map +1 -0
  47. package/dist/Database/Eloquent/Model.js +523 -0
  48. package/dist/Database/Eloquent/Model.js.map +1 -0
  49. package/dist/Database/Eloquent/SoftDeletes.d.ts +41 -0
  50. package/dist/Database/Eloquent/SoftDeletes.d.ts.map +1 -0
  51. package/dist/Database/Eloquent/SoftDeletes.js +22 -0
  52. package/dist/Database/Eloquent/SoftDeletes.js.map +1 -0
  53. package/dist/Database/Ensemble/Concerns/HasAttributes.d.ts +44 -0
  54. package/dist/Database/Ensemble/Concerns/HasAttributes.d.ts.map +1 -0
  55. package/dist/Database/Ensemble/Concerns/HasAttributes.js +8 -0
  56. package/dist/Database/Ensemble/Concerns/HasAttributes.js.map +1 -0
  57. package/dist/Database/Ensemble/Concerns/HasTimestamps.d.ts +41 -0
  58. package/dist/Database/Ensemble/Concerns/HasTimestamps.d.ts.map +1 -0
  59. package/dist/Database/Ensemble/Concerns/HasTimestamps.js +14 -0
  60. package/dist/Database/Ensemble/Concerns/HasTimestamps.js.map +1 -0
  61. package/dist/Database/Ensemble/Ensemble.d.ts +266 -0
  62. package/dist/Database/Ensemble/Ensemble.d.ts.map +1 -0
  63. package/dist/Database/Ensemble/Ensemble.js +524 -0
  64. package/dist/Database/Ensemble/Ensemble.js.map +1 -0
  65. package/dist/Database/Ensemble/EnsembleBuilder.d.ts +76 -0
  66. package/dist/Database/Ensemble/EnsembleBuilder.d.ts.map +1 -0
  67. package/dist/Database/Ensemble/EnsembleBuilder.js +154 -0
  68. package/dist/Database/Ensemble/EnsembleBuilder.js.map +1 -0
  69. package/dist/Database/Ensemble/EnsembleCollection.d.ts +137 -0
  70. package/dist/Database/Ensemble/EnsembleCollection.d.ts.map +1 -0
  71. package/dist/Database/Ensemble/EnsembleCollection.js +284 -0
  72. package/dist/Database/Ensemble/EnsembleCollection.js.map +1 -0
  73. package/dist/Database/Ensemble/SoftDeletes.d.ts +41 -0
  74. package/dist/Database/Ensemble/SoftDeletes.d.ts.map +1 -0
  75. package/dist/Database/Ensemble/SoftDeletes.js +22 -0
  76. package/dist/Database/Ensemble/SoftDeletes.js.map +1 -0
  77. package/dist/Database/Query/Builder.d.ts +219 -0
  78. package/dist/Database/Query/Builder.d.ts.map +1 -0
  79. package/dist/Database/Query/Builder.js +554 -0
  80. package/dist/Database/Query/Builder.js.map +1 -0
  81. package/dist/Database/Query/Expression.d.ts +22 -0
  82. package/dist/Database/Query/Expression.d.ts.map +1 -0
  83. package/dist/Database/Query/Expression.js +35 -0
  84. package/dist/Database/Query/Expression.js.map +1 -0
  85. package/dist/Facades/DB.d.ts +7 -0
  86. package/dist/Facades/DB.d.ts.map +1 -0
  87. package/dist/Facades/DB.js +42 -0
  88. package/dist/Facades/DB.js.map +1 -0
  89. package/dist/index.d.ts +18 -0
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +27 -1
  92. package/dist/index.js.map +1 -1
  93. package/package.json +13 -5
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Query Builder
3
+ *
4
+ * Fluent query builder for constructing database queries
5
+ */
6
+ import { DatabaseAdapter } from '../Contracts/DatabaseAdapter';
7
+ import { QueryBuilderInterface, WhereOperator, OrderDirection, WhereClause, JoinClause, OrderByClause } from '../Contracts/QueryBuilderInterface';
8
+ export declare class Builder<T = any> implements QueryBuilderInterface<T> {
9
+ protected adapter: DatabaseAdapter;
10
+ protected _columns: string[];
11
+ protected _distinct: boolean;
12
+ protected _table?: string;
13
+ protected _wheres: WhereClause[];
14
+ protected _joins: JoinClause[];
15
+ protected _orders: OrderByClause[];
16
+ protected _groups: string[];
17
+ protected _havings: any[];
18
+ protected _limit?: number;
19
+ protected _offset?: number;
20
+ protected _bindings: any[];
21
+ constructor(adapter: DatabaseAdapter);
22
+ /**
23
+ * Set the columns to be selected
24
+ */
25
+ select(...columns: string[]): this;
26
+ /**
27
+ * Add a raw select expression
28
+ */
29
+ selectRaw(sql: string, bindings?: any[]): this;
30
+ /**
31
+ * Force the query to only return distinct results
32
+ */
33
+ distinct(): this;
34
+ /**
35
+ * Set the table which the query is targeting
36
+ */
37
+ from(table: string): this;
38
+ /**
39
+ * Add a basic where clause
40
+ */
41
+ where(column: string, operator?: WhereOperator | any, value?: any): this;
42
+ /**
43
+ * Add an "or where" clause
44
+ */
45
+ orWhere(column: string, operator?: WhereOperator | any, value?: any): this;
46
+ /**
47
+ * Add a where in clause
48
+ */
49
+ whereIn(column: string, values: any[]): this;
50
+ /**
51
+ * Add a where not in clause
52
+ */
53
+ whereNotIn(column: string, values: any[]): this;
54
+ /**
55
+ * Add a where null clause
56
+ */
57
+ whereNull(column: string): this;
58
+ /**
59
+ * Add a where not null clause
60
+ */
61
+ whereNotNull(column: string): this;
62
+ /**
63
+ * Add a where between clause
64
+ */
65
+ whereBetween(column: string, values: [any, any]): this;
66
+ /**
67
+ * Add a raw where clause
68
+ */
69
+ whereRaw(sql: string, bindings?: any[]): this;
70
+ /**
71
+ * Add a join clause
72
+ */
73
+ join(table: string, first: string, operator?: string, second?: string): this;
74
+ /**
75
+ * Add a left join clause
76
+ */
77
+ leftJoin(table: string, first: string, operator?: string, second?: string): this;
78
+ /**
79
+ * Add a right join clause
80
+ */
81
+ rightJoin(table: string, first: string, operator?: string, second?: string): this;
82
+ /**
83
+ * Add an order by clause
84
+ */
85
+ orderBy(column: string, direction?: OrderDirection): this;
86
+ /**
87
+ * Order by latest (descending created_at)
88
+ */
89
+ latest(column?: string): this;
90
+ /**
91
+ * Order by oldest (ascending created_at)
92
+ */
93
+ oldest(column?: string): this;
94
+ /**
95
+ * Add a group by clause
96
+ */
97
+ groupBy(...columns: string[]): this;
98
+ /**
99
+ * Add a having clause
100
+ */
101
+ having(column: string, operator?: string, value?: any): this;
102
+ /**
103
+ * Set the limit
104
+ */
105
+ limit(value: number): this;
106
+ /**
107
+ * Alias for limit
108
+ */
109
+ take(value: number): this;
110
+ /**
111
+ * Set the offset
112
+ */
113
+ offset(value: number): this;
114
+ /**
115
+ * Alias for offset
116
+ */
117
+ skip(value: number): this;
118
+ /**
119
+ * Get all records
120
+ */
121
+ get(): Promise<T[]>;
122
+ /**
123
+ * Get the first record
124
+ */
125
+ first(): Promise<T | null>;
126
+ /**
127
+ * Find a record by ID
128
+ */
129
+ find(id: any): Promise<T | null>;
130
+ /**
131
+ * Get a single column's value
132
+ */
133
+ value(column: string): Promise<any>;
134
+ /**
135
+ * Get an array of column values
136
+ */
137
+ pluck(column: string): Promise<any[]>;
138
+ /**
139
+ * Determine if any rows exist
140
+ */
141
+ exists(): Promise<boolean>;
142
+ /**
143
+ * Get the count of records
144
+ */
145
+ count(column?: string): Promise<number>;
146
+ /**
147
+ * Get the maximum value of a column
148
+ */
149
+ max(column: string): Promise<number | null>;
150
+ /**
151
+ * Get the minimum value of a column
152
+ */
153
+ min(column: string): Promise<number | null>;
154
+ /**
155
+ * Get the average value of a column
156
+ */
157
+ avg(column: string): Promise<number | null>;
158
+ /**
159
+ * Get the sum of a column's values
160
+ */
161
+ sum(column: string): Promise<number>;
162
+ /**
163
+ * Execute an aggregate function
164
+ */
165
+ protected aggregate(func: string, column: string): Promise<any>;
166
+ /**
167
+ * Insert a new record
168
+ */
169
+ insert(values: Record<string, any> | Record<string, any>[]): Promise<boolean>;
170
+ /**
171
+ * Insert a new record and get the ID
172
+ */
173
+ insertGetId(values: Record<string, any>, sequence?: string): Promise<any>;
174
+ /**
175
+ * Update records
176
+ */
177
+ update(values: Record<string, any>): Promise<number>;
178
+ /**
179
+ * Delete records
180
+ */
181
+ delete(): Promise<number>;
182
+ /**
183
+ * Truncate the table
184
+ */
185
+ truncate(): Promise<void>;
186
+ /**
187
+ * Get the SQL query string
188
+ */
189
+ toSql(): string;
190
+ /**
191
+ * Compile the columns
192
+ */
193
+ protected compileColumns(): string;
194
+ /**
195
+ * Compile the where clauses
196
+ */
197
+ protected compileWheres(): string;
198
+ /**
199
+ * Compile the join clauses
200
+ */
201
+ protected compileJoins(): string;
202
+ /**
203
+ * Compile the order by clauses
204
+ */
205
+ protected compileOrders(): string;
206
+ /**
207
+ * Compile the having clauses
208
+ */
209
+ protected compileHavings(): string;
210
+ /**
211
+ * Get the bindings for the query
212
+ */
213
+ getBindings(): any[];
214
+ /**
215
+ * Clone the query builder
216
+ */
217
+ clone(): Builder<T>;
218
+ }
219
+ //# sourceMappingURL=Builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../../../src/Database/Query/Builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EAEd,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,oCAAoC,CAAC;AAG5C,qBAAa,OAAO,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,qBAAqB,CAAC,CAAC,CAAC;IAan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