@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,183 +1,183 @@
1
- import { Contracts } from '../../contracts';
2
- import { IDeliveryClientConfig } from '../../config';
3
- import {
4
- Filters,
5
- IContentItem,
6
- IItemQueryConfig,
7
- IDeliveryNetworkResponse,
8
- Responses,
9
- Parameters,
10
- ClientTypes
11
- } from '../../models';
12
- import { QueryService } from '../../services';
13
- import { BaseItemListingQuery } from '../common/base-item-listing-query.class';
14
-
15
- export class MultipleItemsQuery<
16
- TClientTypes extends ClientTypes,
17
- TContentItem extends IContentItem = IContentItem
18
- > extends BaseItemListingQuery<
19
- TClientTypes,
20
- Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
21
- Responses.IListContentItemsAllResponse<TContentItem, TClientTypes['contentItemType']>,
22
- IItemQueryConfig,
23
- Contracts.IListContentItemsContract
24
- > {
25
- protected _queryConfig: IItemQueryConfig = {};
26
-
27
- constructor(protected config: IDeliveryClientConfig, protected queryService: QueryService<TClientTypes>) {
28
- super(config, queryService);
29
- }
30
-
31
- /**
32
- * Adds information about the total number of content items matching your query.
33
- * When set to true, the pagination object returned in the API response contains
34
- * an additional total_count property.
35
- */
36
- includeTotalCountParameter(): this {
37
- this.parameters.push(new Parameters.IncludeTotalCountParameter());
38
- return this;
39
- }
40
-
41
- /**
42
- * Gets only item of given type
43
- * @param type Codename of type to get
44
- */
45
- type(type: TClientTypes['contentTypeCodenames']): this {
46
- this.parameters.push(new Filters.TypeFilter(type));
47
- return this;
48
- }
49
-
50
- /**
51
- * Gets items of given types (logical or)
52
- * I.e. get items of either 'Actor' or 'Movie' type
53
- * @param types Types to get
54
- */
55
- types(types: TClientTypes['contentTypeCodenames'][]): this {
56
- this.parameters.push(new Filters.TypeFilter(types));
57
- return this;
58
- }
59
-
60
- /**
61
- * Gets only item from given collection
62
- * @param collection Codename of collection to get
63
- */
64
- collection(collection: TClientTypes['collectionCodenames']): this {
65
- this.parameters.push(new Filters.CollectionFilter(collection));
66
- return this;
67
- }
68
-
69
- /**
70
- * Gets items from given collections (logical or)
71
- * I.e. get items of either 'default' or 'christmas-campaign' collection
72
- * @param collections Collections to get
73
- */
74
- collections(collections: TClientTypes['collectionCodenames'][]): this {
75
- this.parameters.push(new Filters.CollectionFilter(collections));
76
- return this;
77
- }
78
-
79
- /**
80
- * Indicates depth of query that affects loading of nested linked items.
81
- * @param depth Depth of the query (> 0)
82
- */
83
- depthParameter(depth: number): this {
84
- this.parameters.push(new Parameters.DepthParameter(depth));
85
- return this;
86
- }
87
-
88
- /**
89
- * Language codename
90
- * @param languageCodename Codename of the language
91
- */
92
- languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
93
- this.parameters.push(new Parameters.LanguageParameter(languageCodename));
94
- return this;
95
- }
96
-
97
- /**
98
- * Used to limit the number of elements returned by query.
99
- * @param elementCodenames Array of element codenames to fetch
100
- */
101
- elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
102
- this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
103
- return this;
104
- }
105
-
106
- /**
107
- * Used to exclude elements returned by query.
108
- * @param elementCodenames Array of element codenames to exclude
109
- */
110
- excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
111
- this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
112
- return this;
113
- }
114
-
115
- toPromise(): Promise<
116
- IDeliveryNetworkResponse<
117
- Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
118
- Contracts.IListContentItemsContract
119
- >
120
- > {
121
- return this.queryService.getMultipleItems(this.getUrl(), this._queryConfig ?? {});
122
- }
123
-
124
- getUrl(): string {
125
- const action = '/items';
126
-
127
- // handle default language
128
- this.processDefaultLanguageParameter();
129
-
130
- // handle archived items
131
- this.processExcludeArchivedItemsParameter();
132
-
133
- return super.resolveUrlInternal(action);
134
- }
135
-
136
- map(json: any): Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']> {
137
- return this.queryService.mappingService.listContentItemsResponse(json);
138
- }
139
-
140
- protected allResponseFactory(
141
- items: any[],
142
- responses: IDeliveryNetworkResponse<
143
- Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
144
- Contracts.IListContentItemsContract
145
- >[]
146
- ): Responses.IListContentItemsAllResponse<TContentItem, TClientTypes['contentItemType']> {
147
- this.linkItems(items, responses);
148
-
149
- return {
150
- items: items,
151
- responses: responses
152
- };
153
- }
154
-
155
- private linkItems(
156
- items: IContentItem[],
157
- responses: IDeliveryNetworkResponse<
158
- Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
159
- Contracts.IListContentItemsContract
160
- >[]
161
- ): void {
162
- // prepare all available items (including components) for linking
163
- const allContentItems: IContentItem[] = [];
164
-
165
- // process linked items (modular_content part of the response)
166
- for (const response of responses) {
167
- allContentItems.push(
168
- ...Object.values(response.data.linkedItems)
169
- .filter((m) => m !== undefined)
170
- .map((m) => m as TClientTypes['contentItemType'])
171
- );
172
- }
173
-
174
- // add standard items
175
- for (const item of items) {
176
- if (!allContentItems.find((m) => m.system.codename.toLowerCase() === item.system.codename.toLowerCase())) {
177
- allContentItems.push(item);
178
- }
179
- }
180
- // process main items
181
- this.linkItemsInRte(allContentItems);
182
- }
183
- }
1
+ import { Contracts } from '../../contracts';
2
+ import { IDeliveryClientConfig } from '../../config';
3
+ import {
4
+ Filters,
5
+ IContentItem,
6
+ IItemQueryConfig,
7
+ IDeliveryNetworkResponse,
8
+ Responses,
9
+ Parameters,
10
+ ClientTypes
11
+ } from '../../models';
12
+ import { QueryService } from '../../services';
13
+ import { BaseItemListingQuery } from '../common/base-item-listing-query.class';
14
+
15
+ export class MultipleItemsQuery<
16
+ TClientTypes extends ClientTypes,
17
+ TContentItem extends IContentItem = IContentItem
18
+ > extends BaseItemListingQuery<
19
+ TClientTypes,
20
+ Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
21
+ Responses.IListContentItemsAllResponse<TContentItem, TClientTypes['contentItemType']>,
22
+ IItemQueryConfig,
23
+ Contracts.IListContentItemsContract
24
+ > {
25
+ protected _queryConfig: IItemQueryConfig = {};
26
+
27
+ constructor(protected config: IDeliveryClientConfig, protected queryService: QueryService<TClientTypes>) {
28
+ super(config, queryService);
29
+ }
30
+
31
+ /**
32
+ * Adds information about the total number of content items matching your query.
33
+ * When set to true, the pagination object returned in the API response contains
34
+ * an additional total_count property.
35
+ */
36
+ includeTotalCountParameter(): this {
37
+ this.parameters.push(new Parameters.IncludeTotalCountParameter());
38
+ return this;
39
+ }
40
+
41
+ /**
42
+ * Gets only item of given type
43
+ * @param type Codename of type to get
44
+ */
45
+ type(type: TClientTypes['contentTypeCodenames']): this {
46
+ this.parameters.push(new Filters.TypeFilter(type));
47
+ return this;
48
+ }
49
+
50
+ /**
51
+ * Gets items of given types (logical or)
52
+ * I.e. get items of either 'Actor' or 'Movie' type
53
+ * @param types Types to get
54
+ */
55
+ types(types: TClientTypes['contentTypeCodenames'][]): this {
56
+ this.parameters.push(new Filters.TypeFilter(types));
57
+ return this;
58
+ }
59
+
60
+ /**
61
+ * Gets only item from given collection
62
+ * @param collection Codename of collection to get
63
+ */
64
+ collection(collection: TClientTypes['collectionCodenames']): this {
65
+ this.parameters.push(new Filters.CollectionFilter(collection));
66
+ return this;
67
+ }
68
+
69
+ /**
70
+ * Gets items from given collections (logical or)
71
+ * I.e. get items of either 'default' or 'christmas-campaign' collection
72
+ * @param collections Collections to get
73
+ */
74
+ collections(collections: TClientTypes['collectionCodenames'][]): this {
75
+ this.parameters.push(new Filters.CollectionFilter(collections));
76
+ return this;
77
+ }
78
+
79
+ /**
80
+ * Indicates depth of query that affects loading of nested linked items.
81
+ * @param depth Depth of the query (> 0)
82
+ */
83
+ depthParameter(depth: number): this {
84
+ this.parameters.push(new Parameters.DepthParameter(depth));
85
+ return this;
86
+ }
87
+
88
+ /**
89
+ * Language codename
90
+ * @param languageCodename Codename of the language
91
+ */
92
+ languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
93
+ this.parameters.push(new Parameters.LanguageParameter(languageCodename));
94
+ return this;
95
+ }
96
+
97
+ /**
98
+ * Used to limit the number of elements returned by query.
99
+ * @param elementCodenames Array of element codenames to fetch
100
+ */
101
+ elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
102
+ this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
103
+ return this;
104
+ }
105
+
106
+ /**
107
+ * Used to exclude elements returned by query.
108
+ * @param elementCodenames Array of element codenames to exclude
109
+ */
110
+ excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
111
+ this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
112
+ return this;
113
+ }
114
+
115
+ toPromise(): Promise<
116
+ IDeliveryNetworkResponse<
117
+ Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
118
+ Contracts.IListContentItemsContract
119
+ >
120
+ > {
121
+ return this.queryService.getMultipleItems(this.getUrl(), this._queryConfig ?? {});
122
+ }
123
+
124
+ getUrl(): string {
125
+ const action = '/items';
126
+
127
+ // handle default language
128
+ this.processDefaultLanguageParameter();
129
+
130
+ // handle archived items
131
+ this.processExcludeArchivedItemsParameter();
132
+
133
+ return super.resolveUrlInternal(action);
134
+ }
135
+
136
+ map(json: any): Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']> {
137
+ return this.queryService.mappingService.listContentItemsResponse(json);
138
+ }
139
+
140
+ protected allResponseFactory(
141
+ items: any[],
142
+ responses: IDeliveryNetworkResponse<
143
+ Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
144
+ Contracts.IListContentItemsContract
145
+ >[]
146
+ ): Responses.IListContentItemsAllResponse<TContentItem, TClientTypes['contentItemType']> {
147
+ this.linkItems(items, responses);
148
+
149
+ return {
150
+ items: items,
151
+ responses: responses
152
+ };
153
+ }
154
+
155
+ private linkItems(
156
+ items: IContentItem[],
157
+ responses: IDeliveryNetworkResponse<
158
+ Responses.IListContentItemsResponse<TContentItem, TClientTypes['contentItemType']>,
159
+ Contracts.IListContentItemsContract
160
+ >[]
161
+ ): void {
162
+ // prepare all available items (including components) for linking
163
+ const allContentItems: IContentItem[] = [];
164
+
165
+ // process linked items (modular_content part of the response)
166
+ for (const response of responses) {
167
+ allContentItems.push(
168
+ ...Object.values(response.data.linkedItems)
169
+ .filter((m) => m !== undefined)
170
+ .map((m) => m as TClientTypes['contentItemType'])
171
+ );
172
+ }
173
+
174
+ // add standard items
175
+ for (const item of items) {
176
+ if (!allContentItems.find((m) => m.system.codename.toLowerCase() === item.system.codename.toLowerCase())) {
177
+ allContentItems.push(item);
178
+ }
179
+ }
180
+ // process main items
181
+ this.linkItemsInRte(allContentItems);
182
+ }
183
+ }
@@ -1,106 +1,106 @@
1
- import { Contracts } from '../../contracts';
2
- import { IDeliveryClientConfig } from '../../config';
3
- import {
4
- IContentItem,
5
- IItemQueryConfig,
6
- IDeliveryNetworkResponse,
7
- Responses,
8
- Parameters,
9
- ClientTypes
10
- } from '../../models';
11
- import { QueryService } from '../../services';
12
- import { BaseQuery } from '../common/base-query.class';
13
-
14
- export class SingleItemQuery<
15
- TClientTypes extends ClientTypes,
16
- TContentItem extends IContentItem = IContentItem
17
- > extends BaseQuery<
18
- TClientTypes,
19
- Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']>,
20
- IItemQueryConfig,
21
- Contracts.IViewContentItemContract
22
- > {
23
- protected _queryConfig: IItemQueryConfig = {};
24
-
25
- constructor(
26
- protected config: IDeliveryClientConfig,
27
- protected queryService: QueryService<TClientTypes>,
28
- private codename: string
29
- ) {
30
- super(config, queryService);
31
-
32
- if (!codename) {
33
- throw Error(`'codename' has to be configured for 'SingleItemQuery' query`);
34
- }
35
- }
36
-
37
- /**
38
- * Indicates depth of query that affects loading of nested linked items.
39
- * @param depth Depth of the query (> 0)
40
- */
41
- depthParameter(depth: number): this {
42
- this.parameters.push(new Parameters.DepthParameter(depth));
43
- return this;
44
- }
45
-
46
- /**
47
- * Used to configure query
48
- * @param queryConfig Query configuration
49
- */
50
- queryConfig(queryConfig: IItemQueryConfig): this {
51
- this._queryConfig = queryConfig;
52
- return this;
53
- }
54
-
55
- /**
56
- * Language codename
57
- * @param languageCodename Codename of the language
58
- */
59
- languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
60
- this.parameters.push(new Parameters.LanguageParameter(languageCodename));
61
- return this;
62
- }
63
-
64
- /**
65
- * Used to limit the number of elements returned by query.
66
- * @param elementCodenames Array of element codenames to fetch
67
- */
68
- elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
69
- this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
70
- return this;
71
- }
72
-
73
- /**
74
- * Used to exclude elements returned by query.
75
- * @param elementCodenames Array of element codenames to exclude
76
- */
77
- excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
78
- this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
79
- return this;
80
- }
81
-
82
- toPromise(): Promise<
83
- IDeliveryNetworkResponse<
84
- Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']>,
85
- Contracts.IViewContentItemContract
86
- >
87
- > {
88
- return this.queryService.getSingleItemAsync(this.getUrl(), this._queryConfig ?? {});
89
- }
90
-
91
- getUrl(): string {
92
- const action = '/items/' + this.codename;
93
-
94
- // add default language is necessry
95
- this.processDefaultLanguageParameter();
96
-
97
- //process client level archived item exclusion
98
- this.processExcludeArchivedItemsParameter();
99
-
100
- return super.resolveUrlInternal(action);
101
- }
102
-
103
- map(json: any): Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']> {
104
- return this.queryService.mappingService.viewContentItemResponse(json);
105
- }
106
- }
1
+ import { Contracts } from '../../contracts';
2
+ import { IDeliveryClientConfig } from '../../config';
3
+ import {
4
+ IContentItem,
5
+ IItemQueryConfig,
6
+ IDeliveryNetworkResponse,
7
+ Responses,
8
+ Parameters,
9
+ ClientTypes
10
+ } from '../../models';
11
+ import { QueryService } from '../../services';
12
+ import { BaseQuery } from '../common/base-query.class';
13
+
14
+ export class SingleItemQuery<
15
+ TClientTypes extends ClientTypes,
16
+ TContentItem extends IContentItem = IContentItem
17
+ > extends BaseQuery<
18
+ TClientTypes,
19
+ Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']>,
20
+ IItemQueryConfig,
21
+ Contracts.IViewContentItemContract
22
+ > {
23
+ protected _queryConfig: IItemQueryConfig = {};
24
+
25
+ constructor(
26
+ protected config: IDeliveryClientConfig,
27
+ protected queryService: QueryService<TClientTypes>,
28
+ private codename: string
29
+ ) {
30
+ super(config, queryService);
31
+
32
+ if (!codename) {
33
+ throw Error(`'codename' has to be configured for 'SingleItemQuery' query`);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Indicates depth of query that affects loading of nested linked items.
39
+ * @param depth Depth of the query (> 0)
40
+ */
41
+ depthParameter(depth: number): this {
42
+ this.parameters.push(new Parameters.DepthParameter(depth));
43
+ return this;
44
+ }
45
+
46
+ /**
47
+ * Used to configure query
48
+ * @param queryConfig Query configuration
49
+ */
50
+ queryConfig(queryConfig: IItemQueryConfig): this {
51
+ this._queryConfig = queryConfig;
52
+ return this;
53
+ }
54
+
55
+ /**
56
+ * Language codename
57
+ * @param languageCodename Codename of the language
58
+ */
59
+ languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
60
+ this.parameters.push(new Parameters.LanguageParameter(languageCodename));
61
+ return this;
62
+ }
63
+
64
+ /**
65
+ * Used to limit the number of elements returned by query.
66
+ * @param elementCodenames Array of element codenames to fetch
67
+ */
68
+ elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
69
+ this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
70
+ return this;
71
+ }
72
+
73
+ /**
74
+ * Used to exclude elements returned by query.
75
+ * @param elementCodenames Array of element codenames to exclude
76
+ */
77
+ excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
78
+ this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
79
+ return this;
80
+ }
81
+
82
+ toPromise(): Promise<
83
+ IDeliveryNetworkResponse<
84
+ Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']>,
85
+ Contracts.IViewContentItemContract
86
+ >
87
+ > {
88
+ return this.queryService.getSingleItemAsync(this.getUrl(), this._queryConfig ?? {});
89
+ }
90
+
91
+ getUrl(): string {
92
+ const action = '/items/' + this.codename;
93
+
94
+ // add default language is necessry
95
+ this.processDefaultLanguageParameter();
96
+
97
+ //process client level archived item exclusion
98
+ this.processExcludeArchivedItemsParameter();
99
+
100
+ return super.resolveUrlInternal(action);
101
+ }
102
+
103
+ map(json: any): Responses.IViewContentItemResponse<TContentItem, TClientTypes['contentItemType']> {
104
+ return this.queryService.mappingService.viewContentItemResponse(json);
105
+ }
106
+ }