@or-sdk/billing 10.30.2-beta.2094.0 → 10.30.2-beta.2096.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 (50) hide show
  1. package/dist/cjs/Billing.js +1 -1
  2. package/dist/cjs/Billing.js.map +1 -1
  3. package/dist/cjs/api/contractsApi/index.js +1 -16
  4. package/dist/cjs/api/contractsApi/index.js.map +1 -1
  5. package/dist/cjs/api/contractsApi/types.js.map +1 -1
  6. package/dist/cjs/api/customersApi/index.js.map +1 -1
  7. package/dist/cjs/api/index.js +1 -3
  8. package/dist/cjs/api/index.js.map +1 -1
  9. package/dist/cjs/api/processingStatusesApi/index.js +61 -0
  10. package/dist/cjs/api/processingStatusesApi/index.js.map +1 -1
  11. package/dist/cjs/api/processingStatusesApi/types.js.map +1 -1
  12. package/dist/esm/Billing.js +2 -2
  13. package/dist/esm/Billing.js.map +1 -1
  14. package/dist/esm/api/contractsApi/index.js +1 -8
  15. package/dist/esm/api/contractsApi/index.js.map +1 -1
  16. package/dist/esm/api/contractsApi/types.js.map +1 -1
  17. package/dist/esm/api/customersApi/index.js.map +1 -1
  18. package/dist/esm/api/index.js +0 -1
  19. package/dist/esm/api/index.js.map +1 -1
  20. package/dist/esm/api/processingStatusesApi/index.js +30 -2
  21. package/dist/esm/api/processingStatusesApi/index.js.map +1 -1
  22. package/dist/esm/api/processingStatusesApi/types.js.map +1 -1
  23. package/dist/types/Billing.d.ts +1 -2
  24. package/dist/types/Billing.d.ts.map +1 -1
  25. package/dist/types/api/contractsApi/index.d.ts +0 -1
  26. package/dist/types/api/contractsApi/index.d.ts.map +1 -1
  27. package/dist/types/api/contractsApi/types.d.ts +0 -46
  28. package/dist/types/api/contractsApi/types.d.ts.map +1 -1
  29. package/dist/types/api/customersApi/index.d.ts.map +1 -1
  30. package/dist/types/api/index.d.ts +0 -1
  31. package/dist/types/api/index.d.ts.map +1 -1
  32. package/dist/types/api/processingStatusesApi/index.d.ts +9 -2
  33. package/dist/types/api/processingStatusesApi/index.d.ts.map +1 -1
  34. package/dist/types/api/processingStatusesApi/types.d.ts +41 -1
  35. package/dist/types/api/processingStatusesApi/types.d.ts.map +1 -1
  36. package/package.json +3 -3
  37. package/src/Billing.ts +1 -3
  38. package/src/api/contractsApi/index.ts +2 -25
  39. package/src/api/contractsApi/types.ts +0 -49
  40. package/src/api/customersApi/index.ts +2 -2
  41. package/src/api/index.ts +0 -1
  42. package/src/api/processingStatusesApi/index.ts +79 -3
  43. package/src/api/processingStatusesApi/types.ts +46 -1
  44. package/dist/cjs/api/progressiveTiersApi/index.js +0 -127
  45. package/dist/cjs/api/progressiveTiersApi/index.js.map +0 -1
  46. package/dist/esm/api/progressiveTiersApi/index.js +0 -57
  47. package/dist/esm/api/progressiveTiersApi/index.js.map +0 -1
  48. package/dist/types/api/progressiveTiersApi/index.d.ts +0 -10
  49. package/dist/types/api/progressiveTiersApi/index.d.ts.map +0 -1
  50. package/src/api/progressiveTiersApi/index.ts +0 -88
@@ -1,4 +1,5 @@
1
- import { RequestDto } from '../../types';
1
+ import { DataSourceProvider } from '@onereach/billing-shared';
2
+ import { CategoryNamespace, RequestDto } from '../../types';
2
3
  export declare enum ProcessType {
3
4
  DATA_COLLECT = "data_collect"
4
5
  }
@@ -37,4 +38,43 @@ export type UpdateProcessingStatusDto = Partial<CreateProcessingStatusDto>;
37
38
  export type ProcessingStatusDto = {
38
39
  id: string;
39
40
  } & CreateProcessingStatusDto;
