@darseen/vaze 1.1.1 → 1.2.1
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/README.md +29 -5
- package/dist/index.cjs +125 -63
- package/dist/index.d.cts +754 -93
- package/dist/index.d.ts +754 -93
- package/dist/index.js +124 -62
- package/package.json +16 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,721 @@
|
|
|
1
|
-
|
|
2
|
-
import { ApiResponse, FileWithUrl, Folder } from '@repo/types';
|
|
3
|
-
export { ApiResponse, FileWithUrl as File, Folder } from '@repo/types';
|
|
1
|
+
declare const entityKind: unique symbol;
|
|
4
2
|
|
|
5
|
-
declare class
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
declare class CasingCache {
|
|
4
|
+
static readonly [entityKind]: string;
|
|
5
|
+
private cachedTables;
|
|
6
|
+
private convert;
|
|
7
|
+
constructor(casing?: Casing);
|
|
8
|
+
getColumnCasing(column: Column): string;
|
|
9
|
+
private cacheTable;
|
|
10
|
+
clearCache(): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Subquery<TAlias extends string = string, TSelectedFields extends Record<string, unknown> = Record<string, unknown>> extends SQLWrapper {
|
|
14
|
+
}
|
|
15
|
+
declare class Subquery<TAlias extends string = string, TSelectedFields extends Record<string, unknown> = Record<string, unknown>> implements SQLWrapper {
|
|
16
|
+
static readonly [entityKind]: string;
|
|
17
|
+
_: {
|
|
18
|
+
brand: 'Subquery';
|
|
19
|
+
sql: SQL;
|
|
20
|
+
selectedFields: TSelectedFields;
|
|
21
|
+
alias: TAlias;
|
|
22
|
+
isWith: boolean;
|
|
23
|
+
usedTables?: string[];
|
|
24
|
+
};
|
|
25
|
+
constructor(sql: SQL, fields: TSelectedFields, alias: string, isWith?: boolean, usedTables?: string[]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface TableConfig$1<TColumn extends Column = Column<any>> {
|
|
29
|
+
name: string;
|
|
30
|
+
schema: string | undefined;
|
|
31
|
+
columns: Record<string, TColumn>;
|
|
32
|
+
dialect: string;
|
|
33
|
+
}
|
|
34
|
+
interface Table<T extends TableConfig$1 = TableConfig$1> extends SQLWrapper {
|
|
35
|
+
}
|
|
36
|
+
declare class Table<T extends TableConfig$1 = TableConfig$1> implements SQLWrapper {
|
|
37
|
+
static readonly [entityKind]: string;
|
|
38
|
+
readonly _: {
|
|
39
|
+
readonly brand: 'Table';
|
|
40
|
+
readonly config: T;
|
|
41
|
+
readonly name: T['name'];
|
|
42
|
+
readonly schema: T['schema'];
|
|
43
|
+
readonly columns: T['columns'];
|
|
44
|
+
readonly inferSelect: InferSelectModel<Table<T>>;
|
|
45
|
+
readonly inferInsert: InferInsertModel<Table<T>>;
|
|
46
|
+
};
|
|
47
|
+
readonly $inferSelect: InferSelectModel<Table<T>>;
|
|
48
|
+
readonly $inferInsert: InferInsertModel<Table<T>>;
|
|
49
|
+
constructor(name: string, schema: string | undefined, baseName: string);
|
|
50
|
+
}
|
|
51
|
+
type MapColumnName<TName extends string, TColumn extends Column, TDBColumNames extends boolean> = TDBColumNames extends true ? TColumn['_']['name'] : TName;
|
|
52
|
+
type InferModelFromColumns<TColumns extends Record<string, Column>, TInferMode extends 'select' | 'insert' = 'select', TConfig extends {
|
|
53
|
+
dbColumnNames: boolean;
|
|
54
|
+
override?: boolean;
|
|
55
|
+
} = {
|
|
56
|
+
dbColumnNames: false;
|
|
57
|
+
override: false;
|
|
58
|
+
}> = Simplify<TInferMode extends 'insert' ? {
|
|
59
|
+
[Key in keyof TColumns & string as RequiredKeyOnly<MapColumnName<Key, TColumns[Key], TConfig['dbColumnNames']>, TColumns[Key]>]: GetColumnData<TColumns[Key], 'query'>;
|
|
60
|
+
} & {
|
|
61
|
+
[Key in keyof TColumns & string as OptionalKeyOnly<MapColumnName<Key, TColumns[Key], TConfig['dbColumnNames']>, TColumns[Key], TConfig['override']>]?: GetColumnData<TColumns[Key], 'query'> | undefined;
|
|
62
|
+
} : {
|
|
63
|
+
[Key in keyof TColumns & string as MapColumnName<Key, TColumns[Key], TConfig['dbColumnNames']>]: GetColumnData<TColumns[Key], 'query'>;
|
|
64
|
+
}>;
|
|
65
|
+
type InferSelectModel<TTable extends Table, TConfig extends {
|
|
66
|
+
dbColumnNames: boolean;
|
|
67
|
+
} = {
|
|
68
|
+
dbColumnNames: false;
|
|
69
|
+
}> = InferModelFromColumns<TTable['_']['columns'], 'select', TConfig>;
|
|
70
|
+
type InferInsertModel<TTable extends Table, TConfig extends {
|
|
71
|
+
dbColumnNames: boolean;
|
|
72
|
+
override?: boolean;
|
|
73
|
+
} = {
|
|
74
|
+
dbColumnNames: false;
|
|
75
|
+
override: false;
|
|
76
|
+
}> = InferModelFromColumns<TTable['_']['columns'], 'insert', TConfig>;
|
|
77
|
+
|
|
78
|
+
type JoinNullability = 'nullable' | 'not-null';
|
|
79
|
+
type ApplyNullability<T, TNullability extends JoinNullability> = TNullability extends 'nullable' ? T | null : TNullability extends 'null' ? null : T;
|
|
80
|
+
type ApplyNotNullMapToJoins<TResult, TNullabilityMap extends Record<string, JoinNullability>> = {
|
|
81
|
+
[TTableName in keyof TResult & keyof TNullabilityMap & string]: ApplyNullability<TResult[TTableName], TNullabilityMap[TTableName]>;
|
|
82
|
+
} & {};
|
|
83
|
+
type SelectMode = 'partial' | 'single' | 'multiple';
|
|
84
|
+
type SelectResult<TResult, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability>> = TSelectMode extends 'partial' ? SelectPartialResult<TResult, TNullabilityMap> : TSelectMode extends 'single' ? SelectResultFields<TResult> : ApplyNotNullMapToJoins<SelectResultFields<TResult>, TNullabilityMap>;
|
|
85
|
+
type SelectPartialResult<TFields, TNullability extends Record<string, JoinNullability>> = TNullability extends TNullability ? {
|
|
86
|
+
[Key in keyof TFields]: TFields[Key] extends infer TField ? TField extends Table ? TField['_']['name'] extends keyof TNullability ? ApplyNullability<SelectResultFields<TField['_']['columns']>, TNullability[TField['_']['name']]> : never : TField extends Column ? TField['_']['tableName'] extends keyof TNullability ? ApplyNullability<SelectResultField<TField>, TNullability[TField['_']['tableName']]> : never : TField extends SQL | SQL.Aliased ? SelectResultField<TField> : TField extends Subquery ? FromSingleKeyObject<TField['_']['selectedFields'], TField['_']['selectedFields'] extends {
|
|
87
|
+
[key: string]: infer TValue;
|
|
88
|
+
} ? SelectResultField<TValue> : never, 'You can only select one column in the subquery'> : TField extends Record<string, any> ? TField[keyof TField] extends AnyColumn<{
|
|
89
|
+
tableName: infer TTableName extends string;
|
|
90
|
+
}> | SQL | SQL.Aliased ? Not<IsUnion<TTableName>> extends true ? ApplyNullability<SelectResultFields<TField>, TNullability[TTableName]> : SelectPartialResult<TField, TNullability> : never : never : never;
|
|
91
|
+
} : never;
|
|
92
|
+
type SelectResultField<T, TDeep extends boolean = true> = T extends DrizzleTypeError<any> ? T : T extends Table ? Equal<TDeep, true> extends true ? SelectResultField<T['_']['columns'], false> : never : T extends Column<any> ? GetColumnData<T> : T extends SQL | SQL.Aliased ? T['_']['type'] : T extends Record<string, any> ? SelectResultFields<T, true> : never;
|
|
93
|
+
type SelectResultFields<TSelectedFields, TDeep extends boolean = true> = Simplify<{
|
|
94
|
+
[Key in keyof TSelectedFields]: SelectResultField<TSelectedFields[Key], TDeep>;
|
|
95
|
+
}>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* This class is used to indicate a primitive param value that is used in `sql` tag.
|
|
99
|
+
* It is only used on type level and is never instantiated at runtime.
|
|
100
|
+
* If you see a value of this type in the code, its runtime value is actually the primitive param value.
|
|
101
|
+
*/
|
|
102
|
+
declare class FakePrimitiveParam {
|
|
103
|
+
static readonly [entityKind]: string;
|
|
104
|
+
}
|
|
105
|
+
interface BuildQueryConfig {
|
|
106
|
+
casing: CasingCache;
|
|
107
|
+
escapeName(name: string): string;
|
|
108
|
+
escapeParam(num: number, value: unknown): string;
|
|
109
|
+
escapeString(str: string): string;
|
|
110
|
+
prepareTyping?: (encoder: DriverValueEncoder<unknown, unknown>) => QueryTypingsValue;
|
|
111
|
+
paramStartIndex?: {
|
|
112
|
+
value: number;
|
|
113
|
+
};
|
|
114
|
+
inlineParams?: boolean;
|
|
115
|
+
invokeSource?: 'indexes' | undefined;
|
|
116
|
+
}
|
|
117
|
+
type QueryTypingsValue = 'json' | 'decimal' | 'time' | 'timestamp' | 'uuid' | 'date' | 'none';
|
|
118
|
+
interface Query {
|
|
119
|
+
sql: string;
|
|
120
|
+
params: unknown[];
|
|
121
|
+
}
|
|
122
|
+
interface QueryWithTypings extends Query {
|
|
123
|
+
typings?: QueryTypingsValue[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Any value that implements the `getSQL` method. The implementations include:
|
|
127
|
+
* - `Table`
|
|
128
|
+
* - `Column`
|
|
129
|
+
* - `View`
|
|
130
|
+
* - `Subquery`
|
|
131
|
+
* - `SQL`
|
|
132
|
+
* - `SQL.Aliased`
|
|
133
|
+
* - `Placeholder`
|
|
134
|
+
* - `Param`
|
|
135
|
+
*/
|
|
136
|
+
interface SQLWrapper {
|
|
137
|
+
getSQL(): SQL;
|
|
138
|
+
shouldOmitSQLParens?(): boolean;
|
|
139
|
+
}
|
|
140
|
+
declare class StringChunk implements SQLWrapper {
|
|
141
|
+
static readonly [entityKind]: string;
|
|
142
|
+
readonly value: string[];
|
|
143
|
+
constructor(value: string | string[]);
|
|
144
|
+
getSQL(): SQL<unknown>;
|
|
145
|
+
}
|
|
146
|
+
type GetDecoderResult<T> = T extends Column ? T['_']['data'] : T extends DriverValueDecoder<infer TData, any> | DriverValueDecoder<infer TData, any>['mapFromDriverValue'] ? TData : never;
|
|
147
|
+
/**
|
|
148
|
+
* Any DB name (table, column, index etc.)
|
|
149
|
+
*/
|
|
150
|
+
declare class Name implements SQLWrapper {
|
|
151
|
+
readonly value: string;
|
|
152
|
+
static readonly [entityKind]: string;
|
|
153
|
+
protected brand: 'Name';
|
|
154
|
+
constructor(value: string);
|
|
155
|
+
getSQL(): SQL<unknown>;
|
|
156
|
+
}
|
|
157
|
+
interface DriverValueDecoder<TData, TDriverParam> {
|
|
158
|
+
mapFromDriverValue(value: TDriverParam): TData;
|
|
159
|
+
}
|
|
160
|
+
interface DriverValueEncoder<TData, TDriverParam> {
|
|
161
|
+
mapToDriverValue(value: TData): TDriverParam | SQL;
|
|
162
|
+
}
|
|
163
|
+
interface DriverValueMapper<TData, TDriverParam> extends DriverValueDecoder<TData, TDriverParam>, DriverValueEncoder<TData, TDriverParam> {
|
|
164
|
+
}
|
|
165
|
+
/** Parameter value that is optionally bound to an encoder (for example, a column). */
|
|
166
|
+
declare class Param<TDataType = unknown, TDriverParamType = TDataType> implements SQLWrapper {
|
|
167
|
+
readonly value: TDataType;
|
|
168
|
+
readonly encoder: DriverValueEncoder<TDataType, TDriverParamType>;
|
|
169
|
+
static readonly [entityKind]: string;
|
|
170
|
+
protected brand: 'BoundParamValue';
|
|
171
|
+
/**
|
|
172
|
+
* @param value - Parameter value
|
|
173
|
+
* @param encoder - Encoder to convert the value to a driver parameter
|
|
174
|
+
*/
|
|
175
|
+
constructor(value: TDataType, encoder?: DriverValueEncoder<TDataType, TDriverParamType>);
|
|
176
|
+
getSQL(): SQL<unknown>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Anything that can be passed to the `` sql`...` `` tagged function.
|
|
180
|
+
*/
|
|
181
|
+
type SQLChunk = StringChunk | SQLChunk[] | SQLWrapper | SQL | Table | View | Subquery | AnyColumn | Param | Name | undefined | FakePrimitiveParam | Placeholder;
|
|
182
|
+
declare class SQL<T = unknown> implements SQLWrapper {
|
|
183
|
+
readonly queryChunks: SQLChunk[];
|
|
184
|
+
static readonly [entityKind]: string;
|
|
185
|
+
_: {
|
|
186
|
+
brand: 'SQL';
|
|
187
|
+
type: T;
|
|
188
|
+
};
|
|
189
|
+
private shouldInlineParams;
|
|
190
|
+
constructor(queryChunks: SQLChunk[]);
|
|
191
|
+
append(query: SQL): this;
|
|
192
|
+
toQuery(config: BuildQueryConfig): QueryWithTypings;
|
|
193
|
+
buildQueryFromSourceParams(chunks: SQLChunk[], _config: BuildQueryConfig): Query;
|
|
194
|
+
private mapInlineParam;
|
|
195
|
+
getSQL(): SQL;
|
|
196
|
+
as(alias: string): SQL.Aliased<T>;
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated
|
|
199
|
+
* Use ``sql<DataType>`query`.as(alias)`` instead.
|
|
200
|
+
*/
|
|
201
|
+
as<TData>(): SQL<TData>;
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated
|
|
204
|
+
* Use ``sql<DataType>`query`.as(alias)`` instead.
|
|
205
|
+
*/
|
|
206
|
+
as<TData>(alias: string): SQL.Aliased<TData>;
|
|
207
|
+
mapWith<TDecoder extends DriverValueDecoder<any, any> | DriverValueDecoder<any, any>['mapFromDriverValue']>(decoder: TDecoder): SQL<GetDecoderResult<TDecoder>>;
|
|
208
|
+
inlineParams(): this;
|
|
209
|
+
/**
|
|
210
|
+
* This method is used to conditionally include a part of the query.
|
|
211
|
+
*
|
|
212
|
+
* @param condition - Condition to check
|
|
213
|
+
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
214
|
+
*/
|
|
215
|
+
if(condition: any | undefined): this | undefined;
|
|
216
|
+
}
|
|
217
|
+
declare namespace SQL {
|
|
218
|
+
class Aliased<T = unknown> implements SQLWrapper {
|
|
219
|
+
readonly sql: SQL;
|
|
220
|
+
readonly fieldAlias: string;
|
|
221
|
+
static readonly [entityKind]: string;
|
|
222
|
+
_: {
|
|
223
|
+
brand: 'SQL.Aliased';
|
|
224
|
+
type: T;
|
|
225
|
+
};
|
|
226
|
+
constructor(sql: SQL, fieldAlias: string);
|
|
227
|
+
getSQL(): SQL;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
declare class Placeholder<TName extends string = string, TValue = any> implements SQLWrapper {
|
|
231
|
+
readonly name: TName;
|
|
232
|
+
static readonly [entityKind]: string;
|
|
233
|
+
protected: TValue;
|
|
234
|
+
constructor(name: TName);
|
|
235
|
+
getSQL(): SQL;
|
|
236
|
+
}
|
|
237
|
+
type ColumnsSelection = Record<string, unknown>;
|
|
238
|
+
declare abstract class View<TName extends string = string, TExisting extends boolean = boolean, TSelection extends ColumnsSelection = ColumnsSelection> implements SQLWrapper {
|
|
239
|
+
static readonly [entityKind]: string;
|
|
240
|
+
_: {
|
|
241
|
+
brand: 'View';
|
|
242
|
+
viewBrand: string;
|
|
243
|
+
name: TName;
|
|
244
|
+
existing: TExisting;
|
|
245
|
+
selectedFields: TSelection;
|
|
246
|
+
};
|
|
247
|
+
readonly $inferSelect: InferSelectViewModel<View<Assume<TName, string>, TExisting, TSelection>>;
|
|
248
|
+
constructor({ name, schema, selectedFields, query }: {
|
|
249
|
+
name: TName;
|
|
250
|
+
schema: string | undefined;
|
|
251
|
+
selectedFields: ColumnsSelection;
|
|
252
|
+
query: SQL | undefined;
|
|
11
253
|
});
|
|
12
|
-
|
|
254
|
+
getSQL(): SQL<unknown>;
|
|
13
255
|
}
|
|
256
|
+
type InferSelectViewModel<TView extends View> = Equal<TView['_']['selectedFields'], {
|
|
257
|
+
[x: string]: unknown;
|
|
258
|
+
}> extends true ? {
|
|
259
|
+
[x: string]: unknown;
|
|
260
|
+
} : SelectResult<TView['_']['selectedFields'], 'single', Record<TView['_']['name'], 'not-null'>>;
|
|
261
|
+
|
|
262
|
+
type RequiredKeyOnly<TKey extends string, T extends Column> = T extends AnyColumn<{
|
|
263
|
+
notNull: true;
|
|
264
|
+
hasDefault: false;
|
|
265
|
+
}> ? TKey : never;
|
|
266
|
+
type OptionalKeyOnly<TKey extends string, T extends Column, OverrideT extends boolean | undefined = false> = TKey extends RequiredKeyOnly<TKey, T> ? never : T extends {
|
|
267
|
+
_: {
|
|
268
|
+
generated: undefined;
|
|
269
|
+
};
|
|
270
|
+
} ? (T extends {
|
|
271
|
+
_: {
|
|
272
|
+
identity: undefined;
|
|
273
|
+
};
|
|
274
|
+
} ? TKey : T['_']['identity'] extends 'always' ? OverrideT extends true ? TKey : never : TKey) : never;
|
|
275
|
+
|
|
276
|
+
type Update<T, TUpdate> = {
|
|
277
|
+
[K in Exclude<keyof T, keyof TUpdate>]: T[K];
|
|
278
|
+
} & TUpdate;
|
|
279
|
+
type Simplify<T> = {
|
|
280
|
+
[K in keyof T]: T[K];
|
|
281
|
+
} & {};
|
|
282
|
+
type Not<T extends boolean> = T extends true ? false : true;
|
|
283
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
284
|
+
type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : never) extends false ? false : true;
|
|
285
|
+
type FromSingleKeyObject<T, Result, TError extends string, K = keyof T> = IsNever<K> extends true ? never : IsUnion<K> extends true ? DrizzleTypeError<TError> : Result;
|
|
286
|
+
type Assume<T, U> = T extends U ? T : U;
|
|
287
|
+
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
288
|
+
interface DrizzleTypeError<T extends string> {
|
|
289
|
+
$drizzleTypeError: T;
|
|
290
|
+
}
|
|
291
|
+
type Casing = 'snake_case' | 'camelCase';
|
|
292
|
+
|
|
293
|
+
type PgSequenceOptions = {
|
|
294
|
+
increment?: number | string;
|
|
295
|
+
minValue?: number | string;
|
|
296
|
+
maxValue?: number | string;
|
|
297
|
+
startWith?: number | string;
|
|
298
|
+
cache?: number | string;
|
|
299
|
+
cycle?: boolean;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
type TableConfig = TableConfig$1<SQLiteColumn<any>>;
|
|
303
|
+
declare class SQLiteTable<T extends TableConfig = TableConfig> extends Table<T> {
|
|
304
|
+
static readonly [entityKind]: string;
|
|
305
|
+
}
|
|
306
|
+
type SQLiteTableWithColumns<T extends TableConfig> = SQLiteTable<T> & {
|
|
307
|
+
[Key in keyof T['columns']]: T['columns'][Key];
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
declare abstract class SQLiteColumn<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = {}, TTypeConfig extends object = {}> extends Column<T, TRuntimeConfig, TTypeConfig & {
|
|
311
|
+
dialect: 'sqlite';
|
|
312
|
+
}> {
|
|
313
|
+
readonly table: SQLiteTable;
|
|
314
|
+
static readonly [entityKind]: string;
|
|
315
|
+
constructor(table: SQLiteTable, config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
type ColumnDataType = 'string' | 'number' | 'boolean' | 'array' | 'json' | 'date' | 'bigint' | 'custom' | 'buffer' | 'dateDuration' | 'duration' | 'relDuration' | 'localTime' | 'localDate' | 'localDateTime';
|
|
319
|
+
type GeneratedStorageMode = 'virtual' | 'stored';
|
|
320
|
+
type GeneratedType = 'always' | 'byDefault';
|
|
321
|
+
type GeneratedColumnConfig<TDataType> = {
|
|
322
|
+
as: TDataType | SQL | (() => SQL);
|
|
323
|
+
type?: GeneratedType;
|
|
324
|
+
mode?: GeneratedStorageMode;
|
|
325
|
+
};
|
|
326
|
+
type GeneratedIdentityConfig = {
|
|
327
|
+
sequenceName?: string;
|
|
328
|
+
sequenceOptions?: PgSequenceOptions;
|
|
329
|
+
type: 'always' | 'byDefault';
|
|
330
|
+
};
|
|
331
|
+
interface ColumnBuilderBaseConfig<TDataType extends ColumnDataType, TColumnType extends string> {
|
|
332
|
+
name: string;
|
|
333
|
+
dataType: TDataType;
|
|
334
|
+
columnType: TColumnType;
|
|
335
|
+
data: unknown;
|
|
336
|
+
driverParam: unknown;
|
|
337
|
+
enumValues: string[] | undefined;
|
|
338
|
+
}
|
|
339
|
+
type ColumnBuilderRuntimeConfig<TData, TRuntimeConfig extends object = object> = {
|
|
340
|
+
name: string;
|
|
341
|
+
keyAsName: boolean;
|
|
342
|
+
notNull: boolean;
|
|
343
|
+
default: TData | SQL | undefined;
|
|
344
|
+
defaultFn: (() => TData | SQL) | undefined;
|
|
345
|
+
onUpdateFn: (() => TData | SQL) | undefined;
|
|
346
|
+
hasDefault: boolean;
|
|
347
|
+
primaryKey: boolean;
|
|
348
|
+
isUnique: boolean;
|
|
349
|
+
uniqueName: string | undefined;
|
|
350
|
+
uniqueType: string | undefined;
|
|
351
|
+
dataType: string;
|
|
352
|
+
columnType: string;
|
|
353
|
+
generated: GeneratedColumnConfig<TData> | undefined;
|
|
354
|
+
generatedIdentity: GeneratedIdentityConfig | undefined;
|
|
355
|
+
} & TRuntimeConfig;
|
|
356
|
+
|
|
357
|
+
interface ColumnBaseConfig<TDataType extends ColumnDataType, TColumnType extends string> extends ColumnBuilderBaseConfig<TDataType, TColumnType> {
|
|
358
|
+
tableName: string;
|
|
359
|
+
notNull: boolean;
|
|
360
|
+
hasDefault: boolean;
|
|
361
|
+
isPrimaryKey: boolean;
|
|
362
|
+
isAutoincrement: boolean;
|
|
363
|
+
hasRuntimeDefault: boolean;
|
|
364
|
+
}
|
|
365
|
+
type ColumnTypeConfig<T extends ColumnBaseConfig<ColumnDataType, string>, TTypeConfig extends object> = T & {
|
|
366
|
+
brand: 'Column';
|
|
367
|
+
tableName: T['tableName'];
|
|
368
|
+
name: T['name'];
|
|
369
|
+
dataType: T['dataType'];
|
|
370
|
+
columnType: T['columnType'];
|
|
371
|
+
data: T['data'];
|
|
372
|
+
driverParam: T['driverParam'];
|
|
373
|
+
notNull: T['notNull'];
|
|
374
|
+
hasDefault: T['hasDefault'];
|
|
375
|
+
isPrimaryKey: T['isPrimaryKey'];
|
|
376
|
+
isAutoincrement: T['isAutoincrement'];
|
|
377
|
+
hasRuntimeDefault: T['hasRuntimeDefault'];
|
|
378
|
+
enumValues: T['enumValues'];
|
|
379
|
+
baseColumn: T extends {
|
|
380
|
+
baseColumn: infer U;
|
|
381
|
+
} ? U : unknown;
|
|
382
|
+
generated: GeneratedColumnConfig<T['data']> | undefined;
|
|
383
|
+
identity: undefined | 'always' | 'byDefault';
|
|
384
|
+
} & TTypeConfig;
|
|
385
|
+
type ColumnRuntimeConfig<TData, TRuntimeConfig extends object> = ColumnBuilderRuntimeConfig<TData, TRuntimeConfig>;
|
|
386
|
+
interface Column<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TTypeConfig extends object = object> extends DriverValueMapper<T['data'], T['driverParam']>, SQLWrapper {
|
|
387
|
+
}
|
|
388
|
+
declare abstract class Column<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TTypeConfig extends object = object> implements DriverValueMapper<T['data'], T['driverParam']>, SQLWrapper {
|
|
389
|
+
readonly table: Table;
|
|
390
|
+
static readonly [entityKind]: string;
|
|
391
|
+
readonly _: ColumnTypeConfig<T, TTypeConfig>;
|
|
392
|
+
readonly name: string;
|
|
393
|
+
readonly keyAsName: boolean;
|
|
394
|
+
readonly primary: boolean;
|
|
395
|
+
readonly notNull: boolean;
|
|
396
|
+
readonly default: T['data'] | SQL | undefined;
|
|
397
|
+
readonly defaultFn: (() => T['data'] | SQL) | undefined;
|
|
398
|
+
readonly onUpdateFn: (() => T['data'] | SQL) | undefined;
|
|
399
|
+
readonly hasDefault: boolean;
|
|
400
|
+
readonly isUnique: boolean;
|
|
401
|
+
readonly uniqueName: string | undefined;
|
|
402
|
+
readonly uniqueType: string | undefined;
|
|
403
|
+
readonly dataType: T['dataType'];
|
|
404
|
+
readonly columnType: T['columnType'];
|
|
405
|
+
readonly enumValues: T['enumValues'];
|
|
406
|
+
readonly generated: GeneratedColumnConfig<T['data']> | undefined;
|
|
407
|
+
readonly generatedIdentity: GeneratedIdentityConfig | undefined;
|
|
408
|
+
protected config: ColumnRuntimeConfig<T['data'], TRuntimeConfig>;
|
|
409
|
+
constructor(table: Table, config: ColumnRuntimeConfig<T['data'], TRuntimeConfig>);
|
|
410
|
+
abstract getSQLType(): string;
|
|
411
|
+
mapFromDriverValue(value: unknown): unknown;
|
|
412
|
+
mapToDriverValue(value: unknown): unknown;
|
|
413
|
+
}
|
|
414
|
+
type AnyColumn<TPartial extends Partial<ColumnBaseConfig<ColumnDataType, string>> = {}> = Column<Required<Update<ColumnBaseConfig<ColumnDataType, string>, TPartial>>>;
|
|
415
|
+
type GetColumnData<TColumn extends Column, TInferMode extends 'query' | 'raw' = 'query'> = TInferMode extends 'raw' ? TColumn['_']['data'] : TColumn['_']['notNull'] extends true ? TColumn['_']['data'] : TColumn['_']['data'] | null;
|
|
416
|
+
|
|
417
|
+
declare const files: SQLiteTableWithColumns<{
|
|
418
|
+
name: "files";
|
|
419
|
+
schema: undefined;
|
|
420
|
+
columns: {
|
|
421
|
+
createdAt: SQLiteColumn<{
|
|
422
|
+
name: "created_at";
|
|
423
|
+
tableName: "files";
|
|
424
|
+
dataType: "string";
|
|
425
|
+
columnType: "SQLiteText";
|
|
426
|
+
data: string;
|
|
427
|
+
driverParam: string;
|
|
428
|
+
notNull: true;
|
|
429
|
+
hasDefault: true;
|
|
430
|
+
isPrimaryKey: false;
|
|
431
|
+
isAutoincrement: false;
|
|
432
|
+
hasRuntimeDefault: false;
|
|
433
|
+
enumValues: [string, ...string[]];
|
|
434
|
+
baseColumn: never;
|
|
435
|
+
identity: undefined;
|
|
436
|
+
generated: undefined;
|
|
437
|
+
}, {}, {
|
|
438
|
+
length: number | undefined;
|
|
439
|
+
}>;
|
|
440
|
+
updatedAt: SQLiteColumn<{
|
|
441
|
+
name: "updated_at";
|
|
442
|
+
tableName: "files";
|
|
443
|
+
dataType: "string";
|
|
444
|
+
columnType: "SQLiteText";
|
|
445
|
+
data: string;
|
|
446
|
+
driverParam: string;
|
|
447
|
+
notNull: true;
|
|
448
|
+
hasDefault: true;
|
|
449
|
+
isPrimaryKey: false;
|
|
450
|
+
isAutoincrement: false;
|
|
451
|
+
hasRuntimeDefault: false;
|
|
452
|
+
enumValues: [string, ...string[]];
|
|
453
|
+
baseColumn: never;
|
|
454
|
+
identity: undefined;
|
|
455
|
+
generated: undefined;
|
|
456
|
+
}, {}, {
|
|
457
|
+
length: number | undefined;
|
|
458
|
+
}>;
|
|
459
|
+
id: SQLiteColumn<{
|
|
460
|
+
name: "id";
|
|
461
|
+
tableName: "files";
|
|
462
|
+
dataType: "string";
|
|
463
|
+
columnType: "SQLiteText";
|
|
464
|
+
data: string;
|
|
465
|
+
driverParam: string;
|
|
466
|
+
notNull: true;
|
|
467
|
+
hasDefault: false;
|
|
468
|
+
isPrimaryKey: true;
|
|
469
|
+
isAutoincrement: false;
|
|
470
|
+
hasRuntimeDefault: false;
|
|
471
|
+
enumValues: [string, ...string[]];
|
|
472
|
+
baseColumn: never;
|
|
473
|
+
identity: undefined;
|
|
474
|
+
generated: undefined;
|
|
475
|
+
}, {}, {
|
|
476
|
+
length: number | undefined;
|
|
477
|
+
}>;
|
|
478
|
+
name: SQLiteColumn<{
|
|
479
|
+
name: "name";
|
|
480
|
+
tableName: "files";
|
|
481
|
+
dataType: "string";
|
|
482
|
+
columnType: "SQLiteText";
|
|
483
|
+
data: string;
|
|
484
|
+
driverParam: string;
|
|
485
|
+
notNull: true;
|
|
486
|
+
hasDefault: false;
|
|
487
|
+
isPrimaryKey: false;
|
|
488
|
+
isAutoincrement: false;
|
|
489
|
+
hasRuntimeDefault: false;
|
|
490
|
+
enumValues: [string, ...string[]];
|
|
491
|
+
baseColumn: never;
|
|
492
|
+
identity: undefined;
|
|
493
|
+
generated: undefined;
|
|
494
|
+
}, {}, {
|
|
495
|
+
length: number | undefined;
|
|
496
|
+
}>;
|
|
497
|
+
type: SQLiteColumn<{
|
|
498
|
+
name: "type";
|
|
499
|
+
tableName: "files";
|
|
500
|
+
dataType: "string";
|
|
501
|
+
columnType: "SQLiteText";
|
|
502
|
+
data: string;
|
|
503
|
+
driverParam: string;
|
|
504
|
+
notNull: true;
|
|
505
|
+
hasDefault: false;
|
|
506
|
+
isPrimaryKey: false;
|
|
507
|
+
isAutoincrement: false;
|
|
508
|
+
hasRuntimeDefault: false;
|
|
509
|
+
enumValues: [string, ...string[]];
|
|
510
|
+
baseColumn: never;
|
|
511
|
+
identity: undefined;
|
|
512
|
+
generated: undefined;
|
|
513
|
+
}, {}, {
|
|
514
|
+
length: number | undefined;
|
|
515
|
+
}>;
|
|
516
|
+
path: SQLiteColumn<{
|
|
517
|
+
name: "path";
|
|
518
|
+
tableName: "files";
|
|
519
|
+
dataType: "string";
|
|
520
|
+
columnType: "SQLiteText";
|
|
521
|
+
data: string;
|
|
522
|
+
driverParam: string;
|
|
523
|
+
notNull: true;
|
|
524
|
+
hasDefault: false;
|
|
525
|
+
isPrimaryKey: false;
|
|
526
|
+
isAutoincrement: false;
|
|
527
|
+
hasRuntimeDefault: false;
|
|
528
|
+
enumValues: [string, ...string[]];
|
|
529
|
+
baseColumn: never;
|
|
530
|
+
identity: undefined;
|
|
531
|
+
generated: undefined;
|
|
532
|
+
}, {}, {
|
|
533
|
+
length: number | undefined;
|
|
534
|
+
}>;
|
|
535
|
+
folderId: SQLiteColumn<{
|
|
536
|
+
name: "folder_id";
|
|
537
|
+
tableName: "files";
|
|
538
|
+
dataType: "string";
|
|
539
|
+
columnType: "SQLiteText";
|
|
540
|
+
data: string;
|
|
541
|
+
driverParam: string;
|
|
542
|
+
notNull: true;
|
|
543
|
+
hasDefault: false;
|
|
544
|
+
isPrimaryKey: false;
|
|
545
|
+
isAutoincrement: false;
|
|
546
|
+
hasRuntimeDefault: false;
|
|
547
|
+
enumValues: [string, ...string[]];
|
|
548
|
+
baseColumn: never;
|
|
549
|
+
identity: undefined;
|
|
550
|
+
generated: undefined;
|
|
551
|
+
}, {}, {
|
|
552
|
+
length: number | undefined;
|
|
553
|
+
}>;
|
|
554
|
+
size: SQLiteColumn<{
|
|
555
|
+
name: "size";
|
|
556
|
+
tableName: "files";
|
|
557
|
+
dataType: "number";
|
|
558
|
+
columnType: "SQLiteInteger";
|
|
559
|
+
data: number;
|
|
560
|
+
driverParam: number;
|
|
561
|
+
notNull: true;
|
|
562
|
+
hasDefault: false;
|
|
563
|
+
isPrimaryKey: false;
|
|
564
|
+
isAutoincrement: false;
|
|
565
|
+
hasRuntimeDefault: false;
|
|
566
|
+
enumValues: undefined;
|
|
567
|
+
baseColumn: never;
|
|
568
|
+
identity: undefined;
|
|
569
|
+
generated: undefined;
|
|
570
|
+
}, {}, {}>;
|
|
571
|
+
};
|
|
572
|
+
dialect: "sqlite";
|
|
573
|
+
}>;
|
|
574
|
+
type File$1 = InferSelectModel<typeof files>;
|
|
575
|
+
|
|
576
|
+
declare const folders: SQLiteTableWithColumns<{
|
|
577
|
+
name: "folders";
|
|
578
|
+
schema: undefined;
|
|
579
|
+
columns: {
|
|
580
|
+
createdAt: SQLiteColumn<{
|
|
581
|
+
name: "created_at";
|
|
582
|
+
tableName: "folders";
|
|
583
|
+
dataType: "string";
|
|
584
|
+
columnType: "SQLiteText";
|
|
585
|
+
data: string;
|
|
586
|
+
driverParam: string;
|
|
587
|
+
notNull: true;
|
|
588
|
+
hasDefault: true;
|
|
589
|
+
isPrimaryKey: false;
|
|
590
|
+
isAutoincrement: false;
|
|
591
|
+
hasRuntimeDefault: false;
|
|
592
|
+
enumValues: [string, ...string[]];
|
|
593
|
+
baseColumn: never;
|
|
594
|
+
identity: undefined;
|
|
595
|
+
generated: undefined;
|
|
596
|
+
}, {}, {
|
|
597
|
+
length: number | undefined;
|
|
598
|
+
}>;
|
|
599
|
+
updatedAt: SQLiteColumn<{
|
|
600
|
+
name: "updated_at";
|
|
601
|
+
tableName: "folders";
|
|
602
|
+
dataType: "string";
|
|
603
|
+
columnType: "SQLiteText";
|
|
604
|
+
data: string;
|
|
605
|
+
driverParam: string;
|
|
606
|
+
notNull: true;
|
|
607
|
+
hasDefault: true;
|
|
608
|
+
isPrimaryKey: false;
|
|
609
|
+
isAutoincrement: false;
|
|
610
|
+
hasRuntimeDefault: false;
|
|
611
|
+
enumValues: [string, ...string[]];
|
|
612
|
+
baseColumn: never;
|
|
613
|
+
identity: undefined;
|
|
614
|
+
generated: undefined;
|
|
615
|
+
}, {}, {
|
|
616
|
+
length: number | undefined;
|
|
617
|
+
}>;
|
|
618
|
+
id: SQLiteColumn<{
|
|
619
|
+
name: "id";
|
|
620
|
+
tableName: "folders";
|
|
621
|
+
dataType: "string";
|
|
622
|
+
columnType: "SQLiteText";
|
|
623
|
+
data: string;
|
|
624
|
+
driverParam: string;
|
|
625
|
+
notNull: true;
|
|
626
|
+
hasDefault: false;
|
|
627
|
+
isPrimaryKey: true;
|
|
628
|
+
isAutoincrement: false;
|
|
629
|
+
hasRuntimeDefault: false;
|
|
630
|
+
enumValues: [string, ...string[]];
|
|
631
|
+
baseColumn: never;
|
|
632
|
+
identity: undefined;
|
|
633
|
+
generated: undefined;
|
|
634
|
+
}, {}, {
|
|
635
|
+
length: number | undefined;
|
|
636
|
+
}>;
|
|
637
|
+
name: SQLiteColumn<{
|
|
638
|
+
name: "name";
|
|
639
|
+
tableName: "folders";
|
|
640
|
+
dataType: "string";
|
|
641
|
+
columnType: "SQLiteText";
|
|
642
|
+
data: string;
|
|
643
|
+
driverParam: string;
|
|
644
|
+
notNull: true;
|
|
645
|
+
hasDefault: false;
|
|
646
|
+
isPrimaryKey: false;
|
|
647
|
+
isAutoincrement: false;
|
|
648
|
+
hasRuntimeDefault: false;
|
|
649
|
+
enumValues: [string, ...string[]];
|
|
650
|
+
baseColumn: never;
|
|
651
|
+
identity: undefined;
|
|
652
|
+
generated: undefined;
|
|
653
|
+
}, {}, {
|
|
654
|
+
length: number | undefined;
|
|
655
|
+
}>;
|
|
656
|
+
path: SQLiteColumn<{
|
|
657
|
+
name: "path";
|
|
658
|
+
tableName: "folders";
|
|
659
|
+
dataType: "string";
|
|
660
|
+
columnType: "SQLiteText";
|
|
661
|
+
data: string;
|
|
662
|
+
driverParam: string;
|
|
663
|
+
notNull: true;
|
|
664
|
+
hasDefault: false;
|
|
665
|
+
isPrimaryKey: false;
|
|
666
|
+
isAutoincrement: false;
|
|
667
|
+
hasRuntimeDefault: false;
|
|
668
|
+
enumValues: [string, ...string[]];
|
|
669
|
+
baseColumn: never;
|
|
670
|
+
identity: undefined;
|
|
671
|
+
generated: undefined;
|
|
672
|
+
}, {}, {
|
|
673
|
+
length: number | undefined;
|
|
674
|
+
}>;
|
|
675
|
+
parentId: SQLiteColumn<{
|
|
676
|
+
name: "parent_id";
|
|
677
|
+
tableName: "folders";
|
|
678
|
+
dataType: "string";
|
|
679
|
+
columnType: "SQLiteText";
|
|
680
|
+
data: string;
|
|
681
|
+
driverParam: string;
|
|
682
|
+
notNull: false;
|
|
683
|
+
hasDefault: false;
|
|
684
|
+
isPrimaryKey: false;
|
|
685
|
+
isAutoincrement: false;
|
|
686
|
+
hasRuntimeDefault: false;
|
|
687
|
+
enumValues: [string, ...string[]];
|
|
688
|
+
baseColumn: never;
|
|
689
|
+
identity: undefined;
|
|
690
|
+
generated: undefined;
|
|
691
|
+
}, {}, {
|
|
692
|
+
length: number | undefined;
|
|
693
|
+
}>;
|
|
694
|
+
};
|
|
695
|
+
dialect: "sqlite";
|
|
696
|
+
}>;
|
|
697
|
+
type Folder = InferSelectModel<typeof folders>;
|
|
698
|
+
|
|
699
|
+
type ApiResponse<T> = {
|
|
700
|
+
data: T;
|
|
701
|
+
error: null;
|
|
702
|
+
} | {
|
|
703
|
+
data: null;
|
|
704
|
+
error: {
|
|
705
|
+
message: string;
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
type FileWithUrl = File$1 & {
|
|
709
|
+
url: string;
|
|
710
|
+
};
|
|
14
711
|
|
|
15
712
|
declare class Files extends Base {
|
|
16
|
-
getAll(options?: {
|
|
17
|
-
limit?: number;
|
|
18
|
-
offset?: number;
|
|
19
|
-
orderBy?: "created_at" | "updated_at" | "name" | "size";
|
|
20
|
-
orderDirection?: "ASC" | "DESC";
|
|
21
|
-
}): Promise<{
|
|
713
|
+
getAll(options?: ListOptions): Promise<{
|
|
22
714
|
error: {
|
|
23
715
|
message: string;
|
|
24
716
|
} | null;
|
|
25
717
|
data: {
|
|
26
|
-
files:
|
|
27
|
-
url: string;
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
folder_id: string;
|
|
31
|
-
path: string;
|
|
32
|
-
size: number;
|
|
33
|
-
type: string;
|
|
34
|
-
created_at: string;
|
|
35
|
-
updated_at: string;
|
|
36
|
-
}[];
|
|
718
|
+
files: any[];
|
|
37
719
|
} | null;
|
|
38
720
|
}>;
|
|
39
721
|
getById(id: string): Promise<{
|
|
@@ -41,119 +723,98 @@ declare class Files extends Base {
|
|
|
41
723
|
message: string;
|
|
42
724
|
} | null;
|
|
43
725
|
data: {
|
|
44
|
-
file:
|
|
45
|
-
url: string;
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
folder_id: string;
|
|
49
|
-
path: string;
|
|
50
|
-
size: number;
|
|
51
|
-
type: string;
|
|
52
|
-
created_at: string;
|
|
53
|
-
updated_at: string;
|
|
54
|
-
} | undefined;
|
|
726
|
+
file: any;
|
|
55
727
|
} | null;
|
|
56
728
|
}>;
|
|
57
|
-
getByName(name: string, options?: {
|
|
58
|
-
limit?: number;
|
|
59
|
-
offset?: number;
|
|
60
|
-
orderBy?: "created_at" | "updated_at" | "name" | "size";
|
|
61
|
-
orderDirection?: "ASC" | "DESC";
|
|
62
|
-
}): Promise<{
|
|
729
|
+
getByName(name: string, options?: ListOptions): Promise<{
|
|
63
730
|
error: {
|
|
64
731
|
message: string;
|
|
65
732
|
} | null;
|
|
66
733
|
data: {
|
|
67
|
-
files:
|
|
68
|
-
url: string;
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
folder_id: string;
|
|
72
|
-
path: string;
|
|
73
|
-
size: number;
|
|
74
|
-
type: string;
|
|
75
|
-
created_at: string;
|
|
76
|
-
updated_at: string;
|
|
77
|
-
}[];
|
|
734
|
+
files: any[];
|
|
78
735
|
} | null;
|
|
79
736
|
}>;
|
|
80
737
|
upload(data: {
|
|
81
|
-
files:
|
|
738
|
+
files: File[];
|
|
82
739
|
folder?: string;
|
|
83
740
|
}): Promise<{
|
|
84
741
|
error: {
|
|
85
742
|
message: string;
|
|
86
743
|
} | null;
|
|
87
744
|
data: {
|
|
88
|
-
files:
|
|
89
|
-
url: string;
|
|
90
|
-
id: string;
|
|
91
|
-
name: string;
|
|
92
|
-
folder_id: string;
|
|
93
|
-
path: string;
|
|
94
|
-
size: number;
|
|
95
|
-
type: string;
|
|
96
|
-
created_at: string;
|
|
97
|
-
updated_at: string;
|
|
98
|
-
}[];
|
|
745
|
+
files: any[];
|
|
99
746
|
} | null;
|
|
100
747
|
}>;
|
|
748
|
+
download(id: string): Promise<ApiResponse<{
|
|
749
|
+
blob: Blob;
|
|
750
|
+
filename: string | null;
|
|
751
|
+
contentType: string;
|
|
752
|
+
}>>;
|
|
101
753
|
rename(data: {
|
|
102
754
|
id: string;
|
|
103
755
|
name: string;
|
|
104
|
-
}): Promise<
|
|
105
|
-
delete(id: string): Promise<
|
|
756
|
+
}): Promise<ApiResponse<null>>;
|
|
757
|
+
delete(id: string): Promise<ApiResponse<null>>;
|
|
106
758
|
}
|
|
107
759
|
|
|
108
760
|
declare class Folders extends Base {
|
|
109
|
-
get(options?: {
|
|
761
|
+
get(options?: ListOptions & {
|
|
110
762
|
id?: string;
|
|
111
763
|
path?: string;
|
|
112
|
-
limit?: number;
|
|
113
|
-
offset?: number;
|
|
114
|
-
orderBy?: "created_at" | "updated_at" | "name";
|
|
115
|
-
orderDirection?: "ASC" | "DESC";
|
|
116
764
|
}): Promise<{
|
|
117
765
|
error: {
|
|
118
766
|
message: string;
|
|
119
767
|
} | null;
|
|
120
768
|
data: {
|
|
121
|
-
files:
|
|
122
|
-
url: string;
|
|
123
|
-
id: string;
|
|
124
|
-
name: string;
|
|
125
|
-
folder_id: string;
|
|
126
|
-
path: string;
|
|
127
|
-
size: number;
|
|
128
|
-
type: string;
|
|
129
|
-
created_at: string;
|
|
130
|
-
updated_at: string;
|
|
131
|
-
}[];
|
|
769
|
+
files: any[];
|
|
132
770
|
folders: Folder[];
|
|
133
771
|
} | null;
|
|
134
772
|
}>;
|
|
135
|
-
create(folder: string): Promise<
|
|
773
|
+
create(folder: string): Promise<ApiResponse<{
|
|
136
774
|
folder: Folder;
|
|
137
775
|
}>>;
|
|
138
776
|
rename(data: {
|
|
139
777
|
id: string;
|
|
140
778
|
name: string;
|
|
141
|
-
}): Promise<
|
|
142
|
-
delete(id: string): Promise<
|
|
779
|
+
}): Promise<ApiResponse<null>>;
|
|
780
|
+
delete(id: string): Promise<ApiResponse<null>>;
|
|
143
781
|
}
|
|
144
782
|
|
|
145
783
|
interface IVaze {
|
|
146
784
|
files: Files;
|
|
147
785
|
folders: Folders;
|
|
148
786
|
}
|
|
787
|
+
type VazeOptions = {
|
|
788
|
+
apiKey?: string;
|
|
789
|
+
vazeUrl?: string;
|
|
790
|
+
};
|
|
791
|
+
type ListOptions = {
|
|
792
|
+
limit?: number;
|
|
793
|
+
offset?: number;
|
|
794
|
+
orderBy?: "createdAt" | "updatedAt" | "name" | "size";
|
|
795
|
+
orderDirection?: "ASC" | "DESC";
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
declare class Base {
|
|
799
|
+
private apiKey;
|
|
800
|
+
protected vazeUrl: string;
|
|
801
|
+
constructor(options?: VazeOptions);
|
|
802
|
+
protected apiUrl(path: string, params?: Record<string, string | number | undefined>): string;
|
|
803
|
+
protected request<T>(method: string, url: string, body?: Record<string, any> | FormData, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
804
|
+
protected requestBlob(url: string): Promise<ApiResponse<{
|
|
805
|
+
blob: Blob;
|
|
806
|
+
filename: string | null;
|
|
807
|
+
contentType: string;
|
|
808
|
+
}>>;
|
|
809
|
+
}
|
|
149
810
|
|
|
150
811
|
declare class Vaze extends Base implements IVaze {
|
|
151
812
|
files: Files;
|
|
152
813
|
folders: Folders;
|
|
153
|
-
constructor(options?:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
814
|
+
constructor(options?: VazeOptions);
|
|
815
|
+
health(): Promise<ApiResponse<{
|
|
816
|
+
message: string;
|
|
817
|
+
}>>;
|
|
157
818
|
}
|
|
158
819
|
|
|
159
|
-
export { Vaze as default };
|
|
820
|
+
export { type ApiResponse, type FileWithUrl as File, type Folder, type ListOptions, type VazeOptions, Vaze as default };
|