@kontent-ai/delivery-sdk 16.4.3 → 16.4.5

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 (113) hide show
  1. package/.npmignore +15 -15
  2. package/LICENSE.md +9 -9
  3. package/dist/bundles/kontent-delivery.umd.js +5076 -4619
  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 +7015 -5766
  10. package/dist/bundles/stats.min.json +11376 -10250
  11. package/dist/cjs/query/element/element-query.class.js +1 -1
  12. package/dist/cjs/query/element/element-query.class.js.map +1 -1
  13. package/dist/cjs/query/item/single-item-query.class.js +1 -1
  14. package/dist/cjs/query/item/single-item-query.class.js.map +1 -1
  15. package/dist/cjs/query/taxonomy/taxonomy-query.class.js +1 -1
  16. package/dist/cjs/query/taxonomy/taxonomy-query.class.js.map +1 -1
  17. package/dist/cjs/query/type/single-type-query.class.js +1 -1
  18. package/dist/cjs/query/type/single-type-query.class.js.map +1 -1
  19. package/dist/cjs/query/used-in/used-in-query.class.js +1 -1
  20. package/dist/cjs/query/used-in/used-in-query.class.js.map +1 -1
  21. package/dist/cjs/sdk-info.generated.js +1 -1
  22. package/dist/es6/query/element/element-query.class.js +1 -1
  23. package/dist/es6/query/element/element-query.class.js.map +1 -1
  24. package/dist/es6/query/item/single-item-query.class.js +1 -1
  25. package/dist/es6/query/item/single-item-query.class.js.map +1 -1
  26. package/dist/es6/query/taxonomy/taxonomy-query.class.js +1 -1
  27. package/dist/es6/query/taxonomy/taxonomy-query.class.js.map +1 -1
  28. package/dist/es6/query/type/single-type-query.class.js +1 -1
  29. package/dist/es6/query/type/single-type-query.class.js.map +1 -1
  30. package/dist/es6/query/used-in/used-in-query.class.js +1 -1
  31. package/dist/es6/query/used-in/used-in-query.class.js.map +1 -1
  32. package/dist/es6/sdk-info.generated.js +1 -1
  33. package/dist/esnext/query/element/element-query.class.js +1 -1
  34. package/dist/esnext/query/element/element-query.class.js.map +1 -1
  35. package/dist/esnext/query/item/single-item-query.class.js +1 -1
  36. package/dist/esnext/query/item/single-item-query.class.js.map +1 -1
  37. package/dist/esnext/query/taxonomy/taxonomy-query.class.js +1 -1
  38. package/dist/esnext/query/taxonomy/taxonomy-query.class.js.map +1 -1
  39. package/dist/esnext/query/type/single-type-query.class.js +1 -1
  40. package/dist/esnext/query/type/single-type-query.class.js.map +1 -1
  41. package/dist/esnext/query/used-in/used-in-query.class.js +1 -1
  42. package/dist/esnext/query/used-in/used-in-query.class.js.map +1 -1
  43. package/dist/esnext/sdk-info.generated.js +1 -1
  44. package/lib/client/delivery-client.factory.ts +9 -9
  45. package/lib/client/delivery-client.ts +163 -163
  46. package/lib/client/idelivery-client.interface.ts +110 -110
  47. package/lib/client/index.ts +3 -3
  48. package/lib/config/delivery-configs.ts +98 -98
  49. package/lib/config/index.ts +1 -1
  50. package/lib/contracts/contracts.ts +265 -265
  51. package/lib/contracts/index.ts +1 -1
  52. package/lib/elements/element-models.ts +89 -89
  53. package/lib/elements/element-resolver.ts +3 -3
  54. package/lib/elements/element-type.ts +16 -16
  55. package/lib/elements/elements.ts +70 -70
  56. package/lib/elements/index.ts +4 -4
  57. package/lib/images/image-url-transformation-builder.factory.ts +5 -5
  58. package/lib/images/image-url-transformation-builder.ts +181 -181
  59. package/lib/images/image.models.ts +4 -4
  60. package/lib/images/index.ts +3 -3
  61. package/lib/index.ts +12 -12
  62. package/lib/mappers/element.mapper.ts +504 -504
  63. package/lib/mappers/generic-element.mapper.ts +20 -20
  64. package/lib/mappers/index.ts +8 -8
  65. package/lib/mappers/item.mapper.ts +181 -181
  66. package/lib/mappers/language.mapper.ts +24 -24
  67. package/lib/mappers/sync.mapper.ts +32 -32
  68. package/lib/mappers/taxonomy.mapper.ts +77 -77
  69. package/lib/mappers/type.mapper.ts +76 -76
  70. package/lib/mappers/used-in.mapper.ts +20 -20
  71. package/lib/models/common/base-responses.ts +13 -13
  72. package/lib/models/common/common-models.ts +118 -118
  73. package/lib/models/common/filters.ts +280 -280
  74. package/lib/models/common/headers.ts +5 -5
  75. package/lib/models/common/index.ts +7 -7
  76. package/lib/models/common/pagination.class.ts +7 -7
  77. package/lib/models/common/parameters.ts +189 -189
  78. package/lib/models/common/sort-order.ts +1 -1
  79. package/lib/models/content-type-models.ts +42 -42
  80. package/lib/models/element-models.ts +51 -51
  81. package/lib/models/index.ts +9 -9
  82. package/lib/models/item-models.ts +192 -192
  83. package/lib/models/language-models.ts +17 -17
  84. package/lib/models/responses.ts +137 -137
  85. package/lib/models/sync-models.ts +18 -18
  86. package/lib/models/taxonomy-models.ts +25 -25
  87. package/lib/query/common/base-item-listing-query.class.ts +274 -274
  88. package/lib/query/common/base-listing-query.class.ts +95 -95
  89. package/lib/query/common/base-query.class.ts +148 -148
  90. package/lib/query/element/element-query.class.ts +47 -45
  91. package/lib/query/index.ts +13 -13
  92. package/lib/query/item/multiple-items-query.class.ts +183 -183
  93. package/lib/query/item/single-item-query.class.ts +106 -106
  94. package/lib/query/items-feed/items-feed-query.class.ts +191 -191
  95. package/lib/query/language/languages-query.class.ts +91 -91
  96. package/lib/query/sync/initialize-sync-query.class.ts +83 -83
  97. package/lib/query/sync/sync-changes-query.class.ts +56 -56
  98. package/lib/query/taxonomy/taxonomies-query.class.ts +82 -82
  99. package/lib/query/taxonomy/taxonomy-query.class.ts +50 -50
  100. package/lib/query/type/multiple-type-query.class.ts +95 -95
  101. package/lib/query/type/single-type-query.class.ts +45 -45
  102. package/lib/query/used-in/used-in-query.class.ts +128 -126
  103. package/lib/sdk-info.generated.ts +1 -1
  104. package/lib/services/base-delivery-query.service.ts +375 -375
  105. package/lib/services/delivery-query.service.ts +336 -336
  106. package/lib/services/index.ts +2 -2
  107. package/lib/services/mapping.service.ts +223 -223
  108. package/lib/utilities/codename.helper.ts +10 -10
  109. package/lib/utilities/delivery-url.helper.ts +11 -11
  110. package/lib/utilities/enum.helper.ts +38 -38
  111. package/lib/utilities/index.ts +3 -3
  112. package/package.json +96 -96
  113. package/readme.md +531 -531
