@kontent-ai/core-sdk 10.0.0-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 (202) hide show
  1. package/.npmignore +14 -0
  2. package/LICENSE.md +9 -0
  3. package/README.md +30 -0
  4. package/dist/cjs/helpers/enum.helper.d.ts +8 -0
  5. package/dist/cjs/helpers/enum.helper.js +79 -0
  6. package/dist/cjs/helpers/enum.helper.js.map +1 -0
  7. package/dist/cjs/helpers/header.helper.d.ts +13 -0
  8. package/dist/cjs/helpers/header.helper.js +24 -0
  9. package/dist/cjs/helpers/header.helper.js.map +1 -0
  10. package/dist/cjs/helpers/headers-helper.d.ts +3 -0
  11. package/dist/cjs/helpers/headers-helper.js +37 -0
  12. package/dist/cjs/helpers/headers-helper.js.map +1 -0
  13. package/dist/cjs/helpers/index.d.ts +5 -0
  14. package/dist/cjs/helpers/index.js +22 -0
  15. package/dist/cjs/helpers/index.js.map +1 -0
  16. package/dist/cjs/helpers/retry-helper.d.ts +37 -0
  17. package/dist/cjs/helpers/retry-helper.js +152 -0
  18. package/dist/cjs/helpers/retry-helper.js.map +1 -0
  19. package/dist/cjs/helpers/url.helper.d.ts +10 -0
  20. package/dist/cjs/helpers/url.helper.js +30 -0
  21. package/dist/cjs/helpers/url.helper.js.map +1 -0
  22. package/dist/cjs/http/http.debugger.d.ts +6 -0
  23. package/dist/cjs/http/http.debugger.js +26 -0
  24. package/dist/cjs/http/http.debugger.js.map +1 -0
  25. package/dist/cjs/http/http.functions.d.ts +11 -0
  26. package/dist/cjs/http/http.functions.js +381 -0
  27. package/dist/cjs/http/http.functions.js.map +1 -0
  28. package/dist/cjs/http/http.models.d.ts +73 -0
  29. package/dist/cjs/http/http.models.js +3 -0
  30. package/dist/cjs/http/http.models.js.map +1 -0
  31. package/dist/cjs/http/http.service.d.ts +19 -0
  32. package/dist/cjs/http/http.service.js +110 -0
  33. package/dist/cjs/http/http.service.js.map +1 -0
  34. package/dist/cjs/http/ihttp.service.d.ts +9 -0
  35. package/dist/cjs/http/ihttp.service.js +3 -0
  36. package/dist/cjs/http/ihttp.service.js.map +1 -0
  37. package/dist/cjs/http/index.d.ts +6 -0
  38. package/dist/cjs/http/index.js +23 -0
  39. package/dist/cjs/http/index.js.map +1 -0
  40. package/dist/cjs/http/test-http.service.d.ts +17 -0
  41. package/dist/cjs/http/test-http.service.js +47 -0
  42. package/dist/cjs/http/test-http.service.js.map +1 -0
  43. package/dist/cjs/index.d.ts +3 -0
  44. package/dist/cjs/index.js +21 -0
  45. package/dist/cjs/index.js.map +1 -0
  46. package/dist/cjs/models/index.d.ts +3 -0
  47. package/dist/cjs/models/index.js +20 -0
  48. package/dist/cjs/models/index.js.map +1 -0
  49. package/dist/cjs/models/isdk-info.d.ts +14 -0
  50. package/dist/cjs/models/isdk-info.js +3 -0
  51. package/dist/cjs/models/isdk-info.js.map +1 -0
  52. package/dist/cjs/models/parameters.d.ts +16 -0
  53. package/dist/cjs/models/parameters.js +30 -0
  54. package/dist/cjs/models/parameters.js.map +1 -0
  55. package/dist/cjs/models/url.models.d.ts +3 -0
  56. package/dist/cjs/models/url.models.js +3 -0
  57. package/dist/cjs/models/url.models.js.map +1 -0
  58. package/dist/cjs/sdk-info.generated.d.ts +2 -0
  59. package/dist/cjs/sdk-info.generated.js +9 -0
  60. package/dist/cjs/sdk-info.generated.js.map +1 -0
  61. package/dist/es2015/helpers/enum.helper.d.ts +8 -0
  62. package/dist/es2015/helpers/enum.helper.js +50 -0
  63. package/dist/es2015/helpers/enum.helper.js.map +1 -0
  64. package/dist/es2015/helpers/header.helper.d.ts +13 -0
  65. package/dist/es2015/helpers/header.helper.js +19 -0
  66. package/dist/es2015/helpers/header.helper.js.map +1 -0
  67. package/dist/es2015/helpers/headers-helper.d.ts +3 -0
  68. package/dist/es2015/helpers/headers-helper.js +11 -0
  69. package/dist/es2015/helpers/headers-helper.js.map +1 -0
  70. package/dist/es2015/helpers/index.d.ts +5 -0
  71. package/dist/es2015/helpers/index.js +6 -0
  72. package/dist/es2015/helpers/index.js.map +1 -0
  73. package/dist/es2015/helpers/retry-helper.d.ts +37 -0
  74. package/dist/es2015/helpers/retry-helper.js +145 -0
  75. package/dist/es2015/helpers/retry-helper.js.map +1 -0
  76. package/dist/es2015/helpers/url.helper.d.ts +10 -0
  77. package/dist/es2015/helpers/url.helper.js +23 -0
  78. package/dist/es2015/helpers/url.helper.js.map +1 -0
  79. package/dist/es2015/http/http.debugger.d.ts +6 -0
  80. package/dist/es2015/http/http.debugger.js +19 -0
  81. package/dist/es2015/http/http.debugger.js.map +1 -0
  82. package/dist/es2015/http/http.functions.d.ts +11 -0
  83. package/dist/es2015/http/http.functions.js +244 -0
  84. package/dist/es2015/http/http.functions.js.map +1 -0
  85. package/dist/es2015/http/http.models.d.ts +73 -0
  86. package/dist/es2015/http/http.models.js +2 -0
  87. package/dist/es2015/http/http.models.js.map +1 -0
  88. package/dist/es2015/http/http.service.d.ts +19 -0
  89. package/dist/es2015/http/http.service.js +45 -0
  90. package/dist/es2015/http/http.service.js.map +1 -0
  91. package/dist/es2015/http/ihttp.service.d.ts +9 -0
  92. package/dist/es2015/http/ihttp.service.js +2 -0
  93. package/dist/es2015/http/ihttp.service.js.map +1 -0
  94. package/dist/es2015/http/index.d.ts +6 -0
  95. package/dist/es2015/http/index.js +7 -0
  96. package/dist/es2015/http/index.js.map +1 -0
  97. package/dist/es2015/http/test-http.service.d.ts +17 -0
  98. package/dist/es2015/http/test-http.service.js +41 -0
  99. package/dist/es2015/http/test-http.service.js.map +1 -0
  100. package/dist/es2015/index.d.ts +3 -0
  101. package/dist/es2015/index.js +5 -0
  102. package/dist/es2015/index.js.map +1 -0
  103. package/dist/es2015/models/index.d.ts +3 -0
  104. package/dist/es2015/models/index.js +4 -0
  105. package/dist/es2015/models/index.js.map +1 -0
  106. package/dist/es2015/models/isdk-info.d.ts +14 -0
  107. package/dist/es2015/models/isdk-info.js +2 -0
  108. package/dist/es2015/models/isdk-info.js.map +1 -0
  109. package/dist/es2015/models/parameters.d.ts +16 -0
  110. package/dist/es2015/models/parameters.js +26 -0
  111. package/dist/es2015/models/parameters.js.map +1 -0
  112. package/dist/es2015/models/url.models.d.ts +3 -0
  113. package/dist/es2015/models/url.models.js +2 -0
  114. package/dist/es2015/models/url.models.js.map +1 -0
  115. package/dist/es2015/sdk-info.generated.d.ts +2 -0
  116. package/dist/es2015/sdk-info.generated.js +6 -0
  117. package/dist/es2015/sdk-info.generated.js.map +1 -0
  118. package/dist/es5/helpers/enum.helper.d.ts +8 -0
  119. package/dist/es5/helpers/enum.helper.js +66 -0
  120. package/dist/es5/helpers/enum.helper.js.map +1 -0
  121. package/dist/es5/helpers/header.helper.d.ts +13 -0
  122. package/dist/es5/helpers/header.helper.js +21 -0
  123. package/dist/es5/helpers/header.helper.js.map +1 -0
  124. package/dist/es5/helpers/headers-helper.d.ts +3 -0
  125. package/dist/es5/helpers/headers-helper.js +23 -0
  126. package/dist/es5/helpers/headers-helper.js.map +1 -0
  127. package/dist/es5/helpers/index.d.ts +5 -0
  128. package/dist/es5/helpers/index.js +6 -0
  129. package/dist/es5/helpers/index.js.map +1 -0
  130. package/dist/es5/helpers/retry-helper.d.ts +37 -0
  131. package/dist/es5/helpers/retry-helper.js +149 -0
  132. package/dist/es5/helpers/retry-helper.js.map +1 -0
  133. package/dist/es5/helpers/url.helper.d.ts +10 -0
  134. package/dist/es5/helpers/url.helper.js +27 -0
  135. package/dist/es5/helpers/url.helper.js.map +1 -0
  136. package/dist/es5/http/http.debugger.d.ts +6 -0
  137. package/dist/es5/http/http.debugger.js +23 -0
  138. package/dist/es5/http/http.debugger.js.map +1 -0
  139. package/dist/es5/http/http.functions.d.ts +11 -0
  140. package/dist/es5/http/http.functions.js +337 -0
  141. package/dist/es5/http/http.functions.js.map +1 -0
  142. package/dist/es5/http/http.models.d.ts +73 -0
  143. package/dist/es5/http/http.models.js +2 -0
  144. package/dist/es5/http/http.models.js.map +1 -0
  145. package/dist/es5/http/http.service.d.ts +19 -0
  146. package/dist/es5/http/http.service.js +72 -0
  147. package/dist/es5/http/http.service.js.map +1 -0
  148. package/dist/es5/http/ihttp.service.d.ts +9 -0
  149. package/dist/es5/http/ihttp.service.js +2 -0
  150. package/dist/es5/http/ihttp.service.js.map +1 -0
  151. package/dist/es5/http/index.d.ts +6 -0
  152. package/dist/es5/http/index.js +7 -0
  153. package/dist/es5/http/index.js.map +1 -0
  154. package/dist/es5/http/test-http.service.d.ts +17 -0
  155. package/dist/es5/http/test-http.service.js +44 -0
  156. package/dist/es5/http/test-http.service.js.map +1 -0
  157. package/dist/es5/index.d.ts +3 -0
  158. package/dist/es5/index.js +5 -0
  159. package/dist/es5/index.js.map +1 -0
  160. package/dist/es5/models/index.d.ts +3 -0
  161. package/dist/es5/models/index.js +4 -0
  162. package/dist/es5/models/index.js.map +1 -0
  163. package/dist/es5/models/isdk-info.d.ts +14 -0
  164. package/dist/es5/models/isdk-info.js +2 -0
  165. package/dist/es5/models/isdk-info.js.map +1 -0
  166. package/dist/es5/models/parameters.d.ts +16 -0
  167. package/dist/es5/models/parameters.js +27 -0
  168. package/dist/es5/models/parameters.js.map +1 -0
  169. package/dist/es5/models/url.models.d.ts +3 -0
  170. package/dist/es5/models/url.models.js +2 -0
  171. package/dist/es5/models/url.models.js.map +1 -0
  172. package/dist/es5/sdk-info.generated.d.ts +2 -0
  173. package/dist/es5/sdk-info.generated.js +6 -0
  174. package/dist/es5/sdk-info.generated.js.map +1 -0
  175. package/dist/umd/kontent-core.umd.js +3476 -0
  176. package/dist/umd/kontent-core.umd.js.map +1 -0
  177. package/dist/umd/kontent-core.umd.min.js +2 -0
  178. package/dist/umd/kontent-core.umd.min.js.map +1 -0
  179. package/dist/umd/report.json +1 -0
  180. package/dist/umd/report.min.json +1 -0
  181. package/dist/umd/stats.json +11920 -0
  182. package/dist/umd/stats.min.json +13789 -0
  183. package/lib/helpers/enum.helper.ts +63 -0
  184. package/lib/helpers/header.helper.ts +23 -0
  185. package/lib/helpers/headers-helper.ts +15 -0
  186. package/lib/helpers/index.ts +5 -0
  187. package/lib/helpers/retry-helper.ts +204 -0
  188. package/lib/helpers/url.helper.ts +26 -0
  189. package/lib/http/http.debugger.ts +21 -0
  190. package/lib/http/http.functions.ts +312 -0
  191. package/lib/http/http.models.ts +83 -0
  192. package/lib/http/http.service.ts +91 -0
  193. package/lib/http/ihttp.service.ts +20 -0
  194. package/lib/http/index.ts +6 -0
  195. package/lib/http/test-http.service.ts +70 -0
  196. package/lib/index.ts +4 -0
  197. package/lib/models/index.ts +3 -0
  198. package/lib/models/isdk-info.ts +15 -0
  199. package/lib/models/parameters.ts +25 -0
  200. package/lib/models/url.models.ts +3 -0
  201. package/lib/sdk-info.generated.ts +7 -0
  202. package/package.json +87 -0
