@bringg/dashboard-sdk 9.89.0 → 9.90.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.
@@ -1,7 +1,11 @@
1
- import { Service } from '@bringg/types';
1
+ import { DELETE_RESPONSE } from '../../Core/CrudService';
2
2
  import Entity from '../../Core/Entity';
3
3
  import Session from '../../Services/Identity/Session';
4
- export default class ServiceEntity extends Entity<Service> {
4
+ import { ServicesSetup, ServicesSetupAction, ServicesSetupCreateParams, ServicesSetupCreateResponse } from '../Services.consts';
5
+ export default class ServiceEntity extends Entity<ServicesSetup> {
5
6
  constructor(session: Session);
6
- getAll(): Promise<Service[]>;
7
+ getAll(): Promise<ServicesSetup[]>;
8
+ create(params: ServicesSetupCreateParams): Promise<ServicesSetupCreateResponse>;
9
+ delete(id: number): Promise<DELETE_RESPONSE>;
10
+ listActions(): Promise<ServicesSetupAction[]>;
7
11
  }
@@ -75,13 +75,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
75
75
  };
76
76
  Object.defineProperty(exports, "__esModule", { value: true });
77
77
  var Entity_1 = __importStar(require("../../Core/Entity"));
78
+ var ENTITY_NAME = 'services_setup';
78
79
  var ServiceEntity = /** @class */ (function (_super) {
79
80
  __extends(ServiceEntity, _super);
80
81
  function ServiceEntity(session) {
81
82
  return _super.call(this, {
82
83
  session: session,
83
- entityName: 'services_setup',
84
- routes: [Entity_1.BaseRoutes.GetAll]
84
+ entityName: ENTITY_NAME,
85
+ routes: [Entity_1.BaseRoutes.GetAll, Entity_1.BaseRoutes.Create, Entity_1.BaseRoutes.Delete]
85
86
  }) || this;
86
87
  }
87
88
  ServiceEntity.prototype.getAll = function () {
@@ -94,6 +95,37 @@ var ServiceEntity = /** @class */ (function (_super) {
94
95
  });
95
96
  });
96
97
  };
98
+ ServiceEntity.prototype.create = function (params) {
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ var _a;
101
+ return __generator(this, function (_b) {
102
+ switch (_b.label) {
103
+ case 0: return [4 /*yield*/, this.service.create((_a = {}, _a[ENTITY_NAME] = params, _a))];
104
+ case 1: return [2 /*return*/, _b.sent()];
105
+ }
106
+ });
107
+ });
108
+ };
109
+ ServiceEntity.prototype.delete = function (id) {
110
+ return __awaiter(this, void 0, void 0, function () {
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0: return [4 /*yield*/, this.service.delete(id)];
114
+ case 1: return [2 /*return*/, _a.sent()];
115
+ }
116
+ });
117
+ });
118
+ };
119
+ ServiceEntity.prototype.listActions = function () {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ return __generator(this, function (_a) {
122
+ return [2 /*return*/, this.service.routeGenerator
123
+ .get("/".concat(ENTITY_NAME, "/list"))
124
+ .setException('failed to get services setup actions')
125
+ .invoke()];
126
+ });
127
+ });
128
+ };
97
129
  return ServiceEntity;
98
130
  }(Entity_1.default));
99
131
  exports.default = ServiceEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceEntity.js","sourceRoot":"","sources":["../../../src/Service/Entity/ServiceEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAuD;AAGvD;IAA2C,iCAAe;IACzD,uBAAY,OAAgB;eAC3B,kBAAM;YACL,OAAO,SAAA;YACP,UAAU,EAAE,gBAAgB;YAC5B,MAAM,EAAE,CAAC,mBAAU,CAAC,MAAM,CAAC;SAC3B,CAAC;IACH,CAAC;IAEY,8BAAM,GAAnB;;;;4BACQ,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAA;4BAAlC,sBAAO,SAA2B,EAAC;;;;KACnC;IACF,oBAAC;AAAD,CAAC,AAZD,CAA2C,gBAAM,GAYhD"}
