@onesignal/node-onesignal 5.6.0 → 5.8.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.
Files changed (89) hide show
  1. package/dist/apis/DefaultApi.js +2282 -4372
  2. package/dist/apis/baseapi.js +11 -30
  3. package/dist/apis/exception.js +9 -26
  4. package/dist/auth/auth.js +17 -83
  5. package/dist/configuration.js +9 -9
  6. package/dist/http/http.js +53 -132
  7. package/dist/http/isomorphic-fetch.js +15 -18
  8. package/dist/middleware.js +8 -9
  9. package/dist/models/ApiKeyToken.js +45 -46
  10. package/dist/models/ApiKeyTokensListResponse.js +15 -16
  11. package/dist/models/App.js +213 -214
  12. package/dist/models/BasicNotification.d.ts +2 -0
  13. package/dist/models/BasicNotification.js +711 -700
  14. package/dist/models/BasicNotificationAllOf.d.ts +1 -0
  15. package/dist/models/BasicNotificationAllOf.js +627 -622
  16. package/dist/models/BasicNotificationAllOfAndroidBackgroundLayout.js +27 -28
  17. package/dist/models/Button.js +27 -28
  18. package/dist/models/CopyTemplateRequest.js +15 -16
  19. package/dist/models/CreateApiKeyRequest.js +27 -28
  20. package/dist/models/CreateApiKeyResponse.js +21 -22
  21. package/dist/models/CreateNotificationSuccessResponse.js +27 -28
  22. package/dist/models/CreateSegmentConflictResponse.js +21 -22
  23. package/dist/models/CreateSegmentSuccessResponse.js +21 -22
  24. package/dist/models/CreateTemplateRequest.js +75 -76
  25. package/dist/models/CreateUserConflictResponse.js +15 -16
  26. package/dist/models/CreateUserConflictResponseErrorsInner.js +27 -28
  27. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js +15 -16
  28. package/dist/models/CustomEvent.js +39 -40
  29. package/dist/models/CustomEventsRequest.js +15 -16
  30. package/dist/models/DeliveryData.js +39 -40
  31. package/dist/models/ExportEventsSuccessResponse.js +15 -16
  32. package/dist/models/ExportSubscriptionsRequestBody.js +27 -28
  33. package/dist/models/ExportSubscriptionsSuccessResponse.js +15 -16
  34. package/dist/models/Filter.js +57 -58
  35. package/dist/models/FilterExpression.js +63 -64
  36. package/dist/models/GenericError.js +27 -28
  37. package/dist/models/GenericSuccessBoolResponse.js +15 -16
  38. package/dist/models/GetNotificationHistoryRequestBody.js +27 -28
  39. package/dist/models/GetSegmentsSuccessResponse.js +33 -34
  40. package/dist/models/LanguageStringMap.js +267 -268
  41. package/dist/models/Notification.d.ts +2 -0
  42. package/dist/models/Notification.js +717 -706
  43. package/dist/models/NotificationAllOf.js +15 -16
  44. package/dist/models/NotificationHistorySuccessResponse.js +21 -22
  45. package/dist/models/NotificationSlice.js +33 -34
  46. package/dist/models/NotificationTarget.d.ts +1 -0
  47. package/dist/models/NotificationTarget.js +93 -88
  48. package/dist/models/NotificationWithMeta.d.ts +2 -0
  49. package/dist/models/NotificationWithMeta.js +789 -778
  50. package/dist/models/NotificationWithMetaAllOf.js +93 -94
  51. package/dist/models/ObjectSerializer.js +111 -115
  52. package/dist/models/Operator.js +15 -16
  53. package/dist/models/OutcomeData.js +27 -28
  54. package/dist/models/OutcomesData.js +15 -16
  55. package/dist/models/PlatformDeliveryData.js +57 -58
  56. package/dist/models/PlatformDeliveryDataEmailAllOf.js +51 -52
  57. package/dist/models/PlatformDeliveryDataSmsAllOf.js +27 -28
  58. package/dist/models/PropertiesBody.js +15 -16
  59. package/dist/models/PropertiesDeltas.js +27 -28
  60. package/dist/models/PropertiesObject.js +75 -76
  61. package/dist/models/Purchase.js +33 -34
  62. package/dist/models/RateLimitError.js +21 -22
  63. package/dist/models/Segment.js +27 -28
  64. package/dist/models/SegmentData.js +51 -52
  65. package/dist/models/SegmentNotificationTarget.js +21 -22
  66. package/dist/models/StartLiveActivityRequest.js +105 -106
  67. package/dist/models/StartLiveActivitySuccessResponse.js +15 -16
  68. package/dist/models/Subscription.js +111 -112
  69. package/dist/models/SubscriptionBody.js +15 -16
  70. package/dist/models/SubscriptionNotificationTarget.d.ts +1 -0
  71. package/dist/models/SubscriptionNotificationTarget.js +81 -76
  72. package/dist/models/TemplateResource.js +45 -46
  73. package/dist/models/TemplatesListResponse.js +15 -16
  74. package/dist/models/TransferSubscriptionRequestBody.js +15 -16
  75. package/dist/models/UpdateApiKeyRequest.js +27 -28
  76. package/dist/models/UpdateLiveActivityRequest.js +63 -64
  77. package/dist/models/UpdateLiveActivitySuccessResponse.js +15 -16
  78. package/dist/models/UpdateTemplateRequest.js +69 -70
  79. package/dist/models/UpdateUserRequest.js +27 -28
  80. package/dist/models/User.js +27 -28
  81. package/dist/models/UserIdentityBody.js +15 -16
  82. package/dist/models/WebButton.js +33 -34
  83. package/dist/rxjsStub.js +8 -9
  84. package/dist/servers.js +14 -15
  85. package/dist/types/ObjectParamAPI.js +92 -94
  86. package/dist/types/ObservableAPI.js +534 -931
  87. package/dist/types/PromiseAPI.js +136 -137
  88. package/dist/util.js +2 -2
  89. package/package.json +4 -2