41
+ export type CreateProcessingJobDto = {
42
+ jobId: string;
43
+ dateFrom: Date;
44
+ dateTo: Date;
45
+ sourceProvider?: DataSourceProvider;
46
+ sourceId?: string;
47
+ eventType?: CategoryNamespace;
48
+ itemsCount: number;
49
+ };
50
+ export type ProcessingJobDto = CreateProcessingJobDto & {
51
+ createdAt: Date;
52
+ updatedAt: Date;
53
+ };
54
+ export type FindProcessingJobDto = {
55
+ jobId?: string;
56
+ dateFrom?: Date;
57
+ dateTo?: Date;
58
+ sourceProvider?: DataSourceProvider;
59
+ sourceId?: string;
60
+ eventType?: CategoryNamespace;
61
+ minItemsCount?: number;
62
+ maxItemsCount?: number;
63
+ } & RequestDto;
64
+ export type ProcessingJobMetricsDto = {
65
+ jobId: string;
66
+ dateFrom: Date;
67
+ dateTo: Date;
68
+ sourceProvider?: DataSourceProvider;
69
+ sourceId?: string;
70
+ eventType?: CategoryNamespace;
71
+ totalEvents: number;
72
+ queuedCount: number;
73
+ progressCount: number;
74
+ successCount: number;
75
+ failedCount: number;
76
+ skippedCount: number;
77
+ createdAt: Date;
78
+ updatedAt?: Date;
79
+ };
40
80
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/api/processingStatusesApi/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,oBAAY,WAAW;IACrB,YAAY,iBAAiB;CAC9B;AAED,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC;AAEf,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM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MAAM,CAAC;CACxB,GAAG,UAAU,CAAC;AAEf,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;IACb,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or-sdk/billing",
3
- "version": "10.30.2-beta.2094.0",
3
+ "version": "10.30.2-beta.2096.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -15,8 +15,8 @@
15
15
  "dev": "pnpm build:watch:esm"
16
16
  },
