typeorm 0.3.12 → 0.3.13-dev.1fcd9f3
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/browser/driver/react-native/ReactNativeDriver.d.ts +219 -6
- package/browser/driver/react-native/ReactNativeDriver.js +662 -10
- package/browser/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/browser/platform/PlatformTools.d.ts +1 -1
- package/browser/platform/PlatformTools.js +5 -2
- package/browser/platform/PlatformTools.js.map +1 -1
- package/browser/util/DateUtils.d.ts +12 -0
- package/browser/util/DateUtils.js +20 -16
- package/browser/util/DateUtils.js.map +1 -1
- package/driver/react-native/ReactNativeDriver.d.ts +219 -6
- package/driver/react-native/ReactNativeDriver.js +663 -11
- package/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/package.json +1 -273
- package/platform/PlatformTools.d.ts +1 -1
- package/platform/PlatformTools.js +5 -2
- package/platform/PlatformTools.js.map +1 -1
- package/util/DateUtils.d.ts +12 -0
- package/util/DateUtils.js +20 -16
- package/util/DateUtils.js.map +1 -1
|
@@ -1,19 +1,231 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Driver } from "../Driver";
|
|
2
|
+
import { ObjectLiteral } from "../../common/ObjectLiteral";
|
|
3
|
+
import { ColumnMetadata } from "../../metadata/ColumnMetadata";
|
|
4
4
|
import { DataSource } from "../../data-source/DataSource";
|
|
5
|
+
import { RdbmsSchemaBuilder } from "../../schema-builder/RdbmsSchemaBuilder";
|
|
6
|
+
import { CteCapabilities } from "../types/CteCapabilities";
|
|
7
|
+
import { MappedColumnTypes } from "../types/MappedColumnTypes";
|
|
8
|
+
import { ColumnType } from "../types/ColumnTypes";
|
|
9
|
+
import { QueryRunner } from "../../query-runner/QueryRunner";
|
|
10
|
+
import { DataTypeDefaults } from "../types/DataTypeDefaults";
|
|
11
|
+
import { TableColumn } from "../../schema-builder/table/TableColumn";
|
|
12
|
+
import { EntityMetadata } from "../../metadata/EntityMetadata";
|
|
5
13
|
import { ReplicationMode } from "../types/ReplicationMode";
|
|
6
|
-
|
|
14
|
+
import { Table } from "../../schema-builder/table/Table";
|
|
15
|
+
import { View } from "../../schema-builder/view/View";
|
|
16
|
+
import { TableForeignKey } from "../../schema-builder/table/TableForeignKey";
|
|
17
|
+
import { UpsertType } from "../types/UpsertType";
|
|
18
|
+
import { ReactNativeConnectionOptions } from "./ReactNativeConnectionOptions";
|
|
19
|
+
type DatabasesMap = Record<string, {
|
|
20
|
+
attachFilepathAbsolute: string;
|
|
21
|
+
attachFilepathRelative: string;
|
|
22
|
+
attachHandle: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Organizes communication with sqlite DBMS.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ReactNativeDriver implements Driver {
|
|
28
|
+
/**
|
|
29
|
+
* Connection used by driver.
|
|
30
|
+
*/
|
|
31
|
+
connection: DataSource;
|
|
32
|
+
/**
|
|
33
|
+
* Sqlite has a single QueryRunner because it works on a single database connection.
|
|
34
|
+
*/
|
|
35
|
+
queryRunner?: QueryRunner;
|
|
36
|
+
/**
|
|
37
|
+
* Real database connection with sqlite database.
|
|
38
|
+
*/
|
|
39
|
+
databaseConnection: any;
|
|
40
|
+
/**
|
|
41
|
+
* Connection options.
|
|
42
|
+
*/
|
|
7
43
|
options: ReactNativeConnectionOptions;
|
|
44
|
+
/**
|
|
45
|
+
* Master database used to perform all write queries.
|
|
46
|
+
*/
|
|
47
|
+
database?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Indicates if replication is enabled.
|
|
50
|
+
*/
|
|
51
|
+
isReplicated: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* SQLite underlying library.
|
|
54
|
+
*/
|
|
55
|
+
sqlite: any;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates if tree tables are supported by this driver.
|
|
58
|
+
*/
|
|
59
|
+
treeSupport: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Represent transaction support by this driver
|
|
62
|
+
*/
|
|
63
|
+
transactionSupport: "simple" | "nested" | "none";
|
|
64
|
+
/**
|
|
65
|
+
* Gets list of supported column data types by a driver.
|
|
66
|
+
*
|
|
67
|
+
* @see https://www.tutorialspoint.com/sqlite/sqlite_data_types.htm
|
|
68
|
+
* @see https://sqlite.org/datatype3.html
|
|
69
|
+
*/
|
|
70
|
+
supportedDataTypes: ColumnType[];
|
|
71
|
+
/**
|
|
72
|
+
* Returns type of upsert supported by driver if any
|
|
73
|
+
*/
|
|
74
|
+
supportedUpsertTypes: UpsertType[];
|
|
75
|
+
/**
|
|
76
|
+
* Gets list of column data types that support length by a driver.
|
|
77
|
+
*/
|
|
78
|
+
withLengthColumnTypes: ColumnType[];
|
|
79
|
+
/**
|
|
80
|
+
* Gets list of spatial column data types.
|
|
81
|
+
*/
|
|
82
|
+
spatialTypes: ColumnType[];
|
|
83
|
+
/**
|
|
84
|
+
* Gets list of column data types that support precision by a driver.
|
|
85
|
+
*/
|
|
86
|
+
withPrecisionColumnTypes: ColumnType[];
|
|
87
|
+
/**
|
|
88
|
+
* Gets list of column data types that support scale by a driver.
|
|
89
|
+
*/
|
|
90
|
+
withScaleColumnTypes: ColumnType[];
|
|
91
|
+
/**
|
|
92
|
+
* Orm has special columns and we need to know what database column types should be for those types.
|
|
93
|
+
* Column types are driver dependant.
|
|
94
|
+
*/
|
|
95
|
+
mappedDataTypes: MappedColumnTypes;
|
|
96
|
+
/**
|
|
97
|
+
* Default values of length, precision and scale depends on column data type.
|
|
98
|
+
* Used in the cases when length/precision/scale is not specified by user.
|
|
99
|
+
*/
|
|
100
|
+
dataTypeDefaults: DataTypeDefaults;
|
|
101
|
+
/**
|
|
102
|
+
* No documentation specifying a maximum length for identifiers could be found
|
|
103
|
+
* for SQLite.
|
|
104
|
+
*/
|
|
105
|
+
maxAliasLength?: number;
|
|
106
|
+
cteCapabilities: CteCapabilities;
|
|
107
|
+
/**
|
|
108
|
+
* Any attached databases (excepting default 'main')
|
|
109
|
+
*/
|
|
110
|
+
attachedDatabases: DatabasesMap;
|
|
8
111
|
constructor(connection: DataSource);
|
|
112
|
+
/**
|
|
113
|
+
* Creates a query runner used to execute database queries.
|
|
114
|
+
*/
|
|
115
|
+
createQueryRunner(mode: ReplicationMode): QueryRunner;
|
|
116
|
+
/**
|
|
117
|
+
* Performs connection to the database.
|
|
118
|
+
*/
|
|
119
|
+
connect(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Makes any action after connection (e.g. create extensions in Postgres driver).
|
|
122
|
+
*/
|
|
123
|
+
afterConnect(): Promise<void>;
|
|
9
124
|
/**
|
|
10
125
|
* Closes connection with database.
|
|
11
126
|
*/
|
|
12
127
|
disconnect(): Promise<void>;
|
|
128
|
+
hasAttachedDatabases(): boolean;
|
|
129
|
+
getAttachedDatabaseHandleByRelativePath(path: string): string | undefined;
|
|
130
|
+
getAttachedDatabasePathRelativeByHandle(handle: string): string | undefined;
|
|
13
131
|
/**
|
|
14
|
-
* Creates a
|
|
132
|
+
* Creates a schema builder used to build and sync a schema.
|
|
15
133
|
*/
|
|
16
|
-
|
|
134
|
+
createSchemaBuilder(): RdbmsSchemaBuilder;
|
|
135
|
+
/**
|
|
136
|
+
* Prepares given value to a value to be persisted, based on its column type and metadata.
|
|
137
|
+
*/
|
|
138
|
+
preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any;
|
|
139
|
+
/**
|
|
140
|
+
* Prepares given value to a value to be hydrated, based on its column type or metadata.
|
|
141
|
+
*/
|
|
142
|
+
prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any;
|
|
143
|
+
/**
|
|
144
|
+
* Replaces parameters in the given sql with special escaping character
|
|
145
|
+
* and an array of parameter names to be passed to a query.
|
|
146
|
+
*/
|
|
147
|
+
escapeQueryWithParameters(sql: string, parameters: ObjectLiteral, nativeParameters: ObjectLiteral): [string, any[]];
|
|
148
|
+
/**
|
|
149
|
+
* Escapes a column name.
|
|
150
|
+
*/
|
|
151
|
+
escape(columnName: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* Build full table name with database name, schema name and table name.
|
|
154
|
+
* E.g. myDB.mySchema.myTable
|
|
155
|
+
*
|
|
156
|
+
* Returns only simple table name because all inherited drivers does not supports schema and database.
|
|
157
|
+
*/
|
|
158
|
+
buildTableName(tableName: string, schema?: string, database?: string): string;
|
|
159
|
+
/**
|
|
160
|
+
* Parse a target table name or other types and return a normalized table definition.
|
|
161
|
+
*/
|
|
162
|
+
parseTableName(target: EntityMetadata | Table | View | TableForeignKey | string): {
|
|
163
|
+
database?: string;
|
|
164
|
+
schema?: string;
|
|
165
|
+
tableName: string;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Creates a database type from a given column metadata.
|
|
169
|
+
*/
|
|
170
|
+
normalizeType(column: {
|
|
171
|
+
type?: ColumnType;
|
|
172
|
+
length?: number | string;
|
|
173
|
+
precision?: number | null;
|
|
174
|
+
scale?: number;
|
|
175
|
+
}): string;
|
|
176
|
+
/**
|
|
177
|
+
* Normalizes "default" value of the column.
|
|
178
|
+
*/
|
|
179
|
+
normalizeDefault(columnMetadata: ColumnMetadata): string | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Normalizes "isUnique" value of the column.
|
|
182
|
+
*/
|
|
183
|
+
normalizeIsUnique(column: ColumnMetadata): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Calculates column length taking into account the default length values.
|
|
186
|
+
*/
|
|
187
|
+
getColumnLength(column: ColumnMetadata): string;
|
|
188
|
+
/**
|
|
189
|
+
* Normalizes "default" value of the column.
|
|
190
|
+
*/
|
|
191
|
+
createFullType(column: TableColumn): string;
|
|
192
|
+
/**
|
|
193
|
+
* Obtains a new database connection to a master server.
|
|
194
|
+
* Used for replication.
|
|
195
|
+
* If replication is not setup then returns default connection's database connection.
|
|
196
|
+
*/
|
|
197
|
+
obtainMasterConnection(): Promise<any>;
|
|
198
|
+
/**
|
|
199
|
+
* Obtains a new database connection to a slave server.
|
|
200
|
+
* Used for replication.
|
|
201
|
+
* If replication is not setup then returns master (default) connection's database connection.
|
|
202
|
+
*/
|
|
203
|
+
obtainSlaveConnection(): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* Creates generated map of values generated or returned by database after INSERT query.
|
|
206
|
+
*/
|
|
207
|
+
createGeneratedMap(metadata: EntityMetadata, insertResult: any, entityIndex: number, entityNum: number): any;
|
|
208
|
+
/**
|
|
209
|
+
* Differentiate columns of this table and columns from the given column metadatas columns
|
|
210
|
+
* and returns only changed.
|
|
211
|
+
*/
|
|
212
|
+
findChangedColumns(tableColumns: TableColumn[], columnMetadatas: ColumnMetadata[]): ColumnMetadata[];
|
|
213
|
+
/**
|
|
214
|
+
* Returns true if driver supports RETURNING / OUTPUT statement.
|
|
215
|
+
*/
|
|
216
|
+
isReturningSqlSupported(): boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Returns true if driver supports uuid values generation on its own.
|
|
219
|
+
*/
|
|
220
|
+
isUUIDGenerationSupported(): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Returns true if driver supports fulltext indices.
|
|
223
|
+
*/
|
|
224
|
+
isFullTextColumnTypeSupported(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Creates an escaped parameter.
|
|
227
|
+
*/
|
|
228
|
+
createParameter(parameterName: string, index: number): string;
|
|
17
229
|
/**
|
|
18
230
|
* Creates connection with the database.
|
|
19
231
|
*/
|
|
@@ -23,3 +235,4 @@ export declare class ReactNativeDriver extends AbstractSqliteDriver {
|
|
|
23
235
|
*/
|
|
24
236
|
protected loadDependencies(): void;
|
|
25
237
|
}
|
|
238
|
+
export {};
|