1
+ {"version":3,"file":"ServiceEntity.js","sourceRoot":"","sources":["../../../src/Service/Entity/ServiceEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0DAAuD;AASvD,IAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC;IAA2C,iCAAqB;IAC/D,uBAAY,OAAgB;eAC3B,kBAAM;YACL,OAAO,SAAA;YACP,UAAU,EAAE,WAAW;YACvB,MAAM,EAAE,CAAC,mBAAU,CAAC,MAAM,EAAE,mBAAU,CAAC,MAAM,EAAE,mBAAU,CAAC,MAAM,CAAC;SACjE,CAAC;IACH,CAAC;IAEY,8BAAM,GAAnB;;;;4BACQ,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAA;4BAAlC,sBAAO,SAA2B,EAAC;;;;KACnC;IAEY,8BAAM,GAAnB,UAAoB,MAAiC;;;;;4BAC7C,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,WAAG,GAAC,WAAW,IAAG,MAAM,MAAG,EAAA;4BAA3D,sBAAO,SAAoD,EAAC;;;;KAC5D;IAEY,8BAAM,GAAnB,UAAoB,EAAU;;;;4BACtB,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;4BAApC,sBAAO,SAA6B,EAAC;;;;KACrC;IAEY,mCAAW,GAAxB;;;gBACC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,WAAI,WAAW,UAAO,CAAC;yBAC3B,YAAY,CAAC,sCAAsC,CAAC;yBACpD,MAAM,EAAE,EAAC;;;KACX;IACF,oBAAC;AAAD,CAAC,AA3BD,CAA2C,gBAAM,GA2BhD"}
@@ -1,7 +1,15 @@
1
- import { Service } from '@bringg/types';
1
+ import { DELETE_RESPONSE } from '../Core/CrudService';
2
2
  import Session from '../Services/Identity/Session';
3
+ import { ServicesSetup, ServicesSetupAction, ServicesSetupCreateParams, ServicesSetupCreateResponse } from './Services.consts';
3
4
  export default class ServiceApi {
4
5
  private entity;
5
6
  constructor(session: Session);
6
- getAll(): Promise<Service[]>;
7
+ /** Every services API key configured for the merchant. */
8
+ getAll(): Promise<ServicesSetup[]>;
9
+ /** Mints a key for one endpoint. An unknown tag name creates a merchant tag. */
10
+ create(params: ServicesSetupCreateParams): Promise<ServicesSetupCreateResponse>;
11
+ /** Trashes a key. Requests using its URL fail from then on. */
12
+ delete(id: number): Promise<DELETE_RESPONSE>;
13
+ /** The endpoints this merchant may create a key for, public plus its allowed private ones. */
14
+ listActions(): Promise<ServicesSetupAction[]>;
7
15
  }
@@ -44,6 +44,7 @@ var ServiceApi = /** @class */ (function () {
44
44
  function ServiceApi(session) {
45
45
  this.entity = new ServiceEntity_1.default(session);
46
46
  }
47
+ /** Every services API key configured for the merchant. */
47
48
  ServiceApi.prototype.getAll = function () {
48
49
  return __awaiter(this, void 0, void 0, function () {
49
50
  return __generator(this, function (_a) {
@@ -54,6 +55,39 @@ var ServiceApi = /** @class */ (function () {
54
55
  });
55
56
  });
56
57
  };
58
+ /** Mints a key for one endpoint. An unknown tag name creates a merchant tag. */
59
+ ServiceApi.prototype.create = function (params) {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0: return [4 /*yield*/, this.entity.create(params)];
64
+ case 1: return [2 /*return*/, _a.sent()];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ /** Trashes a key. Requests using its URL fail from then on. */
70
+ ServiceApi.prototype.delete = function (id) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0: return [4 /*yield*/, this.entity.delete(id)];
75
+ case 1: return [2 /*return*/, _a.sent()];
76
+ }
77
+ });
78
+ });
79
+ };
80
+ /** The endpoints this merchant may create a key for, public plus its allowed private ones. */
81
+ ServiceApi.prototype.listActions = function () {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0: return [4 /*yield*/, this.entity.listActions()];
86
+ case 1: return [2 /*return*/, _a.sent()];
87
+ }
88
+ });
89
+ });
90
+ };
57
91
  return ServiceApi;
58
92
  }());
