@byted-apaas/server-sdk-node 1.0.12 → 1.0.15
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 +31 -1
- package/context/db/impl/IObject.d.ts +37 -0
- package/context/db/impl/object.d.ts +21 -1
- package/context/db/impl/object.js +228 -42
- package/context/db/impl/oql/ioql.d.ts +8 -0
- package/context/db/impl/oql/oql.d.ts +3 -0
- package/context/db/impl/oql/oql.js +10 -1
- package/context/db/impl/queryBuilder.d.ts +2 -2
- package/context/db/impl/queryBuilder.js +5 -13
- package/context/db/impl/transaction/index.d.ts +3 -0
- package/context/db/impl/transaction/index.js +10 -1
- package/context/db/impl/transaction.d.ts +8 -0
- package/kunlun/operator/impl/logicV2.d.ts +1 -0
- package/kunlun/operator/impl/logicV2.js +1 -4
- package/package.json +2 -2
- package/request/innerapi.d.ts +12 -12
- package/request/innerapi.js +45 -45
- package/request/interface.d.ts +12 -12
- package/request/openapi.d.ts +12 -12
- package/request/openapi.js +85 -25
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Copyright 2022 ByteDance Ltd. and/or its affiliates
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.QueryBuilder = exports.
|
|
5
|
+
exports.QueryBuilder = exports.defaultLimit = void 0;
|
|
6
6
|
const order_1 = require("./order");
|
|
7
7
|
const logic_1 = require("../../../kunlun/operator/impl/logic");
|
|
8
8
|
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.maxLimitV2 = 10000;
|
|
9
|
+
// SDK 仅作 limit 小于 0 校验,其他校验拦截由底层控制,如当查询结果不满足受控条件时,limit 仅支持最大 200
|
|
10
|
+
exports.defaultLimit = 200;
|
|
12
11
|
/**
|
|
13
12
|
* 查询构造器,在 DB 中被初始化,用于构建一次查询
|
|
14
13
|
*/
|
|
@@ -18,7 +17,7 @@ class QueryBuilder {
|
|
|
18
17
|
this.dataSource = '';
|
|
19
18
|
this.select = [];
|
|
20
19
|
this.where = null;
|
|
21
|
-
this.limit = exports.
|
|
20
|
+
this.limit = exports.defaultLimit;
|
|
22
21
|
this.offset = 0;
|
|
23
22
|
this.order = [];
|
|
24
23
|
this.logic = new logic_1.Logic();
|
|
@@ -60,15 +59,8 @@ class QueryBuilder {
|
|
|
60
59
|
this.offset = offset;
|
|
61
60
|
}
|
|
62
61
|
setLimit(limit) {
|
|
63
|
-
if (limit < 1) {
|
|
64
|
-
// need import exceptions
|
|
65
|
-
throw new server_common_node_1.exceptions.InvalidParamError(`limit(${limit}) < 1`);
|
|
66
|
-
}
|
|
67
|
-
if (limit > exports.maxLimitV2) {
|
|
68
|
-
// need import exceptions
|
|
69
|
-
throw new server_common_node_1.exceptions.InvalidParamError(`limit(${limit}) > ${exports.maxLimitV2}. Limit should be 1~${exports.maxLimitV2} when querying the id field, otherwise it should be 1~${exports.maxLimit}`);
|
|
70
|
-
}
|
|
71
62
|
this.limit = limit;
|
|
63
|
+
this.isSetLimit = true;
|
|
72
64
|
}
|
|
73
65
|
getLimit() {
|
|
74
66
|
return this.limit;
|
|
@@ -11,10 +11,13 @@ export declare class Transaction<T, mt> implements ITransaction<mt>, ITransactio
|
|
|
11
11
|
operations: TransactionOperation[];
|
|
12
12
|
uuid2result: Record<string, uuidOrRecordIDResult>;
|
|
13
13
|
isCommit: boolean;
|
|
14
|
+
authType: string;
|
|
14
15
|
batchResults: (string | number)[][];
|
|
15
16
|
constructor(objectApiName: string);
|
|
16
17
|
currentObject(): TransactionObject<mt[currentObjApiName]>;
|
|
17
18
|
object<T extends keyof mt>(objectApiName: T): TransactionObject<mt[T]>;
|
|
18
19
|
commit(): Promise<void>;
|
|
20
|
+
useSystemAuth(): this;
|
|
21
|
+
useUserAuth(): this;
|
|
19
22
|
}
|
|
20
23
|
export {};
|
|
@@ -6,6 +6,7 @@ exports.Transaction = void 0;
|
|
|
6
6
|
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
7
7
|
const Request = require("../../../../request/interface");
|
|
8
8
|
const operation_1 = require("./operation");
|
|
9
|
+
const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
|
|
9
10
|
const assert = require('assert');
|
|
10
11
|
const { v4: uuidv4 } = require("uuid");
|
|
11
12
|
class Transaction {
|
|
@@ -216,7 +217,7 @@ class Transaction {
|
|
|
216
217
|
if (!this.operations || this.operations.length === 0) {
|
|
217
218
|
return;
|
|
218
219
|
}
|
|
219
|
-
let uuid2recordId = await Request.GetInstance().modifyRecordsWithTransaction(this.placeholders, this.operations);
|
|
220
|
+
let uuid2recordId = await Request.GetInstance().modifyRecordsWithTransaction(this.placeholders, this.operations, this.authType);
|
|
220
221
|
if (!uuid2recordId) {
|
|
221
222
|
throw new server_common_node_1.exceptions.InternalError("uuid2recordId is empty");
|
|
222
223
|
}
|
|
@@ -255,6 +256,14 @@ class Transaction {
|
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
}
|
|
259
|
+
useSystemAuth() {
|
|
260
|
+
this.authType = constants_1.AuthTypeSystem;
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
useUserAuth() {
|
|
264
|
+
this.authType = constants_1.AuthTypeUser;
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
258
267
|
}
|
|
259
268
|
exports.Transaction = Transaction;
|
|
260
269
|
function deepEqualExceptID(left, right) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildCriterionV2 = exports.logical = exports.QueryV2 = exports.LogicalExpression = exports.ArithmeticExpression = exports.NewConstantExpressionField = exports.NewMetadataExpressionField = void 0;
|
|
4
4
|
const operator_1 = require("./operator");
|
|
5
|
-
const queryBuilder_1 = require("../../../context/db/impl/queryBuilder");
|
|
6
5
|
function NewMetadataExpressionField(objectApiName, fieldApiName) {
|
|
7
6
|
return {
|
|
8
7
|
type: "metadataVariable",
|
|
@@ -110,10 +109,8 @@ class QueryV2 {
|
|
|
110
109
|
return this;
|
|
111
110
|
}
|
|
112
111
|
limit(limit) {
|
|
113
|
-
if (limit <= 0 || limit > 10000) {
|
|
114
|
-
throw new Error(`limit(${limit}) > ${queryBuilder_1.maxLimitV2}. Limit should be 1~${queryBuilder_1.maxLimitV2} when querying the id field, otherwise it should be 1~${queryBuilder_1.maxLimit}`);
|
|
115
|
-
}
|
|
116
112
|
this._limit = limit;
|
|
113
|
+
this.isSetLimit = true;
|
|
117
114
|
return this;
|
|
118
115
|
}
|
|
119
116
|
orderBy(fieldApiNames) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byted-apaas/server-sdk-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "aPaaS Server SDK",
|
|
5
5
|
"author": "zhouwexin <zhouwexin@bytedance.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"pre-build": "rm -rf build && tsc"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@byted-apaas/server-common-node": "^1.0.
|
|
15
|
+
"@byted-apaas/server-common-node": "^1.0.13",
|
|
16
16
|
"@jorgeferrero/stream-to-buffer": "^2.0.6",
|
|
17
17
|
"dayjs": "^1.9.6",
|
|
18
18
|
"form-data": "^3.0.0",
|
package/request/innerapi.d.ts
CHANGED
|
@@ -8,16 +8,16 @@ import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from "@byted-a
|
|
|
8
8
|
import { AppCtx } from "../application/application";
|
|
9
9
|
export declare class RequestRpc implements IInnerAPIRequest {
|
|
10
10
|
constructor();
|
|
11
|
-
createRecordBySync(objectApiName: string, record: object): any;
|
|
12
|
-
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
13
|
-
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
14
|
-
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
15
|
-
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object
|
|
16
|
-
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
17
|
-
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
18
|
-
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object
|
|
19
|
-
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
20
|
-
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
11
|
+
createRecordBySync(objectApiName: string, record: object, authType: string): any;
|
|
12
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object, authType: string): any;
|
|
13
|
+
deleteRecordBySync(objectApiName: string, recordID: number, authType: string): any;
|
|
14
|
+
createRecordsByAsync(objectApiName: string, records: object[], authType: string): any;
|
|
15
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
16
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
17
|
+
createRecordsBySync(objectApiName: string, records: object[], authType: string): any;
|
|
18
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
19
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
20
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string): any;
|
|
21
21
|
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
|
|
22
22
|
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
23
23
|
downloadFileByID(fileID: string, filePath?: string): Promise<Buffer | void>;
|
|
@@ -27,9 +27,9 @@ export declare class RequestRpc implements IInnerAPIRequest {
|
|
|
27
27
|
getFields(objectApiName: string): Promise<any>;
|
|
28
28
|
getField(objectApiName: string, fieldApiName: string): Promise<any>;
|
|
29
29
|
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): Promise<void>;
|
|
30
|
-
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
30
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[], authType: string): Promise<Map<string, number>>;
|
|
31
31
|
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
32
|
-
oql(oql: string, args: any[], namedArgs: Record<string, any
|
|
32
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>, authType: string): Promise<string | any[]>;
|
|
33
33
|
invokeFuncSync(idOrName: {
|
|
34
34
|
APIId?: string;
|
|
35
35
|
APIName?: string;
|
package/request/innerapi.js
CHANGED
|
@@ -14,10 +14,10 @@ const utils = common.utils;
|
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const checkUtils = common.checkUtils;
|
|
16
16
|
const path = require('path');
|
|
17
|
-
async function pre(isTransUser) {
|
|
17
|
+
async function pre(isTransUser, authType) {
|
|
18
18
|
let ctx;
|
|
19
19
|
try {
|
|
20
|
-
ctx = await rpc.rebuildRpcCtx(isTransUser);
|
|
20
|
+
ctx = await rpc.rebuildRpcCtx(isTransUser, authType);
|
|
21
21
|
}
|
|
22
22
|
catch (err) {
|
|
23
23
|
throw new exceptions.InternalError(`RebuildRpcCtx failed: ${err.message}`);
|
|
@@ -33,19 +33,19 @@ function post(baseResp) {
|
|
|
33
33
|
if (baseResp.StatusMessage !== "") {
|
|
34
34
|
msg = baseResp.StatusMessage;
|
|
35
35
|
}
|
|
36
|
-
if (baseResp.extra
|
|
36
|
+
if (baseResp.extra.get("is_system_error") === "true") {
|
|
37
37
|
throw new exceptions.InternalError(`${msg} [${baseResp.KStatusCode}]`);
|
|
38
38
|
}
|
|
39
39
|
throw new exceptions.InvalidParamError(`${msg} [${baseResp.KStatusCode}]`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
async function createRecordBySync(objectApiName, record) {
|
|
42
|
+
async function createRecordBySync(objectApiName, record, authType) {
|
|
43
43
|
// 1.check
|
|
44
44
|
if (!objectApiName) {
|
|
45
45
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
46
46
|
}
|
|
47
47
|
// 2.前置处理
|
|
48
|
-
let ctx = await pre();
|
|
48
|
+
let ctx = await pre(true, authType);
|
|
49
49
|
// 3.构造 params
|
|
50
50
|
let param = {};
|
|
51
51
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -68,13 +68,13 @@ async function createRecordBySync(objectApiName, record) {
|
|
|
68
68
|
post(resp.BaseResp);
|
|
69
69
|
return { _id: Number(resp.RecordID) };
|
|
70
70
|
}
|
|
71
|
-
async function updateRecordBySync(objectApiName, recordID, record) {
|
|
71
|
+
async function updateRecordBySync(objectApiName, recordID, record, authType) {
|
|
72
72
|
// 1.check
|
|
73
73
|
if (!objectApiName) {
|
|
74
74
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
75
75
|
}
|
|
76
76
|
// 2.前置处理
|
|
77
|
-
let ctx = await pre();
|
|
77
|
+
let ctx = await pre(true, authType);
|
|
78
78
|
// 3.构造 params
|
|
79
79
|
let param = {};
|
|
80
80
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -98,13 +98,13 @@ async function updateRecordBySync(objectApiName, recordID, record) {
|
|
|
98
98
|
post(resp.BaseResp);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
async function deleteRecordBySync(objectApiName, recordID) {
|
|
101
|
+
async function deleteRecordBySync(objectApiName, recordID, authType) {
|
|
102
102
|
// 1.check
|
|
103
103
|
if (!objectApiName) {
|
|
104
104
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
105
105
|
}
|
|
106
106
|
// 2.前置处理
|
|
107
|
-
let ctx = await pre();
|
|
107
|
+
let ctx = await pre(true, authType);
|
|
108
108
|
// 3.构造 params
|
|
109
109
|
let param = {};
|
|
110
110
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -127,13 +127,13 @@ async function deleteRecordBySync(objectApiName, recordID) {
|
|
|
127
127
|
post(resp.BaseResp);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
async function createRecordsByAsync(objectApiName, records) {
|
|
130
|
+
async function createRecordsByAsync(objectApiName, records, authType) {
|
|
131
131
|
// 1.check
|
|
132
132
|
if (!objectApiName) {
|
|
133
133
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
134
134
|
}
|
|
135
135
|
// 2.前置处理
|
|
136
|
-
let ctx = await pre();
|
|
136
|
+
let ctx = await pre(true, authType);
|
|
137
137
|
// 3.构造 params
|
|
138
138
|
let param = {};
|
|
139
139
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -156,13 +156,13 @@ async function createRecordsByAsync(objectApiName, records) {
|
|
|
156
156
|
post(resp.BaseResp);
|
|
157
157
|
return { taskID: Number(resp.TaskID) };
|
|
158
158
|
}
|
|
159
|
-
async function updateRecordsByAsync(objectApiName, recordMap) {
|
|
159
|
+
async function updateRecordsByAsync(objectApiName, recordMap, authType) {
|
|
160
160
|
// 1.check
|
|
161
161
|
if (!objectApiName) {
|
|
162
162
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
163
163
|
}
|
|
164
164
|
// 2.前置处理
|
|
165
|
-
let ctx = await pre();
|
|
165
|
+
let ctx = await pre(true, authType);
|
|
166
166
|
// 3.构造 params
|
|
167
167
|
let param = {};
|
|
168
168
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -185,13 +185,13 @@ async function updateRecordsByAsync(objectApiName, recordMap) {
|
|
|
185
185
|
post(resp.BaseResp);
|
|
186
186
|
return { taskID: Number(resp.TaskID) };
|
|
187
187
|
}
|
|
188
|
-
async function deleteRecordsByAsync(objectApiName, recordIDs) {
|
|
188
|
+
async function deleteRecordsByAsync(objectApiName, recordIDs, authType) {
|
|
189
189
|
// 1.check
|
|
190
190
|
if (!objectApiName) {
|
|
191
191
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
192
192
|
}
|
|
193
193
|
// 2.前置处理
|
|
194
|
-
let ctx = await pre();
|
|
194
|
+
let ctx = await pre(true, authType);
|
|
195
195
|
// 3.构造 params
|
|
196
196
|
let param = {};
|
|
197
197
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -218,13 +218,13 @@ async function deleteRecordsByAsync(objectApiName, recordIDs) {
|
|
|
218
218
|
post(resp.BaseResp);
|
|
219
219
|
return { taskID: Number(resp.TaskID) };
|
|
220
220
|
}
|
|
221
|
-
async function createRecordsBySync(objectApiName, records) {
|
|
221
|
+
async function createRecordsBySync(objectApiName, records, authType) {
|
|
222
222
|
// 1.check
|
|
223
223
|
if (!objectApiName) {
|
|
224
224
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
225
225
|
}
|
|
226
226
|
// 2.前置处理
|
|
227
|
-
let ctx = await pre();
|
|
227
|
+
let ctx = await pre(true, authType);
|
|
228
228
|
// 3.构造 params
|
|
229
229
|
let param = {};
|
|
230
230
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -247,25 +247,25 @@ async function createRecordsBySync(objectApiName, records) {
|
|
|
247
247
|
// 5.后置处理
|
|
248
248
|
post(resp.BaseResp);
|
|
249
249
|
let recordIDList = new Array();
|
|
250
|
-
let errMap =
|
|
250
|
+
let errMap = {};
|
|
251
251
|
resp.RecordIDs.forEach((v, idx) => {
|
|
252
252
|
recordIDList.push(Number(v));
|
|
253
253
|
});
|
|
254
254
|
resp.ErrMap.forEach((v, k) => {
|
|
255
|
-
errMap
|
|
255
|
+
errMap[Number(k)] = v;
|
|
256
256
|
});
|
|
257
257
|
return {
|
|
258
258
|
record_ids: recordIDList,
|
|
259
259
|
err_map: errMap
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
async function updateRecordsBySync(objectApiName, recordMap) {
|
|
262
|
+
async function updateRecordsBySync(objectApiName, recordMap, authType) {
|
|
263
263
|
// 1.check
|
|
264
264
|
if (!objectApiName) {
|
|
265
265
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
266
266
|
}
|
|
267
267
|
// 2.前置处理
|
|
268
|
-
let ctx = await pre();
|
|
268
|
+
let ctx = await pre(true, authType);
|
|
269
269
|
// 3.构造 params
|
|
270
270
|
let param = {};
|
|
271
271
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -287,19 +287,19 @@ async function updateRecordsBySync(objectApiName, recordMap) {
|
|
|
287
287
|
}
|
|
288
288
|
// 5.后置处理
|
|
289
289
|
post(resp.BaseResp);
|
|
290
|
-
let errMap =
|
|
290
|
+
let errMap = {};
|
|
291
291
|
resp.ErrMap.forEach((v, k) => {
|
|
292
|
-
errMap
|
|
292
|
+
errMap[Number(k)] = v;
|
|
293
293
|
});
|
|
294
294
|
return { err_map: errMap };
|
|
295
295
|
}
|
|
296
|
-
async function deleteRecordsBySync(objectApiName, recordIDs) {
|
|
296
|
+
async function deleteRecordsBySync(objectApiName, recordIDs, authType) {
|
|
297
297
|
// 1.check
|
|
298
298
|
if (!objectApiName) {
|
|
299
299
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
300
300
|
}
|
|
301
301
|
// 2.前置处理
|
|
302
|
-
let ctx = await pre();
|
|
302
|
+
let ctx = await pre(true, authType);
|
|
303
303
|
// 3.构造 params
|
|
304
304
|
let param = {};
|
|
305
305
|
let task_id = utils.getTriggerTaskID();
|
|
@@ -325,13 +325,13 @@ async function deleteRecordsBySync(objectApiName, recordIDs) {
|
|
|
325
325
|
}
|
|
326
326
|
// 5.后置处理
|
|
327
327
|
post(resp.BaseResp);
|
|
328
|
-
let errMap =
|
|
328
|
+
let errMap = {};
|
|
329
329
|
resp.ErrMap.forEach((v, k) => {
|
|
330
|
-
errMap
|
|
330
|
+
errMap[Number(k)] = v;
|
|
331
331
|
});
|
|
332
332
|
return { err_map: errMap };
|
|
333
333
|
}
|
|
334
|
-
async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount) {
|
|
334
|
+
async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
335
335
|
if (limit > 10000) {
|
|
336
336
|
limit = 10000;
|
|
337
337
|
}
|
|
@@ -340,7 +340,7 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ign
|
|
|
340
340
|
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
341
341
|
}
|
|
342
342
|
// 2.前置处理
|
|
343
|
-
let ctx = await pre();
|
|
343
|
+
let ctx = await pre(true, authType);
|
|
344
344
|
// 3.构造 params
|
|
345
345
|
let param = {};
|
|
346
346
|
let orders = new Array();
|
|
@@ -713,7 +713,7 @@ async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
|
|
|
713
713
|
// 5. deal with response
|
|
714
714
|
post(resp.BaseResp);
|
|
715
715
|
}
|
|
716
|
-
async function modifyRecordsWithTransaction(placeholders, operations) {
|
|
716
|
+
async function modifyRecordsWithTransaction(placeholders, operations, authType) {
|
|
717
717
|
// 1. prepare args
|
|
718
718
|
// TODO: change placeholders type
|
|
719
719
|
let ph = new Map();
|
|
@@ -733,7 +733,7 @@ async function modifyRecordsWithTransaction(placeholders, operations) {
|
|
|
733
733
|
param.TaskID = BigInt(taskID);
|
|
734
734
|
}
|
|
735
735
|
// 3. prepare request
|
|
736
|
-
let ctx = await pre();
|
|
736
|
+
let ctx = await pre(true, authType);
|
|
737
737
|
// 4. do request
|
|
738
738
|
let resp;
|
|
739
739
|
try {
|
|
@@ -782,7 +782,7 @@ async function getGlobalConfigByKey(key) {
|
|
|
782
782
|
}
|
|
783
783
|
throw new exceptions.InvalidParamError(`undefined global variable (${key})`);
|
|
784
784
|
}
|
|
785
|
-
async function oql(oql, args, namedArgs) {
|
|
785
|
+
async function oql(oql, args, namedArgs, authType) {
|
|
786
786
|
// 1. build parameters
|
|
787
787
|
const queryData = JSON.stringify({
|
|
788
788
|
"query": oql,
|
|
@@ -795,7 +795,7 @@ async function oql(oql, args, namedArgs) {
|
|
|
795
795
|
param.Namespace = await (0, common_1.getNamespaceForOpenAndFaaSSDK)();
|
|
796
796
|
param.QueryData = Buffer.from(queryData);
|
|
797
797
|
// 3. prepare request
|
|
798
|
-
let ctx = await pre();
|
|
798
|
+
let ctx = await pre(true, authType);
|
|
799
799
|
// 4. do request
|
|
800
800
|
let resp;
|
|
801
801
|
try {
|
|
@@ -1096,25 +1096,25 @@ class RequestRpc {
|
|
|
1096
1096
|
this.openSDKUploadAvatar = openSDKUploadAvatar;
|
|
1097
1097
|
this.openSDKDownloadAvatar = openSDKDownloadAvatar;
|
|
1098
1098
|
}
|
|
1099
|
-
createRecordBySync(objectApiName, record) {
|
|
1099
|
+
createRecordBySync(objectApiName, record, authType) {
|
|
1100
1100
|
}
|
|
1101
|
-
updateRecordBySync(objectApiName, recordID, record) {
|
|
1101
|
+
updateRecordBySync(objectApiName, recordID, record, authType) {
|
|
1102
1102
|
}
|
|
1103
|
-
deleteRecordBySync(objectApiName, recordID) {
|
|
1103
|
+
deleteRecordBySync(objectApiName, recordID, authType) {
|
|
1104
1104
|
}
|
|
1105
|
-
createRecordsByAsync(objectApiName, records) {
|
|
1105
|
+
createRecordsByAsync(objectApiName, records, authType) {
|
|
1106
1106
|
}
|
|
1107
|
-
updateRecordsByAsync(objectApiName, recordMap) {
|
|
1107
|
+
updateRecordsByAsync(objectApiName, recordMap, authType) {
|
|
1108
1108
|
}
|
|
1109
|
-
deleteRecordsByAsync(objectApiName, recordIDs) {
|
|
1109
|
+
deleteRecordsByAsync(objectApiName, recordIDs, authType) {
|
|
1110
1110
|
}
|
|
1111
|
-
createRecordsBySync(objectApiName, records) {
|
|
1111
|
+
createRecordsBySync(objectApiName, records, authType) {
|
|
1112
1112
|
}
|
|
1113
|
-
updateRecordsBySync(objectApiName, recordMap) {
|
|
1113
|
+
updateRecordsBySync(objectApiName, recordMap, authType) {
|
|
1114
1114
|
}
|
|
1115
|
-
deleteRecordsBySync(objectApiName, recordIDs) {
|
|
1115
|
+
deleteRecordsBySync(objectApiName, recordIDs, authType) {
|
|
1116
1116
|
}
|
|
1117
|
-
getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount) {
|
|
1117
|
+
getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
1118
1118
|
}
|
|
1119
1119
|
async updateWorkflowVariables(ctx, instanceId, variables, variableTypes) {
|
|
1120
1120
|
}
|
|
@@ -1139,13 +1139,13 @@ class RequestRpc {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
async terminateWorkflowInstance(workflowInstanceId, operator, reason) {
|
|
1141
1141
|
}
|
|
1142
|
-
async modifyRecordsWithTransaction(placeholders, operations) {
|
|
1142
|
+
async modifyRecordsWithTransaction(placeholders, operations, authType) {
|
|
1143
1143
|
return null;
|
|
1144
1144
|
}
|
|
1145
1145
|
async getGlobalConfigByKey(key) {
|
|
1146
1146
|
return null;
|
|
1147
1147
|
}
|
|
1148
|
-
async oql(oql, args, namedArgs) {
|
|
1148
|
+
async oql(oql, args, namedArgs, authType) {
|
|
1149
1149
|
return [];
|
|
1150
1150
|
}
|
|
1151
1151
|
async invokeFuncSync(idOrName, params) {
|
package/request/interface.d.ts
CHANGED
|
@@ -32,16 +32,16 @@ export type OpenSDKGetRecordsReq = {
|
|
|
32
32
|
export interface IInnerAPIRequest extends IInnerAPIBaseRequest, IInnerAPIOpenSDKRequest {
|
|
33
33
|
}
|
|
34
34
|
export interface IInnerAPIBaseRequest {
|
|
35
|
-
createRecordBySync(objectApiName: string, record: object): any;
|
|
36
|
-
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
37
|
-
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
38
|
-
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
39
|
-
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object
|
|
40
|
-
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
41
|
-
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
42
|
-
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object
|
|
43
|
-
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
44
|
-
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
35
|
+
createRecordBySync(objectApiName: string, record: object, authType: string): any;
|
|
36
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object, authType: string): any;
|
|
37
|
+
deleteRecordBySync(objectApiName: string, recordID: number, authType: string): any;
|
|
38
|
+
createRecordsByAsync(objectApiName: string, records: object[], authType: string): any;
|
|
39
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
40
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
41
|
+
createRecordsBySync(objectApiName: string, records: object[], authType: string): any;
|
|
42
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
43
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
44
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string): any;
|
|
45
45
|
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
|
|
46
46
|
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
47
47
|
downloadFileByID(fileID: string, filePath?: string): Promise<Buffer | void>;
|
|
@@ -51,9 +51,9 @@ export interface IInnerAPIBaseRequest {
|
|
|
51
51
|
getFields(objectApiName: string): Promise<any>;
|
|
52
52
|
getField(objectApiName: string, fieldApiName: string): Promise<any>;
|
|
53
53
|
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): Promise<void>;
|
|
54
|
-
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
54
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[], authType: string): Promise<Map<string, number>>;
|
|
55
55
|
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
56
|
-
oql(oql: string, args: any[], namedArgs: Record<string, any
|
|
56
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>, authType: string): Promise<string | any[]>;
|
|
57
57
|
invokeFuncSync(idOrName: {
|
|
58
58
|
APIId?: string;
|
|
59
59
|
APIName?: string;
|
package/request/openapi.d.ts
CHANGED
|
@@ -10,16 +10,16 @@ export declare function updateWorkflowVariables(ctx: any, instanceId: number, va
|
|
|
10
10
|
export declare class RequestHttp implements IInnerAPIRequest {
|
|
11
11
|
constructor();
|
|
12
12
|
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): any;
|
|
13
|
-
createRecordBySync(objectApiName: string, record: object): any;
|
|
14
|
-
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
15
|
-
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
16
|
-
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
17
|
-
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object
|
|
18
|
-
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
19
|
-
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
20
|
-
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object
|
|
21
|
-
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
22
|
-
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
13
|
+
createRecordBySync(objectApiName: string, record: object, authType: string): any;
|
|
14
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object, authType: string): any;
|
|
15
|
+
deleteRecordBySync(objectApiName: string, recordID: number, authType: string): any;
|
|
16
|
+
createRecordsByAsync(objectApiName: string, records: object[], authType: string): any;
|
|
17
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
18
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
19
|
+
createRecordsBySync(objectApiName: string, records: object[], authType: string): any;
|
|
20
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
|
|
21
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[], authType: string): any;
|
|
22
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string): any;
|
|
23
23
|
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
24
24
|
downloadFileByID(fileID: string, filePath?: string): Promise<void | Buffer>;
|
|
25
25
|
downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | void>;
|
|
@@ -28,9 +28,9 @@ export declare class RequestHttp implements IInnerAPIRequest {
|
|
|
28
28
|
getFields(objectApiName: string): any;
|
|
29
29
|
getField(objectApiName: string, fieldApiName: string): any;
|
|
30
30
|
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): any;
|
|
31
|
-
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
31
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[], authType: string): Promise<Map<string, number>>;
|
|
32
32
|
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
33
|
-
oql(oql: string, args: any[], namedArgs: Record<string, any
|
|
33
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>, authType: string): any;
|
|
34
34
|
invokeFuncSync(idOrName: {
|
|
35
35
|
APIId?: string;
|
|
36
36
|
APIName?: string;
|