@kontent-ai/delivery-sdk 16.4.2 → 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 +5770 -4807
  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 +10038 -7042
  10. package/dist/bundles/stats.min.json +14400 -10652
  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,189 +1,189 @@
1
- import { IQueryParameter } from '@kontent-ai/core-sdk';
2
-
3
- import { SortOrder } from './sort-order';
4
-
5
- export namespace Parameters {
6
- const defaultValue: string = '';
7
-
8
- export class QueryParameter implements IQueryParameter {
9
- /**
10
- * Parameter
11
- * @constructor
12
- * @param {string} name - Name of the parameter
13
- * @param {string} value - Value of the parameter
14
- */
15
- constructor(public name: string, public value: string) {
16
- if (!name) {
17
- throw Error(`Name of the parameter is not specified`);
18
- }
19
- }
20
-
21
- getParam(): string {
22
- return `${this.name}=${this.value}`;
23
- }
24
- }
25
-
26
- export class ElementsParameter implements IQueryParameter {
27
- /**
28
- * Sets elements (projection) so that only certain elements from a content item are returned
29
- * @constructor
30
- * @param {string[]} elementCodenames - Array of element codenames to include in response.
31
- */
32
- constructor(public elementCodenames: string[]) {}
33
-
34
- getParam(): string {
35
- return `elements=${this.getParamValue()}`;
36
- }
37
-
38
- private getParamValue(): string | undefined {
39
- if (!this.elementCodenames) {
40
- return defaultValue;
41
- }
42
-
43
- return this.elementCodenames
44
- .map((m) => {
45
- if (!m) {
46
- throw Error(`Codename of 'ElementsParameter' cannot be null or empty`);
47
- }
48
- return m.trim();
49
- })
50
- .join(',');
51
- }
52
- }
53
-
54
- export class ExcludeElementsParameter implements IQueryParameter {
55
- /**
56
- * Sets elements (projection) so that only certain elements are excluded from API response
57
- * @constructor
58
- * @param {string[]} elementCodenames - Array of element codenames to exclude from API response.
59
- */
60
- constructor(public elementCodenames: string[]) {}
61
-
62
- getParam(): string {
63
- return `excludeElements=${this.getParamValue()}`;
64
- }
65
-
66
- private getParamValue(): string | undefined {
67
- if (!this.elementCodenames) {
68
- return defaultValue;
69
- }
70
-
71
- return this.elementCodenames
72
- .map((m) => {
73
- if (!m) {
74
- throw Error(`Codename of 'ExcludeElementsParameter' cannot be null or empty`);
75
- }
76
- return m.trim();
77
- })
78
- .join(',');
79
- }
80
- }
81
-
82
- export class LimitParameter implements IQueryParameter {
83
- /**
84
- * Limits the number of items that are returned from response
85
- * @constructor
86
- * @param {number} limit - Number of elements that will be returned
87
- */
88
- constructor(public limit: number) {
89
- if (limit <= 0) {
90
- throw Error(`'LimitParameter' must specify a positive integer`);
91
- }
92
- }
93
-
94
- getParam(): string {
95
- return `limit=${this.limit}`;
96
- }
97
- }
98
-
99
- export class IncludeTotalCountParameter implements IQueryParameter {
100
- /**
101
- * Adds 'includeTotalCount' query parameter to query
102
- * @constructor
103
- */
104
- constructor() {}
105
-
106
- getParam(): string {
107
- return `includeTotalCount=true`;
108
- }
109
- }
110
-
111
- export class SkipParameter implements IQueryParameter {
112
- /**
113
- * Configures response to skip certain number of items
114
- * @constructor
115
- * @param {number} skip - Number of content items that will be skipped
116
- */
117
- constructor(public skip: number) {
118
- if (skip < 0) {
119
- throw Error(`'SkipParameter' must specify a positive integer number or zero."`);
120
- }
121
- }
122
-
123
- getParam(): string {
124
- return `skip=${this.skip}`;
125
- }
126
- }
127
-
128
- export class OrderParameter implements IQueryParameter {
129
- /**
130
- * Sorts the response based on given element.
131
- * @constructor
132
- * @param {string} element - Element that will be used for sorting (can be both elements.<elementname> or system.<elementname>)
133
- * @param {SortOrder} sortOrder - Order type (desc/asc). Defaults to 'asc' if SortOrder is null or invalid.
134
- */
135
- constructor(public element: string, public sortOrder: SortOrder) {
136
- if (!element) {
137
- throw Error(`Element specified in 'OrderParameter' is null or empty`);
138
- }
139
- }
140
-
141
- getParam(): string {
142
- return `order=${this.getParamValue()}`;
143
- }
144
-
145
- private getParamValue(): string | undefined {
146
- return `${this.element.trim()}[${this.sortOrder}]`;
147
- }
148
- }
149
-
150
- export class CustomParameter implements IQueryParameter {
151
- constructor(public param: string) {}
152
-
153
- getParam(): string {
154
- return this.param;
155
- }
156
- }
157
-
158
- export class DepthParameter implements IQueryParameter {
159
- /**
160
- * Configures the depth of the response. Content items might reference another 'linked items' using the Linked items element.
161
- * Recursively, these linked items can reference another linked items.
162
- * By default, only one level of linked content is returned.
163
- * @constructor
164
- * @param {number} depth - Depth fo the response
165
- */
166
- constructor(public depth: number) {
167
- if (depth < 0) {
168
- throw Error(`'DepthParameter' must specify a positive integer or zero`);
169
- }
170
- }
171
-
172
- getParam(): string {
173
- return `depth=${this.depth}`;
174
- }
175
- }
176
-
177
- export class LanguageParameter implements IQueryParameter {
178
- /**
179
- * Specifies language version to fetch
180
- * @constructor
181
- * @param {string} languageCodename - Codename of the language
182
- */
183
- constructor(public languageCodename: string) {}
184
-
185
- getParam(): string {
186
- return `language=${this.languageCodename}`;
187
- }
188
- }
189
- }
1
+ import { IQueryParameter } from '@kontent-ai/core-sdk';
2
+
3
+ import { SortOrder } from './sort-order';
4
+
5
+ export namespace Parameters {
6
+ const defaultValue: string = '';
7
+
8
+ export class QueryParameter implements IQueryParameter {
9
+ /**
10
+ * Parameter
11
+ * @constructor
12
+ * @param {string} name - Name of the parameter
13
+ * @param {string} value - Value of the parameter
14
+ */
15
+ constructor(public name: string, public value: string) {
16
+ if (!name) {
17
+ throw Error(`Name of the parameter is not specified`);
18
+ }
19
+ }
20
+
21
+ getParam(): string {
22
+ return `${this.name}=${this.value}`;
23
+ }
24
+ }
25
+
26
+ export class ElementsParameter implements IQueryParameter {
27
+ /**
28
+ * Sets elements (projection) so that only certain elements from a content item are returned
29
+ * @constructor
30
+ * @param {string[]} elementCodenames - Array of element codenames to include in response.
31
+ */
32
+ constructor(public elementCodenames: string[]) {}
33
+
34
+ getParam(): string {
35
+ return `elements=${this.getParamValue()}`;
36
+ }
37
+
38
+ private getParamValue(): string | undefined {
39
+ if (!this.elementCodenames) {
40
+ return defaultValue;
41
+ }
42
+
43
+ return this.elementCodenames
44
+ .map((m) => {
45
+ if (!m) {
46
+ throw Error(`Codename of 'ElementsParameter' cannot be null or empty`);
47
+ }
48
+ return m.trim();
49
+ })
50
+ .join(',');
51
+ }
52
+ }
53
+
54
+ export class ExcludeElementsParameter implements IQueryParameter {
55
+ /**
56
+ * Sets elements (projection) so that only certain elements are excluded from API response
57
+ * @constructor
58
+ * @param {string[]} elementCodenames - Array of element codenames to exclude from API response.
59
+ */
60
+ constructor(public elementCodenames: string[]) {}
61
+
62
+ getParam(): string {
63
+ return `excludeElements=${this.getParamValue()}`;
64
+ }
65
+
66
+ private getParamValue(): string | undefined {
67
+ if (!this.elementCodenames) {
68
+ return defaultValue;
69
+ }
70
+
71
+ return this.elementCodenames
72
+ .map((m) => {
73
+ if (!m) {
74
+ throw Error(`Codename of 'ExcludeElementsParameter' cannot be null or empty`);
75
+ }
76
+ return m.trim();
77
+ })
78
+ .join(',');
79
+ }
80
+ }
81
+
82
+ export class LimitParameter implements IQueryParameter {
83
+ /**
84
+ * Limits the number of items that are returned from response
85
+ * @constructor
86
+ * @param {number} limit - Number of elements that will be returned
87
+ */
88
+ constructor(public limit: number) {
89
+ if (limit <= 0) {
90
+ throw Error(`'LimitParameter' must specify a positive integer`);
91
+ }
92
+ }
93
+
94
+ getParam(): string {
95
+ return `limit=${this.limit}`;
96
+ }
97
+ }
98
+
99
+ export class IncludeTotalCountParameter implements IQueryParameter {
100
+ /**
101
+ * Adds 'includeTotalCount' query parameter to query
102
+ * @constructor
103
+ */
104
+ constructor() {}
105
+
106
+ getParam(): string {
107
+ return `includeTotalCount=true`;
108
+ }
109
+ }
110
+
111
+ export class SkipParameter implements IQueryParameter {
112
+ /**
113
+ * Configures response to skip certain number of items
114
+ * @constructor
115
+ * @param {number} skip - Number of content items that will be skipped
116
+ */
117
+ constructor(public skip: number) {
118
+ if (skip < 0) {
119
+ throw Error(`'SkipParameter' must specify a positive integer number or zero."`);
120
+ }
121
+ }
122
+
123
+ getParam(): string {
124
+ return `skip=${this.skip}`;
125
+ }
126
+ }
127
+
128
+ export class OrderParameter implements IQueryParameter {
129
+ /**
130
+ * Sorts the response based on given element.
131
+ * @constructor
132
+ * @param {string} element - Element that will be used for sorting (can be both elements.<elementname> or system.<elementname>)
133
+ * @param {SortOrder} sortOrder - Order type (desc/asc). Defaults to 'asc' if SortOrder is null or invalid.
134
+ */
135
+ constructor(public element: string, public sortOrder: SortOrder) {
136
+ if (!element) {
137
+ throw Error(`Element specified in 'OrderParameter' is null or empty`);
138
+ }
139
+ }
140
+
141
+ getParam(): string {
142
+ return `order=${this.getParamValue()}`;
143
+ }
144
+
145
+ private getParamValue(): string | undefined {
146
+ return `${this.element.trim()}[${this.sortOrder}]`;
147
+ }
148
+ }
149
+
150
+ export class CustomParameter implements IQueryParameter {
151
+ constructor(public param: string) {}
152
+
153
+ getParam(): string {
154
+ return this.param;
155
+ }
156
+ }
157
+
158
+ export class DepthParameter implements IQueryParameter {
159
+ /**
160
+ * Configures the depth of the response. Content items might reference another 'linked items' using the Linked items element.
161
+ * Recursively, these linked items can reference another linked items.
162
+ * By default, only one level of linked content is returned.
163
+ * @constructor
164
+ * @param {number} depth - Depth fo the response
165
+ */
166
+ constructor(public depth: number) {
167
+ if (depth < 0) {
168
+ throw Error(`'DepthParameter' must specify a positive integer or zero`);
169
+ }
170
+ }
171
+
172
+ getParam(): string {
173
+ return `depth=${this.depth}`;
174
+ }
175
+ }
176
+
177
+ export class LanguageParameter implements IQueryParameter {
178
+ /**
179
+ * Specifies language version to fetch
180
+ * @constructor
181
+ * @param {string} languageCodename - Codename of the language
182
+ */
183
+ constructor(public languageCodename: string) {}
184
+
185
+ getParam(): string {
186
+ return `language=${this.languageCodename}`;
187
+ }
188
+ }
189
+ }
@@ -1 +1 @@
1
- export type SortOrder = 'asc' | 'desc';
1
+ export type SortOrder = 'asc' | 'desc';
@@ -1,42 +1,42 @@
1
- import { IQueryConfig } from './common/common-models';
2
- import { IGenericElement } from './element-models';
3
-
4
- export interface IContentTypeSystemAttributes<TContentTypeCodename extends string> {
5
- /**
6
- * Id of the type
7
- */
8
- id: string;
9
-
10
- /**
11
- * Name of the type
12
- */
13
- name: string;
14
-
15
- /**
16
- * Codename of the type
17
- */
18
- codename: TContentTypeCodename;
19
-
20
- /**
21
- * Date of last modification
22
- */
23
- lastModified: Date;
24
- }
25
-
26
- export interface IContentType<TContentTypeCodename extends string> {
27
- /**
28
- * Content type system attributes
29
- */
30
- system: IContentTypeSystemAttributes<TContentTypeCodename>;
31
-
32
- /**
33
- * Elements (elements) assigned to content type
34
- */
35
- elements: IGenericElement[];
36
- }
37
-
38
- export interface IContentTypeQueryConfig extends IQueryConfig {
39
- /**
40
- * No dedicated properties required at this moment
41
- */
42
- }
1
+ import { IQueryConfig } from './common/common-models';
2
+ import { IGenericElement } from './element-models';
3
+
4
+ export interface IContentTypeSystemAttributes<TContentTypeCodename extends string> {
5
+ /**
6
+ * Id of the type
7
+ */
8
+ id: string;
9
+
10
+ /**
11
+ * Name of the type
12
+ */
13
+ name: string;
14
+
15
+ /**
16
+ * Codename of the type
17
+ */
18
+ codename: TContentTypeCodename;
19
+
20
+ /**
21
+ * Date of last modification
22
+ */
23
+ lastModified: Date;
24
+ }
25
+
26
+ export interface IContentType<TContentTypeCodename extends string> {
27
+ /**
28
+ * Content type system attributes
29
+ */
30
+ system: IContentTypeSystemAttributes<TContentTypeCodename>;
31
+
32
+ /**
33
+ * Elements (elements) assigned to content type
34
+ */
35
+ elements: IGenericElement[];
36
+ }
37
+
38
+ export interface IContentTypeQueryConfig extends IQueryConfig {
39
+ /**
40
+ * No dedicated properties required at this moment
41
+ */
42
+ }
@@ -1,51 +1,51 @@
1
- import { IQueryConfig } from './common/common-models';
2
-
3
- export interface IElementQueryConfig extends IQueryConfig {
4
- /**
5
- * No dedicated properties required at this moment
6
- */
7
- }
8
-
9
- export interface IGenericElementOption {
10
- /**
11
- * Name of the option
12
- */
13
- name: string;
14
-
15
- /**
16
- * Value of the option
17
- */
18
- codename: string;
19
- }
20
-
21
- export interface IGenericElement {
22
- /**
23
- * Indexer
24
- */
25
- [key: string]: any;
26
-
27
- /**
28
- * Codename of the element
29
- */
30
- codename?: string;
31
-
32
- /**
33
- * Type of the element
34
- */
35
- type: string;
36
-
37
- /**
38
- * Name of the element
39
- */
40
- name: string;
41
-
42
- /**
43
- * Taxonomy group in case the element is a taxonomy
44
- */
45
- taxonomyGroup?: string;
46
-
47
- /**
48
- * Array of options if the element has some
49
- */
50
- options: IGenericElementOption[];
51
- }
1
+ import { IQueryConfig } from './common/common-models';
2
+
3
+ export interface IElementQueryConfig extends IQueryConfig {
4
+ /**
5
+ * No dedicated properties required at this moment
6
+ */
7
+ }
8
+
9
+ export interface IGenericElementOption {
10
+ /**
11
+ * Name of the option
12
+ */
13
+ name: string;
14
+
15
+ /**
16
+ * Value of the option
17
+ */
18
+ codename: string;
19
+ }
20
+
21
+ export interface IGenericElement {
22
+ /**
23
+ * Indexer
24
+ */
25
+ [key: string]: any;
26
+
27
+ /**
28
+ * Codename of the element
29
+ */
30
+ codename?: string;
31
+
32
+ /**
33
+ * Type of the element
34
+ */
35
+ type: string;
36
+
37
+ /**
38
+ * Name of the element
39
+ */
40
+ name: string;
41
+
42
+ /**
43
+ * Taxonomy group in case the element is a taxonomy
44
+ */
45
+ taxonomyGroup?: string;
46
+
47
+ /**
48
+ * Array of options if the element has some
49
+ */
50
+ options: IGenericElementOption[];
51
+ }
@@ -1,9 +1,9 @@
1
- export * from './common';
2
- export * from './element-models';
3
- export * from './item-models';
4
- export * from './taxonomy-models';
5
- export * from './content-type-models';
6
- export * from './language-models';
7
- export * from './responses';
8
- export * from './sync-models';
9
-
1
+ export * from './common';
2
+ export * from './element-models';
3
+ export * from './item-models';
4
+ export * from './taxonomy-models';
5
+ export * from './content-type-models';
6
+ export * from './language-models';
7
+ export * from './responses';
8
+ export * from './sync-models';
9
+