@kontent-ai/delivery-sdk 16.4.3 → 16.4.4

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 (83) hide show
  1. package/.npmignore +15 -15
  2. package/LICENSE.md +9 -9
  3. package/dist/bundles/kontent-delivery.umd.js +5077 -4620
  4. package/dist/bundles/kontent-delivery.umd.js.map +1 -1
  5. package/dist/bundles/kontent-delivery.umd.min.js +1 -1
  6. package/dist/bundles/kontent-delivery.umd.min.js.map +1 -1
  7. package/dist/bundles/report.json +1 -1
  8. package/dist/bundles/report.min.json +1 -1
  9. package/dist/bundles/stats.json +7195 -5946
  10. package/dist/bundles/stats.min.json +11923 -10797
  11. package/dist/cjs/sdk-info.generated.js +1 -1
  12. package/dist/es6/sdk-info.generated.js +1 -1
  13. package/dist/esnext/sdk-info.generated.js +1 -1
  14. package/lib/client/delivery-client.factory.ts +9 -9
  15. package/lib/client/delivery-client.ts +163 -163
  16. package/lib/client/idelivery-client.interface.ts +110 -110
  17. package/lib/client/index.ts +3 -3
  18. package/lib/config/delivery-configs.ts +98 -98
  19. package/lib/config/index.ts +1 -1
  20. package/lib/contracts/contracts.ts +265 -265
  21. package/lib/contracts/index.ts +1 -1
  22. package/lib/elements/element-models.ts +89 -89
  23. package/lib/elements/element-resolver.ts +3 -3
  24. package/lib/elements/element-type.ts +16 -16
  25. package/lib/elements/elements.ts +70 -70
  26. package/lib/elements/index.ts +4 -4
  27. package/lib/images/image-url-transformation-builder.factory.ts +5 -5
  28. package/lib/images/image-url-transformation-builder.ts +181 -181
  29. package/lib/images/image.models.ts +4 -4
  30. package/lib/images/index.ts +3 -3
  31. package/lib/index.ts +12 -12
  32. package/lib/mappers/element.mapper.ts +504 -504
  33. package/lib/mappers/generic-element.mapper.ts +20 -20
  34. package/lib/mappers/index.ts +8 -8
  35. package/lib/mappers/item.mapper.ts +181 -181
  36. package/lib/mappers/language.mapper.ts +24 -24
  37. package/lib/mappers/sync.mapper.ts +32 -32
  38. package/lib/mappers/taxonomy.mapper.ts +77 -77
  39. package/lib/mappers/type.mapper.ts +76 -76
  40. package/lib/mappers/used-in.mapper.ts +20 -20
  41. package/lib/models/common/base-responses.ts +13 -13
  42. package/lib/models/common/common-models.ts +118 -118
  43. package/lib/models/common/filters.ts +280 -280
  44. package/lib/models/common/headers.ts +5 -5
  45. package/lib/models/common/index.ts +7 -7
  46. package/lib/models/common/pagination.class.ts +7 -7
  47. package/lib/models/common/parameters.ts +189 -189
  48. package/lib/models/common/sort-order.ts +1 -1
  49. package/lib/models/content-type-models.ts +42 -42
  50. package/lib/models/element-models.ts +51 -51
  51. package/lib/models/index.ts +9 -9
  52. package/lib/models/item-models.ts +192 -192
  53. package/lib/models/language-models.ts +17 -17
  54. package/lib/models/responses.ts +137 -137
  55. package/lib/models/sync-models.ts +18 -18
  56. package/lib/models/taxonomy-models.ts +25 -25
  57. package/lib/query/common/base-item-listing-query.class.ts +274 -274
  58. package/lib/query/common/base-listing-query.class.ts +95 -95
  59. package/lib/query/common/base-query.class.ts +148 -148
  60. package/lib/query/element/element-query.class.ts +45 -45
  61. package/lib/query/index.ts +13 -13
  62. package/lib/query/item/multiple-items-query.class.ts +183 -183
  63. package/lib/query/item/single-item-query.class.ts +106 -106
  64. package/lib/query/items-feed/items-feed-query.class.ts +191 -191
  65. package/lib/query/language/languages-query.class.ts +91 -91
  66. package/lib/query/sync/initialize-sync-query.class.ts +83 -83
  67. package/lib/query/sync/sync-changes-query.class.ts +56 -56
  68. package/lib/query/taxonomy/taxonomies-query.class.ts +82 -82
  69. package/lib/query/taxonomy/taxonomy-query.class.ts +50 -50
  70. package/lib/query/type/multiple-type-query.class.ts +95 -95
  71. package/lib/query/type/single-type-query.class.ts +45 -45
  72. package/lib/query/used-in/used-in-query.class.ts +126 -126
  73. package/lib/sdk-info.generated.ts +1 -1
  74. package/lib/services/base-delivery-query.service.ts +375 -375
  75. package/lib/services/delivery-query.service.ts +336 -336
  76. package/lib/services/index.ts +2 -2
  77. package/lib/services/mapping.service.ts +223 -223
  78. package/lib/utilities/codename.helper.ts +10 -10
  79. package/lib/utilities/delivery-url.helper.ts +11 -11
  80. package/lib/utilities/enum.helper.ts +38 -38
  81. package/lib/utilities/index.ts +3 -3
  82. package/package.json +96 -96
  83. package/readme.md +531 -531
