@byted-apaas/server-sdk-node 1.0.8 → 1.0.10

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.
@@ -158,7 +158,7 @@ export interface _IKQuery<T> {
158
158
  * context.db.object("_user").orderBy(["_email", "_phoneNumber"]).find()
159
159
  * ```
160
160
  */
161
- orderBy<K extends keyof T>(fieldApiNames: K[]): _IKQuery<T>;
161
+ orderBy<K extends keyof T>(fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
162
162
  /**
163
163
  * 根据指定字段升序排序(a -> z, 0 -> 9)
164
164
  * @param fieldApiNames 排序依据的字段,按先后顺序确定优先级,用逗号分隔
@@ -167,7 +167,7 @@ export interface _IKQuery<T> {
167
167
  * context.db.object("_user").orderBy("_email", "_phoneNumber").find()
168
168
  * ```
169
169
  */
170
- orderBy<K extends keyof T>(...fieldApiNames: K[]): _IKQuery<T>;
170
+ orderBy<K extends keyof T>(...fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
171
171
  /**
172
172
  * 根据指定字段降序排序(z -> a, 9 -> 0)
173
173
  * @param fieldApiNames 排序依据的字段数组,按先后顺序确定优先级
@@ -176,7 +176,7 @@ export interface _IKQuery<T> {
176
176
  * context.db.object("_user").orderByDesc("_email", "_phoneNumber").find()
177
177
  * ```
178
178
  */
179
- orderByDesc<K extends keyof T>(fieldApiNames: K[]): _IKQuery<T>;
179
+ orderByDesc<K extends keyof T>(fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
180
180
  /**
181
181
  * 根据指定字段降序排序(z -> a, 9 -> 0)
182
182
  * @param fieldApiNames 排序依据的字段,按先后顺序确定优先级,用逗号分隔
@@ -185,7 +185,7 @@ export interface _IKQuery<T> {
185
185
  * context.db.object("_user").orderByDesc("_email", "_phoneNumber").find()
186
186
  * ```
187
187
  */
188
- orderByDesc<K extends keyof T>(...fieldApiNames: K[]): _IKQuery<T>;
188
+ orderByDesc<K extends keyof T>(...fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
189
189
  /**
190
190
  * 指定需返回的字段
191
191
  * @param fieldApiNames 需返回的字段数组
@@ -194,7 +194,7 @@ export interface _IKQuery<T> {
194
194
  * context.db.object("_user").select(["_name", "_email"]).find()
195
195
  * ```
196
196
  */
197
- select<K extends keyof T>(fieldApiNames: K[]): _IKQuery<T>;
197
+ select<K extends keyof T>(fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
198
198
  /**
199
199
  * 指定需返回的字段
200
200
  * @param fieldApiNames 需返回的字段,用逗号分隔
@@ -203,7 +203,7 @@ export interface _IKQuery<T> {
203
203
  * context.db.object("_user").select("_name", "_email").find()
204
204
  * ```
205
205
  */
206
- select<K extends keyof T>(...fieldApiNames: K[]): _IKQuery<T>;
206
+ select<K extends keyof T>(...fieldApiNames: K[]): Omit<_IKQuery<T>, 'findAll'>;
207
207
  /**
208
208
  * 设置查询条件
209
209
  * @param conditionMap 对字段赋值以指定查询筛选条件
@@ -215,11 +215,11 @@ export interface _IKQuery<T> {
215
215
  * }).find()
216
216
  * ```
217
217
  */
218
- where(conditionMap: _WhereCond<T>): _IKQuery<T>;
218
+ where(conditionMap: _WhereCond<T>): Omit<_IKQuery<T>, 'findAll'>;
219
219
  /**
220
220
  * 设置查询条件
221
221
  */
222
- where(): _IKQuery<T>;
222
+ where(): Omit<_IKQuery<T>, 'findAll'>;
223
223
  /**
224
224
  * 指定分页查询的数量
225
225
  * @param limit 分页查询的数量
@@ -229,7 +229,7 @@ export interface _IKQuery<T> {
229
229
  * context.db.object("_user").limit(10)
230
230
  * ```
231
231
  */
232
- limit(limit: number): _IKQuery<T>;
232
+ limit(limit: number): Omit<_IKQuery<T>, 'findAll'>;
233
233
  /**
234
234
  * 指定分页查询的偏移量
235
235
  * @param offset 分页查询的偏移量
@@ -239,7 +239,7 @@ export interface _IKQuery<T> {
239
239
  * context.db.object("_user").offset(0)
240
240
  * ```
241
241
  */
242
- offset(offset: number): _IKQuery<T>;
242
+ offset(offset: number): Omit<_IKQuery<T>, 'findAll'>;
243
243
  /**
244
244
  * 指定条件的行数
245
245
  * @example
@@ -498,6 +498,7 @@ class _KQuery {
498
498
  }
499
499
  limit(limit) {
500
500
  const { queryBuilder, queryV2 } = queryPropertiesStore.get(this);
501
+ limit = Number(limit);
501
502
  if (queryV2) {
502
503
  queryV2.limit(limit);
503
504
  }
@@ -509,6 +510,7 @@ class _KQuery {
509
510
  ;
510
511
  offset(offset) {
511
512
  const { queryBuilder, queryV2 } = queryPropertiesStore.get(this);
513
+ offset = Number(offset);
512
514
  if (queryV2) {
513
515
  queryV2.offset(offset);
514
516
  }
@@ -126,7 +126,7 @@ class _KunlunFile {
126
126
  data = fs.createReadStream(data);
127
127
  }
128
128
  // 2. data must be Stream at here.
129
- return await Request.GetInstance().uploadFile(data, expire);
129
+ return await Request.GetHttpInstance().uploadFile(data, expire);
130
130
  }
131
131
  }
132
132
  exports._KunlunFile = _KunlunFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",
@@ -425,7 +425,7 @@ async function uploadFile(data, expire) {
425
425
  id: resp.ID,
426
426
  token: resp.Token,
427
427
  size: resp.Size,
428
- mimeType: resp.MimeType,
428
+ mime_type: resp.MimeType,
429
429
  name: resp.Filename,
430
430
  };
431
431
  }
@@ -5,13 +5,14 @@ import { Stream } from "stream";
5
5
  import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from "@byted-apaas/server-common-node/context/workflow/workflow";
6
6
  import { AppCtx } from "../application/application";
7
7
  import { Order } from "../context/db/impl/order";
8
+ export declare function GetHttpInstance(): IInnerAPIRequest;
8
9
  export declare function GetInstance(): IInnerAPIRequest;
9
10
  export declare function GetFaaSInfraInstance(): IFaaSInfraRequest;
10
11
  export type UploadFileResp = {
11
12
  id: string;
12
13
  token: string;
13
14
  size: bigint;
14
- mimeType: string;
15
+ mime_type: string;
15
16
  name: string;
16
17
  };
17
18
  export type OrderV2 = {
@@ -2,7 +2,7 @@
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.GetFaaSInfraInstance = exports.GetInstance = void 0;
5
+ exports.GetFaaSInfraInstance = exports.GetInstance = exports.GetHttpInstance = void 0;
6
6
  const openapi_1 = require("./openapi");
7
7
  const innerapi_1 = require("./innerapi");
8
8
  const common = require("@byted-apaas/server-common-node");
@@ -19,6 +19,7 @@ function GetHttpInstance() {
19
19
  }
20
20
  return requestInstanceMap["httpRequest"];
21
21
  }
22
+ exports.GetHttpInstance = GetHttpInstance;
22
23
  function GetRpcInstance() {
23
24
  if (!requestInstanceMap["rpcRequest"]) {
24
25
  requestInstanceMap["rpcRequest"] = new innerapi_1.RequestRpc();