@digione/node-custom-api 0.2.0-alpha11 → 0.2.0-alpha12
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/package.json +1 -1
- package/utils/auth.d.ts +3 -1
- package/utils/auth.js +2 -2
- package/utils/db.d.ts +14 -6
- package/utils/db.js +13 -13
- package/utils/stream.d.ts +10 -4
- package/utils/stream.js +13 -13
package/package.json
CHANGED
package/utils/auth.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export declare class AuthUtil {
|
|
|
15
15
|
success: number;
|
|
16
16
|
token: any;
|
|
17
17
|
}>;
|
|
18
|
-
refreshAccessTokenByToken(token: any
|
|
18
|
+
refreshAccessTokenByToken(token: any, { attributes_include }?: {
|
|
19
|
+
attributes_include?: any[];
|
|
20
|
+
}): Promise<{
|
|
19
21
|
access_token: string;
|
|
20
22
|
}>;
|
|
21
23
|
signNotificationTokenByToken(token: any, input?: any): Promise<{
|
package/utils/auth.js
CHANGED
|
@@ -75,7 +75,7 @@ class AuthUtil {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
refreshAccessTokenByToken(token) {
|
|
78
|
+
refreshAccessTokenByToken(token, { attributes_include = [] } = {}) {
|
|
79
79
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
81
|
const tokenData = yield (0, helper_1.getTokenDataFromTokenBySecret)(token, (0, helper_1.getENV)('JWT_SECRET'));
|
|
@@ -84,7 +84,7 @@ class AuthUtil {
|
|
|
84
84
|
yield access_token_1.AccessTokenModel.schema(this.ref, "_").destroy({
|
|
85
85
|
where: { refresh_token_id: refreshTokenId }
|
|
86
86
|
});
|
|
87
|
-
let include_access = {}, attributes = (this.ref == 'core') ? ['group_id'] : ['organ_id', 'group_id', 'b2b_group_id', 'team_id'];
|
|
87
|
+
let include_access = {}, attributes = (this.ref == 'core') ? ['group_id'] : ['organ_id', 'group_id', 'b2b_group_id', 'team_id'].concat(attributes_include);
|
|
88
88
|
let refresh = yield refresh_token_1.RefreshTokenModel.schema(this.ref, "_").findOne({
|
|
89
89
|
where: { id: refreshTokenId }, attributes, raw: true
|
|
90
90
|
});
|
package/utils/db.d.ts
CHANGED
|
@@ -33,20 +33,23 @@ export declare const findAll: (table: string, { where, attributes, association,
|
|
|
33
33
|
offset?: number;
|
|
34
34
|
order?: any[];
|
|
35
35
|
}) => Promise<Array<any>>;
|
|
36
|
-
export declare const update: (ref: string, table: string, input: any, { where, default_lang, index }?: {
|
|
36
|
+
export declare const update: (ref: string, table: string, input: any, { where, default_lang, index, transaction }?: {
|
|
37
37
|
where?: {};
|
|
38
38
|
default_lang?: string;
|
|
39
39
|
index?: string;
|
|
40
|
+
transaction?: sequelize.Transaction;
|
|
40
41
|
}) => Promise<[undefined, number] | {
|
|
41
42
|
[x: string]: any;
|
|
42
43
|
}>;
|
|
43
|
-
export declare const insert: (ref: string, table: string, input: any, { index }?: {
|
|
44
|
+
export declare const insert: (ref: string, table: string, input: any, { index, transaction }?: {
|
|
44
45
|
index?: string;
|
|
46
|
+
transaction?: sequelize.Transaction;
|
|
45
47
|
}) => Promise<{
|
|
46
48
|
[x: string]: any;
|
|
47
49
|
}>;
|
|
48
|
-
export declare const remove: (ref: string, table: string, { where }?: {
|
|
50
|
+
export declare const remove: (ref: string, table: string, { where, transaction }?: {
|
|
49
51
|
where?: {};
|
|
52
|
+
transaction?: sequelize.Transaction;
|
|
50
53
|
}) => Promise<number>;
|
|
51
54
|
export declare const max: (ref: string, table: string, field: any, { where }?: {
|
|
52
55
|
where?: {};
|
|
@@ -55,9 +58,12 @@ export declare const getNextId: (ref: string, table: any) => Promise<any>;
|
|
|
55
58
|
export declare const getFieldAll: (table: string, { type }?: {
|
|
56
59
|
type?: boolean;
|
|
57
60
|
}) => Promise<any[]>;
|
|
58
|
-
export declare const truncate: (table: string
|
|
59
|
-
|
|
61
|
+
export declare const truncate: (table: string, { transaction }?: {
|
|
62
|
+
transaction?: sequelize.Transaction;
|
|
63
|
+
}) => Promise<[unknown[], unknown]>;
|
|
64
|
+
export declare const cloneTable: (old_table: string, new_table: string, { withRow, transaction }?: {
|
|
60
65
|
withRow?: boolean;
|
|
66
|
+
transaction?: sequelize.Transaction;
|
|
61
67
|
}) => Promise<boolean>;
|
|
62
68
|
export declare const createTable: (table: string, attributes: any, { removePrimary, field }?: {
|
|
63
69
|
removePrimary?: boolean;
|
|
@@ -91,4 +97,6 @@ export declare const changeColumn: (table: string, field: string, schema: ModelA
|
|
|
91
97
|
remove_index?: boolean;
|
|
92
98
|
}) => Promise<void>;
|
|
93
99
|
export declare const removeColumn: (table: string, field: string) => Promise<[unknown[], unknown]>;
|
|
94
|
-
export declare const cloneColumn: (table: string, old_field: string, new_field: string
|
|
100
|
+
export declare const cloneColumn: (table: string, old_field: string, new_field: string, { transaction }?: {
|
|
101
|
+
transaction?: sequelize.Transaction;
|
|
102
|
+
}) => Promise<[undefined, number]>;
|
package/utils/db.js
CHANGED
|
@@ -138,7 +138,7 @@ const findAll = (table, { where = {}, attributes = [], association = [], limit =
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
exports.findAll = findAll;
|
|
141
|
-
const update = (ref, table, input, { where = {}, default_lang = "", index = "id" } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
+
const update = (ref, table, input, { where = {}, default_lang = "", index = "id", transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
142
142
|
if (where['lang_code'] && (input['lang_code'] && input[index])) {
|
|
143
143
|
let exist = yield (0, exports.count)(ref + "_" + table, { primaryKey: index, where: { lang_code: input['lang_code'], [index]: input[index] } });
|
|
144
144
|
if (!exist) {
|
|
@@ -171,7 +171,7 @@ const update = (ref, table, input, { where = {}, default_lang = "", index = "id"
|
|
|
171
171
|
let whereClause = (0, exports.genWhere)(where);
|
|
172
172
|
let query = `UPDATE ${table} ${set} ${whereClause}`;
|
|
173
173
|
try {
|
|
174
|
-
let data = yield database_1.default.query(query, { type: sequelize.QueryTypes.UPDATE });
|
|
174
|
+
let data = yield database_1.default.query(query, { type: sequelize.QueryTypes.UPDATE, transaction });
|
|
175
175
|
return data;
|
|
176
176
|
}
|
|
177
177
|
catch (err) {
|
|
@@ -180,7 +180,7 @@ const update = (ref, table, input, { where = {}, default_lang = "", index = "id"
|
|
|
180
180
|
return Promise.reject(errors_1.generalError.BAD_REQUEST);
|
|
181
181
|
});
|
|
182
182
|
exports.update = update;
|
|
183
|
-
const insert = (ref, table, input, { index = "id" } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
+
const insert = (ref, table, input, { index = "id", transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
184
184
|
table = ref ? ref + "_" + table : table;
|
|
185
185
|
let insert, rawField = "", rawValues = "";
|
|
186
186
|
_.each(input, (value, key) => {
|
|
@@ -197,7 +197,7 @@ const insert = (ref, table, input, { index = "id" } = {}) => tslib_1.__awaiter(v
|
|
|
197
197
|
}
|
|
198
198
|
let query = `INSERT INTO ${table} ${insert}`;
|
|
199
199
|
try {
|
|
200
|
-
let insert = yield database_1.default.query(query, { type: sequelize.QueryTypes.INSERT });
|
|
200
|
+
let insert = yield database_1.default.query(query, { type: sequelize.QueryTypes.INSERT, transaction });
|
|
201
201
|
return { [index]: input[index] ? input[index] : insert[0] };
|
|
202
202
|
}
|
|
203
203
|
catch (err) {
|
|
@@ -206,12 +206,12 @@ const insert = (ref, table, input, { index = "id" } = {}) => tslib_1.__awaiter(v
|
|
|
206
206
|
return Promise.reject(errors_1.generalError.BAD_REQUEST);
|
|
207
207
|
});
|
|
208
208
|
exports.insert = insert;
|
|
209
|
-
const remove = (ref, table, { where = {} } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
209
|
+
const remove = (ref, table, { where = {}, transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
210
210
|
table = ref ? ref + "_" + table : table;
|
|
211
211
|
let whereClause = (0, exports.genWhere)(where);
|
|
212
212
|
let query = `DELETE FROM ${table} ${whereClause}`;
|
|
213
213
|
try {
|
|
214
|
-
yield database_1.default.query(query, { type: sequelize.QueryTypes.DELETE });
|
|
214
|
+
yield database_1.default.query(query, { type: sequelize.QueryTypes.DELETE, transaction });
|
|
215
215
|
return 1;
|
|
216
216
|
}
|
|
217
217
|
catch (err) {
|
|
@@ -263,16 +263,16 @@ const getFieldAll = (table, { type = false } = {}) => tslib_1.__awaiter(void 0,
|
|
|
263
263
|
return null;
|
|
264
264
|
});
|
|
265
265
|
exports.getFieldAll = getFieldAll;
|
|
266
|
-
const truncate = (table) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
267
|
-
return database_1.default.query(`TRUNCATE TABLE ${table}`, { type: sequelize.QueryTypes.RAW });
|
|
266
|
+
const truncate = (table, { transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
267
|
+
return database_1.default.query(`TRUNCATE TABLE ${table}`, { type: sequelize.QueryTypes.RAW, transaction });
|
|
268
268
|
});
|
|
269
269
|
exports.truncate = truncate;
|
|
270
|
-
const cloneTable = (old_table, new_table, { withRow = true } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
270
|
+
const cloneTable = (old_table, new_table, { withRow = true, transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
271
271
|
let exist = yield (0, exports.getExistTable)(new_table);
|
|
272
272
|
if (exist)
|
|
273
273
|
return false;
|
|
274
|
-
yield database_1.default.query(`CREATE TABLE ${new_table} LIKE ${old_table}`, { type: sequelize.QueryTypes.RAW });
|
|
275
|
-
withRow && (yield database_1.default.query(`INSERT INTO ${new_table} SELECT * FROM ${old_table}`, { type: sequelize.QueryTypes.INSERT }));
|
|
274
|
+
yield database_1.default.query(`CREATE TABLE ${new_table} LIKE ${old_table}`, { type: sequelize.QueryTypes.RAW, transaction });
|
|
275
|
+
withRow && (yield database_1.default.query(`INSERT INTO ${new_table} SELECT * FROM ${old_table}`, { type: sequelize.QueryTypes.INSERT, transaction }));
|
|
276
276
|
return true;
|
|
277
277
|
});
|
|
278
278
|
exports.cloneTable = cloneTable;
|
|
@@ -389,9 +389,9 @@ const removeColumn = (table, field) => tslib_1.__awaiter(void 0, void 0, void 0,
|
|
|
389
389
|
return null;
|
|
390
390
|
});
|
|
391
391
|
exports.removeColumn = removeColumn;
|
|
392
|
-
const cloneColumn = (table, old_field, new_field) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
392
|
+
const cloneColumn = (table, old_field, new_field, { transaction = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
393
393
|
try {
|
|
394
|
-
return yield database_1.default.query(`UPDATE ${table} SET ${new_field} = ${old_field}`, { type: sequelize.QueryTypes.UPDATE });
|
|
394
|
+
return yield database_1.default.query(`UPDATE ${table} SET ${new_field} = ${old_field}`, { type: sequelize.QueryTypes.UPDATE, transaction });
|
|
395
395
|
}
|
|
396
396
|
catch (err) { }
|
|
397
397
|
return null;
|
package/utils/stream.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { FileUtil, TagFile } from './file';
|
|
3
|
+
import { Transaction } from 'sequelize';
|
|
3
4
|
import { QueryParamOption } from '../interface/param';
|
|
4
5
|
import { Request } from 'express';
|
|
5
6
|
import * as Joi from 'joi';
|
|
@@ -149,12 +150,13 @@ export declare class StreamUtil {
|
|
|
149
150
|
df_lang?: string;
|
|
150
151
|
}): Promise<any[]>;
|
|
151
152
|
truncate(slug: string, namespace: string): Promise<true | any[]>;
|
|
152
|
-
remove(slug: string, namespace: string, index: any, { field, where, error }?: {
|
|
153
|
+
remove(slug: string, namespace: string, index: any, { field, where, error, transaction }?: {
|
|
153
154
|
field?: string;
|
|
154
155
|
where?: {};
|
|
155
156
|
error?: boolean;
|
|
157
|
+
transaction?: Transaction;
|
|
156
158
|
}): Promise<boolean>;
|
|
157
|
-
upsert(slug: string, namespace: string, input?: any, { id, req, raw_input, attributes, field, where, default_lang, builder }?: {
|
|
159
|
+
upsert(slug: string, namespace: string, input?: any, { id, req, raw_input, attributes, field, where, default_lang, builder, transaction }?: {
|
|
158
160
|
id?: string;
|
|
159
161
|
req?: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
160
162
|
raw_input?: {};
|
|
@@ -163,6 +165,7 @@ export declare class StreamUtil {
|
|
|
163
165
|
where?: {};
|
|
164
166
|
default_lang?: string;
|
|
165
167
|
builder?: boolean;
|
|
168
|
+
transaction?: Transaction;
|
|
166
169
|
}): Promise<any>;
|
|
167
170
|
upsertBySlug(slug: string, namespace: string, index: string, { ref, req, parent_slug, input, tags, group }?: {
|
|
168
171
|
ref?: string;
|
|
@@ -246,14 +249,17 @@ export declare class StreamUtil {
|
|
|
246
249
|
lang?: any[];
|
|
247
250
|
}): Promise<any[]>;
|
|
248
251
|
checkStream(slug: string, namespace: string): Promise<number>;
|
|
249
|
-
addStream(slug: string, namespace: string, input?: any, { stream, column, checkDuplicate, fields, removePrimary }?: {
|
|
252
|
+
addStream(slug: string, namespace: string, input?: any, { stream, column, checkDuplicate, fields, removePrimary, transaction }?: {
|
|
250
253
|
stream?: any;
|
|
251
254
|
column?: {};
|
|
252
255
|
checkDuplicate?: boolean;
|
|
253
256
|
fields?: Field[];
|
|
254
257
|
removePrimary?: boolean;
|
|
258
|
+
transaction?: Transaction;
|
|
255
259
|
}): Promise<any>;
|
|
256
|
-
updateStream(slug: string, namespace: string, input?: any
|
|
260
|
+
updateStream(slug: string, namespace: string, input?: any, { transaction }?: {
|
|
261
|
+
transaction?: Transaction;
|
|
262
|
+
}): Promise<[undefined, number] | {
|
|
257
263
|
[x: string]: any;
|
|
258
264
|
}>;
|
|
259
265
|
removeStreamByNamespace(namespace: string): Promise<{
|
package/utils/stream.js
CHANGED
|
@@ -800,7 +800,7 @@ class StreamUtil {
|
|
|
800
800
|
return true;
|
|
801
801
|
});
|
|
802
802
|
}
|
|
803
|
-
remove(slug, namespace, index, { field = "id", where = {}, error = true } = {}) {
|
|
803
|
+
remove(slug, namespace, index, { field = "id", where = {}, error = true, transaction = undefined } = {}) {
|
|
804
804
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
805
805
|
let { id: id_stream, stream_prefix, fields: streams } = yield this.findField(slug, namespace, { field_only: false, field_required: false, convert_option: true });
|
|
806
806
|
let table = stream_prefix ? stream_prefix + slug : slug;
|
|
@@ -814,7 +814,7 @@ class StreamUtil {
|
|
|
814
814
|
if (field_type == "multiple" && field_data && field_data['choose_stream'] && field_data['self_table'] != "yes") {
|
|
815
815
|
let stream = yield stream_1.StreamModel.schema(this.ref, "_").findOne({ where: { id: field_data['choose_stream'] }, raw: true, attributes: ['stream_slug', 'stream_prefix'] });
|
|
816
816
|
let table_f = stream['stream_prefix'] ? stream['stream_prefix'] + stream['stream_slug'] : stream['stream_slug'];
|
|
817
|
-
yield (0, db_1.remove)(this.ref, `${table}_${table_f}`, { where: { row_id: id } });
|
|
817
|
+
yield (0, db_1.remove)(this.ref, `${table}_${table_f}`, { where: { row_id: id }, transaction });
|
|
818
818
|
}
|
|
819
819
|
else if ((field_type == "file" || field_type == "image")) {
|
|
820
820
|
file_id = file_id.concat(query.reduce((total, item) => item[field_slug] ? total.concat(item[field_slug]) : total, []));
|
|
@@ -824,7 +824,7 @@ class StreamUtil {
|
|
|
824
824
|
yield this.fileUtil.removeFileById(file_id, { error: false });
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
|
-
yield (0, db_1.remove)(this.ref, table, { where });
|
|
827
|
+
yield (0, db_1.remove)(this.ref, table, { where, transaction });
|
|
828
828
|
}
|
|
829
829
|
else if (error) {
|
|
830
830
|
return Promise.reject(errors_1.generalError.NOT_FOUND);
|
|
@@ -832,7 +832,7 @@ class StreamUtil {
|
|
|
832
832
|
return true;
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
|
-
upsert(slug, namespace, input = {}, { id = "", req = {}, raw_input = {}, attributes = [], field = "id", where = {}, default_lang = "en", builder = true } = {}) {
|
|
835
|
+
upsert(slug, namespace, input = {}, { id = "", req = {}, raw_input = {}, attributes = [], field = "id", where = {}, default_lang = "en", builder = true, transaction = undefined } = {}) {
|
|
836
836
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
837
837
|
let files = {}, id_files = {};
|
|
838
838
|
let lang_code = input['lang_code'] ? input['lang_code'] : default_lang;
|
|
@@ -927,11 +927,11 @@ class StreamUtil {
|
|
|
927
927
|
})));
|
|
928
928
|
}
|
|
929
929
|
if (id) {
|
|
930
|
-
yield (0, db_1.update)(this.ref, table, data, { where, default_lang });
|
|
930
|
+
yield (0, db_1.update)(this.ref, table, data, { where, default_lang, transaction });
|
|
931
931
|
query = { id };
|
|
932
932
|
}
|
|
933
933
|
else {
|
|
934
|
-
query = yield (0, db_1.insert)(this.ref, table, data);
|
|
934
|
+
query = yield (0, db_1.insert)(this.ref, table, data, { transaction });
|
|
935
935
|
id = query['id'];
|
|
936
936
|
}
|
|
937
937
|
if (!id_stream || (fields && !fields.length)) {
|
|
@@ -943,7 +943,7 @@ class StreamUtil {
|
|
|
943
943
|
let stream = yield stream_1.StreamModel.schema(this.ref, "_").findOne({ where: { id: field_data['choose_stream'] }, raw: true, attributes: ['stream_slug', 'stream_prefix'] });
|
|
944
944
|
let table_f = stream['stream_prefix'] ? stream['stream_prefix'] + stream['stream_slug'] : stream['stream_slug'];
|
|
945
945
|
if (!isNew) {
|
|
946
|
-
yield (0, db_1.remove)(this.ref, `${table}_${table_f}`, { where: { row_id: id } });
|
|
946
|
+
yield (0, db_1.remove)(this.ref, `${table}_${table_f}`, { where: { row_id: id }, transaction });
|
|
947
947
|
}
|
|
948
948
|
if (raw_input[field_slug]) {
|
|
949
949
|
let op = [];
|
|
@@ -956,7 +956,7 @@ class StreamUtil {
|
|
|
956
956
|
if (!v)
|
|
957
957
|
return 1;
|
|
958
958
|
let input = { row_id: id, [slug + "_id"]: id, [table_f + "_id"]: v };
|
|
959
|
-
yield (0, db_1.insert)(this.ref, `${table}_${table_f}`, input);
|
|
959
|
+
yield (0, db_1.insert)(this.ref, `${table}_${table_f}`, input, { transaction });
|
|
960
960
|
})));
|
|
961
961
|
}
|
|
962
962
|
}
|
|
@@ -1439,7 +1439,7 @@ class StreamUtil {
|
|
|
1439
1439
|
return yield stream_1.StreamModel.schema(this.ref, "_").count({ where: { stream_slug: slug, stream_namespace: namespace } });
|
|
1440
1440
|
});
|
|
1441
1441
|
}
|
|
1442
|
-
addStream(slug, namespace, input = {}, { stream = undefined, column = {}, checkDuplicate = true, fields = [], removePrimary = false } = {}) {
|
|
1442
|
+
addStream(slug, namespace, input = {}, { stream = undefined, column = {}, checkDuplicate = true, fields = [], removePrimary = false, transaction = undefined } = {}) {
|
|
1443
1443
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1444
1444
|
input['stream_slug'] = slug;
|
|
1445
1445
|
input['stream_namespace'] = namespace;
|
|
@@ -1461,10 +1461,10 @@ class StreamUtil {
|
|
|
1461
1461
|
input['stream_name'] = _.startCase(_.camelCase(input['stream_slug']));
|
|
1462
1462
|
}
|
|
1463
1463
|
input['view_options'] = input['view_options'] ? JSON.stringify(input['view_options']) : null;
|
|
1464
|
-
stream = yield (0, db_1.insert)(this.ref, stream_1.StreamModel.getTableName().toString(), input);
|
|
1464
|
+
stream = yield (0, db_1.insert)(this.ref, stream_1.StreamModel.getTableName().toString(), input, { transaction });
|
|
1465
1465
|
}
|
|
1466
1466
|
else {
|
|
1467
|
-
yield (0, db_1.update)(this.ref, stream_1.StreamModel.getTableName().toString(), input);
|
|
1467
|
+
yield (0, db_1.update)(this.ref, stream_1.StreamModel.getTableName().toString(), input, { transaction });
|
|
1468
1468
|
}
|
|
1469
1469
|
input['id'] = stream['id'];
|
|
1470
1470
|
if (!exist && input['stream_type'] == "auto")
|
|
@@ -1475,14 +1475,14 @@ class StreamUtil {
|
|
|
1475
1475
|
return stream;
|
|
1476
1476
|
});
|
|
1477
1477
|
}
|
|
1478
|
-
updateStream(slug, namespace, input = {}) {
|
|
1478
|
+
updateStream(slug, namespace, input = {}, { transaction = undefined } = {}) {
|
|
1479
1479
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1480
1480
|
let query = yield stream_1.StreamModel.schema(this.ref, "_").findOne({ where: { stream_slug: slug, stream_namespace: namespace }, attributes: ['id'], raw: true });
|
|
1481
1481
|
if (!query) {
|
|
1482
1482
|
return Promise.reject(errors_1.generalError.NOT_FOUND);
|
|
1483
1483
|
}
|
|
1484
1484
|
delete input['id'];
|
|
1485
|
-
return yield (0, db_1.update)(this.ref, stream_1.StreamModel.getTableName().toString(), input, { where: { id: query['id'] } });
|
|
1485
|
+
return yield (0, db_1.update)(this.ref, stream_1.StreamModel.getTableName().toString(), input, { where: { id: query['id'] }, transaction });
|
|
1486
1486
|
});
|
|
1487
1487
|
}
|
|
1488
1488
|
removeStreamByNamespace(namespace) {
|