@@ -1,95 +1,95 @@
1
- import { Contracts } from '../../contracts';
2
- import { IDeliveryClientConfig } from '../../config';
3
- import {
4
- ClientTypes,
5
- IContentType,
6
- IContentTypeQueryConfig,
7
- IDeliveryNetworkResponse,
8
- Parameters,
9
- Responses
10
- } from '../../models';
11
- import { QueryService } from '../../services';
12
- import { BaseListingQuery } from '../common/base-listing-query.class';
13
-
14
- export class MultipleTypeQuery<TClientTypes extends ClientTypes> extends BaseListingQuery<
15
- TClientTypes,
16
- IContentType<TClientTypes['contentTypeCodenames']>,
17
- Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
18
- Responses.IListContentTypesAllResponse<TClientTypes['contentTypeCodenames']>,
19
- IContentTypeQueryConfig,
20
- Contracts.IListContentTypeContract
21
- > {
22
- protected _queryConfig: IContentTypeQueryConfig = {};
23
-
24
- constructor(protected config: IDeliveryClientConfig, protected queryService: QueryService<TClientTypes>) {
25
- super(config, queryService);
26
- }
27
-
28
- /**
29
- * Used to limit the number of elements returned by query.
30
- * @param elementCodenames Array of element codenames to fetch
31
- */
32
- elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
33
- this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
34
- return this;
35
- }
36
-
37
- /**
38
- * Used to exclude elements returned by query.
39
- * @param elementCodenames Array of element codenames to exclude
40
- */
41
- excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
42
- this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
43
- return this;
44
- }
45
-
46
- /**
47
- * Limits the number of taxonomies returned by query
48
- * @param limit Number of taxonomies to load
49
- */
50
- limitParameter(limit: number): this {
51
- this.parameters.push(new Parameters.LimitParameter(limit));
52
- return this;
53
- }
54
-
55
- /**
56
- * Skips the selected number of taxonomies
57
- * @param skip Number of taxonomies to skip
58
- */
59
- skipParameter(skip: number): this {
60
- this.parameters.push(new Parameters.SkipParameter(skip));
61
- return this;
62
- }
63
-
64
- toPromise(): Promise<
65
- IDeliveryNetworkResponse<
66
- Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
67
- Contracts.IListContentTypeContract
68
- >
69
- > {
70
- return this.queryService.getMultipleTypes(this.getUrl(), this._queryConfig ?? {});
71
- }
72
-
73
- getUrl(): string {
74
- const action = '/types';
75
-
76
- return super.resolveUrlInternal(action);
77
- }
78
-
79
- map(json: any): Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']> {
80
- return this.queryService.mappingService.listContentTypesResponse(json);
81
- }
82
-
83
- protected allResponseFactory(
84
- items: IContentType<TClientTypes['contentTypeCodenames']>[],
85
- responses: IDeliveryNetworkResponse<
86
- Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
87
- Contracts.IListContentTypeContract
88
- >[]
89
- ): Responses.IListContentTypesAllResponse<TClientTypes['contentTypeCodenames']> {
90
- return {
91
- items: items,
92
- responses: responses
93
- };
94
- }
95
- }
1
+ import { Contracts } from '../../contracts';
2
+ import { IDeliveryClientConfig } from '../../config';
3
+ import {
4
+ ClientTypes,
5
+ IContentType,
6
+ IContentTypeQueryConfig,
7
+ IDeliveryNetworkResponse,
8
+ Parameters,
9
+ Responses
10
+ } from '../../models';
11
+ import { QueryService } from '../../services';
12
+ import { BaseListingQuery } from '../common/base-listing-query.class';
13
+
14
+ export class MultipleTypeQuery<TClientTypes extends ClientTypes> extends BaseListingQuery<
15
+ TClientTypes,
16
+ IContentType<TClientTypes['contentTypeCodenames']>,
17
+ Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
18
+ Responses.IListContentTypesAllResponse<TClientTypes['contentTypeCodenames']>,
19
+ IContentTypeQueryConfig,
20
+ Contracts.IListContentTypeContract
21
+ > {
22
+ protected _queryConfig: IContentTypeQueryConfig = {};
23
+
24
+ constructor(protected config: IDeliveryClientConfig, protected queryService: QueryService<TClientTypes>) {
25
+ super(config, queryService);
26
+ }
27
+
28
+ /**
29
+ * Used to limit the number of elements returned by query.
30
+ * @param elementCodenames Array of element codenames to fetch
31
+ */
32
+ elementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
33
+ this.parameters.push(new Parameters.ElementsParameter(elementCodenames));
34
+ return this;
35
+ }
36
+
37
+ /**
38
+ * Used to exclude elements returned by query.
39
+ * @param elementCodenames Array of element codenames to exclude
40
+ */
41
+ excludeElementsParameter(elementCodenames: TClientTypes['elementCodenames'][]): this {
42
+ this.parameters.push(new Parameters.ExcludeElementsParameter(elementCodenames));
43
+ return this;
44
+ }
45
+
46
+ /**
47
+ * Limits the number of taxonomies returned by query
48
+ * @param limit Number of taxonomies to load
49
+ */
50
+ limitParameter(limit: number): this {
51
+ this.parameters.push(new Parameters.LimitParameter(limit));
52
+ return this;
53
+ }
54
+
55
+ /**
56
+ * Skips the selected number of taxonomies
57
+ * @param skip Number of taxonomies to skip
58
+ */
59
+ skipParameter(skip: number): this {
60
+ this.parameters.push(new Parameters.SkipParameter(skip));
61
+ return this;
62
+ }
63
+
64
+ toPromise(): Promise<
65
+ IDeliveryNetworkResponse<
66
+ Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
67
+ Contracts.IListContentTypeContract
68
+ >
69
+ > {
70
+ return this.queryService.getMultipleTypes(this.getUrl(), this._queryConfig ?? {});
71
+ }
72
+
73
+ getUrl(): string {
74
+ const action = '/types';
75
+
76
+ return super.resolveUrlInternal(action);
77
+ }
78
+
79
+ map(json: any): Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']> {
80
+ return this.queryService.mappingService.listContentTypesResponse(json);
81
+ }
82
+
83
+ protected allResponseFactory(
84
+ items: IContentType<TClientTypes['contentTypeCodenames']>[],
85
+ responses: IDeliveryNetworkResponse<
86
+ Responses.IListContentTypesResponse<TClientTypes['contentTypeCodenames']>,
87
+ Contracts.IListContentTypeContract
88
+ >[]
89
+ ): Responses.IListContentTypesAllResponse<TClientTypes['contentTypeCodenames']> {
90
+ return {
91
+ items: items,
92
+ responses: responses
93
+ };
94
+ }
95
+ }
@@ -1,45 +1,45 @@
1
- import { Contracts } from '../../contracts';
2
- import { IDeliveryClientConfig } from '../../config';
3
- import { ClientTypes, IContentTypeQueryConfig, IDeliveryNetworkResponse, Responses } from '../../models';
4
- import { QueryService } from '../../services';
5
- import { BaseQuery } from '../common/base-query.class';
6
-
7
- export class SingleTypeQuery<TClientTypes extends ClientTypes> extends BaseQuery<
8
- TClientTypes,
9
- Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']>,
10
- IContentTypeQueryConfig,
11
- Contracts.IViewContentTypeContract
12
- > {
13
- protected _queryConfig: IContentTypeQueryConfig = {};
14
-
15
- constructor(
16
- protected config: IDeliveryClientConfig,
17
- protected queryService: QueryService<TClientTypes>,
18
- private typeCodename: string
19
- ) {
20
- super(config, queryService);
21
-
22
- if (!typeCodename) {
23
- throw Error(`Cannot create type query without the codename of the type`);
24
- }
25
- }
26
-
27
- toPromise(): Promise<
28
- IDeliveryNetworkResponse<
29
- Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']>,
30
- Contracts.IViewContentTypeContract
31
- >
32
- > {
33
- return this.queryService.getSingleType(this.getUrl(), this._queryConfig ?? {});
34
- }
35
-
36
- getUrl(): string {
37
- const action = '/types/' + this.typeCodename;
38
-
39
- return super.resolveUrlInternal(action);
40
- }
41
-
42
- map(json: any): Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']> {
43
- return this.queryService.mappingService.viewContentTypeResponse(json);
44
- }
45
- }
1
+ import { Contracts } from '../../contracts';
2
+ import { IDeliveryClientConfig } from '../../config';
3
+ import { ClientTypes, IContentTypeQueryConfig, IDeliveryNetworkResponse, Responses } from '../../models';
4
+ import { QueryService } from '../../services';
5
+ import { BaseQuery } from '../common/base-query.class';
6
+
7
+ export class SingleTypeQuery<TClientTypes extends ClientTypes> extends BaseQuery<
8
+ TClientTypes,
9
+ Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']>,
10
+ IContentTypeQueryConfig,
11
+ Contracts.IViewContentTypeContract
12
+ > {
13
+ protected _queryConfig: IContentTypeQueryConfig = {};
14
+
15
+ constructor(
16
+ protected config: IDeliveryClientConfig,
17
+ protected queryService: QueryService<TClientTypes>,
18
+ private typeCodename: string
19
+ ) {
20
+ super(config, queryService);
21
+
22
+ if (!typeCodename) {
23
+ throw Error(`Cannot create type query without the codename of the type`);
24
+ }
25
+ }
26
+
27
+ toPromise(): Promise<
28
+ IDeliveryNetworkResponse<
29
+ Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']>,
30
+ Contracts.IViewContentTypeContract
31
+ >
32
+ > {
33
+ return this.queryService.getSingleType(this.getUrl(), this._queryConfig ?? {});
34
+ }
35
+
36
+ getUrl(): string {
37
+ const action = '/types/' + encodeURIComponent(this.typeCodename);
38
+
39
+ return super.resolveUrlInternal(action);
40
+ }
41
+
42
+ map(json: any): Responses.IViewContentTypeResponse<TClientTypes['contentTypeCodenames']> {
43
+ return this.queryService.mappingService.viewContentTypeResponse(json);
44
+ }
45
+ }
@@ -1,126 +1,128 @@
1
- import { Contracts } from '../../contracts';
2
- import { IDeliveryClientConfig } from '../../config';
3
- import {
4
- Filters,
5
- IDeliveryNetworkResponse,
6
- Parameters,
7
- Responses,
8
- IItemFeedQueryConfig,
9
- ClientTypes,
10
- IUsedInItemRecord,
11
- IQueryConfig
12
- } from '../../models';
13
- import { QueryService } from '../../services';
14
- import { BaseListingQuery } from '../common/base-listing-query.class';
15
-
16
- export type UsedInSetup = {
17
- readonly entity: 'asset' | 'contentItem';
18
- readonly codename: string;
19
- };
20
-
21
- export class UsedInQuery<TClientTypes extends ClientTypes> extends BaseListingQuery<
22
- TClientTypes,
23
- IUsedInItemRecord<TClientTypes>,
24
- Responses.IUsedInResponse<TClientTypes>,
25
- Responses.IUsedInAllResponse<TClientTypes>,
26
- IQueryConfig,
27
- Contracts.IUsedInItemsContract
28
- > {
29
- protected _queryConfig: IQueryConfig = {};
30
-
31
- constructor(
32
- protected readonly config: IDeliveryClientConfig,
33
- protected readonly queryService: QueryService<TClientTypes>,
34
- protected readonly setup: UsedInSetup
35
- ) {
36
- super(config, queryService);
37
- }
38
-
39
- /**
40
- * Gets only item of given type
41
- * @param type Codename of type to get
42
- */
43
- type(type: TClientTypes['contentTypeCodenames']): this {
44
- this.parameters.push(new Filters.TypeFilter(type));
45
- return this;
46
- }
47
-
48
- /**
49
- * Gets items of given types (logical or)
50
- * I.e. get items of either 'Actor' or 'Movie' type
51
- * @param types Types to get
52
- */
53
- types(types: TClientTypes['contentTypeCodenames'][]): this {
54
- this.parameters.push(new Filters.TypeFilter(types));
55
- return this;
56
- }
57
-
58
- /**
59
- * Gets only item from given collection
60
- * @param collection Codename of collection to get
61
- */
62
- collection(collection: TClientTypes['collectionCodenames']): this {
63
- this.parameters.push(new Filters.CollectionFilter(collection));
64
- return this;
65
- }
66
-
67
- /**
68
- * Gets items from given collections (logical or)
69
- * I.e. get items of either 'default' or 'christmas-campaign' collection
70
- * @param collections Collections to get
71
- */
72
- collections(collections: TClientTypes['collectionCodenames'][]): this {
73
- this.parameters.push(new Filters.CollectionFilter(collections));
74
- return this;
75
- }
76
-
77
- /**
78
- * Language codename
79
- * @param languageCodename Codename of the language
80
- */
81
- languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
82
- this.parameters.push(new Parameters.LanguageParameter(languageCodename));
83
- return this;
84
- }
85
-
86
- toPromise(): Promise<
87
- IDeliveryNetworkResponse<Responses.IUsedInResponse<TClientTypes>, Contracts.IUsedInItemsContract>
88
- > {
89
- return this.queryService.getUsedIn(this.getUrl(), this._queryConfig ?? {});
90
- }
91
-
92
- getUrl(): string {
93
- const action = `/${this.setup.entity === 'asset' ? 'assets' : 'items'}/${this.setup.codename}/used-in`;
94
-
95
- // add default language is necessary
96
- this.processDefaultLanguageParameter();
97
-
98
- //process client level archived item exclusion
99
- this.processExcludeArchivedItemsParameter();
100
-
101
- return super.resolveUrlInternal(action);
102
- }
103
-
104
- /**
105
- * Used to configure query
106
- * @param queryConfig Query configuration
107
- */
108
- queryConfig(queryConfig: IItemFeedQueryConfig): this {
109
- this._queryConfig = queryConfig;
110
- return this;
111
- }
112
-
113
- map(json: any): Responses.IUsedInResponse<TClientTypes> {
114
- return this.queryService.mappingService.usedInResponse(json);
115
- }
116
-
117
- protected allResponseFactory(
118
- items: IUsedInItemRecord<TClientTypes>[],
119
- responses: IDeliveryNetworkResponse<Responses.IUsedInResponse<TClientTypes>, Contracts.IUsedInItemsContract>[]
120
- ): Responses.IUsedInAllResponse<TClientTypes> {
121
- return {
122
- items: items,
123
- responses: responses
124
- };
125
- }
126
- }
1
+ import { Contracts } from '../../contracts';
2
+ import { IDeliveryClientConfig } from '../../config';
3
+ import {
4
+ Filters,
5
+ IDeliveryNetworkResponse,
6
+ Parameters,
7
+ Responses,
8
+ IItemFeedQueryConfig,
9
+ ClientTypes,
10
+ IUsedInItemRecord,
11
+ IQueryConfig
12
+ } from '../../models';
13
+ import { QueryService } from '../../services';
14
+ import { BaseListingQuery } from '../common/base-listing-query.class';
15
+
16
+ export type UsedInSetup = {
17
+ readonly entity: 'asset' | 'contentItem';
18
+ readonly codename: string;
19
+ };
20
+
21
+ export class UsedInQuery<TClientTypes extends ClientTypes> extends BaseListingQuery<
22
+ TClientTypes,
23
+ IUsedInItemRecord<TClientTypes>,
24
+ Responses.IUsedInResponse<TClientTypes>,
25
+ Responses.IUsedInAllResponse<TClientTypes>,
26
+ IQueryConfig,
27
+ Contracts.IUsedInItemsContract
28
+ > {
29
+ protected _queryConfig: IQueryConfig = {};
30
+
31
+ constructor(
32
+ protected readonly config: IDeliveryClientConfig,
33
+ protected readonly queryService: QueryService<TClientTypes>,
34
+ protected readonly setup: UsedInSetup
35
+ ) {
36
+ super(config, queryService);
37
+ }
38
+
39
+ /**
40
+ * Gets only item of given type
41
+ * @param type Codename of type to get
42
+ */
43
+ type(type: TClientTypes['contentTypeCodenames']): this {
44
+ this.parameters.push(new Filters.TypeFilter(type));
45
+ return this;
46
+ }
47
+
48
+ /**
49
+ * Gets items of given types (logical or)
50
+ * I.e. get items of either 'Actor' or 'Movie' type
51
+ * @param types Types to get
52
+ */
53
+ types(types: TClientTypes['contentTypeCodenames'][]): this {
54
+ this.parameters.push(new Filters.TypeFilter(types));
55
+ return this;
56
+ }
57
+
58
+ /**
59
+ * Gets only item from given collection
60
+ * @param collection Codename of collection to get
61
+ */
62
+ collection(collection: TClientTypes['collectionCodenames']): this {
63
+ this.parameters.push(new Filters.CollectionFilter(collection));
64
+ return this;
65
+ }
66
+
67
+ /**
68
+ * Gets items from given collections (logical or)
69
+ * I.e. get items of either 'default' or 'christmas-campaign' collection
70
+ * @param collections Collections to get
71
+ */
72
+ collections(collections: TClientTypes['collectionCodenames'][]): this {
73
+ this.parameters.push(new Filters.CollectionFilter(collections));
74
+ return this;
75
+ }
76
+
77
+ /**
78
+ * Language codename
79
+ * @param languageCodename Codename of the language
80
+ */
81
+ languageParameter(languageCodename: TClientTypes['languageCodenames']): this {
82
+ this.parameters.push(new Parameters.LanguageParameter(languageCodename));
83
+ return this;
84
+ }
85
+
86
+ toPromise(): Promise<
87
+ IDeliveryNetworkResponse<Responses.IUsedInResponse<TClientTypes>, Contracts.IUsedInItemsContract>
88
+ > {
89
+ return this.queryService.getUsedIn(this.getUrl(), this._queryConfig ?? {});
90
+ }
91
+
92
+ getUrl(): string {
93
+ const action = `/${this.setup.entity === 'asset' ? 'assets' : 'items'}/${encodeURIComponent(
94
+ this.setup.codename
95
+ )}/used-in`;
96
+
97
+ // add default language is necessary
98
+ this.processDefaultLanguageParameter();
99
+
100
+ //process client level archived item exclusion
101
+ this.processExcludeArchivedItemsParameter();
102
+
103
+ return super.resolveUrlInternal(action);
104
+ }
105
+
106
+ /**
107
+ * Used to configure query
108
+ * @param queryConfig Query configuration
109
+ */
110
+ queryConfig(queryConfig: IItemFeedQueryConfig): this {
111
+ this._queryConfig = queryConfig;
112
+ return this;
113
+ }
114
+
115
+ map(json: any): Responses.IUsedInResponse<TClientTypes> {
116
+ return this.queryService.mappingService.usedInResponse(json);
117
+ }
118
+
119
+ protected allResponseFactory(
120
+ items: IUsedInItemRecord<TClientTypes>[],
121
+ responses: IDeliveryNetworkResponse<Responses.IUsedInResponse<TClientTypes>, Contracts.IUsedInItemsContract>[]
122
+ ): Responses.IUsedInAllResponse<TClientTypes> {
123
+ return {
124
+ items: items,
125
+ responses: responses
126
+ };
127
+ }
128
+ }
@@ -2,6 +2,6 @@
2
2
  import { ISDKInfo } from '@kontent-ai/core-sdk';
3
3
  export const sdkInfo: ISDKInfo = {
4
4
  host: 'npmjs.com',
5
- version: '16.4.3',
5
+ version: '16.4.5',
6
6
  name: '@kontent-ai/delivery-sdk'
7
7
  };