@sitecore/sc-contenthub-webclient-sdk 1.2.7 → 1.2.14

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.
package/README.md CHANGED
@@ -1,49 +1,31 @@
1
1
  # Sitecore Content Hub WebClient JS SDK
2
2
 
3
- Sitecore Content Hub WebClient JS SDK, which is a lightweight JS client for Sitecore Content Hub.
3
+ Lightweight JS client for [Sitecore Content Hub](https://doc.sitecore.com/ch/en/developers/cloud-dev/index-en.html).
4
4
 
5
- ## Internal resources
5
+ Environment
6
6
 
7
- - [Backlog](https://stylelabs.atlassian.net/secure/RapidBoard.jspa?rapidView=347&projectKey=ONSJSSDK&view=planning.nodetail&issueLimit=100)
8
- - Slack: #ch-devex-questions
7
+ - Node.js
9
8
 
10
- ## Release process
9
+ Language level
11
10
 
12
- There are currently three build configurations that are specified in `bitbucket-pipelines.yml`
11
+ - ES6
12
+ - ESNext
13
13
 
14
- - A basic build runs each time a pull request is created or updated. This is to ensure that all unit tests are passing before committing any code to `master`.
15
- - Once a pull request has been completed and the code is merged to `master`, an internal build is triggered automatically.
16
- - Public releases can be created by tagging a commit with the following: `release-<major>.<minor>.<patch>` (e.g `release-1.0.0`). Upon a successful build all artifacts are pushed to the public channels.
14
+ Module system
17
15
 
18
- ### To Release
16
+ - CommonJS
17
+ - ESNext
19
18
 
20
- - Add new release tag, `release-<major>.<minor>.<patch>`.
21
- - Trigger a release build to publish final artifacts to the partners feed.
22
- - Cut the release branch, `release\<major>.<minor>.x`.
23
- - Update the Changelog in Documentation repository.
24
- - Update Content Hub repository with new official released version.
25
- - Bump version for the next release.
19
+ ## Installing
26
20
 
27
- ## Documentation
28
-
29
- [Stylelabs.M.Docs reporitory](https://bitbucket.org/stylelabsdev/stylelabs.m.docs/src/master/docfx-website/content/4.0.x/integrations/javascript-sdk/)
30
-
31
- _NOTE: There are multiple paths for various versions that need to be updated independently._
32
-
33
- ## Dev test configuration
21
+ ```bash
22
+ npm install @sitecore/sc-contenthub-webclient-sdk
23
+ ```
34
24
 
35
- Some tests require an instance of ContentHub and a configuration to run.
25
+ ## Documentation
36
26
 
37
- 1. Create a .env file in project root.
38
- 1. Configure an OAuth client in `<path-to-contenthub>/en-us/admin/oauthclients`.
27
+ - [Sitecore Content Hub](https://doc.sitecore.com/ch/en/developers/cloud-dev/index-en.html)
39
28
 
40
- Example .env config:
29
+ - [Sitecore Content Hub SDKs](https://doc.sitecore.com/ch/en/developers/cloud-dev/javascript-sdk.html)
41
30
 
42
- ```
43
- ENDPOINT=https://localhost:5001
44
- OAUTH_CLIENT_ID=jssdk
45
- OAUTH_CLIENT_SECRET=testsecret
46
- USER_NAME=Administrator
47
- USER_PASSWORD=admin
48
- IGNORE_HTTPS_ERRORS=true
49
- ```
31
+ _NOTE: There are multiple paths for various versions._
@@ -1,5 +1,6 @@
1
1
  import { Nullable, NullableResultPromise } from "../base-types";
2
2
  import { IEntityDefinition } from "../contracts/base";
3
+ import { ViewMode } from "../contracts/base/view-mode";
3
4
  /**
4
5
  * Caches definition in memory.
5
6
  */
@@ -47,7 +48,7 @@ export declare class EntityDefinitionCache {
47
48
  * @param includeConditionalMembers - Include conditional members
48
49
  * @param loadPermissions - Load permissions for the definitions
49
50
  */
50
- loadAll(definitions: Array<IEntityDefinition>, loadAllIndividually?: boolean, loadAsGroup?: false | string, includeConditionalMembers?: boolean, loadPermissions?: boolean): void;
51
+ loadAll(definitions: Array<IEntityDefinition>, loadAllIndividually?: boolean, loadAsGroup?: false | string, includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): void;
51
52
  /**
52
53
  * Retrieves an array of definitions that was cached with the specified group key.
53
54
  *
@@ -58,7 +59,7 @@ export declare class EntityDefinitionCache {
58
59
  * @param includeConditionalMembers - Include conditional members
59
60
  * @param loadPermissions - Load permissions for the definitions
60
61
  */
61
- getAll(group?: string, includeConditionalMembers?: boolean, loadPermissions?: boolean): Nullable<Array<IEntityDefinition>>;
62
+ getAll(group?: string, includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Nullable<Array<IEntityDefinition>>;
62
63
  /**
63
64
  * Invalidates/removes the definition with specified name or id from the cache.
64
65
  * @param key - The definition name or definition id
@@ -24,8 +24,8 @@ class EntityDefinitionCache {
24
24
  load(definition, includeConditionalMembers, loadPermissions) {
25
25
  guard_1.default.notNullOrUndefined(definition, "definition");
26
26
  guard_1.default.notNullOrUndefined(definition.id, "definition id");
27
- this._map.set(this.getCacheKey(definition.name, includeConditionalMembers, loadPermissions), definition);
28
- this._map.set(this.getCacheKey(definition.id.toString(), includeConditionalMembers, loadPermissions), definition);
27
+ this._map.set(this.getCacheKey(definition.name, { includeConditionalMembers, loadPermissions }), definition);
28
+ this._map.set(this.getCacheKey(definition.id.toString(), { includeConditionalMembers, loadPermissions }), definition);
29
29
  }
30
30
  /**
31
31
  * Load the specified definition into the cache asynchronously.
@@ -37,7 +37,10 @@ class EntityDefinitionCache {
37
37
  loadAsync(key, promise, includeConditionalMembers, loadPermissions) {
38
38
  this.validateKey(key);
39
39
  guard_1.default.notNullOrUndefined(promise);
40
- this._map.set(`${this._promiseKeyPrefix}${this.getCacheKey(key.toString(), includeConditionalMembers, loadPermissions)}`, promise);
40
+ this._map.set(`${this._promiseKeyPrefix}${this.getCacheKey(key.toString(), {
41
+ includeConditionalMembers,
42
+ loadPermissions,
43
+ })}`, promise);
41
44
  const loadPromise = promise.then(definition => {
42
45
  if (definition) {
43
46
  this.load(definition);
@@ -54,7 +57,7 @@ class EntityDefinitionCache {
54
57
  */
55
58
  get(key, includeConditionalMembers, loadPermissions) {
56
59
  this.validateKey(key);
57
- const res = this._map.get(this.getCacheKey(key.toString(), includeConditionalMembers, loadPermissions)) || null;
60
+ const res = this._map.get(this.getCacheKey(key.toString(), { includeConditionalMembers, loadPermissions })) || null;
58
61
  return res;
59
62
  }
60
63
  /**
@@ -66,12 +69,14 @@ class EntityDefinitionCache {
66
69
  */
67
70
  getAsync(key, includeConditionalMembers, loadPermissions) {
68
71
  this.validateKey(key);
69
- const promise = (this._map.get(`${this._promiseKeyPrefix}${this.getCacheKey(key.toString(), includeConditionalMembers, loadPermissions)}`) || null);
72
+ const promise = (this._map.get(`${this._promiseKeyPrefix}${this.getCacheKey(key.toString(), {
73
+ includeConditionalMembers,
74
+ loadPermissions,
75
+ })}`) || null);
70
76
  if (promise != null) {
71
77
  return promise;
72
78
  }
73
- const definition = (this.get(this.getCacheKey(key.toString(), includeConditionalMembers, loadPermissions)) ||
74
- null);
79
+ const definition = (this.get(this.getCacheKey(key.toString(), { includeConditionalMembers, loadPermissions })) || null);
75
80
  if (definition != null) {
76
81
  return Promise.resolve(definition);
77
82
  }
@@ -85,14 +90,23 @@ class EntityDefinitionCache {
85
90
  * @param includeConditionalMembers - Include conditional members
86
91
  * @param loadPermissions - Load permissions for the definitions
87
92
  */
88
- loadAll(definitions, loadAllIndividually = true, loadAsGroup = this._allCacheKey, includeConditionalMembers, loadPermissions) {
93
+ loadAll(definitions, loadAllIndividually = true, loadAsGroup = this._allCacheKey, includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
89
94
  guard_1.default.notNullOrUndefined(definitions);
90
95
  if (definitions.length === 0) {
91
96
  return;
92
97
  }
93
98
  if (loadAsGroup) {
94
99
  guard_1.default.stringNotNullOrEmpty(loadAsGroup);
95
- this._map.set(this.getCacheKey(loadAsGroup, includeConditionalMembers, loadPermissions), definitions);
100
+ this._map.set(this.getCacheKey(loadAsGroup, {
101
+ filter,
102
+ definitionsToLoadByName,
103
+ definitionsToLoadById,
104
+ viewMode,
105
+ loadPermissions,
106
+ includeConditionalMembers,
107
+ excludeTaxonomyDefinitions,
108
+ excludeSystemOwnedDefinitions,
109
+ }), definitions);
96
110
  }
97
111
  if (loadAllIndividually) {
98
112
  definitions.forEach(definition => this.load(definition, includeConditionalMembers, loadPermissions), this);
@@ -108,8 +122,17 @@ class EntityDefinitionCache {
108
122
  * @param includeConditionalMembers - Include conditional members
109
123
  * @param loadPermissions - Load permissions for the definitions
110
124
  */
111
- getAll(group = this._allCacheKey, includeConditionalMembers, loadPermissions) {
112
- const res = this._map.get(this.getCacheKey(group, includeConditionalMembers, loadPermissions)) || null;
125
+ getAll(group = this._allCacheKey, includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
126
+ const res = this._map.get(this.getCacheKey(group, {
127
+ filter,
128
+ definitionsToLoadByName,
129
+ definitionsToLoadById,
130
+ viewMode,
131
+ loadPermissions,
132
+ includeConditionalMembers,
133
+ excludeTaxonomyDefinitions,
134
+ excludeSystemOwnedDefinitions,
135
+ })) || null;
113
136
  return res instanceof Array ? res : null;
114
137
  }
115
138
  /**
@@ -127,8 +150,8 @@ class EntityDefinitionCache {
127
150
  const definition = this.get(key);
128
151
  if (!definition)
129
152
  return;
130
- this._map.delete(this.getCacheKey(definition.name, includeConditionalMembers, loadPermissions));
131
- this._map.delete(this.getCacheKey(definition.id.toString(), includeConditionalMembers, loadPermissions));
153
+ this._map.delete(this.getCacheKey(definition.name, { includeConditionalMembers, loadPermissions }));
154
+ this._map.delete(this.getCacheKey(definition.id.toString(), { includeConditionalMembers, loadPermissions }));
132
155
  }
133
156
  validateKey(key) {
134
157
  if (typeof key === "string") {
@@ -138,8 +161,18 @@ class EntityDefinitionCache {
138
161
  guard_1.default.validId(key);
139
162
  }
140
163
  }
141
- getCacheKey(key, includeConditionalMembers, loadPermissions) {
142
- return [key.trim().toLowerCase(), includeConditionalMembers && "conditionals", loadPermissions && "permissions"]
164
+ getCacheKey(key, { filter, definitionsToLoadByName, definitionsToLoadById, viewMode, loadPermissions, includeConditionalMembers, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, }) {
165
+ return [
166
+ key.trim().toLowerCase(),
167
+ includeConditionalMembers && "conditionals",
168
+ loadPermissions && "permissions",
169
+ viewMode,
170
+ excludeTaxonomyDefinitions && "excludeTaxonomyDefinitions",
171
+ excludeSystemOwnedDefinitions && "excludeSystemOwnedDefinitions",
172
+ filter,
173
+ definitionsToLoadByName,
174
+ definitionsToLoadById,
175
+ ]
143
176
  .filter(Boolean)
144
177
  .join("-");
145
178
  }
@@ -1,5 +1,6 @@
1
1
  import { MapNumberTo, MapStringTo, NullableResultPromise } from "../base-types";
2
2
  import { IEntityDefinition } from "../contracts/base/entity-definition";
3
+ import { ViewMode } from "../contracts/base/view-mode";
3
4
  import { IEntityDefinitionIterator } from "../contracts/querying/entity-definition-iterator";
4
5
  import { IEntityDefinitionQueryResult } from "../contracts/querying/entity-definition-query-result";
5
6
  import { IIdIterator } from "../contracts/querying/id-iterator";
@@ -28,16 +29,28 @@ export interface IEntityDefinitionsClient {
28
29
  * Get all the {@link IEntityDefinition}s.
29
30
  * @param includeConditionalMembers - Include conditional members
30
31
  * @param loadPermissions - Load permissions for the definitions
32
+ * @param viewMode - Select appropriate ViewMode
33
+ * @param loadPermissions - Load permissions for the definitions
34
+ * @param excludeTaxonomyDefinitions - Exclude taxonomy definitions from the result
35
+ * @param excludeSystemOwnedDefinitions - Exclude system owned definitions from the result
36
+ * @param filter - Additional filters
37
+ * @param definitionsToLoadByName - Comma separated list of definition names
38
+ * @param definitionsToLoadById - Comma separated list of definition identifiers
31
39
  * @returns Promise which resolved to an array of {@link IEntityDefinition}s.
32
40
  */
33
- getAllAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Array<IEntityDefinition>>;
41
+ getAllAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Array<IEntityDefinition>>;
34
42
  /**
35
43
  * Get all the {@link IEntityDefinition}s (cached).
36
44
  * @param includeConditionalMembers - Include conditional members
37
45
  * @param loadPermissions - Load permissions for the definitions
46
+ * @param excludeTaxonomyDefinitions - Exclude taxonomy definitions from the result
47
+ * @param excludeSystemOwnedDefinitions - Exclude system owned definitions from the result
48
+ * @param filter - Additional filters
49
+ * @param definitionsToLoadByName - Comma separated list of definition names
50
+ * @param definitionsToLoadById - Comma separated list of definition identifiers
38
51
  * @returns Promise which resolved to an array of {@link IEntityDefinition}s.
39
52
  */
40
- getAllCachedAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Array<IEntityDefinition>>;
53
+ getAllCachedAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Array<IEntityDefinition>>;
41
54
  /**
42
55
  * Get the cached {@link IEntityDefinition} instance by the specified name.
43
56
  * @param name - The name of the definition
@@ -101,8 +114,8 @@ export declare class EntityDefinitionsClient implements IEntityDefinitionsClient
101
114
  private readonly _client;
102
115
  private readonly _cache;
103
116
  constructor(client: IExtendedContentHubClient);
104
- getAllCachedAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Array<IEntityDefinition>>;
105
- getAllAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Array<IEntityDefinition>>;
117
+ getAllCachedAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Array<IEntityDefinition>>;
118
+ getAllAsync(includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Array<IEntityDefinition>>;
106
119
  getAsync(param: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean, cacheSignature?: string): NullableResultPromise<IEntityDefinition>;
107
120
  getCachedAsync(param: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean, cacheSignature?: string): NullableResultPromise<IEntityDefinition>;
108
121
  getNameAsync(id: number, cacheSignature?: string): NullableResultPromise<string>;
@@ -17,6 +17,7 @@ const http_status_codes_1 = require("http-status-codes");
17
17
  const ta_json_1 = require("ta-json");
18
18
  const urijs_1 = __importDefault(require("urijs"));
19
19
  const entity_definition_cache_1 = require("../caches/entity-definition-cache");
20
+ const api_1 = require("../constants/api");
20
21
  const entity_definition_id_iterator_1 = require("../contracts/querying/entity-definition-id-iterator");
21
22
  const entity_definition_id_query_result_1 = require("../contracts/querying/entity-definition-id-query-result");
22
23
  const entity_definition_iterator_1 = require("../contracts/querying/entity-definition-iterator");
@@ -28,25 +29,24 @@ const entity_definition_resource_1 = require("../models/entity-definition-resour
28
29
  const type_guards_1 = require("../type-guards");
29
30
  const array_utilities_1 = require("../utilities/array-utilities");
30
31
  const response_handler_1 = require("./response-handler");
31
- const api_1 = require("../constants/api");
32
32
  class EntityDefinitionsClient {
33
33
  constructor(client) {
34
34
  this._client = client;
35
35
  this._cache = new entity_definition_cache_1.EntityDefinitionCache();
36
36
  }
37
- getAllCachedAsync(includeConditionalMembers = true, loadPermissions) {
37
+ getAllCachedAsync(includeConditionalMembers = true, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- let definitions = this._cache.getAll(undefined, includeConditionalMembers, loadPermissions);
39
+ let definitions = this._cache.getAll(undefined, includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById);
40
40
  if (!definitions) {
41
- definitions = yield this.getAllAsync(includeConditionalMembers, loadPermissions);
41
+ definitions = yield this.getAllAsync(includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById);
42
42
  }
43
43
  return definitions;
44
44
  });
45
45
  }
46
- getAllAsync(includeConditionalMembers = true, loadPermissions) {
46
+ getAllAsync(includeConditionalMembers = true, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
47
47
  return __awaiter(this, void 0, void 0, function* () {
48
- const allEntityDefinitions = yield this.getAllBatchedAsync(includeConditionalMembers, loadPermissions);
49
- this._cache.loadAll(allEntityDefinitions, undefined, undefined, includeConditionalMembers, loadPermissions);
48
+ const allEntityDefinitions = yield this.getAllBatchedAsync(includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById);
49
+ this._cache.loadAll(allEntityDefinitions, undefined, undefined, includeConditionalMembers, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById);
50
50
  return allEntityDefinitions;
51
51
  });
52
52
  }
@@ -334,14 +334,14 @@ class EntityDefinitionsClient {
334
334
  return Promise.all(definitions).then(results => results.filter((result) => result != null));
335
335
  });
336
336
  }
337
- getAllBatchedAsync(includeConditionalMembers = true, loadPermissions) {
337
+ getAllBatchedAsync(includeConditionalMembers = true, loadPermissions, viewMode, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
338
338
  var _a, _b;
339
339
  return __awaiter(this, void 0, void 0, function* () {
340
340
  const resources = [];
341
341
  let resource = null;
342
342
  let skip = 0;
343
343
  while (resource == null || resource.next) {
344
- const link = (_a = resource === null || resource === void 0 ? void 0 : resource.next) !== null && _a !== void 0 ? _a : (yield this._client.linkHelper.definitionsLinkAsync(skip, EntityDefinitionsClient._batchSize, includeConditionalMembers, undefined, loadPermissions));
344
+ const link = (_a = resource === null || resource === void 0 ? void 0 : resource.next) !== null && _a !== void 0 ? _a : (yield this._client.linkHelper.definitionsLinkAsync(skip, EntityDefinitionsClient._batchSize, includeConditionalMembers, viewMode, loadPermissions, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById));
345
345
  const response = yield this._client.raw.getAsync(link.href);
346
346
  response_handler_1.ResponseHandler.handleErrors(response);
347
347
  resource = ta_json_1.TaJson.deserialize(response.content, entity_definition_collection_resource_1.EntityDefinitionCollectionResource);
@@ -25,6 +25,7 @@ export declare abstract class EntityBase implements IEntity {
25
25
  id?: number;
26
26
  identifier: Nullable<string>;
27
27
  hasPublicLink?: boolean;
28
+ masterFileModifiedOn?: Date;
28
29
  gatewayLinks?: Record<string, Link>;
29
30
  publicLink?: string;
30
31
  publicCollectionLink?: string;
@@ -300,6 +300,10 @@ __decorate([
300
300
  (0, ta_json_1.JsonProperty)("hasPublicLink"),
301
301
  __metadata("design:type", Boolean)
302
302
  ], EntityBase.prototype, "hasPublicLink", void 0);
303
+ __decorate([
304
+ (0, ta_json_1.JsonProperty)("masterFileModifiedOn"),
305
+ __metadata("design:type", Date)
306
+ ], EntityBase.prototype, "masterFileModifiedOn", void 0);
303
307
  __decorate([
304
308
  (0, ta_json_1.JsonProperty)("gatewayLinks"),
305
309
  __metadata("design:type", Object)
@@ -91,6 +91,10 @@ export interface IEntity extends IResource, IDirtyTracking {
91
91
  * Gets or sets a value indicating whether this entity has at least one public link.
92
92
  */
93
93
  hasPublicLink?: boolean;
94
+ /**
95
+ * Gets the modification date of the related MasterFile entity.
96
+ */
97
+ masterFileModifiedOn?: Date;
94
98
  /**
95
99
  * The name of the page that the saved selection should redirect too.
96
100
  */
@@ -1,9 +1,9 @@
1
+ import { AggregateLoadOption } from "clients/aggregates-client";
1
2
  import { Nullable, NullableResultPromise } from "./base-types";
2
3
  import { IExtendedContentHubClient } from "./clients/extended-client";
3
4
  import { ViewMode } from "./contracts/base/view-mode";
4
5
  import CultureInfo from "./culture-info";
5
6
  import Link from "./link";
6
- import { AggregateLoadOption } from "clients/aggregates-client";
7
7
  export interface ILinkHelper {
8
8
  /**
9
9
  * Extracts the name of a data source from the specified link.
@@ -96,7 +96,7 @@ export interface ILinkHelper {
96
96
  * @param excludeSystemOwnedDefinitions - [Optional] Exclude system owned definitions from the result
97
97
  * @returns Link to the entity definitions included in this batch.
98
98
  */
99
- definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise<Link>;
99
+ definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Link>;
100
100
  relationToLinkAsync(id: number, name: string): Promise<Link>;
101
101
  /**
102
102
  * Extracts the id of an entity from the specified link.
@@ -218,7 +218,7 @@ export declare class LinkHelper implements ILinkHelper {
218
218
  definitionToLinkAsync(param: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Link>;
219
219
  definitionToLinkV2Async(name: string, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<Link>;
220
220
  definitionsToLinkAsync(values: Nullable<Array<string>> | Nullable<Array<number>>, skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise<Link>;
221
- definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise<Link>;
221
+ definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string): Promise<Link>;
222
222
  idFromEntityAsync(link: Link): Promise<number | null>;
223
223
  idsFromEntitiesAsync(links: Array<Link>): Promise<Array<number>>;
224
224
  entityToLinkAsync(param: number | string, culture?: Nullable<CultureInfo>): Promise<Link>;
@@ -236,7 +236,7 @@ export declare class LinkHelper implements ILinkHelper {
236
236
  commandToLinkAsync(namespace: string, command: string): Promise<Link>;
237
237
  sendConfirmationMailToLinkAsync(userId: number): Promise<Link>;
238
238
  sendNotificationToLinkAsync(notificationType: string): Promise<Link>;
239
- aggregateToLinkAsync(aggregateName: string, entityId: number, culture?: CultureInfo, { loadPermissions, loadOptionLists, loadSettings, loadEntities, loadDefinitions }?: AggregateLoadOption): Promise<Link>;
239
+ aggregateToLinkAsync(aggregateName: string, entityId: number, culture?: CultureInfo, { loadPermissions, loadOptionLists, loadSettings, loadEntities, loadDefinitions, }?: AggregateLoadOption): Promise<Link>;
240
240
  pageResourceToLinkAsync(page: string | number, culture: CultureInfo, entityId?: number): Promise<Link>;
241
241
  searchLinkAsync(): Promise<Readonly<Link>>;
242
242
  allFacetsAsync(): Promise<Readonly<Link>>;
@@ -139,7 +139,7 @@ class LinkHelper {
139
139
  return yield this.bindAsync(api_1.ENTITY_DEFINITIONS.templateName, variables);
140
140
  });
141
141
  }
142
- definitionsLinkAsync(skip, take, includeConditionalMembers, viewMode, loadPermissions, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions) {
142
+ definitionsLinkAsync(skip, take, includeConditionalMembers, viewMode, loadPermissions, excludeTaxonomyDefinitions, excludeSystemOwnedDefinitions, filter, definitionsToLoadByName, definitionsToLoadById) {
143
143
  return __awaiter(this, void 0, void 0, function* () {
144
144
  const variables = LinkHelper.applyEntityDefinitionVariables({
145
145
  skip,
@@ -149,6 +149,9 @@ class LinkHelper {
149
149
  loadPermissions,
150
150
  excludeTaxonomyDefinitions,
151
151
  excludeSystemOwnedDefinitions,
152
+ filter,
153
+ definitionsToLoadByName,
154
+ definitionsToLoadById,
152
155
  });
153
156
  return yield this.bindAsync(api_1.ENTITY_DEFINITIONS.templateName, variables);
154
157
  });
@@ -326,7 +329,7 @@ class LinkHelper {
326
329
  }
327
330
  //#endregion
328
331
  //#region Aggregates
329
- aggregateToLinkAsync(aggregateName, entityId, culture, { loadPermissions, loadOptionLists = true, loadSettings = true, loadEntities = true, loadDefinitions = true } = {}) {
332
+ aggregateToLinkAsync(aggregateName, entityId, culture, { loadPermissions, loadOptionLists = true, loadSettings = true, loadEntities = true, loadDefinitions = true, } = {}) {
330
333
  return __awaiter(this, void 0, void 0, function* () {
331
334
  guard_1.default.stringNotNullOrEmpty(aggregateName);
332
335
  guard_1.default.validId(entityId);
@@ -127,6 +127,7 @@ class EntityMapper {
127
127
  isCurrentUserDefault: entity.isCurrentUserDefault,
128
128
  languageSupportedOotb: entity.languageSupportedOotb,
129
129
  hasPublicLink: entity.hasPublicLink,
130
+ masterFileModifiedOn: entity.masterFileModifiedOn,
130
131
  savedSelectionPageName: entity.savedSelectionPageName,
131
132
  gatewayLinks: entity.gatewayLinks,
132
133
  publicLink: entity.publicLink,
@@ -171,6 +172,7 @@ class EntityMapper {
171
172
  entity.isCurrentUserDefault = resource.isCurrentUserDefault;
172
173
  entity.languageSupportedOotb = resource.languageSupportedOotb;
173
174
  entity.hasPublicLink = resource.hasPublicLink;
175
+ entity.masterFileModifiedOn = resource.masterFileModifiedOn;
174
176
  entity.savedSelectionPageName = resource.savedSelectionPageName;
175
177
  entity.gatewayLinks = resource.gatewayLinks;
176
178
  entity.publicLink = resource.publicLink;
@@ -35,6 +35,7 @@ export declare class EntityResource extends Resource {
35
35
  isCurrentUserDefault?: boolean;
36
36
  languageSupportedOotb?: boolean;
37
37
  hasPublicLink?: boolean;
38
+ masterFileModifiedOn?: Date;
38
39
  savedSelectionPageName?: string;
39
40
  gatewayLinks?: Record<string, Link>;
40
41
  publicLink?: string;
@@ -151,6 +151,10 @@ __decorate([
151
151
  (0, ta_json_1.JsonProperty)("HasPublicLink"),
152
152
  __metadata("design:type", Boolean)
153
153
  ], EntityResource.prototype, "hasPublicLink", void 0);
154
+ __decorate([
155
+ (0, ta_json_1.JsonProperty)("masterFileModifiedOn"),
156
+ __metadata("design:type", Date)
157
+ ], EntityResource.prototype, "masterFileModifiedOn", void 0);
154
158
  __decorate([
155
159
  (0, ta_json_1.JsonProperty)("saved_selection_page_name"),
156
160
  __metadata("design:type", String)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore/sc-contenthub-webclient-sdk",
3
- "version": "1.2.7",
3
+ "version": "1.2.14",
4
4
  "description": "Sitecore Content Hub WebClient SDK.",
5
5
  "scripts": {
6
6
  "build": "npm run clean && npm run test && tsc && npm run lint",
@@ -10,11 +10,12 @@
10
10
  "test": "jest --forceExit --verbose --detectOpenHandles --coverage",
11
11
  "watch-test": "npm run test -- --watchAll",
12
12
  "clean": "rimraf dist/",
13
- "version": "echo $npm_package_version"
13
+ "bump-version": "npm version --no-git-tag-version --force",
14
+ "pack": "npm pack --pack-destination ./artifacts"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",
17
- "url": "bitbucket.org/stylelabsdev/sitecore.ch.sdk.javascript.git"
18
+ "url": "github.com/Sitecore-PD/sitecore.contenthub.cli"
18
19
  },
19
20
  "keywords": [
20
21
  "sitecore",
@@ -22,7 +23,7 @@
22
23
  "contenthub"
23
24
  ],
24
25
  "author": "Sitecore",
25
- "license": "MIT",
26
+ "license": "SEE LICENSE IN Sitecore.Artifact.License.Agreement.md",
26
27
  "files": [
27
28
  "/dist/**/*.d.ts",
28
29
  "/dist/**/*.js"
@@ -32,12 +33,12 @@
32
33
  "dependencies": {
33
34
  "axios": "^0.24.0",
34
35
  "axios-extensions": "^3.1.3",
36
+ "form-data": "^4.0.0",
35
37
  "http-status-codes": "^2.1.4",
36
38
  "ow": "^0.28.1",
37
39
  "string-format": "^2.0.0",
38
40
  "ta-json": "^2.5.0",
39
- "urijs": "^1.19.7",
40
- "form-data": "^4.0.0"
41
+ "urijs": "^1.19.7"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@types/jest": "^27.0.2",
package/LICENSE DELETED
@@ -1,24 +0,0 @@
1
- MIT License
2
- -----------
3
-
4
- Copyright (c) 2019 Sitecore
5
- Permission is hereby granted, free of charge, to any person
6
- obtaining a copy of this software and associated documentation
7
- files (the "Software"), to deal in the Software without
8
- restriction, including without limitation the rights to use,
9
- copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the
11
- Software is furnished to do so, subject to the following
12
- conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.