@@ -1,280 +1,280 @@
1
- import { IQueryParameter } from '@kontent-ai/core-sdk';
2
-
3
- export namespace Filters {
4
- const valueSeparator: string = ',';
5
- const defaultValue: string = '';
6
-
7
- const getParamValueForSystemFilter = (param: string | string[]): string | undefined => {
8
- if (!param) {
9
- return defaultValue;
10
- }
11
-
12
- if (Array.isArray(param)) {
13
- let value = '';
14
- // use [in] filter
15
- for (let i = 0; i < param.length; i++) {
16
- value = value + param[i].toString();
17
-
18
- if (i !== param.length - 1) {
19
- // append separator if its not last item
20
- value = value + valueSeparator;
21
- }
22
- }
23
-
24
- return value;
25
- }
26
-
27
- // single param was given
28
- return param.toString();
29
- };
30
-
31
- export class TypeFilter implements IQueryParameter {
32
- constructor(public type: string | string[]) {}
33
-
34
- getParam(): string {
35
- if (Array.isArray(this.type)) {
36
- // multiple types
37
- return `system.type[in]=${getParamValueForSystemFilter(this.type)}`;
38
- }
39
-
40
- // single type
41
- return `system.type=${getParamValueForSystemFilter(this.type)}`;
42
- }
43
- }
44
-
45
- export class CollectionFilter implements IQueryParameter {
46
- constructor(public collection: string | string[]) {}
47
-
48
- getParam(): string {
49
- if (Array.isArray(this.collection)) {
50
- // multiple collections
51
- return `system.collection[in]=${getParamValueForSystemFilter(this.collection)}`;
52
- }
53
-
54
- // single collection
55
- return `system.collection=${getParamValueForSystemFilter(this.collection)}`;
56
- }
57
- }
58
-
59
- export class EmptyFilter implements IQueryParameter {
60
- constructor(public element: string) {}
61
-
62
- getParam(): string {
63
- return `${this.element.trim()}[empty]`;
64
- }
65
- }
66
-
67
- export class NotEmptyFilter implements IQueryParameter {
68
- constructor(public element: string) {}
69
-
70
- getParam(): string {
71
- return `${this.element.trim()}[nempty]`;
72
- }
73
- }
74
-
75
- export class EqualsFilter implements IQueryParameter {
76
- constructor(public element: string, public value: string) {}
77
-
78
- getParam(): string {
79
- return `${this.element.trim()}[eq]=${this.getParamValue()}`;
80
- }
81
-
82
- private getParamValue(): string | undefined {
83
- if (!this.value) {
84
- return defaultValue;
85
- }
86
-
87
- return this.value;
88
- }
89
- }
90
-
91
- export class NotEqualsFilter implements IQueryParameter {
92
- constructor(public element: string, public value: string) {}
93
-
94
- getParam(): string {
95
- return `${this.element.trim()}[neq]=${this.getParamValue()}`;
96
- }
97
-
98
- private getParamValue(): string | undefined {
99
- if (!this.value) {
100
- return defaultValue;
101
- }
102
-
103
- return this.value;
104
- }
105
- }
106
-
107
- export class AllFilter implements IQueryParameter {
108
- constructor(public element: string, public values: string[]) {}
109
-
110
- getParam(): string {
111
- return `${this.element.trim()}[all]=${this.getParamValue()}`;
112
- }
113
-
114
- private getParamValue(): string | undefined {
115
- if (!this.values || !Array.isArray(this.values)) {
116
- return defaultValue;
117
- }
118
-
119
- return this.values.map((m) => m.trim()).join(',');
120
- }
121
- }
122
-
123
- export class AnyFilter implements IQueryParameter {
124
- constructor(public element: string, public values: string[]) {}
125
-
126
- getParam(): string {
127
- return `${this.element.trim()}[any]=${this.getParamValue()}`;
128
- }
129
-
130
- private getParamValue(): string | undefined {
131
- if (!this.values || !Array.isArray(this.values)) {
132
- return defaultValue;
133
- }
134
-
135
- return this.values.map((m) => m.trim()).join(',');
136
- }
137
- }
138
-
139
- export class ContainsFilter implements IQueryParameter {
140
- constructor(public element: string, public values: string[]) {}
141
-
142
- getParam(): string {
143
- return `${this.element.trim()}[contains]=${this.getParamValue()}`;
144
- }
145
-
146
- private getParamValue(): string | undefined {
147
- if (!this.values || !Array.isArray(this.values)) {
148
- return defaultValue;
149
- }
150
-
151
- return this.values.map((m) => m.trim()).join(',');
152
- }
153
- }
154
-
155
- export class GreaterThanFilter implements IQueryParameter {
156
- constructor(public element: string, public value: string | number) {}
157
-
158
- getParam(): string {
159
- return `${this.element.trim()}[gt]=${this.getParamValue()}`;
160
- }
161
-
162
- private getParamValue(): string | number | undefined {
163
- if (!this.value) {
164
- return defaultValue;
165
- }
166
-
167
- return this.value;
168
- }
169
- }
170
-
171
- export class GreaterThanOrEqualFilter implements IQueryParameter {
172
- constructor(public element: string, public value: string | number) {}
173
-
174
- getParam(): string {
175
- return `${this.element.trim()}[gte]=${this.getParamValue()}`;
176
- }
177
-
178
- getParamValue(): string | number | undefined {
179
- if (!this.value) {
180
- return defaultValue;
181
- }
182
-
183
- return this.value;
184
- }
185
- }
186
-
187
- export class InFilter implements IQueryParameter {
188
- constructor(public element: string, public values: string[]) {}
189
-
190
- getParam(): string {
191
- return `${this.element.trim()}[in]=${this.getParamValue()}`;
192
- }
193
-
194
- private getParamValue(): string | undefined {
195
- if (!this.values || !Array.isArray(this.values)) {
196
- return defaultValue;
197
- }
198
-
199
- return this.values
200
- .map((m) => {
201
- return m.trim();
202
- })
203
- .join(',');
204
- }
205
- }
206
-
207
- export class NotInFilter implements IQueryParameter {
208
- constructor(public element: string, public values: string[]) {}
209
-
210
- getParam(): string {
211
- return `${this.element.trim()}[nin]=${this.getParamValue()}`;
212
- }
213
-
214
- private getParamValue(): string | undefined {
215
- if (!this.values || !Array.isArray(this.values)) {
216
- return defaultValue;
217
- }
218
-
219
- return this.values
220
- .map((m) => {
221
- return m.trim();
222
- })
223
- .join(',');
224
- }
225
- }
226
-
227
- export class LessThanFilter implements IQueryParameter {
228
- constructor(public element: string, public value: string | number) {}
229
-
230
- getParam(): string {
231
- return `${this.element.trim()}[lt]=${this.getParamValue()}`;
232
- }
233
-
234
- private getParamValue(): string | number | undefined {
235
- if (!this.value) {
236
- return defaultValue;
237
- }
238
- return this.value;
239
- }
240
- }
241
-
242
- export class LessThanOrEqualFilter implements IQueryParameter {
243
- constructor(public element: string, public value: string | number) {}
244
-
245
- getParam(): string {
246
- return `${this.element.trim()}[lte]=${this.getParamValue()}`;
247
- }
248
-
249
- private getParamValue(): string | number | undefined {
250
- if (!this.value) {
251
- return defaultValue;
252
- }
253
-
254
- return this.value;
255
- }
256
- }
257
-
258
- export class RangeFilter implements IQueryParameter {
259
- constructor(public element: string, public lowerValue: number | string, public higherValue: number | string) {}
260
-
261
- getParam(): string {
262
- return `${this.element.trim()}[range]=${this.getParamValue()}`;
263
- }
264
-
265
- private getParamValue(): string | number | undefined {
266
- let lowerVal = defaultValue;
267
- let higherVal = defaultValue;
268
-
269
- if (this.lowerValue) {
270
- lowerVal = this.lowerValue.toString();
271
- }
272
-
273
- if (this.higherValue) {
274
- higherVal = this.higherValue.toString();
275
- }
276
-
277
- return `${lowerVal},${higherVal}`;
278
- }
279
- }
280
- }
1
+ import { IQueryParameter } from '@kontent-ai/core-sdk';
2
+
3
+ export namespace Filters {
4
+ const valueSeparator: string = ',';
5
+ const defaultValue: string = '';
6
+
7
+ const getParamValueForSystemFilter = (param: string | string[]): string | undefined => {
8
+ if (!param) {
9
+ return defaultValue;
10
+ }
11
+
12
+ if (Array.isArray(param)) {
13
+ let value = '';
14
+ // use [in] filter
15
+ for (let i = 0; i < param.length; i++) {
16
+ value = value + param[i].toString();
17
+
18
+ if (i !== param.length - 1) {
19
+ // append separator if its not last item
20
+ value = value + valueSeparator;
21
+ }
22
+ }
23
+
24
+ return value;
25
+ }
26
+
27
+ // single param was given
28
+ return param.toString();
29
+ };
30
+
31
+ export class TypeFilter implements IQueryParameter {
32
+ constructor(public type: string | string[]) {}
33
+
34
+ getParam(): string {
35
+ if (Array.isArray(this.type)) {
36
+ // multiple types
37
+ return `system.type[in]=${getParamValueForSystemFilter(this.type)}`;
38
+ }
39
+
40
+ // single type
41
+ return `system.type=${getParamValueForSystemFilter(this.type)}`;
42
+ }
43
+ }
44
+
45
+ export class CollectionFilter implements IQueryParameter {
46
+ constructor(public collection: string | string[]) {}
47
+
48
+ getParam(): string {
49
+ if (Array.isArray(this.collection)) {
50
+ // multiple collections
51
+ return `system.collection[in]=${getParamValueForSystemFilter(this.collection)}`;
52
+ }
53
+
54
+ // single collection
55
+ return `system.collection=${getParamValueForSystemFilter(this.collection)}`;
56
+ }
57
+ }
58
+
59
+ export class EmptyFilter implements IQueryParameter {
60
+ constructor(public element: string) {}
61
+
62
+ getParam(): string {
63
+ return `${this.element.trim()}[empty]`;
64
+ }
65
+ }
66
+
67
+ export class NotEmptyFilter implements IQueryParameter {
68
+ constructor(public element: string) {}
69
+
70
+ getParam(): string {
71
+ return `${this.element.trim()}[nempty]`;
72
+ }
73
+ }
74
+
75
+ export class EqualsFilter implements IQueryParameter {
76
+ constructor(public element: string, public value: string) {}
77
+
78
+ getParam(): string {
79
+ return `${this.element.trim()}[eq]=${this.getParamValue()}`;
80
+ }
81
+
82
+ private getParamValue(): string | undefined {
83
+ if (!this.value) {
84
+ return defaultValue;
85
+ }
86
+
87
+ return this.value;
88
+ }
89
+ }
90
+
91
+ export class NotEqualsFilter implements IQueryParameter {
92
+ constructor(public element: string, public value: string) {}
93
+
94
+ getParam(): string {
95
+ return `${this.element.trim()}[neq]=${this.getParamValue()}`;
96
+ }
97
+
98
+ private getParamValue(): string | undefined {
99
+ if (!this.value) {
100
+ return defaultValue;
101
+ }
102
+
103
+ return this.value;
104
+ }
105
+ }
106
+
107
+ export class AllFilter implements IQueryParameter {
108
+ constructor(public element: string, public values: string[]) {}
109
+
110
+ getParam(): string {
111
+ return `${this.element.trim()}[all]=${this.getParamValue()}`;
112
+ }
113
+
114
+ private getParamValue(): string | undefined {
115
+ if (!this.values || !Array.isArray(this.values)) {
116
+ return defaultValue;
117
+ }
118
+
119
+ return this.values.map((m) => m.trim()).join(',');
120
+ }
121
+ }
122
+
123
+ export class AnyFilter implements IQueryParameter {
124
+ constructor(public element: string, public values: string[]) {}
125
+
126
+ getParam(): string {
127
+ return `${this.element.trim()}[any]=${this.getParamValue()}`;
128
+ }
129
+
130
+ private getParamValue(): string | undefined {
131
+ if (!this.values || !Array.isArray(this.values)) {
132
+ return defaultValue;
133
+ }
134
+
135
+ return this.values.map((m) => m.trim()).join(',');
136
+ }
137
+ }
138
+
139
+ export class ContainsFilter implements IQueryParameter {
140
+ constructor(public element: string, public values: string[]) {}
141
+
142
+ getParam(): string {
143
+ return `${this.element.trim()}[contains]=${this.getParamValue()}`;
144
+ }
145
+
146
+ private getParamValue(): string | undefined {
147
+ if (!this.values || !Array.isArray(this.values)) {
148
+ return defaultValue;
149
+ }
150
+
151
+ return this.values.map((m) => m.trim()).join(',');
152
+ }
153
+ }
154
+
155
+ export class GreaterThanFilter implements IQueryParameter {
156
+ constructor(public element: string, public value: string | number) {}
157
+
158
+ getParam(): string {
159
+ return `${this.element.trim()}[gt]=${this.getParamValue()}`;
160
+ }
161
+
162
+ private getParamValue(): string | number | undefined {
163
+ if (!this.value) {
164
+ return defaultValue;
165
+ }
166
+
167
+ return this.value;
168
+ }
169
+ }
170
+
171
+ export class GreaterThanOrEqualFilter implements IQueryParameter {
172
+ constructor(public element: string, public value: string | number) {}
173
+
174
+ getParam(): string {
175
+ return `${this.element.trim()}[gte]=${this.getParamValue()}`;
176
+ }
177
+
178
+ getParamValue(): string | number | undefined {
179
+ if (!this.value) {
180
+ return defaultValue;
181
+ }
182
+
183
+ return this.value;
184
+ }
185
+ }
186
+
187
+ export class InFilter implements IQueryParameter {
188
+ constructor(public element: string, public values: string[]) {}
189
+
190
+ getParam(): string {
191
+ return `${this.element.trim()}[in]=${this.getParamValue()}`;
192
+ }
193
+
194
+ private getParamValue(): string | undefined {
195
+ if (!this.values || !Array.isArray(this.values)) {
196
+ return defaultValue;
197
+ }
198
+
199
+ return this.values
200
+ .map((m) => {
201
+ return m.trim();
202
+ })
203
+ .join(',');
204
+ }
205
+ }
206
+
207
+ export class NotInFilter implements IQueryParameter {
208
+ constructor(public element: string, public values: string[]) {}
209
+
210
+ getParam(): string {
211
+ return `${this.element.trim()}[nin]=${this.getParamValue()}`;
212
+ }
213
+
214
+ private getParamValue(): string | undefined {
215
+ if (!this.values || !Array.isArray(this.values)) {
216
+ return defaultValue;
217
+ }
218
+
219
+ return this.values
220
+ .map((m) => {
221
+ return m.trim();
222
+ })
223
+ .join(',');
224
+ }
225
+ }
226
+
227
+ export class LessThanFilter implements IQueryParameter {
228
+ constructor(public element: string, public value: string | number) {}
229
+
230
+ getParam(): string {
231
+ return `${this.element.trim()}[lt]=${this.getParamValue()}`;
232
+ }
233
+
234
+ private getParamValue(): string | number | undefined {
235
+ if (!this.value) {
236
+ return defaultValue;
237
+ }
238
+ return this.value;
239
+ }
240
+ }
241
+
242
+ export class LessThanOrEqualFilter implements IQueryParameter {
243
+ constructor(public element: string, public value: string | number) {}
244
+
245
+ getParam(): string {
246
+ return `${this.element.trim()}[lte]=${this.getParamValue()}`;
247
+ }
248
+
249
+ private getParamValue(): string | number | undefined {
250
+ if (!this.value) {
251
+ return defaultValue;
252
+ }
253
+
254
+ return this.value;
255
+ }
256
+ }
257
+
258
+ export class RangeFilter implements IQueryParameter {
259
+ constructor(public element: string, public lowerValue: number | string, public higherValue: number | string) {}
260
+
261
+ getParam(): string {
262
+ return `${this.element.trim()}[range]=${this.getParamValue()}`;
263
+ }
264
+
265
+ private getParamValue(): string | number | undefined {
266
+ let lowerVal = defaultValue;
267
+ let higherVal = defaultValue;
268
+
269
+ if (this.lowerValue) {
270
+ lowerVal = this.lowerValue.toString();
271
+ }
272
+
273
+ if (this.higherValue) {
274
+ higherVal = this.higherValue.toString();
275
+ }
276
+
277
+ return `${lowerVal},${higherVal}`;
278
+ }
279
+ }
280
+ }
@@ -1,5 +1,5 @@
1
- export const continuationTokenHeaderName: string = 'X-Continuation';
2
- export const waitForLoadingNewContentHeader: string = 'X-KC-Wait-For-Loading-New-Content';
3
- export const sdkVersionHeader: string = 'X-KC-SDKID';
4
- export const staleContentHeaderName: string = 'X-Stale-Content';
5
-
1
+ export const continuationTokenHeaderName: string = 'X-Continuation';
2
+ export const waitForLoadingNewContentHeader: string = 'X-KC-Wait-For-Loading-New-Content';
3
+ export const sdkVersionHeader: string = 'X-KC-SDKID';
4
+ export const staleContentHeaderName: string = 'X-Stale-Content';
5
+
@@ -1,7 +1,7 @@
1
- export * from './filters';
2
- export * from './pagination.class';
3
- export * from './parameters';
4
- export * from './sort-order';
5
- export * from './common-models';
6
- export * from './base-responses';
7
- export * from './headers';
1
+ export * from './filters';
2
+ export * from './pagination.class';
3
+ export * from './parameters';
4
+ export * from './sort-order';
5
+ export * from './common-models';
6
+ export * from './base-responses';
7
+ export * from './headers';
@@ -1,7 +1,7 @@
1
- export interface IPagination {
2
- skip: number;
3
- limit: number;
4
- count: number;
5
- nextPage: string;
6
- totalCount: number | null;
7
- }
1
+ export interface IPagination {
2
+ skip: number;
3
+ limit: number;
4
+ count: number;
5
+ nextPage: string;
6
+ totalCount: number | null;
7
+ }