@@ -1,19 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.RequiredError = exports.BaseAPIRequestFactory = exports.COLLECTION_FORMATS = void 0;
19
4
  exports.COLLECTION_FORMATS = {
@@ -22,25 +7,21 @@ exports.COLLECTION_FORMATS = {
22
7
  tsv: "\t",
23
8
  pipes: "|",
24
9
  };
25
- var BaseAPIRequestFactory = (function () {
26
- function BaseAPIRequestFactory(configuration) {
10
+ class BaseAPIRequestFactory {
11
+ constructor(configuration) {
27
12
  this.configuration = configuration;
28
13
  }
29
- return BaseAPIRequestFactory;
30
- }());
14
+ }
31
15
  exports.BaseAPIRequestFactory = BaseAPIRequestFactory;
32
16
  ;
33
- var RequiredError = (function (_super) {
34
- __extends(RequiredError, _super);
35
- function RequiredError(api, method, field) {
36
- var _this = _super.call(this, "Required parameter " + field + " was null or undefined when calling " + api + "." + method + ".") || this;
37
- _this.api = api;
38
- _this.method = method;
39
- _this.field = field;
40
- _this.name = "RequiredError";
41
- return _this;
17
+ class RequiredError extends Error {
18
+ constructor(api, method, field) {
19
+ super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + ".");
20
+ this.api = api;
21
+ this.method = method;
22
+ this.field = field;
23
+ this.name = "RequiredError";
42
24
  }
43
- return RequiredError;
44
- }(Error));
25
+ }
45
26
  exports.RequiredError = RequiredError;
46
27
  //# sourceMappingURL=baseapi.js.map
@@ -1,32 +1,15 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.ApiException = void 0;
19
- var ApiException = (function (_super) {
20
- __extends(ApiException, _super);
21
- function ApiException(code, message, body, headers) {
22
- var _this = _super.call(this, "HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
23
- JSON.stringify(headers)) || this;
24
- _this.code = code;
25
- _this.body = body;
26
- _this.headers = headers;
27
- return _this;
4
+ class ApiException extends Error {
5
+ constructor(code, message, body, headers) {
6
+ super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
7
+ JSON.stringify(headers));
8
+ this.code = code;
9
+ this.body = body;
10
+ this.headers = headers;
11
+ Object.setPrototypeOf(this, ApiException.prototype);
28
12
  }
29
- return ApiException;
30
- }(Error));
13
+ }
31
14
  exports.ApiException = ApiException;
32
15
  //# sourceMappingURL=exception.js.map
package/dist/auth/auth.js CHANGED
@@ -1,98 +1,32 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.configureAuthMethods = exports.RestApiKeyAuthentication = exports.OrganizationApiKeyAuthentication = void 0;
40
- var OrganizationApiKeyAuthentication = (function () {
41
- function OrganizationApiKeyAuthentication(tokenProvider) {
4
+ class OrganizationApiKeyAuthentication {
5
+ constructor(tokenProvider) {
42
6
  this.tokenProvider = tokenProvider;
43
7
  }
44
- OrganizationApiKeyAuthentication.prototype.getName = function () {
8
+ getName() {
45
9
  return "organization_api_key";
46
- };
47
- OrganizationApiKeyAuthentication.prototype.applySecurityAuthentication = function (context) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var _a, _b, _c, _d;
50
- return __generator(this, function (_e) {
51
- switch (_e.label) {
52
- case 0:
53
- _b = (_a = context).setHeaderParam;
54
- _c = ["Authorization"];
55
- _d = "Key ";
56
- return [4, this.tokenProvider.getToken()];
57
- case 1:
58
- _b.apply(_a, _c.concat([_d + (_e.sent())]));
59
- return [2];
60
- }
61
- });
62
- });
63
- };
64
- return OrganizationApiKeyAuthentication;
65
- }());
10
+ }
11
+ async applySecurityAuthentication(context) {
12
+ context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken());
13
+ }
14
+ }
66
15
  exports.OrganizationApiKeyAuthentication = OrganizationApiKeyAuthentication;