59
93
  exports.default = ServiceApi;
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceApi.js","sourceRoot":"","sources":["../../src/Service/ServiceApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,yEAAmD;AAEnD;IAGC,oBAAY,OAAgB;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAEY,2BAAM,GAAnB;;;;4BACQ,qBAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAA;4BAAjC,sBAAO,SAA0B,EAAC;;;;KAClC;IACF,iBAAC;AAAD,CAAC,AAVD,IAUC"}
1
+ {"version":3,"file":"ServiceApi.js","sourceRoot":"","sources":["../../src/Service/ServiceApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yEAAmD;AAQnD;IAGC,oBAAY,OAAgB;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,0DAA0D;IAC7C,2BAAM,GAAnB;;;;4BACQ,qBAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAA;4BAAjC,sBAAO,SAA0B,EAAC;;;;KAClC;IAED,gFAAgF;IACnE,2BAAM,GAAnB,UAAoB,MAAiC;;;;4BAC7C,qBAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAA;4BAAvC,sBAAO,SAAgC,EAAC;;;;KACxC;IAED,+DAA+D;IAClD,2BAAM,GAAnB,UAAoB,EAAU;;;;4BACtB,qBAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;4BAAnC,sBAAO,SAA4B,EAAC;;;;KACpC;IAED,8FAA8F;IACjF,gCAAW,GAAxB;;;;4BACQ,qBAAM,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAA;4BAAtC,sBAAO,SAA+B,EAAC;;;;KACvC;IACF,iBAAC;AAAD,CAAC,AA1BD,IA0BC"}
@@ -0,0 +1,31 @@
1
+ export interface ServicesSetup {
2
+ id: number;
3
+ action: string;
4
+ action_name: string;
5
+ first_auth_key: string;
6
+ second_auth_key: string;
7
+ tag: string | null;
8
+ user_id: number | null;
9
+ url: string;
10
+ }
11
+ export interface ServicesSetupAction {
12
+ id: string;
13
+ action_name: string;
14
+ label: string;
15
+ scope: string;
16
+ }
17
+ export interface ServicesSetupCreateParams {
18
+ action: {
19
+ id: string;
20
+ };
21
+ tag?: string;
22
+ user_id?: number;
23
+ }
24
+ /**
25
+ * A rejected action never reaches here: `handleAuthorizedRequest` turns a `success: false` body into
26
+ * a thrown `BringgException`, so the only body a caller can observe is the successful one.
27
+ */
28
+ export interface ServicesSetupCreateResponse {
29
+ success: true;
30
+ service: ServicesSetup;
31
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Services.consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Services.consts.js","sourceRoot":"","sources":["../../src/Service/Services.consts.ts"],"names":[],"mappings":""}
@@ -22381,13 +22381,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
22381
22381
  };
22382
22382
  Object.defineProperty(exports, "__esModule", ({ value: true }));
22383
22383
  var Entity_1 = __importStar(__webpack_require__(7483));
22384
+ var ENTITY_NAME = 'services_setup';
22384
22385
  var ServiceEntity = /** @class */ (function (_super) {
22385
22386
  __extends(ServiceEntity, _super);
22386
22387
  function ServiceEntity(session) {
22387
22388
  return _super.call(this, {
22388
22389
  session: session,
22389
- entityName: 'services_setup',
22390
- routes: [Entity_1.BaseRoutes.GetAll]
22390
+ entityName: ENTITY_NAME,
22391
+ routes: [Entity_1.BaseRoutes.GetAll, Entity_1.BaseRoutes.Create, Entity_1.BaseRoutes.Delete]
22391
22392
  }) || this;
22392
22393
  }
22393
22394
  ServiceEntity.prototype.getAll = function () {
@@ -22400,6 +22401,37 @@ var ServiceEntity = /** @class */ (function (_super) {
22400
22401
  });
22401
22402
  });
22402
22403
  };
22404
+ ServiceEntity.prototype.create = function (params) {
22405
+ return __awaiter(this, void 0, void 0, function () {
22406
+ var _a;
22407
+ return __generator(this, function (_b) {
22408
+ switch (_b.label) {
22409
+ case 0: return [4 /*yield*/, this.service.create((_a = {}, _a[ENTITY_NAME] = params, _a))];
22410
+ case 1: return [2 /*return*/, _b.sent()];
22411
+ }
22412
+ });
22413
+ });
22414
+ };
22415
+ ServiceEntity.prototype.delete = function (id) {
22416
+ return __awaiter(this, void 0, void 0, function () {
22417
+ return __generator(this, function (_a) {
22418
+ switch (_a.label) {
22419
+ case 0: return [4 /*yield*/, this.service.delete(id)];
22420
+ case 1: return [2 /*return*/, _a.sent()];
22421
+ }
22422
+ });
22423
+ });
22424
+ };
22425
+ ServiceEntity.prototype.listActions = function () {
22426
+ return __awaiter(this, void 0, void 0, function () {
22427
+ return __generator(this, function (_a) {
22428
+ return [2 /*return*/, this.service.routeGenerator
22429
+ .get("/".concat(ENTITY_NAME, "/list"))
22430
+ .setException('failed to get services setup actions')
22431
+ .invoke()];
22432
+ });
22433
+ });
22434
+ };
22403
22435
  return ServiceEntity;
22404
22436
  }(Entity_1.default));
