@bytexbyte/ike-app-api 1.0.34 → 1.0.36

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.
@@ -0,0 +1,19 @@
1
+ import BxBApi from '@bytexbyte/bxb-api';
2
+ import { BleConnectionErrorLog } from '../types';
3
+ declare type BleConnectionErrorLogBody = Pick<BleConnectionErrorLog, 'title' | 'detail'>;
4
+ declare type BleConnectionErrorLogResult = {
5
+ bleConnectionErrorLog: BleConnectionErrorLog;
6
+ error?: undefined;
7
+ } | {
8
+ bleConnectionErrorLog?: undefined;
9
+ error: 'You are not logged in.' | 'Missing title.' | 'Missing detail.' | 'Server timeout.';
10
+ };
11
+ declare class IKEAppBleConnectionErrorLogApi extends BxBApi {
12
+ constructor({ host, onSuccess, onError }: {
13
+ host: string;
14
+ onSuccess?: () => void;
15
+ onError?: (error: any) => void;
16
+ });
17
+ create(form: BleConnectionErrorLogBody): Promise<BleConnectionErrorLogResult>;
18
+ }
19
+ export default IKEAppBleConnectionErrorLogApi;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ /* eslint-disable no-undef */
55
+ var bxb_api_1 = require("@bytexbyte/bxb-api");
56
+ var config_1 = require("../config");
57
+ var IKEAppBleConnectionErrorLogApi = /** @class */ (function (_super) {
58
+ __extends(IKEAppBleConnectionErrorLogApi, _super);
59
+ function IKEAppBleConnectionErrorLogApi(_a) {
60
+ var host = _a.host, onSuccess = _a.onSuccess, onError = _a.onError;
61
+ return _super.call(this, {
62
+ host: host,
63
+ secretKey: config_1.localSecretKey,
64
+ secret: '',
65
+ moduleName: 'bleConnectionErrorLog',
66
+ onSuccess: onSuccess,
67
+ onError: onError,
68
+ }) || this;
69
+ }
70
+ IKEAppBleConnectionErrorLogApi.prototype.create = function (form) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var controller, timeoutId, response, error_1;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ controller = new AbortController();
77
+ timeoutId = setTimeout(function () { return controller.abort(); }, 4000);
78
+ _a.label = 1;
79
+ case 1:
80
+ _a.trys.push([1, 3, , 4]);
81
+ return [4 /*yield*/, this.bxbFetch({
82
+ method: 'POST',
83
+ headers: { 'Content-Type': 'application/json' },
84
+ body: JSON.stringify(form),
85
+ signal: controller.signal,
86
+ })];
87
+ case 2:
88
+ response = _a.sent();
89
+ return [2 /*return*/, response.json()];
90
+ case 3:
91
+ error_1 = _a.sent();
92
+ return [2 /*return*/, { error: 'Server timeout.' }];
93
+ case 4: return [2 /*return*/];
94
+ }
95
+ });
96
+ });
97
+ };
98
+ return IKEAppBleConnectionErrorLogApi;
99
+ }(bxb_api_1.default));
100
+ exports.default = IKEAppBleConnectionErrorLogApi;
package/lib/Rsa/index.js CHANGED
@@ -77,7 +77,7 @@ var IKEAppRsaApi = /** @class */ (function (_super) {
77
77
  headers: {
78
78
  'Content-Type': 'application/json',
79
79
  },
80
- body: JSON.stringify(form)
80
+ body: JSON.stringify(form),
81
81
  }, "uuid")];
82
82
  case 1:
83
83
  response = _a.sent();
@@ -96,7 +96,7 @@ var IKEAppRsaApi = /** @class */ (function (_super) {
96
96
  headers: {
97
97
  'Content-Type': 'application/json',
98
98
  },
99
- body: JSON.stringify(form)
99
+ body: JSON.stringify(form),
100
100
  }, "verifySignedToken")];
101
101
  case 1:
102
102
  response = _a.sent();
@@ -115,7 +115,7 @@ var IKEAppRsaApi = /** @class */ (function (_super) {
115
115
  headers: {
116
116
  'Content-Type': 'application/json',
117
117
  },
118
- body: JSON.stringify(form)
118
+ body: JSON.stringify(form),
119
119
  }, "verifyEncryptedToken")];
120
120
  case 1:
121
121
  response = _a.sent();
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import IKEAppVersionApi from './App';
2
2
  import IKEAppAuthApi from './Auth';
3
3
  import IKEAppBatchApi from './Batch';
4
+ import IKEAppBleConnectionErrorLogApi from './BleConnectionErrorLog';
4
5
  import IKEAppContractApi from './Contract';
5
6
  import IKEAppDigitalCustomizationApi from './DigitalCustomization';
6
7
  import IKEAppFileApi from './File';
@@ -31,6 +32,7 @@ declare class IKEAppApi {
31
32
  inAppNotification: IKEApInAppNotificationApi;
32
33
  incode: IKEAppIncodeApi;
33
34
  rsa: IKEAppRsaApi;
35
+ bleConnectionErrorLog: IKEAppBleConnectionErrorLogApi;
34
36
  constructor({ host, env, secretKey, secret, onSuccess, onError, }: {
35
37
  host: string;
36
38
  env: string;
package/lib/index.js CHANGED
@@ -50,6 +50,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  var App_1 = require("./App");
51
51
  var Auth_1 = require("./Auth");
52
52
  var Batch_1 = require("./Batch");
53
+ var BleConnectionErrorLog_1 = require("./BleConnectionErrorLog");
53
54
  var Contract_1 = require("./Contract");
54
55
  var DigitalCustomization_1 = require("./DigitalCustomization");
55
56
  var File_1 = require("./File");
@@ -95,6 +96,7 @@ var IKEAppApi = /** @class */ (function () {
95
96
  this.rsa = new Rsa_1.default({ host: host, onSuccess: onSuccess, onError: onError });
96
97
  this.inAppNotification = new InAppNotification_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
97
98
  this.incode = new Incode_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
99
+ this.bleConnectionErrorLog = new BleConnectionErrorLog_1.default({ host: host, onSuccess: onSuccess, onError: onError });
98
100
  }
99
101
  return IKEAppApi;
100
102
  }());
package/lib/types.d.ts CHANGED
@@ -515,6 +515,17 @@ export declare type WebUser = {
515
515
  firstName: string;
516
516
  lastName: string;
517
517
  };
518
+ /**
519
+ * Model BleConnectionErrorLog
520
+ *
521
+ */
522
+ export declare type BleConnectionErrorLog = {
523
+ id: string;
524
+ userId: string;
525
+ title: string;
526
+ detail: string;
527
+ createdAt: Date;
528
+ };
518
529
  /**
519
530
  * Enums
520
531
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/ike-app-api",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "app api",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -76,4 +76,4 @@
76
76
  "tsutils": "^2.29.0",
77
77
  "wrappy": "^1.0.2"
78
78
  }
79
- }
79
+ }