@itwin/core-backend 4.3.0-dev.8 → 4.4.0-dev.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/CHANGELOG.md +54 -1
- package/lib/cjs/BriefcaseManager.js +3 -3
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +196 -0
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -0
- package/lib/cjs/ChangesetECAdaptor.js +746 -0
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -0
- package/lib/cjs/CheckpointManager.js +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +8 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +9 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +10 -3
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +5 -5
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +1 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +13 -9
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +1 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +2 -2
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +185 -0
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -0
- package/lib/cjs/SqliteChangesetReader.js +217 -0
- package/lib/cjs/SqliteChangesetReader.js.map +1 -0
- package/lib/cjs/core-backend.d.ts +2 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +2 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/package.json +21 -16
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module SQLiteDb
|
|
3
|
+
*/
|
|
4
|
+
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
5
|
+
import { IDisposable } from "@itwin/core-bentley";
|
|
6
|
+
import { ECDb } from "./ECDb";
|
|
7
|
+
import { IModelDb } from "./IModelDb";
|
|
8
|
+
/** Changed value type
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
type SqliteValue = Uint8Array | number | string | null | undefined;
|
|
12
|
+
/** Array of changed values
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
type SqliteValueArray = SqliteValue[];
|
|
16
|
+
/**
|
|
17
|
+
* Format option when converting change from array to column/value object.
|
|
18
|
+
* @beta
|
|
19
|
+
*/
|
|
20
|
+
export interface ChangeFormatArgs {
|
|
21
|
+
/** include table name */
|
|
22
|
+
includeTableName?: true;
|
|
23
|
+
/** include op code */
|
|
24
|
+
includeOpCode?: true;
|
|
25
|
+
/** include null columns */
|
|
26
|
+
includeNullColumns?: true;
|
|
27
|
+
/** include value version */
|
|
28
|
+
includeStage?: true;
|
|
29
|
+
/** include primary key in update change */
|
|
30
|
+
includePrimaryKeyInUpdateNew?: true;
|
|
31
|
+
}
|
|
32
|
+
/** Operation that cause the change
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
export type SqliteChangeOp = "Inserted" | "Updated" | "Deleted";
|
|
36
|
+
/** Stage is version of value that needed to be read
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export type SqliteValueStage = "Old" | "New";
|
|
40
|
+
/** Db from which schema will be read. It should be from timeline to which changeset belong.
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export type AnyDb = IModelDb | ECDb;
|
|
44
|
+
/** Arg to open a changeset file from disk
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface SqliteChangesetReaderArgs {
|
|
48
|
+
/** db from which schema will be read. It should be close to changeset.*/
|
|
49
|
+
readonly db?: AnyDb;
|
|
50
|
+
/** invert the changeset operations */
|
|
51
|
+
readonly invert?: true;
|
|
52
|
+
/** do not check if column of change match db schema instead ignore addition columns */
|
|
53
|
+
readonly disableSchemaCheck?: true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Represent sqlite change.
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
export interface SqliteChange {
|
|
60
|
+
/** name of table */
|
|
61
|
+
$table?: string;
|
|
62
|
+
/** SQLite operation that created this change */
|
|
63
|
+
$op?: SqliteChangeOp;
|
|
64
|
+
/** version of data in change. */
|
|
65
|
+
$stage?: SqliteValueStage;
|
|
66
|
+
/** columns in change */
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Read raw sqlite changeset from disk and enumerate changes.
|
|
71
|
+
* It also optionally let you format change with schema from
|
|
72
|
+
* a db provided.
|
|
73
|
+
* @beta
|
|
74
|
+
*/
|
|
75
|
+
export declare class SqliteChangesetReader implements IDisposable {
|
|
76
|
+
/** db from where sql schema will be read */
|
|
77
|
+
readonly db?: AnyDb | undefined;
|
|
78
|
+
private readonly _nativeReader;
|
|
79
|
+
private _schemaCache;
|
|
80
|
+
private _disableSchemaCheck;
|
|
81
|
+
private _changeIndex;
|
|
82
|
+
protected constructor(
|
|
83
|
+
/** db from where sql schema will be read */
|
|
84
|
+
db?: AnyDb | undefined);
|
|
85
|
+
/**
|
|
86
|
+
* Open changeset file from disk
|
|
87
|
+
* @param args fileName of changeset reader and other options.
|
|
88
|
+
* @returns SqliteChangesetReader instance
|
|
89
|
+
*/
|
|
90
|
+
static openFile(args: {
|
|
91
|
+
readonly fileName: string;
|
|
92
|
+
} & SqliteChangesetReaderArgs): SqliteChangesetReader;
|
|
93
|
+
/**
|
|
94
|
+
* Open local changes in iModel.
|
|
95
|
+
* @param args iModel and other options.
|
|
96
|
+
* @returns SqliteChangesetReader instance
|
|
97
|
+
*/
|
|
98
|
+
static openLocalChanges(args: {
|
|
99
|
+
iModel: IModelJsNative.DgnDb;
|
|
100
|
+
includeInMemoryChanges?: true;
|
|
101
|
+
} & SqliteChangesetReaderArgs): SqliteChangesetReader;
|
|
102
|
+
/** check if schema check is disabled or not */
|
|
103
|
+
get disableSchemaCheck(): boolean;
|
|
104
|
+
/** Move to next change in changeset
|
|
105
|
+
* @returns true if there is current change false if reader is end of changeset.
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
step(): boolean;
|
|
109
|
+
/** Check if reader current on a row
|
|
110
|
+
* @beta
|
|
111
|
+
*/
|
|
112
|
+
get hasRow(): boolean;
|
|
113
|
+
/** Check if its current change is indirect
|
|
114
|
+
* @beta
|
|
115
|
+
*/
|
|
116
|
+
get isIndirect(): boolean;
|
|
117
|
+
/** Get count of columns in current change
|
|
118
|
+
* @beta
|
|
119
|
+
*/
|
|
120
|
+
get columnCount(): number;
|
|
121
|
+
/** Get operation that caused the change
|
|
122
|
+
* @beta
|
|
123
|
+
*/
|
|
124
|
+
get op(): SqliteChangeOp;
|
|
125
|
+
/** Get primary key value array
|
|
126
|
+
* @beta
|
|
127
|
+
*/
|
|
128
|
+
get primaryKeyValues(): SqliteValueArray;
|
|
129
|
+
/** Get primary key columns.
|
|
130
|
+
* @note To this to work db arg must be set when opening changeset file.
|
|
131
|
+
* @beta
|
|
132
|
+
*/
|
|
133
|
+
getPrimaryKeyColumnNames(): string[];
|
|
134
|
+
/** Get current change table.
|
|
135
|
+
* @beta
|
|
136
|
+
*/
|
|
137
|
+
get tableName(): string;
|
|
138
|
+
/**
|
|
139
|
+
* Get changed value for a column
|
|
140
|
+
* @param columnIndex index of column in current change
|
|
141
|
+
* @param stage old or new value for change.
|
|
142
|
+
* @returns value for changed column
|
|
143
|
+
* @beta
|
|
144
|
+
*/
|
|
145
|
+
getChangeValue(columnIndex: number, stage: SqliteValueStage): SqliteValue;
|
|
146
|
+
/**
|
|
147
|
+
* Get all changed value in current change as array
|
|
148
|
+
* @param stage old or new values for current change.
|
|
149
|
+
* @returns array of values.
|
|
150
|
+
* @beta
|
|
151
|
+
*/
|
|
152
|
+
getChangeValuesArray(stage: SqliteValueStage): SqliteValueArray | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Get change as object and format its content.
|
|
155
|
+
* @param stage old or new value for current change.
|
|
156
|
+
* @param args change format options
|
|
157
|
+
* @returns return object or undefined
|
|
158
|
+
* @beta
|
|
159
|
+
*/
|
|
160
|
+
getChangeValuesObject(stage: SqliteValueStage, args?: ChangeFormatArgs): SqliteChange | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Get list of column for a table. This function also caches the result.
|
|
163
|
+
* @note To this to work db arg must be set when opening changeset file.
|
|
164
|
+
* @param tableName name of the table for which columns are requested.
|
|
165
|
+
* @returns columns of table.
|
|
166
|
+
* @beta
|
|
167
|
+
*/
|
|
168
|
+
getColumnNames(tableName: string): string[];
|
|
169
|
+
/** index of current change
|
|
170
|
+
* @beta
|
|
171
|
+
*/
|
|
172
|
+
get changeIndex(): number;
|
|
173
|
+
/**
|
|
174
|
+
* Close changeset
|
|
175
|
+
* @beta
|
|
176
|
+
*/
|
|
177
|
+
close(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Dispose this object
|
|
180
|
+
* @beta
|
|
181
|
+
*/
|
|
182
|
+
dispose(): void;
|
|
183
|
+
}
|
|
184
|
+
export {};
|
|
185
|
+
//# sourceMappingURL=SqliteChangesetReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqliteChangesetReader.d.ts","sourceRoot":"","sources":["../../src/SqliteChangesetReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE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OAKG;IACI,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,SAAS;IAGlF;;;;;;OAMG;IACI,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,GAAE,gBAAqB,GAAG,YAAY,GAAG,SAAS;IAyC5G;;;;;;OAMG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAkBlD;;OAEG;IACH,IAAW,WAAW,WAAgC;IACtD;;;OAGG;IACI,KAAK;IAIZ;;;OAGG;IACI,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SqliteChangesetReader = void 0;
|
|
4
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
5
|
+
const IModelHost_1 = require("./IModelHost");
|
|
6
|
+
/**
|
|
7
|
+
* Read raw sqlite changeset from disk and enumerate changes.
|
|
8
|
+
* It also optionally let you format change with schema from
|
|
9
|
+
* a db provided.
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
class SqliteChangesetReader {
|
|
13
|
+
constructor(
|
|
14
|
+
/** db from where sql schema will be read */
|
|
15
|
+
db) {
|
|
16
|
+
this.db = db;
|
|
17
|
+
this._nativeReader = new IModelHost_1.IModelHost.platform.ChangesetReader();
|
|
18
|
+
this._schemaCache = new Map();
|
|
19
|
+
this._disableSchemaCheck = false;
|
|
20
|
+
this._changeIndex = 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Open changeset file from disk
|
|
24
|
+
* @param args fileName of changeset reader and other options.
|
|
25
|
+
* @returns SqliteChangesetReader instance
|
|
26
|
+
*/
|
|
27
|
+
static openFile(args) {
|
|
28
|
+
const reader = new SqliteChangesetReader(args.db);
|
|
29
|
+
reader._disableSchemaCheck = args.disableSchemaCheck ?? false;
|
|
30
|
+
reader._nativeReader.openFile(args.fileName, args.invert ?? false);
|
|
31
|
+
return reader;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Open local changes in iModel.
|
|
35
|
+
* @param args iModel and other options.
|
|
36
|
+
* @returns SqliteChangesetReader instance
|
|
37
|
+
*/
|
|
38
|
+
static openLocalChanges(args) {
|
|
39
|
+
const reader = new SqliteChangesetReader(args.db);
|
|
40
|
+
reader._disableSchemaCheck = args.disableSchemaCheck ?? false;
|
|
41
|
+
reader._nativeReader.openLocalChanges(args.iModel, args.includeInMemoryChanges ?? false, args.invert ?? false);
|
|
42
|
+
return reader;
|
|
43
|
+
}
|
|
44
|
+
/** check if schema check is disabled or not */
|
|
45
|
+
get disableSchemaCheck() { return this._disableSchemaCheck; }
|
|
46
|
+
/** Move to next change in changeset
|
|
47
|
+
* @returns true if there is current change false if reader is end of changeset.
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
step() {
|
|
51
|
+
if (this._nativeReader.step()) {
|
|
52
|
+
this._changeIndex++;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
/** Check if reader current on a row
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
get hasRow() {
|
|
61
|
+
return this._nativeReader.hasRow();
|
|
62
|
+
}
|
|
63
|
+
/** Check if its current change is indirect
|
|
64
|
+
* @beta
|
|
65
|
+
*/
|
|
66
|
+
get isIndirect() {
|
|
67
|
+
return this._nativeReader.isIndirectChange();
|
|
68
|
+
}
|
|
69
|
+
/** Get count of columns in current change
|
|
70
|
+
* @beta
|
|
71
|
+
*/
|
|
72
|
+
get columnCount() {
|
|
73
|
+
return this._nativeReader.getColumnCount();
|
|
74
|
+
}
|
|
75
|
+
/** Get operation that caused the change
|
|
76
|
+
* @beta
|
|
77
|
+
*/
|
|
78
|
+
get op() {
|
|
79
|
+
if (this._nativeReader.getOpCode() === core_bentley_1.DbOpcode.Insert)
|
|
80
|
+
return "Inserted";
|
|
81
|
+
if (this._nativeReader.getOpCode() === core_bentley_1.DbOpcode.Delete)
|
|
82
|
+
return "Deleted";
|
|
83
|
+
return "Updated";
|
|
84
|
+
}
|
|
85
|
+
/** Get primary key value array
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
get primaryKeyValues() {
|
|
89
|
+
return this._nativeReader.getPrimaryKeys();
|
|
90
|
+
}
|
|
91
|
+
/** Get primary key columns.
|
|
92
|
+
* @note To this to work db arg must be set when opening changeset file.
|
|
93
|
+
* @beta
|
|
94
|
+
*/
|
|
95
|
+
getPrimaryKeyColumnNames() {
|
|
96
|
+
const pks = [];
|
|
97
|
+
const cols = this.getColumnNames(this.tableName);
|
|
98
|
+
if (!this._disableSchemaCheck && cols.length !== this.columnCount)
|
|
99
|
+
throw new Error(`changeset table ${this.tableName} columns count does not match db declared table. ${this.columnCount} <> ${cols.length}`);
|
|
100
|
+
for (let i = 0; i < this.columnCount; ++i)
|
|
101
|
+
if (this._nativeReader.isPrimaryKeyColumn(i))
|
|
102
|
+
pks.push(cols[i]);
|
|
103
|
+
return pks;
|
|
104
|
+
}
|
|
105
|
+
/** Get current change table.
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
get tableName() {
|
|
109
|
+
return this._nativeReader.getTableName();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get changed value for a column
|
|
113
|
+
* @param columnIndex index of column in current change
|
|
114
|
+
* @param stage old or new value for change.
|
|
115
|
+
* @returns value for changed column
|
|
116
|
+
* @beta
|
|
117
|
+
*/
|
|
118
|
+
getChangeValue(columnIndex, stage) {
|
|
119
|
+
return this._nativeReader.getColumnValue(columnIndex, stage === "New" ? 1 /* IModelJsNative.DbChangeStage.New */ : 0 /* IModelJsNative.DbChangeStage.Old */);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get all changed value in current change as array
|
|
123
|
+
* @param stage old or new values for current change.
|
|
124
|
+
* @returns array of values.
|
|
125
|
+
* @beta
|
|
126
|
+
*/
|
|
127
|
+
getChangeValuesArray(stage) {
|
|
128
|
+
return this._nativeReader.getRow(stage === "New" ? 1 /* IModelJsNative.DbChangeStage.New */ : 0 /* IModelJsNative.DbChangeStage.Old */);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get change as object and format its content.
|
|
132
|
+
* @param stage old or new value for current change.
|
|
133
|
+
* @param args change format options
|
|
134
|
+
* @returns return object or undefined
|
|
135
|
+
* @beta
|
|
136
|
+
*/
|
|
137
|
+
getChangeValuesObject(stage, args = {}) {
|
|
138
|
+
const cols = this.getColumnNames(this.tableName);
|
|
139
|
+
const row = this.getChangeValuesArray(stage);
|
|
140
|
+
if (!row)
|
|
141
|
+
return undefined;
|
|
142
|
+
process.env;
|
|
143
|
+
const minLen = Math.min(cols.length, row.length);
|
|
144
|
+
if (!this._disableSchemaCheck && cols.length !== this.columnCount)
|
|
145
|
+
throw new Error(`changeset table ${this.tableName} columns count does not match db declared table. ${this.columnCount} <> ${cols.length}`);
|
|
146
|
+
const out = {};
|
|
147
|
+
if (args.includeTableName) {
|
|
148
|
+
out.$table = this.tableName;
|
|
149
|
+
}
|
|
150
|
+
if (args.includeOpCode) {
|
|
151
|
+
out.$op = this.op;
|
|
152
|
+
}
|
|
153
|
+
if (args.includeStage) {
|
|
154
|
+
out.$stage = stage;
|
|
155
|
+
}
|
|
156
|
+
if (args.includePrimaryKeyInUpdateNew && this.op === "Updated" && stage === "New") {
|
|
157
|
+
const pkNames = this.getPrimaryKeyColumnNames();
|
|
158
|
+
const pkValues = this.primaryKeyValues;
|
|
159
|
+
pkNames.forEach((v, i) => {
|
|
160
|
+
out[v] = pkValues[i];
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const isNullOrUndefined = (val) => typeof val === "undefined";
|
|
164
|
+
for (let i = 0; i < minLen; ++i) {
|
|
165
|
+
const columnValue = row[i];
|
|
166
|
+
const columnName = cols[i];
|
|
167
|
+
if (!args.includeNullColumns && isNullOrUndefined(columnValue))
|
|
168
|
+
continue;
|
|
169
|
+
out[columnName] = columnValue;
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get list of column for a table. This function also caches the result.
|
|
175
|
+
* @note To this to work db arg must be set when opening changeset file.
|
|
176
|
+
* @param tableName name of the table for which columns are requested.
|
|
177
|
+
* @returns columns of table.
|
|
178
|
+
* @beta
|
|
179
|
+
*/
|
|
180
|
+
getColumnNames(tableName) {
|
|
181
|
+
const columns = this._schemaCache.get(tableName);
|
|
182
|
+
if (columns)
|
|
183
|
+
return columns;
|
|
184
|
+
if (!this.db)
|
|
185
|
+
throw new Error("getColumns() require db context to be provided.");
|
|
186
|
+
return this.db.withPreparedSqliteStatement("SELECT [name] FROM PRAGMA_TABLE_INFO(?) ORDER BY [cid]", (stmt) => {
|
|
187
|
+
stmt.bindString(1, tableName);
|
|
188
|
+
const tblCols = [];
|
|
189
|
+
while (stmt.step() === core_bentley_1.DbResult.BE_SQLITE_ROW) {
|
|
190
|
+
tblCols.push(stmt.getValueString(0));
|
|
191
|
+
}
|
|
192
|
+
this._schemaCache.set(tableName, tblCols);
|
|
193
|
+
return tblCols;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/** index of current change
|
|
197
|
+
* @beta
|
|
198
|
+
*/
|
|
199
|
+
get changeIndex() { return this._changeIndex; }
|
|
200
|
+
/**
|
|
201
|
+
* Close changeset
|
|
202
|
+
* @beta
|
|
203
|
+
*/
|
|
204
|
+
close() {
|
|
205
|
+
this._changeIndex = 0;
|
|
206
|
+
this._nativeReader.close();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Dispose this object
|
|
210
|
+
* @beta
|
|
211
|
+
*/
|
|
212
|
+
dispose() {
|
|
213
|
+
this.close();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
exports.SqliteChangesetReader = SqliteChangesetReader;
|
|
217
|
+
//# sour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C;IACb,CAAC;IACD;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,OAAO;YACT,OAAO,OAAO,CAAC;QAEjB,IAAI,CAAC,IAAI,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAErE,OAAO,IAAI,CAAC,EAAE,CAAC,2BAA2B,CAAC,wDAAwD,EAAE,CAAC,IAAI,EAAE,EAAE;YAC5G,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YAC9B,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,aAAa,EAAE;gBAC7C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACtC;YACD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC1C,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IACD;;OAEG;IACH,IAAW,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACtD;;;OAGG;IACI,KAAK;QACV,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IACD;;;OAGG;IACI,OAAO;QACZ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AAvND,sDAuNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module SQLiteDb\r\n */\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { DbOpcode, DbResult, IDisposable } from \"@itwin/core-bentley\";\r\nimport { ECDb } from \"./ECDb\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/** Changed value type\r\n * @beta\r\n*/\r\ntype SqliteValue = Uint8Array | number | string | null | undefined;\r\n\r\n/** Array of changed values\r\n * @beta\r\n*/\r\ntype SqliteValueArray = SqliteValue[];\r\n/**\r\n * Format option when converting change from array to column/value object.\r\n * @beta\r\n */\r\nexport interface ChangeFormatArgs {\r\n /** include table name */\r\n includeTableName?: true;\r\n /** include op code */\r\n includeOpCode?: true;\r\n /** include null columns */\r\n includeNullColumns?: true;\r\n /** include value version */\r\n includeStage?: true;\r\n /** include primary key in update change */\r\n includePrimaryKeyInUpdateNew?: true;\r\n}\r\n\r\n/** Operation that cause the change\r\n * @beta\r\n*/\r\nexport type SqliteChangeOp = \"Inserted\" | \"Updated\" | \"Deleted\";\r\n\r\n/** Stage is version of value that needed to be read\r\n * @beta\r\n*/\r\nexport type SqliteValueStage = \"Old\" | \"New\";\r\n\r\n/** Db from which schema will be read. It should be from timeline to which changeset belong.\r\n * @beta\r\n*/\r\nexport type AnyDb = IModelDb | ECDb;\r\n\r\n/** Arg to open a changeset file from disk\r\n * @beta\r\n*/\r\nexport interface SqliteChangesetReaderArgs {\r\n /** db from which schema will be read. It should be close to changeset.*/\r\n readonly db?: AnyDb;\r\n /** invert the changeset operations */\r\n readonly invert?: true;\r\n /** do not check if column of change match db schema instead ignore addition columns */\r\n readonly disableSchemaCheck?: true;\r\n}\r\n\r\n/**\r\n * Represent sqlite change.\r\n * @beta\r\n */\r\nexport interface SqliteChange {\r\n /** name of table */\r\n $table?: string;\r\n /** SQLite operation that created this change */\r\n $op?: SqliteChangeOp;\r\n /** version of data in change. */\r\n $stage?: SqliteValueStage;\r\n /** columns in change */\r\n [key: string]: any;\r\n}\r\n\r\n/**\r\n * Read raw sqlite changeset from disk and enumerate changes.\r\n * It also optionally let you format change with schema from\r\n * a db provided.\r\n * @beta\r\n */\r\nexport class SqliteChangesetReader implements IDisposable {\r\n private readonly _nativeReader = new IModelHost.platform.ChangesetReader();\r\n private _schemaCache = new Map<string, string[]>();\r\n private _disableSchemaCheck = false;\r\n private _changeIndex = 0;\r\n protected constructor(\r\n /** db from where sql schema will be read */\r\n public readonly db?: AnyDb,\r\n ) { }\r\n\r\n /**\r\n * Open changeset file from disk\r\n * @param args fileName of changeset reader and other options.\r\n * @returns SqliteChangesetReader instance\r\n */\r\n public static openFile(args: { readonly fileName: string } & SqliteChangesetReaderArgs): SqliteChangesetReader {\r\n const reader = new SqliteChangesetReader(args.db);\r\n reader._disableSchemaCheck = args.disableSchemaCheck ?? false;\r\n reader._nativeReader.openFile(args.fileName, args.invert ?? false);\r\n return reader;\r\n }\r\n\r\n /**\r\n * Open local changes in iModel.\r\n * @param args iModel and other options.\r\n * @returns SqliteChangesetReader instance\r\n */\r\n public static openLocalChanges(args: { iModel: IModelJsNative.DgnDb, includeInMemoryChanges?: true } & SqliteChangesetReaderArgs): SqliteChangesetReader {\r\n const reader = new SqliteChangesetReader(args.db);\r\n reader._disableSchemaCheck = args.disableSchemaCheck ?? false;\r\n reader._nativeReader.openLocalChanges(args.iModel, args.includeInMemoryChanges ?? false, args.invert ?? false);\r\n return reader;\r\n }\r\n /** check if schema check is disabled or not */\r\n public get disableSchemaCheck(): boolean { return this._disableSchemaCheck; }\r\n /** Move to next change in changeset\r\n * @returns true if there is current change false if reader is end of changeset.\r\n * @beta\r\n */\r\n public step(): boolean {\r\n if (this._nativeReader.step()) {\r\n this._changeIndex++;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Check if reader current on a row\r\n * @beta\r\n */\r\n public get hasRow(): boolean {\r\n return this._nativeReader.hasRow();\r\n }\r\n /** Check if its current change is indirect\r\n * @beta\r\n */\r\n public get isIndirect(): boolean {\r\n return this._nativeReader.isIndirectChange();\r\n }\r\n /** Get count of columns in current change\r\n * @beta\r\n */\r\n public get columnCount(): number {\r\n return this._nativeReader.getColumnCount();\r\n }\r\n /** Get operation that caused the change\r\n * @beta\r\n */\r\n public get op(): SqliteChangeOp {\r\n if (this._nativeReader.getOpCode() === DbOpcode.Insert)\r\n return \"Inserted\";\r\n\r\n if (this._nativeReader.getOpCode() === DbOpcode.Delete)\r\n return \"Deleted\";\r\n\r\n return \"Updated\";\r\n }\r\n /** Get primary key value array\r\n * @beta\r\n */\r\n public get primaryKeyValues(): SqliteValueArray {\r\n return this._nativeReader.getPrimaryKeys();\r\n }\r\n /** Get primary key columns.\r\n * @note To this to work db arg must be set when opening changeset file.\r\n * @beta\r\n */\r\n public getPrimaryKeyColumnNames(): string[] {\r\n const pks = [];\r\n const cols = this.getColumnNames(this.tableName);\r\n if (!this._disableSchemaCheck && cols.length !== this.columnCount)\r\n throw new Error(`changeset table ${this.tableName} columns count does not match db declared table. ${this.columnCount} <> ${cols.length}`);\r\n\r\n for (let i = 0; i < this.columnCount; ++i)\r\n if (this._nativeReader.isPrimaryKeyColumn(i))\r\n pks.push(cols[i]);\r\n\r\n return pks;\r\n }\r\n /** Get current change table.\r\n * @beta\r\n */\r\n public get tableName(): string {\r\n return this._nativeReader.getTableName();\r\n }\r\n /**\r\n * Get changed value for a column\r\n * @param columnIndex index of column in current change\r\n * @param stage old or new value for change.\r\n * @returns value for changed column\r\n * @beta\r\n */\r\n public getChangeValue(columnIndex: number, stage: SqliteValueStage): SqliteValue {\r\n return this._nativeReader.getColumnValue(columnIndex, stage === \"New\" ? IModelJsNative.DbChangeStage.New : IModelJsNative.DbChangeStage.Old);\r\n }\r\n /**\r\n * Get all changed value in current change as array\r\n * @param stage old or new values for current change.\r\n * @returns array of values.\r\n * @beta\r\n */\r\n public getChangeValuesArray(stage: SqliteValueStage): SqliteValueArray | undefined {\r\n return this._nativeReader.getRow(stage === \"New\" ? IModelJsNative.DbChangeStage.New : IModelJsNative.DbChangeStage.Old);\r\n }\r\n /**\r\n * Get change as object and format its content.\r\n * @param stage old or new value for current change.\r\n * @param args change format options\r\n * @returns return object or undefined\r\n * @beta\r\n */\r\n public getChangeValuesObject(stage: SqliteValueStage, args: ChangeFormatArgs = {}): SqliteChange | undefined {\r\n const cols = this.getColumnNames(this.tableName);\r\n const row = this.getChangeValuesArray(stage);\r\n if (!row)\r\n return undefined;\r\n process.env;\r\n const minLen = Math.min(cols.length, row.length);\r\n\r\n if (!this._disableSchemaCheck && cols.length !== this.columnCount)\r\n throw new Error(`changeset table ${this.tableName} columns count does not match db declared table. ${this.columnCount} <> ${cols.length}`);\r\n\r\n const out: SqliteChange = {};\r\n if (args.includeTableName) {\r\n out.$table = this.tableName;\r\n }\r\n if (args.includeOpCode) {\r\n out.$op = this.op;\r\n }\r\n if (args.includeStage) {\r\n out.$stage = stage;\r\n }\r\n\r\n if (args.includePrimaryKeyInUpdateNew && this.op === \"Updated\" && stage === \"New\") {\r\n const pkNames = this.getPrimaryKeyColumnNames();\r\n const pkValues = this.primaryKeyValues;\r\n pkNames.forEach((v, i) => {\r\n out[v] = pkValues[i];\r\n });\r\n }\r\n const isNullOrUndefined = (val: SqliteValue) => typeof val === \"undefined\";\r\n\r\n for (let i = 0; i < minLen; ++i) {\r\n const columnValue = row[i];\r\n const columnName = cols[i];\r\n if (!args.includeNullColumns && isNullOrUndefined(columnValue))\r\n continue;\r\n\r\n out[columnName] = columnValue;\r\n }\r\n return out;\r\n }\r\n /**\r\n * Get list of column for a table. This function also caches the result.\r\n * @note To this to work db arg must be set when opening changeset file.\r\n * @param tableName name of the table for which columns are requested.\r\n * @returns columns of table.\r\n * @beta\r\n */\r\n public getColumnNames(tableName: string): string[] {\r\n const columns = this._schemaCache.get(tableName);\r\n if (columns)\r\n return columns;\r\n\r\n if (!this.db)\r\n throw new Error(\"getColumns() require db context to be provided.\");\r\n\r\n return this.db.withPreparedSqliteStatement(\"SELECT [name] FROM PRAGMA_TABLE_INFO(?) ORDER BY [cid]\", (stmt) => {\r\n stmt.bindString(1, tableName);\r\n const tblCols: string[] = [];\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n tblCols.push(stmt.getValueString(0));\r\n }\r\n this._schemaCache.set(tableName, tblCols);\r\n return tblCols;\r\n });\r\n }\r\n /** index of current change\r\n * @beta\r\n */\r\n public get changeIndex() { return this._changeIndex; }\r\n /**\r\n * Close changeset\r\n * @beta\r\n */\r\n public close() {\r\n this._changeIndex = 0;\r\n this._nativeReader.close();\r\n }\r\n /**\r\n * Dispose this object\r\n * @beta\r\n */\r\n public dispose(): void {\r\n this.close();\r\n }\r\n}\r\n"]}
|
|
@@ -62,6 +62,8 @@ export * from "./ViewStore";
|
|
|
62
62
|
export * from "./workspace/Settings";
|
|
63
63
|
export * from "./workspace/SettingsSchemas";
|
|
64
64
|
export * from "./workspace/Workspace";
|
|
65
|
+
export * from "./SqliteChangesetReader";
|
|
66
|
+
export * from "./ChangesetECAdaptor";
|
|
65
67
|
/** @docs-package-description
|
|
66
68
|
* The core-backend package always runs on the computer with a local Briefcase.
|
|
67
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEnG,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gB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AC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AAErC;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
package/lib/cjs/core-backend.js
CHANGED
|
@@ -86,6 +86,8 @@ __exportStar(require("./ViewStore"), exports);
|
|
|
86
86
|
__exportStar(require("./workspace/Settings"), exports);
|
|
87
87
|
__exportStar(require("./workspace/SettingsSchemas"), exports);
|
|
88
88
|
__exportStar(require("./workspace/Workspace"), exports);
|
|
89
|
+
__exportStar(require("./SqliteChangesetReader"), exports);
|
|
90
|
+
__exportStar(require("./ChangesetECAdaptor"), exports);
|
|
89
91
|
/** @docs-package-description
|
|
90
92
|
* The core-backend package always runs on the computer with a local Briefcase.
|
|
91
93
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,4DAAmG;AAA1F,iHAAA,cAAc,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAEhE,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,yDAAuC;AACvC,qDAAmC;AACnC,6CAA2B;AAC3B,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,iDAA+B;AAC/B,+DAA6C;AAC7C,6DAA2C;AAC3C,4DAA0C;AAC1C,0DAAwC;AACxC,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,sDAAoC;AACpC,2CAAyB;AACzB,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,mDAAiC;AACjC,4CAA0B;AAC1B,uDAAqC;AACrC,6CAA2B;AAC3B,8DAA4C;AAC5C,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,qDAAmC;AACnC,+CAA6B;AAC7B,2DAAyC;AACzC,kDAAgC;AAChC,iDAA+B;AAC/B,gDAA8B;AAC9B,2CAAyB;AACzB,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,4CAA0B;AAC1B,gDAA8B;AA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AAC5C,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AAErC;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport { IModelJsNative, NativeCloudSqlite, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\n\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./BlobContainerService\";\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./ChannelControl\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CloudSqlite\";\r\nexport * from \"./CodeService\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./ElementTreeWalker\";\r\nexport * from \"./Entity\";\r\nexport * from \"./EntityReferences\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./GeoCoordConfig\";\r\nexport * from \"./HubMock\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelDb\";\r\nexport * from \"./IModelElementCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./SchemaSync\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./LocalHub\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./PropertyStore\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./rpc/tracing\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SchemaUtils\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TileStorage\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./ViewStore\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSchemas\";\r\nexport * from \"./workspace/Workspace\";\r\nexport * from \"./SqliteChangesetReader\";\r\nexport * from \"./ChangesetECAdaptor\";\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/guide/fundamentals/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description BlobContainers\r\n * Classes for working with cloud-based blob containers.\r\n */\r\n/**\r\n * @docs-group-description TileStorage\r\n * Class for working with cloud storage using iTwin/object-storage cloud providers\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n/**\r\n * @docs-group-description ViewStateHydrator\r\n * Class responsible for loading ViewStates.\r\n */\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-backend",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-dev.1",
|
|
4
4
|
"description": "iTwin.js backend components",
|
|
5
5
|
"main": "lib/cjs/core-backend.js",
|
|
6
6
|
"typings": "lib/cjs/core-backend",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": "^18.0.0"
|
|
9
|
+
"node": "^18.0.0 || ^20.0.0"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"url": "http://www.bentley.com"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@itwin/core-bentley": "^4.
|
|
29
|
-
"@itwin/core-common": "^4.
|
|
30
|
-
"@itwin/core-geometry": "^4.
|
|
28
|
+
"@itwin/core-bentley": "^4.4.0-dev.1",
|
|
29
|
+
"@itwin/core-common": "^4.4.0-dev.1",
|
|
30
|
+
"@itwin/core-geometry": "^4.4.0-dev.1",
|
|
31
31
|
"@opentelemetry/api": "^1.0.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/fs-extra": "^4.0.7",
|
|
48
48
|
"@types/mocha": "^8.2.2",
|
|
49
49
|
"@types/multiparty": "^0.0.31",
|
|
50
|
-
"@types/node": "18.16.
|
|
50
|
+
"@types/node": "~18.16.20",
|
|
51
51
|
"@types/semver": "7.3.10",
|
|
52
52
|
"@types/sinon": "^10.0.15",
|
|
53
53
|
"@types/touch": "^3.1.2",
|
|
@@ -60,23 +60,25 @@
|
|
|
60
60
|
"eslint": "^8.44.0",
|
|
61
61
|
"fs-extra": "^8.1.0",
|
|
62
62
|
"mocha": "^10.0.0",
|
|
63
|
+
"node-simctl": "~7.2.1",
|
|
63
64
|
"null-loader": "^4.0.1",
|
|
64
65
|
"nyc": "^15.1.0",
|
|
65
66
|
"rimraf": "^3.0.2",
|
|
66
67
|
"sinon": "^15.0.4",
|
|
67
68
|
"source-map-loader": "^4.0.0",
|
|
69
|
+
"ts-node": "^10.8.2",
|
|
68
70
|
"typescript": "~5.0.2",
|
|
69
71
|
"webpack": "^5.76.0",
|
|
70
|
-
"@itwin/build-tools": "4.
|
|
71
|
-
"@itwin/core-bentley": "4.
|
|
72
|
-
"@itwin/core-common": "4.
|
|
73
|
-
"@itwin/core-geometry": "4.
|
|
74
|
-
"@itwin/core-webpack-tools": "4.
|
|
75
|
-
"@itwin/ecsql-common": "4.
|
|
72
|
+
"@itwin/build-tools": "4.4.0-dev.1",
|
|
73
|
+
"@itwin/core-bentley": "4.4.0-dev.1",
|
|
74
|
+
"@itwin/core-common": "4.4.0-dev.1",
|
|
75
|
+
"@itwin/core-geometry": "4.4.0-dev.1",
|
|
76
|
+
"@itwin/core-webpack-tools": "4.4.0-dev.1",
|
|
77
|
+
"@itwin/ecsql-common": "4.4.0-dev.1",
|
|
76
78
|
"internal-tools": "3.0.0-dev.69"
|
|
77
79
|
},
|
|
78
80
|
"dependencies": {
|
|
79
|
-
"@bentley/imodeljs-native": "4.
|
|
81
|
+
"@bentley/imodeljs-native": "4.3.5",
|
|
80
82
|
"@itwin/cloud-agnostic-core": "^2.1.0",
|
|
81
83
|
"@itwin/object-storage-azure": "^2.1.0",
|
|
82
84
|
"@itwin/object-storage-core": "^2.1.0",
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
"semver": "^7.3.5",
|
|
90
92
|
"touch": "^3.1.0",
|
|
91
93
|
"ws": "^7.5.3",
|
|
92
|
-
"@itwin/core-telemetry": "4.
|
|
94
|
+
"@itwin/core-telemetry": "4.4.0-dev.1"
|
|
93
95
|
},
|
|
94
96
|
"nyc": {
|
|
95
97
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -97,7 +99,7 @@
|
|
|
97
99
|
"scripts": {
|
|
98
100
|
"build": "npm run -s build:cjs && npm run -s copy:assets && npm run -s copy:test-assets",
|
|
99
101
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
100
|
-
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
102
|
+
"clean": "rimraf lib .rush/temp/package-deps*.json ../../tools/internal/ios/core-test-runner/build ../../tools/internal/lib",
|
|
101
103
|
"docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-backend/file.json --tsIndexFile=./core-backend.ts --onlyJson",
|
|
102
104
|
"copy:assets": "cpx \"./src/assets/**/*\" ./lib/cjs/assets",
|
|
103
105
|
"copy:config": "internal-tools copy-config",
|
|
@@ -108,6 +110,9 @@
|
|
|
108
110
|
"test": "mocha",
|
|
109
111
|
"ios:webpack:tests": "TESTS_GLOB=./lib/**/*.test.js webpack --config ../../tools/internal/ios/ios.webpack.config.js",
|
|
110
112
|
"ios:copy:assets": "cpx \"./src/test/assets/**/*\" ../../tools/internal/lib/ios/assets/assets && cpx \"./src/assets/**/*\" ../../tools/internal/lib/ios/assets/assets",
|
|
111
|
-
"ios:build:tests": "npm run -s build && npm run -s ios:webpack:tests && npm run -s ios:copy:assets"
|
|
113
|
+
"ios:build:tests": "npm run -s build && npm run -s ios:webpack:tests && npm run -s ios:copy:assets",
|
|
114
|
+
"ios:build:core-test-runner": "cd ../../tools/internal/ios/core-test-runner && xcrun xcodebuild -derivedDataPath ./build/DerivedData build CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO PROVISIONING_PROFILE_SPECIFIER= -scheme core-test-runner -arch x86_64 -sdk iphonesimulator -configuration Debug",
|
|
115
|
+
"ios:tests:simulator": "ts-node --skip-project runUnitTestsIosSimulator.ts",
|
|
116
|
+
"ios:all": "npm run ios:build:tests && npm run ios:build:core-test-runner && npm run ios:tests:simulator"
|
|
112
117
|
}
|
|
113
118
|
}
|