67
- var RestApiKeyAuthentication = (function () {
68
- function RestApiKeyAuthentication(tokenProvider) {
16
+ class RestApiKeyAuthentication {
17
+ constructor(tokenProvider) {
69
18
  this.tokenProvider = tokenProvider;
70
19
  }
71
- RestApiKeyAuthentication.prototype.getName = function () {
20
+ getName() {
72
21
  return "rest_api_key";
73
- };
74
- RestApiKeyAuthentication.prototype.applySecurityAuthentication = function (context) {
75
- return __awaiter(this, void 0, void 0, function () {
76
- var _a, _b, _c, _d;
77
- return __generator(this, function (_e) {
78
- switch (_e.label) {
79
- case 0:
80
- _b = (_a = context).setHeaderParam;
81
- _c = ["Authorization"];
82
- _d = "Key ";
83
- return [4, this.tokenProvider.getToken()];
84
- case 1:
85
- _b.apply(_a, _c.concat([_d + (_e.sent())]));
86
- return [2];
87
- }
88
- });
89
- });
90
- };
91
- return RestApiKeyAuthentication;
92
- }());
22
+ }
23
+ async applySecurityAuthentication(context) {
24
+ context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken());
25
+ }
26
+ }
93
27
  exports.RestApiKeyAuthentication = RestApiKeyAuthentication;