@@ -0,0 +1,83 @@
1
+ import { ResponseType } from 'axios';
2
+
3
+ export interface IResponseRetryStrategyResult {
4
+ options: IRetryStrategyOptions;
5
+ retryAttempts: number;
6
+ }
7
+
8
+ export interface IResponse<TRawData> {
9
+ data: TRawData;
10
+ headers: IHeader[];
11
+ rawResponse: any;
12
+ status: number;
13
+ retryStrategy: IResponseRetryStrategyResult;
14
+ }
15
+
16
+ export interface IRetryStrategyOptions {
17
+ /**
18
+ * back-off interval between retries
19
+ */
20
+ deltaBackoffMs?: number;
21
+ /**
22
+ * Maximum allowed number of attempts
23
+ */
24
+ maxAttempts?: number;
25
+ /**
26
+ * Indicates if jitter is added to retry
27
+ */
28
+ addJitter?: boolean;
29
+ /**
30
+ * Determines if error can be retried. There are errors that are never retried
31
+ * such as when request is cancelled or the response status is 404 and so on...
32
+ */
33
+ canRetryError?: (error: any) => boolean;
34
+ }
35
+
36
+ export interface IHttpQueryCall {
37
+ url: string;
38
+ }
39
+
40
+ export interface IHttpPostQueryCall extends IHttpQueryCall {
41
+ body: any;
42
+ }
43
+
44
+ export interface IHttpPutQueryCall extends IHttpQueryCall {
45
+ body: any;
46
+ }
47
+
48
+ export interface IHttpPatchQueryCall extends IHttpQueryCall {
49
+ body: any;
50
+ }
51
+
52
+ export interface IHttpDeleteQueryCall extends IHttpQueryCall {}
53
+
54
+ export interface IHttpGetQueryCall extends IHttpQueryCall {}
55
+
56
+ export interface IHttpCancelRequestToken<TCancelToken> {
57
+ token: TCancelToken;
58
+ cancel: (cancelMessage?: string) => void;
59
+ }
60
+
61
+ export interface IHttpQueryOptions<TCancelToken> {
62
+ /**
63
+ * retry strategy
64
+ */
65
+ retryStrategy?: IRetryStrategyOptions;
66
+ /**
67
+ * Request headers
68
+ */
69
+ headers?: IHeader[];
70
+ /**
71
+ * Response type
72
+ */
73
+ responseType?: ResponseType;
74
+ /**
75
+ * Cancel token
76
+ */
77
+ cancelToken?: IHttpCancelRequestToken<TCancelToken>;
78
+ }
79
+
80
+ export interface IHeader {
81
+ header: string;
82
+ value: string;
83
+ }
@@ -0,0 +1,91 @@
1
+ import axios, { AxiosInstance, AxiosRequestConfig, CancelToken } from 'axios';
2
+
3
+ import * as HttpFunctions from './http.functions';
4
+ import { IHttpFunctionsConfig } from './http.functions';
5
+ import {
6
+ IResponse,
7
+ IHttpDeleteQueryCall,
8
+ IHttpGetQueryCall,
9
+ IHttpPatchQueryCall,
10
+ IHttpPostQueryCall,
11
+ IHttpPutQueryCall,
12
+ IHttpQueryOptions,
13
+ IHttpCancelRequestToken
14
+ } from './http.models';
15
+ import { IHttpService } from './ihttp.service';
16
+
17
+ export class HttpService implements IHttpService<CancelToken> {
18
+ private readonly axiosInstance: AxiosInstance;
19
+
20
+ private readonly functionsConfig: IHttpFunctionsConfig;
21
+
22
+ constructor(
23
+ private opts?: {
24
+ axiosRequestConfig?: AxiosRequestConfig;
25
+ logErrorsToConsole?: boolean;
26
+ }
27
+ ) {
28
+ this.axiosInstance = axios.create(opts?.axiosRequestConfig);
29
+ this.functionsConfig = this.getFunctionsConfig();
30
+ }
31
+
32
+ async getAsync<TRawData>(
33
+ call: IHttpGetQueryCall,
34
+ options?: IHttpQueryOptions<CancelToken>
35
+ ): Promise<IResponse<TRawData>> {
36
+ return await HttpFunctions.getWithRetryAsync<TRawData>(this.axiosInstance, call, this.functionsConfig, options);
37
+ }
38
+
39
+ async postAsync<TRawData>(
40
+ call: IHttpPostQueryCall,
41
+ options?: IHttpQueryOptions<CancelToken>
42
+ ): Promise<IResponse<TRawData>> {
43
+ return await HttpFunctions.postWithRetryAsync<TRawData>(
44
+ this.axiosInstance,
45
+ call,
46
+ this.functionsConfig,
47
+ options
48
+ );
49
+ }
50
+
51
+ async putAsync<TRawData>(
52
+ call: IHttpPutQueryCall,
53
+ options?: IHttpQueryOptions<CancelToken>
54
+ ): Promise<IResponse<TRawData>> {
55
+ return await HttpFunctions.putWithRetryAsync<TRawData>(this.axiosInstance, call, this.functionsConfig, options);
56
+ }
57
+
58
+ async patchAsync<TRawData>(
59
+ call: IHttpPatchQueryCall,
60
+ options?: IHttpQueryOptions<CancelToken>
61
+ ): Promise<IResponse<TRawData>> {
62
+ return await HttpFunctions.patchWithRetryAsync<TRawData>(
63
+ this.axiosInstance,
64
+ call,
65
+ this.functionsConfig,
66
+ options
67
+ );
68
+ }
69
+
70
+ async deleteAsync<TRawData>(
71
+ call: IHttpDeleteQueryCall,
72
+ options?: IHttpQueryOptions<CancelToken>
73
+ ): Promise<IResponse<TRawData>> {
74
+ return await HttpFunctions.deleteWithRetryAsync<TRawData>(
75
+ this.axiosInstance,
76
+ call,
77
+ this.functionsConfig,
78
+ options
79
+ );
80
+ }
81
+
82
+ createCancelToken(): IHttpCancelRequestToken<CancelToken> {
83
+ return HttpFunctions.createCancelToken();
84
+ }
85
+
86
+ private getFunctionsConfig(): IHttpFunctionsConfig {
87
+ return {
88
+ logErrorsToConsole: this.opts?.logErrorsToConsole ?? true
89
+ };
90
+ }
91
+ }
@@ -0,0 +1,20 @@
1
+ import {
2
+ IResponse,
3
+ IHttpDeleteQueryCall,
4
+ IHttpGetQueryCall,
5
+ IHttpPostQueryCall,
6
+ IHttpPutQueryCall,
7
+ IHttpQueryOptions,
8
+ IHttpPatchQueryCall,
9
+ IHttpCancelRequestToken,
10
+ } from './http.models';
11
+
12
+ export interface IHttpService<TCancelToken> {
13
+ getAsync<TRawData>(call: IHttpGetQueryCall, options?: IHttpQueryOptions<TCancelToken>): Promise<IResponse<TRawData>>;
14
+ postAsync<TRawData>(call: IHttpPostQueryCall, options?: IHttpQueryOptions<TCancelToken>): Promise<IResponse<TRawData>>;
15
+ putAsync<TRawData>(call: IHttpPutQueryCall, options?: IHttpQueryOptions<TCancelToken>): Promise<IResponse<TRawData>>;
16
+ patchAsync<TRawData>(call: IHttpPatchQueryCall, options?: IHttpQueryOptions<TCancelToken>): Promise<IResponse<TRawData>>;
17
+ deleteAsync<TRawData>(call: IHttpDeleteQueryCall, options?: IHttpQueryOptions<TCancelToken>): Promise<IResponse<TRawData>>;
18
+
19
+ createCancelToken(): IHttpCancelRequestToken<TCancelToken>;
20
+ }
@@ -0,0 +1,6 @@
1
+ export * from './ihttp.service';
2
+ export * from './http.service';
3
+ export * from './http.models';
4
+ export * from './http.functions';
5
+ export * from './http.debugger';
6
+ export * from './test-http.service';
@@ -0,0 +1,70 @@
1
+ import {
2
+ IResponse,
3
+ IHttpDeleteQueryCall,
4
+ IHttpGetQueryCall,
5
+ IHttpPatchQueryCall,
6
+ IHttpPostQueryCall,
7
+ IHttpPutQueryCall,
8
+ IHttpQueryOptions,
9
+ IHttpCancelRequestToken
10
+ } from './http.models';
11
+ import { IHttpService } from './ihttp.service';
12
+
13
+ export class TestHttpService implements IHttpService<undefined> {
14
+ public response?: IResponse<any> = undefined;
15
+ public error?: any = undefined;
16
+
17
+ constructor(config: { response?: IResponse<any>; error?: any }) {
18
+ Object.assign(this, config);
19
+ }
20
+
21
+ getAsync<TRawData>(call: IHttpGetQueryCall, options?: IHttpQueryOptions<undefined>): Promise<IResponse<TRawData>> {
22
+ return this.resolveTestCall();
23
+ }
24
+
25
+ postAsync<TRawData>(
26
+ call: IHttpPostQueryCall,
27
+ options?: IHttpQueryOptions<undefined>
28
+ ): Promise<IResponse<TRawData>> {
29
+ return this.resolveTestCall();
30
+ }
31
+
32
+ putAsync<TRawData>(call: IHttpPutQueryCall, options?: IHttpQueryOptions<undefined>): Promise<IResponse<TRawData>> {
33
+ return this.resolveTestCall();
34
+ }
35
+
36
+ patchAsync<TRawData>(
37
+ call: IHttpPatchQueryCall,
38
+ options?: IHttpQueryOptions<undefined>
39
+ ): Promise<IResponse<TRawData>> {
40
+ return this.resolveTestCall();
41
+ }
42
+
43
+ deleteAsync<TRawData>(
44
+ call: IHttpDeleteQueryCall,
45
+ options?: IHttpQueryOptions<undefined>
46
+ ): Promise<IResponse<TRawData>> {
47
+ return this.resolveTestCall();
48
+ }
49
+
50
+ createCancelToken(): IHttpCancelRequestToken<undefined> {
51
+ return {
52
+ cancel: () => {},
53
+ token: undefined
54
+ };
55
+ }
56
+
57
+ private resolveTestCall(): Promise<IResponse<any>> {
58
+ const promise = new Promise<IResponse<any>>((resolve, reject) => {
59
+ if (this.response) {
60
+ resolve(this.response);
61
+ }
62
+ if (this.error) {
63
+ reject(this.error);
64
+ }
65
+
66
+ throw Error(`Missing test data`);
67
+ });
68
+ return promise;
69
+ }
70
+ }
package/lib/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ /* Public API */
2
+ export * from './helpers';
3
+ export * from './models';
4
+ export * from './http';
@@ -0,0 +1,3 @@
1
+ export * from './url.models';
2
+ export * from './isdk-info';
3
+ export * from './parameters';
@@ -0,0 +1,15 @@
1
+ export interface ISDKInfo {
2
+
3
+ /**
4
+ * Name of SDK
5
+ */
6
+ name: string;
7
+ /**
8
+ * Version SDK
9
+ */
10
+ version: string;
11
+ /**
12
+ * Host of SDK
13
+ */
14
+ host: string;
15
+ }
@@ -0,0 +1,25 @@
1
+ import { IQueryParameter } from './url.models';
2
+
3
+ export namespace Parameters {
4
+ export class CustomParameter implements IQueryParameter {
5
+ /**
6
+ * Custom parameter
7
+ * @constructor
8
+ * @param {string} name - Name of the parameter
9
+ * @param {string} value - Value of the parameter
10
+ */
11
+ constructor(public name: string, public value: string) {
12
+ if (!name) {
13
+ throw Error(`Name of the custom parameter is not specified`);
14
+ }
15
+ }
16
+
17
+ public getParam(): string {
18
+ return this.name;
19
+ }
20
+
21
+ public getParamValue(): string {
22
+ return this.value;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ export interface IQueryParameter {
2
+ getParam(): string;
3
+ }
@@ -0,0 +1,7 @@
1
+
2
+ import { ISDKInfo } from '.';
3
+ export const sdkInfo: ISDKInfo = {
4
+ host: 'npmjs.com',
5
+ version: '10.0.0-0',
6
+ name: '@kontent-ai/core-sdk'
7
+ };
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@kontent-ai/core-sdk",
3
+ "version": "10.0.0-0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/kontent-ai/kontent-core-js"
7
+ },
8
+ "private": false,
9
+ "author": "richard sustek",
10
+ "license": "MIT",
11
+ "description": "Core package with shared / common functionality for Kontent.ai SDKs",
12
+ "keywords": [
13
+ "Kontent.ai",
14
+ "Kontent AI",
15
+ "Kontent SDK Core"
16
+ ],
17
+ "engines": {
18
+ "node": ">= 8"
19
+ },
20
+ "main": "./dist/cjs/index.js",
21
+ "module": "./dist/es5/index.js",
22
+ "es2015": "./dist/es2015/index.js",
23
+ "types": "./dist/cjs/index.d.ts",
24
+ "standard-version": {
25
+ "scripts": {
26
+ "postchangelog": "npm run set-sdk-version"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "release": "standard-version",
31
+ "release:major": "npm run ts-lint:check && standard-version --release-as major",
32
+ "release:major:beta": "npm run ts-lint:check && standard-version --prerelease --release-as major",
33
+ "release:beta": "standard-version --prerelease",
34
+ "ts-lint:fix": "tslint --project ./tsconfig.json --fix",
35
+ "ts-lint:check": "tslint --project ./tsconfig.json",
36
+ "test:node": "npm run build:cjs && mocha -- \"test/node/**/*.js\" --timeout 15000",
37
+ "test:browser": "karma start karma.conf.js",
38
+ "test:dev": "karma start karma-dev.conf.js",
39
+ "test:ci": "karma start karma-ci.conf.js",
40
+ "test:all": "npm run test:node && npm run test:ci",
41
+ "new-patch": "npm version patch && npm run set-sdk-version && npm run check-version",
42
+ "new-minor": "npm version minor && npm run set-sdk-version && npm run check-version",
43
+ "new-major": "npm version major && npm run set-sdk-version && npm run check-version",
44
+ "prepublishOnly": "npm run ts-lint:check && npm run check-version && npm run build:all && npm run test:all",
45
+ "webpack:dev": "webpack --mode development --config webpack.config.js --progress",
46
+ "webpack:prod": "webpack --mode production --config webpack.config.js --progress",
47
+ "set-sdk-version": "node ./misc/set-sdk-version.js",
48
+ "check-version": "ts-node ./misc/verify-sdk-version.ts",
49
+ "publish:beta": "npm publish --tag=next",
50
+ "build:umd": "npm run webpack:dev && npm run webpack:prod",
51
+ "build:es2015": "tsc --p tsconfig.es2015.json",
52
+ "build:es5": "tsc --p tsconfig.es5.json",
53
+ "build:cjs": "tsc --p tsconfig.cjs.json",
54
+ "build:all": "npm run build:umd && npm run build:cjs && npm run build:es5 && npm run build:es2015",
55
+ "bundle-stats:min": "npm run build:umd && webpack-bundle-analyzer dist/_bundles/stats.min.json",
56
+ "bundle-stats": "npm run build:umd && webpack-bundle-analyzer dist/_bundles/stats.json"
57
+ },
58
+ "dependencies": {
59
+ "axios": "0.27.2"
60
+ },
61
+ "devDependencies": {
62
+ "@types/jasmine": "4.0.3",
63
+ "@types/node": "18.0.3",
64
+ "colors": "1.4.0",
65
+ "core-js": "3.23.4",
66
+ "jasmine-core": "4.2.0",
67
+ "jasmine-spec-reporter": "7.0.0",
68
+ "karma": "6.4.0",
69
+ "karma-chrome-launcher": "3.1.1",
70
+ "karma-cli": "2.0.0",
71
+ "karma-jasmine": "5.1.0",
72
+ "karma-jasmine-html-reporter": "2.0.0",
73
+ "karma-sourcemap-loader": "0.3.8",
74
+ "karma-typescript": "5.5.3",
75
+ "karma-typescript-es6-transform": "5.5.3",
76
+ "karma-webpack": "5.0.0",
77
+ "mocha": "10.0.0",
78
+ "standard-version": "9.5.0",
79
+ "ts-loader": "9.3.1",
80
+ "ts-node": "10.8.2",
81
+ "tslint": "6.1.3",
82
+ "typescript": "4.7.4",
83
+ "webpack": "5.73.0",
84
+ "webpack-bundle-analyzer": "4.5.0",
85
+ "webpack-cli": "4.10.0"
86
+ }
87
+ }