22405
22437
  exports["default"] = ServiceEntity;
@@ -22457,6 +22489,7 @@ var ServiceApi = /** @class */ (function () {
22457
22489
  function ServiceApi(session) {
22458
22490
  this.entity = new ServiceEntity_1.default(session);
22459
22491
  }
22492
+ /** Every services API key configured for the merchant. */
22460
22493
  ServiceApi.prototype.getAll = function () {
22461
22494
  return __awaiter(this, void 0, void 0, function () {
22462
22495
  return __generator(this, function (_a) {
@@ -22467,6 +22500,39 @@ var ServiceApi = /** @class */ (function () {
22467
22500
  });
22468
22501
  });
22469
22502
  };
22503
+ /** Mints a key for one endpoint. An unknown tag name creates a merchant tag. */
22504
+ ServiceApi.prototype.create = function (params) {
22505
+ return __awaiter(this, void 0, void 0, function () {
22506
+ return __generator(this, function (_a) {
22507
+ switch (_a.label) {
22508
+ case 0: return [4 /*yield*/, this.entity.create(params)];
22509
+ case 1: return [2 /*return*/, _a.sent()];
22510
+ }
22511
+ });
22512
+ });
22513
+ };
22514
+ /** Trashes a key. Requests using its URL fail from then on. */
22515
+ ServiceApi.prototype.delete = function (id) {
22516
+ return __awaiter(this, void 0, void 0, function () {
22517
+ return __generator(this, function (_a) {
22518
+ switch (_a.label) {
22519
+ case 0: return [4 /*yield*/, this.entity.delete(id)];
22520
+ case 1: return [2 /*return*/, _a.sent()];
22521
+ }
22522
+ });
22523
+ });
22524
+ };
22525
+ /** The endpoints this merchant may create a key for, public plus its allowed private ones. */
22526
+ ServiceApi.prototype.listActions = function () {
22527
+ return __awaiter(this, void 0, void 0, function () {
22528
+ return __generator(this, function (_a) {
22529
+ switch (_a.label) {
22530
+ case 0: return [4 /*yield*/, this.entity.listActions()];
22531
+ case 1: return [2 /*return*/, _a.sent()];
22532
+ }
22533
+ });
22534
+ });
22535
+ };
22470
22536
  return ServiceApi;
22471
22537
  }());
22472
22538
  exports["default"] = ServiceApi;
@@ -22474,6 +22540,16 @@ exports["default"] = ServiceApi;
22474
22540
 
22475
22541
  /***/ }),
22476
22542
 
22543
+ /***/ 60653:
22544
+ /***/ ((__unused_webpack_module, exports) => {
22545
+
22546
+ "use strict";
22547
+
22548
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
22549
+ //# sourceMappingURL=Services.consts.js.map
22550
+
22551
+ /***/ }),
22552
+
22477
22553
  /***/ 73746:
22478
22554
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
22479
22555
 
@@ -24708,7 +24784,7 @@ var BringgException_1 = __webpack_require__(43605);
24708
24784
  var client_page_1 = __webpack_require__(16573);
24709
24785
  var Logger_1 = __importDefault(__webpack_require__(55860));
24710
24786
  var abort_1 = __webpack_require__(34179);
