@or-sdk/sku-builder 2.1.2-beta.4049.0 → 2.1.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/sku-builder@2.1.1...@or-sdk/sku-builder@2.1.2) (2026-03-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **@or-sdk/sku-builder:** handle non string sql codes ([07eeaa2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/07eeaa22c93e850ec7e2de973a14fbb2262f7131))
12
+
13
+
14
+
6
15
  ## [2.1.1](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/sku-builder@2.1.0...@or-sdk/sku-builder@2.1.1) (2026-02-25)
7
16
 
8
17
  **Note:** Version bump only for package @or-sdk/sku-builder
@@ -1,13 +1,89 @@
1
1
  import { AxiosError, Base } from '@or-sdk/base';
2
2
  import { Mapping, Options, SkuBuilderConfig } from './types';
3
+ /**
4
+ * OneReach SkuBuilder service
5
+ * ## Installation:
6
+ * ```
7
+ * $ npm i @or-sdk/sku-builder
8
+ * ```
9
+ */
3
10
  export declare class SkuBuilder extends Base {
4
11
  private readonly userToken?;
5
12
  private readonly billingApiUrl?;
6
13
  private mapping;
7
14
  private withApiErrorLog;
15
+ /**
16
+ * @param {SkuBuilderConfig} [params]
17
+ * Configuration parameters for the SkuBuilder.
18
+ *
19
+ * @param {string} [params.token]
20
+ * The account token for authentication.
21
+ *
22
+ * @param {string} [params.billingApiUrl]
23
+ * The URL for the billing API.
24
+ *
25
+ * @param {string} [params.discoveryUrl]
26
+ * The URL for the discovery service.
27
+ *
28
+ * @param {Array<Mapping>} [params.mapping]
29
+ * Optional mapping configurations.
30
+ * In case this parameter empty SDK gets all mappings and apply it authomaticaly
31
+ *
32
+ * @param {boolean} [params.withApiErrorLog]
33
+ * Flag to enable API error logging.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { SkuBuilder } from '@or-sdk/sku-builder'
38
+ * const skuBuilder = new SkuBuilder({
39
+ * token: 'my-account-token-string',
40
+ * billingApiUrl: 'https://billing.ops-dev.api.onereach.ai',
41
+ * discoveryUrl: 'http://example.billing.ops-dev/endpoint',
42
+ * mapping: 'array-of-mapping-collections'
43
+ * });
44
+ * ```
45
+ */
8
46
  constructor(params?: SkuBuilderConfig);
47
+ /**
48
+ * The method gets SKU mapping collections.
49
+ *
50
+ * @returns {Array<Mapping>} array of mapping collections
51
+ */
9
52
  getMapping(): Promise<Mapping[]>;
53
+ /**
54
+ * Generates SKUs for incoming events.
55
+ * This function processes an array of incoming event objects, all of which should belong to the same
56
+ * type (`type`). Based on the `type`, the function determines the appropriate SKU generation
57
+ * logic. It then extends each event object with generated SKU identifiers and associated amount properties.
58
+ *
59
+ * @param {Array<Object>} payload
60
+ * An array of incoming event objects. Each event should conform to the expected structure based on the `type`.
61
+ * All events in the array must belong to the same category or type as specified by `type`.
62
+ *
63
+ * @param {type} type
64
+ * A string representing the type or category of the events. This parameter dictates the SKU generation strategy.
65
+ * Examples might include `"flow-processing"`, `"executable"`, `"text-messaging"`, etc.
66
+ *
67
+ * @param {Object} [options={}]
68
+ * Optional parameters to control the flow processing behavior. These options can customize how SKUs are generated
69
+ * or how the events are processed. If not provided, default processing rules will apply.
70
+ *
71
+ * @property {boolean} [options.isProcessingSegment=false]
72
+ * Determines whether each SKU should be generated in segements. By defult each SKU are generating in minutes.
73
+ *
74
+ * @returns {Array<Object>}
75
+ * Returns a new array of event objects, each extended with the following additional properties:
76
+ *
77
+ * - `SKU` (string): The generated SKU identifier for the event.
78
+ * - `Amount` (number): The calculated amount associated with the SKU, based on event data and processing rules.
79
+ */
10
80
  makeSku<T extends Record<string, unknown>>(payload: T[], type: string, options?: Options): Promise<(Record<"SKU" | "Amount", unknown> & T)[]>;
81
+ /**
82
+ * Parses an AxiosError and returns a standardized Error object.
83
+ *
84
+ * @param {AxiosError} e - The AxiosError instance to be parsed.
85
+ * @returns {Error} A new Error object containing the error code, message, and stack trace.
86
+ */
11
87
  parseError(e: AxiosError): Error;
12
88
  private logApiError;
13
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SkuBuilder.d.ts","sourceRoot":"","sources":["../../src/SkuBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAS,MAAM,cAAc,CAAC;AAKvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAwB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAWnF,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;IACxC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,eAAe,CAAU;gBAiCrB,MAAM,GAAE,gBAAqB;IAsB5B,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IA0DhC,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,OAAO,EAAE,CAAC,EAAE,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO;IAmBZ,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK;IAavC,OAAO,CAAC,WAAW;CAYpB"}
1
+ {"version":3,"file":"SkuBuilder.d.ts","sourceRoot":"","sources":["../../src/SkuBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAS,MAAM,cAAc,CAAC;AAKvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAwB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAInF;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;IACxC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,eAAe,CAAU;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;gBACS,MAAM,GAAE,gBAAqB;IAiBzC;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IA+B7C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,OAAO,EAAE,CAAC,EAAE,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO;IAanB;;;;;OAKG;IACI,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK;IAavC,OAAO,CAAC,WAAW;CAYpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or-sdk/sku-builder",
3
- "version": "2.1.2-beta.4049.0",
3
+ "version": "2.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -32,5 +32,6 @@
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
- }
35
+ },
36
+ "gitHead": "489df97c5794d1b32c6f2c8a990bbce6fb558bad"
36
37
  }