94
28
  function configureAuthMethods(config) {
95
- var authMethods = {};
29
+ let authMethods = {};
96
30
  if (!config) {
97
31
  return authMethods;
98
32
  }
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createConfiguration = void 0;
4
- var middleware_1 = require("./middleware");
5
- var isomorphic_fetch_1 = require("./http/isomorphic-fetch");
6
- var servers_1 = require("./servers");
7
- var auth_1 = require("./auth/auth");
4
+ const middleware_1 = require("./middleware");
5
+ const isomorphic_fetch_1 = require("./http/isomorphic-fetch");
6
+ const servers_1 = require("./servers");
7
+ const auth_1 = require("./auth/auth");
8
8
  function createConfiguration(conf) {
9
- var authMethods = {
9
+ const authMethods = {
10
10
  'organization_api_key': {
11
11
  tokenProvider: {
12
- getToken: function () { return conf.organizationApiKey || ''; }
12
+ getToken: () => conf.organizationApiKey || ''
13
13
  }
14
14
  },
15
15
  'rest_api_key': {
16
16
  tokenProvider: {
17
- getToken: function () { return conf.restApiKey || ''; }
17
+ getToken: () => conf.restApiKey || ''
18
18
  }
19
19
  },
20
20
  };
21
- var configuration = {
21
+ const configuration = {
22
22
  baseServer: conf.baseServer !== undefined ? conf.baseServer : servers_1.server1,
23
23
  httpApi: conf.httpApi || new isomorphic_fetch_1.IsomorphicFetchHttpLibrary(),
24
24
  middleware: conf.middleware || [],
25
25
  authMethods: (0, auth_1.configureAuthMethods)(Object.assign(authMethods, conf.authMethods || {}))
26
26
  };
27
27
  if (conf.promiseMiddleware) {
28
- conf.promiseMiddleware.forEach(function (m) { return configuration.middleware.push(new middleware_1.PromiseMiddlewareWrapper(m)); });
28
+ conf.promiseMiddleware.forEach(m => configuration.middleware.push(new middleware_1.PromiseMiddlewareWrapper(m)));
29
29
  }
30
30
  return configuration;
31
31
  }
package/dist/http/http.js CHANGED
@@ -1,19 +1,4 @@
1
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
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
3
  if (k2 === undefined) k2 = k;
19
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -28,45 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
28
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
15
  };
31
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
32
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
- return new (P || (P = Promise))(function (resolve, reject) {
34
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37
- step((generator = generator.apply(thisArg, _arguments || [])).next());
38
- });
39
- };
40
- var __generator = (this && this.__generator) || function (thisArg, body) {
41
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
42
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
43
- function verb(n) { return function (v) { return step([n, v]); }; }
44
- function step(op) {
45
- if (f) throw new TypeError("Generator is already executing.");
46
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
47
- 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;
48
- if (y = 0, t) op = [op[0] & 2, t.value];
49
- switch (op[0]) {
50
- case 0: case 1: t = op; break;
51
- case 4: _.label++; return { value: op[1], done: false };
52
- case 5: _.label++; y = op[1]; op = [0]; continue;
53
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
54
- default:
55
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
56
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
57
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
58
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
59
- if (t[2]) _.ops.pop();
60
- _.trys.pop(); continue;
61
- }
62
- op = body.call(thisArg, _);
63
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
64
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
65
- }
66
- };
67
16
  Object.defineProperty(exports, "__esModule", { value: true });
68
17
  exports.wrapHttpLibrary = exports.ResponseContext = exports.SelfDecodingBody = exports.RequestContext = exports.HttpException = exports.HttpMethod = void 0;
69
- var rxjsStub_1 = require("../rxjsStub");
18
+ const rxjsStub_1 = require("../rxjsStub");
70
19
  __exportStar(require("./isomorphic-fetch"), exports);
71
20
  var HttpMethod;
72
21
  (function (HttpMethod) {
@@ -80,92 +29,78 @@ var HttpMethod;
80
29
  HttpMethod["TRACE"] = "TRACE";
81
30
  HttpMethod["PATCH"] = "PATCH";
82
31
  })(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
83
- var HttpException = (function (_super) {
84
- __extends(HttpException, _super);
85
- function HttpException(msg) {
86
- return _super.call(this, msg) || this;
32
+ class HttpException extends Error {
33
+ constructor(msg) {
34
+ super(msg);
87
35
  }
88
- return HttpException;
89
- }(Error));
36
+ }
90
37
  exports.HttpException = HttpException;
91
- var RequestContext = (function () {
92
- function RequestContext(url, httpMethod) {
38
+ class RequestContext {
39
+ constructor(url, httpMethod) {
93
40
  this.httpMethod = httpMethod;
94
41
  this.headers = {};
95
42
  this.body = undefined;
96
43
  this.url = new URL(url);
97
44
  }
98
- RequestContext.prototype.getUrl = function () {
45
+ getUrl() {
99
46
  return this.url.toString();
100
- };
101
- RequestContext.prototype.setUrl = function (url) {
47
+ }
48
+ setUrl(url) {
102
49
  this.url = new URL(url);
103
- };
104
- RequestContext.prototype.setBody = function (body) {
50
+ }
51
+ setBody(body) {
105
52
  this.body = body;
106
- };
107
- RequestContext.prototype.getHttpMethod = function () {
53
+ }
54
+ getHttpMethod() {
108
55
  return this.httpMethod;
109
- };
110
- RequestContext.prototype.getHeaders = function () {
56
+ }
57
+ getHeaders() {
111
58
  return this.headers;
112
- };
113
- RequestContext.prototype.getBody = function () {
59
+ }
60
+ getBody() {
114
61
  return this.body;
115
- };
116
- RequestContext.prototype.setQueryParam = function (name, value) {
62
+ }
63
+ setQueryParam(name, value) {
117
64
  this.url.searchParams.set(name, value);
118
- };
119
- RequestContext.prototype.addCookie = function (name, value) {
65
+ }
66
+ addCookie(name, value) {
120
67
  if (!this.headers["Cookie"]) {
121
68
  this.headers["Cookie"] = "";
122
69
  }
123
70
  this.headers["Cookie"] += name + "=" + value + "; ";
124
- };
125
- RequestContext.prototype.setHeaderParam = function (key, value) {
71
+ }
72
+ setHeaderParam(key, value) {
126
73
  this.headers[key] = value;
127
- };
128
- return RequestContext;
129
- }());
74
+ }
75
+ }
130
76
  exports.RequestContext = RequestContext;
131
- var SelfDecodingBody = (function () {
132
- function SelfDecodingBody(dataSource) {
77
+ class SelfDecodingBody {
78
+ constructor(dataSource) {
133
79
  this.dataSource = dataSource;
134
80
  }
135
- SelfDecodingBody.prototype.binary = function () {
81
+ binary() {
136
82
  return this.dataSource;
137
- };
138
- SelfDecodingBody.prototype.text = function () {
139
- return __awaiter(this, void 0, void 0, function () {
140
- var data;
141
- return __generator(this, function (_a) {
142
- switch (_a.label) {
143
- case 0: return [4, this.dataSource];
144
- case 1:
145
- data = _a.sent();
146
- return [2, data.toString()];
147
- }
148
- });
149
- });
150
- };
151
- return SelfDecodingBody;
152
- }());
83
+ }
84
+ async text() {
85
+ const data = await this.dataSource;
86
+ return data.toString();
87
+ }
88
+ }
153
89
  exports.SelfDecodingBody = SelfDecodingBody;
154
- var ResponseContext = (function () {
155
- function ResponseContext(httpStatusCode, headers, body) {
90
+ class ResponseContext {
91
+ constructor(httpStatusCode, headers, body) {
156
92
  this.httpStatusCode = httpStatusCode;
157
93
  this.headers = headers;
158
94
  this.body = body;
159
95
  }
160
- ResponseContext.prototype.getParsedHeader = function (headerName) {
161
- var result = {};
96
+ getParsedHeader(headerName) {
97
+ const result = {};
162
98
  if (!this.headers[headerName]) {
163
99
  return result;
164
100
  }
165
- var parameters = this.headers[headerName].split(";");
166
- for (var _i = 0, parameters_1 = parameters; _i < parameters_1.length; _i++) {
167
- var parameter = parameters_1[_i];
168
- var _a = parameter.split("=", 2), key = _a[0], value = _a[1];
101
+ const parameters = this.headers[headerName].split(";");
102
+ for (const parameter of parameters) {
103
+ let [key, value] = parameter.split("=", 2);
169
104
  key = key.toLowerCase().trim();
170
105
  if (value === undefined) {
171
106
  result[""] = key;
@@ -179,34 +114,20 @@ var ResponseContext = (function () {
179
114
  }
180
115
  }
181
116
  return result;
182
- };
183
- ResponseContext.prototype.getBodyAsFile = function () {
184
- return __awaiter(this, void 0, void 0, function () {
185
- var data, fileName;
186
- return __generator(this, function (_a) {
187
- switch (_a.label) {
188
- case 0: return [4, this.body.binary()];
189
- case 1:
190
- data = _a.sent();
191
- fileName = this.getParsedHeader("content-disposition")["filename"] || "";
192
- return [2, { data: data, name: fileName }];
193
- }
194
- });
195
- });
196
- };
197
- ResponseContext.prototype.getBodyAsAny = function () {
198
- return __awaiter(this, void 0, void 0, function () {
199
- return __generator(this, function (_a) {
200
- return [2, this.body];
201
- });
202
- });
203
- };
204
- return ResponseContext;
205
- }());
117
+ }
118
+ async getBodyAsFile() {
119
+ const data = await this.body.binary();
120
+ const fileName = this.getParsedHeader("content-disposition")["filename"] || "";
121
+ return { data, name: fileName };
122
+ }
123
+ async getBodyAsAny() {
124
+ return this.body;
125
+ }
126
+ }
206
127
  exports.ResponseContext = ResponseContext;
207
128
  function wrapHttpLibrary(promiseHttpLibrary) {
208
129
  return {
209
- send: function (request) {
130
+ send(request) {
210
131
  return (0, rxjsStub_1.from)(promiseHttpLibrary.send(request));
211
132
  }
212
133
  };
@@ -1,32 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IsomorphicFetchHttpLibrary = void 0;
4
- var http_1 = require("./http");
5
- var rxjsStub_1 = require("../rxjsStub");
6
- var IsomorphicFetchHttpLibrary = (function () {
7
- function IsomorphicFetchHttpLibrary() {
8
- }
9
- IsomorphicFetchHttpLibrary.prototype.send = function (request) {
10
- var method = request.getHttpMethod().toString();
11
- var body = request.getBody();
12
- var resultPromise = fetch(request.getUrl(), {
4
+ const http_1 = require("./http");
5
+ const rxjsStub_1 = require("../rxjsStub");
6
+ class IsomorphicFetchHttpLibrary {
7
+ send(request) {
8
+ let method = request.getHttpMethod().toString();
9
+ let body = request.getBody();
10
+ const resultPromise = fetch(request.getUrl(), {
13
11
  method: method,
14
12
  body: body,
15
13
  headers: request.getHeaders(),
16
- }).then(function (resp) {
17
- var headers = {};
18
- resp.headers.forEach(function (value, name) {
14
+ }).then((resp) => {
15
+ const headers = {};
16
+ resp.headers.forEach((value, name) => {
19
17
  headers[name] = value;
20
18
  });
21
- var body = {
22
- text: function () { return resp.text(); },
23
- binary: function () { return resp.buffer(); }
19
+ const body = {
20
+ text: () => resp.text(),
21
+ binary: () => resp.buffer()
24
22
  };
25
23
  return new http_1.ResponseContext(resp.status, headers, body);
26
24
  });
27
25
  return (0, rxjsStub_1.from)(resultPromise);
28
- };
29
- return IsomorphicFetchHttpLibrary;
30
- }());
26
+ }
27
+ }
31
28
  exports.IsomorphicFetchHttpLibrary = IsomorphicFetchHttpLibrary;
32
29
  //# sourceMappingURL=isomorphic-fetch.js.map
@@ -1,18 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PromiseMiddlewareWrapper = void 0;
4
- var rxjsStub_1 = require("./rxjsStub");
5
- var PromiseMiddlewareWrapper = (function () {
6
- function PromiseMiddlewareWrapper(middleware) {
4
+ const rxjsStub_1 = require("./rxjsStub");
5
+ class PromiseMiddlewareWrapper {
6
+ constructor(middleware) {
7
7
  this.middleware = middleware;
8
8
  }
9
- PromiseMiddlewareWrapper.prototype.pre = function (context) {
9
+ pre(context) {
10
10
  return (0, rxjsStub_1.from)(this.middleware.pre(context));
11
- };
12
- PromiseMiddlewareWrapper.prototype.post = function (context) {
11
+ }
12
+ post(context) {
13
13
  return (0, rxjsStub_1.from)(this.middleware.post(context));
14
- };
15
- return PromiseMiddlewareWrapper;
16
- }());
14
+ }
15
+ }
17
16
  exports.PromiseMiddlewareWrapper = PromiseMiddlewareWrapper;
18
17
  //# sourceMappingURL=middleware.js.map