24711
- var version = '9.89.0';
24787
+ var version = '9.90.0';
24712
24788
  function logErrorResponse(response) {
24713
24789
  var data = response.data, status = response.status;
24714
24790
  try {
@@ -36622,7 +36698,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36622
36698
  return (mod && mod.__esModule) ? mod : { "default": mod };
36623
36699
  };
36624
36700
  Object.defineProperty(exports, "__esModule", ({ value: true }));
36625
- exports.WorkflowsApi = exports.VehicleTypeConsts = exports.VehicleCategoryConsts = exports.VehicleGroup = exports.VehiclesApi = exports.AbortUtils = exports.UsersApi = exports.UserGroupValues = exports.UserGroupTypes = exports.UploadApi = exports.UploadConsts = exports.TasksExplorerApi = exports.TaskRejectReasonsApi = exports.TaskInventoryConsts = exports.TasksApi = exports.TaskGroupValues = exports.TaskGroupTypes = exports.TagConsts = exports.ServiceAreaApi = exports.ServiceAreaFilterGroups = exports.RunsApi = exports.RunStatus = exports.RunConsts = exports.ResourceUploadType = exports.ReasonToChangeInventory = exports.PrivilegesConsts = exports.PlannedRoutesConsts = exports.PlannedDeliveryWindowsApi = exports.RecurrenceType = exports.PlannedDeliveryWindowsFilterGroups = exports.OptimizationResultApi = exports.NotificationTypesConsts = exports.NotificationTemplateConsts = exports.LookupConsts = exports.LanguageConsts = exports.ExclusionWindowApiV2 = exports.ExclusionWindowsFilterGroups = exports.DeliveryWindowsApi = exports.DeliveryBlockConsts = exports.CrewConsts = exports.Responses = exports.clientPageFromLocation = exports.CLIENT_PAGE_HEADER = exports.ChatMessageConsts = exports.ChatConversationConsts = void 0;
36701
+ exports.WorkflowsApi = exports.VehicleTypeConsts = exports.VehicleCategoryConsts = exports.VehicleGroup = exports.VehiclesApi = exports.AbortUtils = exports.UsersApi = exports.UserGroupValues = exports.UserGroupTypes = exports.UploadApi = exports.UploadConsts = exports.TasksExplorerApi = exports.TaskRejectReasonsApi = exports.TaskInventoryConsts = exports.TasksApi = exports.TaskGroupValues = exports.TaskGroupTypes = exports.TagConsts = exports.ServiceAreaApi = exports.ServiceAreaFilterGroups = exports.ServicesSetupConsts = exports.RunsApi = exports.RunStatus = exports.RunConsts = exports.ResourceUploadType = exports.ReasonToChangeInventory = exports.PrivilegesConsts = exports.PlannedRoutesConsts = exports.PlannedDeliveryWindowsApi = exports.RecurrenceType = exports.PlannedDeliveryWindowsFilterGroups = exports.OptimizationResultApi = exports.NotificationTypesConsts = exports.NotificationTemplateConsts = exports.LookupConsts = exports.LanguageConsts = exports.ExclusionWindowApiV2 = exports.ExclusionWindowsFilterGroups = exports.DeliveryWindowsApi = exports.DeliveryBlockConsts = exports.CrewConsts = exports.Responses = exports.clientPageFromLocation = exports.CLIENT_PAGE_HEADER = exports.ChatMessageConsts = exports.ChatConversationConsts = void 0;
36626
36702
  __exportStar(__webpack_require__(82661), exports);
36627
36703
  __exportStar(__webpack_require__(37360), exports);
36628
36704
  __exportStar(__webpack_require__(5655), exports);
@@ -36662,6 +36738,7 @@ var runs_consts_1 = __webpack_require__(4669);
36662
36738
  Object.defineProperty(exports, "RunStatus", ({ enumerable: true, get: function () { return runs_consts_1.RunStatus; } }));
36663
36739
  var runs_api_1 = __webpack_require__(83582);
36664
36740
  Object.defineProperty(exports, "RunsApi", ({ enumerable: true, get: function () { return __importDefault(runs_api_1).default; } }));
36741
+ exports.ServicesSetupConsts = __importStar(__webpack_require__(60653));
36665
36742
  var service_area_consts_1 = __webpack_require__(16410);
36666
36743
  Object.defineProperty(exports, "ServiceAreaFilterGroups", ({ enumerable: true, get: function () { return service_area_consts_1.ServiceAreaFilterGroups; } }));
36667
36744
  var service_area_api_1 = __webpack_require__(35248);