bkper-js 1.38.0 → 1.39.0

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/lib/index.d.ts CHANGED
@@ -2283,6 +2283,10 @@ export declare class Query {
2283
2283
  * @return This Query string to be executed
2284
2284
  */
2285
2285
  getQuery(): string | undefined;
2286
+ /**
2287
+ * Perform delete group.
2288
+ */
2289
+ remove(): Promise<Query>;
2286
2290
  }
2287
2291
 
2288
2292
  /**
package/lib/model/Book.js CHANGED
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import * as AccountService from '../service/account-service.js';
11
11
  import * as BookService from '../service/book-service.js';
12
+ import * as QueryService from '../service/query-service.js';
12
13
  import * as BalancesService from '../service/balances-service.js';
13
14
  import * as FileService from '../service/file-service.js';
14
15
  import * as GroupService from '../service/group-service.js';
@@ -866,7 +867,7 @@ export class Book {
866
867
  getSavedQueries() {
867
868
  return __awaiter(this, void 0, void 0, function* () {
868
869
  if (this.queries == null) {
869
- const queryPayloads = yield BookService.getSavedQueries(this.getId());
870
+ const queryPayloads = yield QueryService.getSavedQueries(this.getId());
870
871
  this.queries = queryPayloads.map(payload => new Query(this, payload));
871
872
  }
872
873
  return this.queries;
@@ -1,3 +1,13 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import * as QueryService from '../service/query-service.js';
1
11
  /**
2
12
  * Defines a saved Query in a [[Book]].
3
13
  *
@@ -34,5 +44,18 @@ export class Query {
34
44
  getQuery() {
35
45
  return this.payload.query;
36
46
  }
47
+ /**
48
+ * Perform delete group.
49
+ */
50
+ remove() {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const queryId = this.getId();
53
+ if (!queryId) {
54
+ throw new Error("Query id null!");
55
+ }
56
+ this.payload = yield QueryService.deleteSavedQuery(this.book.getId(), queryId);
57
+ return this;
58
+ });
59
+ }
37
60
  }
38
61
  //# sourceMappingURL=Query.js.map
@@ -56,11 +56,4 @@ export function getApps(bookId) {
56
56
  return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
57
57
  });
58
58
  }
59
- export function getSavedQueries(bookId) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- var _a;
62
- let response = yield new HttpBooksApiV5Request(`${bookId}/queries`).setMethod('GET').fetch();
63
- return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
64
- });
65
- }
66
59
  //# sourceMappingURL=book-service.js.map
@@ -0,0 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { HttpBooksApiV5Request } from "./http-api-request.js";
11
+ export function getSavedQueries(bookId) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ var _a;
14
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries`).setMethod('GET').fetch();
15
+ return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
16
+ });
17
+ }
18
+ export function deleteSavedQuery(bookId, queryId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries/${queryId}`).setMethod('DELETE').fetch();
21
+ return response.data;
22
+ });
23
+ }
24
+ //# sourceMappingURL=query-service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.38.0",
3
+ "version": "1.39.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",