17
17
  "dependencies": {
18
- "@onereach/billing-dto": "^10.30.2-beta.2094.0",
19
- "@onereach/billing-shared": "^10.30.2-beta.2094.0",
18
+ "@onereach/billing-dto": "^10.30.2-beta.2096.0",
19
+ "@onereach/billing-shared": "^10.30.2-beta.2096.0",
20
20
  "@or-sdk/base": "^0.42.3",
21
21
  "@or-sdk/discovery": "1.9.2",
22
22
  "@types/qs": "6.14.0",
package/src/Billing.ts CHANGED
@@ -32,7 +32,6 @@ import {
32
32
  ThresholdSettingsApi,
33
33
  DataReconciliationApi,
34
34
  AuditApi,
35
- ProgressiveTiersApi,
36
35
  } from './api';
37
36
  import { SERVICE_KEY } from './constants';
38
37
  import { BillingConfig } from './types';
@@ -80,7 +79,6 @@ export class Billing extends Base {
80
79
  public readonly thresholdAlertsApi: ThresholdAlertsApi;
81
80
  public readonly dataReconciliationApi: DataReconciliationApi;
82
81
  public readonly auditApi: AuditApi;
83
- public readonly progressiveTiersApi: ProgressiveTiersApi;
84
82
 
85
83
  /**
86
84
  * ```typescript
@@ -140,10 +138,10 @@ export class Billing extends Base {
140
138
  this.employeesApi = new EmployeesApi(apiCall);
141
139
  this.discoveryApi = new DiscoveryApi(apiCall);
142
140
  this.thresholdAlertsApi = new ThresholdAlertsApi(apiCall);
141
+ this.thresholdAlertsApi = new ThresholdAlertsApi(apiCall);
143
142
  this.thresholdSettingsApi = new ThresholdSettingsApi(apiCall);
144
143
  this.dataReconciliationApi = new DataReconciliationApi(apiCall);
145
144
  this.auditApi = new AuditApi(apiCall);
146
- this.progressiveTiersApi = new ProgressiveTiersApi(apiCall);
147
145
  }
148
146
 
149
147
  async callApi<T>(params: CalApiParams): Promise<T> {
@@ -7,7 +7,7 @@ export default class ContractsApi extends BaseApi {
7
7
  private readonly apiBasePath = 'contracts';
8
8
 
9
9
  /**
10
- * Retrieves contracts based on provided search parameters (V2 with progressive tier support)
10
+ * Retrieves contracts based on provided search parameters
11
11
  * @param {ContractSearchParams} [params] - Search parameters
12
12
  * @param {OptionalApiParams} [options] - Optional API params (e.g., abort signal).
13
13
  * @returns {Promise<ResponseDto<ContractResponse>>} Promise resolving to contract response
@@ -23,30 +23,7 @@ export default class ContractsApi extends BaseApi {
23
23
  };
24
24
  return await this.apiCall({
25
25
  method: 'GET',
26
- route: `v2/${this.apiBasePath}`,
27
- params: _params,
28
- ...options,
29
- });
30
- }
31
-
32
- /**
33
- * Retrieves contracts based on provided search parameters (Legacy without progressive tiers)
34
- * @param {ContractSearchParams} [params] - Search parameters
35
- * @param {OptionalApiParams} [options] - Optional API params (e.g., abort signal).
36
- * @returns {Promise<ResponseDto<ContractResponse>>} Promise resolving to contract response
37
- */
38
- public async legacyGetContracts(
39
- params?: ContractSearchParams,
40
- options: OptionalApiParams = {},
41
- ): Promise<ResponseDto<ContractResponse>> {
42
- const _params = {
43
- ...params,
44
- id: params?.id?.join(',') ?? undefined,
45
- customerId: params?.customerId?.join(',') ?? undefined,
46
- };
47
- return await this.apiCall({
48
- method: 'GET',
49
- route: 'contracts',
26
+ route: `${this.apiBasePath}`,
50
27
  params: _params,
51
28
  ...options,
52
29
  });
@@ -1,6 +1,3 @@
1
- import { PricingRuleDto } from '@onereach/billing-dto';
2
- import { DateType, PricingRuleType } from '@onereach/billing-shared';
3
-
4
1
  import { RequestDto } from '../../types';
5
2
 
6
3
  export type CreditResponse = {
@@ -25,19 +22,6 @@ export type OtherFeeResponse = {
25
22
  endDate: Date;
26
23
  };
27
24
 
28
- export type ProgressiveTierAssignment = {
29
- id: string;
30
- name: string;
31
- category: string;
32
- ruleType: PricingRuleType;
33
- dateFrom: string;
34
- dateTo?: string;
35
- dateType: DateType;
36
- skus?: string[];
37
- pricingRules: PricingRuleDto[];
38
- assignedAt: Date;
39
- };
40
-
41
25
  export interface ContractResponse {
42
26
  id: string;
43
27
  customerId?: string;
@@ -60,37 +44,6 @@ export interface ContractResponse {
60
44
  credits?: CreditResponse[];
61
45
  otherFees?: OtherFeeResponse[];
62
46
  customerName?: string;
63
- progressiveTiers?: ProgressiveTierAssignment[];
64
- createdAt?: Date;
65
- updatedAt?: Date;
66
- deletedAt?: Date;
67
- }
68
-
69
- export interface LegacyContractResponse {
70
- id: string;
71
- customerId?: string;
72
- currency?: string;
73
- startDate: Date;
74
- endDate: Date;
75
- lateFees?: string;
76
- minimumCustomSupportFee?: number;
77
- minimumPlatformSupportFee?: number;
78
- minimumUsageCommitFee?: number;
79
- name: string;
80
- paymentTerms?: string;
81
- poNumber?: string;
82
- skuExclusions?: string[];
83
- slackMessageId?: string;
84
- status?: string;
85
- tiers?: string[];
86
- usagePrepaymentBucket?: number;
87
- variablePlatformSupportFee?: number;
88
- credits?: CreditResponse[];
89
- otherFees?: OtherFeeResponse[];
90
- customerName?: string;
91
- createdAt?: Date;
92
- updatedAt?: Date;
93
- deletedAt?: Date;
94
47
  }
95
48
 
96
49
  export type ContractSearchParams = {
@@ -138,7 +91,6 @@ export interface CreateContractDto {
138
91
  variablePlatformSupportFee?: number;
139
92
  credits?: CreditDto[];
140
93
  otherFees?: OtherFeeDto[];
141
- progressiveTierIds?: string[];
142
94
  }
143
95
 
144
96
  export class UpdateContractDto {
@@ -161,5 +113,4 @@ export class UpdateContractDto {
161
113
  endDate?: Date;
162
114
  credits?: CreditDto[];
163
115
  otherFees?: OtherFeeDto[];
164
- progressiveTierIds?: string[];
165
116
  }
@@ -1,4 +1,4 @@
1
- import { PaginatedResponseDto, CustomerDto, QueryPaymentsCustomersDto, CustomerQueryParamsDto } from '@onereach/billing-dto';
1
+ import { PaginatedResponseDto, CustomerDto, QueryPaymentsCustomersDto } from '@onereach/billing-dto';
2
2
 
3
3
  import { OptionalApiParams } from '../../types';
4
4
  import { BaseApi } from '../baseApi';
@@ -31,7 +31,7 @@ export default class CustomersApi extends BaseApi {
31
31
  ids: params?.ids?.join(',') ?? undefined,
32
32
  domains: params?.domains?.join(',') ?? undefined,
33
33
  approver: params?.approver?.join(',') ?? undefined,
34
- } as CustomerQueryParamsDto;
34
+ };
35
35
  return await this.apiCall<PaginatedResponseDto<CustomerDto>>({
36
36
  method: 'GET',
37
37
  route: `${this.apiBasePath}`,
package/src/api/index.ts CHANGED
@@ -28,4 +28,3 @@ export { default as ThresholdAlertsApi } from './thresholdAlertsApi';
28
28
  export { default as ThresholdSettingsApi } from './thresholdSettingsApi';
29
29
  export { default as DataReconciliationApi } from './dataReconciliationApi';
30
30
  export { default as AuditApi } from './auditApi';
31
- export { default as ProgressiveTiersApi } from './progressiveTiersApi';
@@ -1,9 +1,13 @@
1
- import { ResponseDto } from '../../types';
1
+ import { OptionalApiParams, ResponseDto } from '../../types';
2
2
  import { BaseApi } from '../baseApi';
3
3
 
4
4
  import {
5
+ CreateProcessingJobDto,
5
6
  CreateProcessingStatusDto,
7
+ FindProcessingJobDto,
6
8
  FindProcessingStatusDto,
9
+ ProcessingJobDto,
10
+ ProcessingJobMetricsDto,
7
11
  ProcessingStatusDto,
8
12
  UpdateProcessingStatusDto,
9
13
  } from './types';
@@ -32,7 +36,7 @@ export default class ProcessingStatusesApi extends BaseApi {
32
36
  return await this.apiCall({
33
37
  method: 'GET',
34
38
  route: `${this.apiBasePath}`,
35
- params: params,
39
+ params,
36
40
  });
37
41
  }
38
42
 
@@ -118,7 +122,79 @@ export default class ProcessingStatusesApi extends BaseApi {
118
122
  return await this.apiCall({
119
123
  method: 'DELETE',
120
124
  route: `${this.apiBasePath}`,
121
- params: { id: id },
125
+ params: { id },
126
+ });
127
+ }
128
+
129
+ /**
130
+ * Retrieves a list of processing jobs from the API, filtered by optional parameters.
131
+ *
132
+ * @param {FindProcessingJobDto} params - Filter parameters for querying jobs.
133
+ * @param {string} [params.jobId] - Filter by the unique job ID.
134
+ * @param {Date} [params.dateFrom] - Filter for jobs with dateFrom after this date.
135
+ * @param {Date} [params.dateTo] - Filter for jobs with dateTo before this date.
136
+ * @param {DataSourceProvider} [params.sourceProvider] - Filter by data source provider.
137
+ * @param {string} [params.sourceId] - Filter by source ID.
138
+ * @param {CategoryNamespace} [params.eventType] - Filter by event type.
139
+ * @param {number} [params.minItemsCount] - Filter by minimum items count.
140
+ * @param {number} [params.maxItemsCount] - Filter by maximum items count.
141
+ * @returns {Promise<ProcessingJobDto>} A promise resolving to processing job data.
142
+ */
143
+ public async getJobs(params: FindProcessingJobDto, options: OptionalApiParams = {}): Promise<ResponseDto<ProcessingJobDto>> {
144
+ return await this.apiCall({
145
+ method: 'GET',
146
+ route: `${this.apiBasePath}/jobs`,
147
+ params,
148
+ ...options,
149
+ });
150
+ }
151
+
152
+ /**
153
+ * Retrieves metrics and statistics for a specific processing job.
154
+ *
155
+ * @param {string} jobId - The unique identifier of the job for which to fetch metrics.
156
+ * @returns {Promise<ProcessingJobMetricsDto>} A promise that resolves to job metrics including jobId, dateFrom, dateTo, sourceProvider, sourceId, eventType, totalEvents, queuedCount, progressCount, successCount, failedCount, skippedCount, createdAt, and updatedAt.
157
+ */
158
+ public async getJobMetrics(jobId: string, options: OptionalApiParams = {}): Promise<ProcessingJobMetricsDto> {
159
+ return await this.apiCall({
160
+ method: 'GET',
161
+ route: `${this.apiBasePath}/jobs/${jobId}`,
162
+ ...options,
163
+ });
164
+ }
165
+
166
+ /**
167
+ * Creates a new processing job entry.
168
+ *
169
+ * @param {CreateProcessingJobDto} data - The data for the new processing job.
170
+ * @param {string} data.jobId - The unique job identifier.
171
+ * @param {Date} data.dateFrom - The start date for the job.
172
+ * @param {Date} data.dateTo - The end date for the job.
173
+ * @param {DataSourceProvider} [data.sourceProvider] - The data source provider.
174
+ * @param {string} [data.sourceId] - The source ID.
175
+ * @param {CategoryNamespace} [data.eventType] - The event type.
176
+ * @param {number} data.itemsCount - The total number of items to process.
177
+ * @returns {Promise<ProcessingJobDto>} A promise that resolves to the newly created processing job.
178
+ */
179
+ public async createJob(data: CreateProcessingJobDto): Promise<ProcessingJobDto> {
180
+ return await this.apiCall({
181
+ method: 'POST',
182
+ route: `${this.apiBasePath}/jobs`,
183
+ data,
184
+ });
185
+ };
186
+
187
+ /**
188
+ * Deletes a processing job by its ID.
189
+ *
190
+ * @param {string} jobId - The unique identifier of the job to delete.
191
+ * @returns {Promise<{ raw: any; affected?: number | null }>} A promise that resolves to an object containing deletion details.
192
+ */
193
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
+ public async removeJob(jobId: string): Promise<{ raw: any; affected?: number | null; }> {
195
+ return await this.apiCall({
196
+ method: 'DELETE',
197
+ route: `${this.apiBasePath}/jobs/${jobId}`,
122
198
  });
123
199
  }
124
200
  }
@@ -1,4 +1,6 @@
1
- import { RequestDto } from '../../types';
1
+ import { DataSourceProvider } from '@onereach/billing-shared';
2
+
3
+ import { CategoryNamespace, RequestDto } from '../../types';
2
4
 
3
5
  export enum ProcessType {
4
6
  DATA_COLLECT = 'data_collect',
@@ -41,3 +43,46 @@ export type CreateProcessingStatusDto = {
41
43
  export type UpdateProcessingStatusDto = Partial<CreateProcessingStatusDto>;
42
44
 
43
45
  export type ProcessingStatusDto = { id: string; } & CreateProcessingStatusDto;
46
+
47
+ export type CreateProcessingJobDto = {
48
+ jobId: string;
49
+ dateFrom: Date;
50
+ dateTo: Date;
51
+ sourceProvider?: DataSourceProvider;
52
+ sourceId?: string;
53
+ eventType?: CategoryNamespace;
54
+ itemsCount: number;
55
+ }
56
+
57
+ export type ProcessingJobDto = CreateProcessingJobDto & {
58
+ createdAt: Date;
59
+ updatedAt: Date;
60
+ }
61
+
62
+ export type FindProcessingJobDto = {
63
+ jobId?: string;
64
+ dateFrom?: Date;
65
+ dateTo?: Date;
66
+ sourceProvider?: DataSourceProvider;
67
+ sourceId?: string;
68
+ eventType?: CategoryNamespace;
69
+ minItemsCount?: number;
70
+ maxItemsCount?: number;
71
+ } & RequestDto;
72
+
73
+ export type ProcessingJobMetricsDto = {
74
+ jobId: string;
75
+ dateFrom: Date;
76
+ dateTo: Date;
77
+ sourceProvider?: DataSourceProvider;
78
+ sourceId?: string;
79
+ eventType?: CategoryNamespace;
80
+ totalEvents: number;
81
+ queuedCount: number;
82
+ progressCount: number;
83
+ successCount: number;
84
+ failedCount: number;
85
+ skippedCount: number;
86
+ createdAt: Date;
87
+ updatedAt?: Date;
88
+ };
@@ -1,127 +0,0 @@
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
- return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
- var baseApi_1 = require("../baseApi");
55
- var ProgressiveTiersApi = (function (_super) {
56
- __extends(ProgressiveTiersApi, _super);
57
- function ProgressiveTiersApi() {
58
- var _this = _super !== null && _super.apply(this, arguments) || this;
59
- _this.apiBasePath = 'progressive-tiers';
60
- return _this;
61
- }
62
- ProgressiveTiersApi.prototype.getProgressiveTiers = function () {
63
- return __awaiter(this, arguments, void 0, function (params) {
64
- if (params === void 0) { params = {}; }
65
- return __generator(this, function (_a) {
66
- switch (_a.label) {
67
- case 0: return [4, this.apiCall({
68
- method: 'GET',
69
- route: "".concat(this.apiBasePath),
70
- params: params,
71
- })];
72
- case 1: return [2, _a.sent()];
73
- }
74
- });
75
- });
76
- };
77
- ProgressiveTiersApi.prototype.createProgressiveTier = function (data) {
78
- return __awaiter(this, void 0, void 0, function () {
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
81
- case 0: return [4, this.apiCall({
82
- method: 'POST',
83
- route: "".concat(this.apiBasePath),
84
- data: data,
85
- })];
86
- case 1: return [2, _a.sent()];
87
- }
88
- });
89
- });
90
- };
91
- ProgressiveTiersApi.prototype.updateProgressiveTier = function (id, data) {
92
- return __awaiter(this, void 0, void 0, function () {
93
- return __generator(this, function (_a) {
94
- switch (_a.label) {
95
- case 0: return [4, this.apiCall({
96
- method: 'PUT',
97
- route: "".concat(this.apiBasePath),
98
- params: { id: id },
99
- data: data,
100
- })];
101
- case 1: return [2, _a.sent()];
102
- }
103
- });
104
- });
105
- };
106
- ProgressiveTiersApi.prototype.deleteProgressiveTier = function (id_1) {
107
- return __awaiter(this, arguments, void 0, function (id, softDelete) {
108
- if (softDelete === void 0) { softDelete = false; }
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0: return [4, this.apiCall({
112
- method: 'DELETE',
113
- route: "".concat(this.apiBasePath),
114
- params: {
115
- id: id,
116
- softDelete: softDelete.toString(),
117
- },
118
- })];
119
- case 1: return [2, _a.sent()];
120
- }
121
- });
122
- });
123
- };
124
- return ProgressiveTiersApi;
125
- }(baseApi_1.BaseApi));
126
- exports.default = ProgressiveTiersApi;
127
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/progressiveTiersApi/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,sCAAqC;AAErC;IAAiD,uCAAO;IAAxD;;QACmB,iBAAW,GAAG,mBAAmB,CAAC;;IA4ErD,CAAC;IA9Dc,iDAAmB,GAAhC;4DAAiC,MAAoC;YAApC,uBAAA,EAAA,WAAoC;;;4BAC5D,WAAM,IAAI,CAAC,OAAO,CAAC;4BACxB,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;4BAC5B,MAAM,EAAE,MAAM;yBACf,CAAC,EAAA;4BAJF,WAAO,SAIL,EAAC;;;;KACJ;IAeY,mDAAqB,GAAlC,UAAmC,IAA8B;;;;4BACxD,WAAM,IAAI,CAAC,OAAO,CAAC;4BACxB,MAAM,EAAE,MAAM;4BACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;4BAC5B,IAAI,MAAA;yBACL,CAAC,EAAA;4BAJF,WAAO,SAIL,EAAC;;;;KACJ;IASY,mDAAqB,GAAlC,UAAmC,EAAU,EAAE,IAA8B;;;;4BACpE,WAAM,IAAI,CAAC,OAAO,CAAC;4BACxB,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;4BAC5B,MAAM,EAAE,EAAE,EAAE,IAAA,EAAE;4BACd,IAAI,MAAA;yBACL,CAAC,EAAA;4BALF,WAAO,SAKL,EAAC;;;;KACJ;IASY,mDAAqB,GAAlC;4DAAmC,EAAU,EAAE,UAA2B;YAA3B,2BAAA,EAAA,kBAA2B;;;4BACjE,WAAM,IAAI,CAAC,OAAO,CAAC;4BACxB,MAAM,EAAE,QAAQ;4BAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;4BAC5B,MAAM,EAAE;gCACN,EAAE,EAAE,EAAE;gCACN,UAAU,EAAE,UAAU,CAAC,QAAQ,EAAE;6BAClC;yBACF,CAAC,EAAA;4BAPF,WAAO,SAOL,EAAC;;;;KACJ;IACH,0BAAC;AAAD,CAAC,AA7ED,CAAiD,iBAAO,GA6EvD"}
@@ -1,57 +0,0 @@
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 { BaseApi } from '../baseApi';
11
- export default class ProgressiveTiersApi extends BaseApi {
12
- constructor() {
13
- super(...arguments);
14
- this.apiBasePath = 'progressive-tiers';
15
- }
16
- getProgressiveTiers() {
17
- return __awaiter(this, arguments, void 0, function* (params = {}) {
18
- return yield this.apiCall({
19
- method: 'GET',
20
- route: `${this.apiBasePath}`,
21
- params: params,
22
- });
23
- });
24
- }
25
- createProgressiveTier(data) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return yield this.apiCall({
28
- method: 'POST',
29
- route: `${this.apiBasePath}`,
30
- data,
31
- });
32
- });
33
- }
34
- updateProgressiveTier(id, data) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- return yield this.apiCall({
37
- method: 'PUT',
38
- route: `${this.apiBasePath}`,
39
- params: { id },
40
- data,
41
- });
42
- });
43
- }
44
- deleteProgressiveTier(id_1) {
45
- return __awaiter(this, arguments, void 0, function* (id, softDelete = false) {
46
- return yield this.apiCall({
47
- method: 'DELETE',
48
- route: `${this.apiBasePath}`,
49
- params: {
50
- id: id,
51
- softDelete: softDelete.toString(),
52
- },
53
- });
54
- });
55
- }
56
- }
57
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/progressiveTiersApi/index.ts"],"names":[],"mappings":";;;;;;;;;AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IAAxD;;QACmB,gBAAW,GAAG,mBAAmB,CAAC;IA4ErD,CAAC;IA9Dc,mBAAmB;6DAAC,SAAkC,EAAE;YACnE,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;gBACxB,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC5B,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;QACL,CAAC;KAAA;IAeY,qBAAqB,CAAC,IAA8B;;YAC/D,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;gBACxB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC5B,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;IASY,qBAAqB,CAAC,EAAU,EAAE,IAA8B;;YAC3E,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;gBACxB,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC5B,MAAM,EAAE,EAAE,EAAE,EAAE;gBACd,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;IASY,qBAAqB;6DAAC,EAAU,EAAE,aAAsB,KAAK;YACxE,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;gBACxB,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC5B,MAAM,EAAE;oBACN,EAAE,EAAE,EAAE;oBACN,UAAU,EAAE,UAAU,CAAC,QAAQ,EAAE;iBAClC;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
@@ -1,10 +0,0 @@
1
- import { CreateProgressiveTierDto, UpdateProgressiveTierDto, ProgressiveTierDto, ProgressiveTierResponseDto, FindProgressiveTiersDto } from '@onereach/billing-dto';
2
- import { BaseApi } from '../baseApi';
3
- export default class ProgressiveTiersApi extends BaseApi {
4
- private readonly apiBasePath;
5
- getProgressiveTiers(params?: FindProgressiveTiersDto): Promise<ProgressiveTierResponseDto>;
6
- createProgressiveTier(data: CreateProgressiveTierDto): Promise<ProgressiveTierDto>;
7
- updateProgressiveTier(id: string, data: UpdateProgressiveTierDto): Promise<ProgressiveTierDto>;
8
- deleteProgressiveTier(id: string, softDelete?: boolean): Promise<ProgressiveTierDto>;
9
- }
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/progressiveTiersApi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IACtD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IActC,mBAAmB,CAAC,MAAM,GAAE,uBAA4B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAqB9F,qBAAqB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAelF,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgB9F,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAUzG"}