@sitecore/sc-contenthub-webclient-sdk 0.9.7 → 1.0.6
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 +21 -0
- package/dist/base-types.d.ts +5 -2
- package/dist/caches/entity-definition-cache.d.ts +14 -1
- package/dist/caches/entity-definition-cache.js +35 -0
- package/dist/clients/aggregates-client.d.ts +19 -0
- package/dist/clients/aggregates-client.js +35 -0
- package/dist/clients/api-client.d.ts +0 -1
- package/dist/clients/api-client.js +7 -9
- package/dist/clients/content-hub-client.d.ts +13 -1
- package/dist/clients/content-hub-client.js +8 -0
- package/dist/clients/entity-definitions-client.js +7 -6
- package/dist/clients/internal-client.js +12 -2
- package/dist/clients/permissions-client.d.ts +16 -0
- package/dist/clients/permissions-client.js +53 -0
- package/dist/clients/raw-client.d.ts +1 -1
- package/dist/clients/request-message.d.ts +1 -1
- package/dist/clients/schema-querying.js +2 -2
- package/dist/clients/search-client.d.ts +9 -0
- package/dist/clients/search-client.js +11 -0
- package/dist/clients/upload-client.d.ts +21 -0
- package/dist/clients/upload-client.js +98 -0
- package/dist/clients/version-checker.d.ts +32 -0
- package/dist/clients/version-checker.js +60 -0
- package/dist/constants/api.d.ts +14 -0
- package/dist/constants/api.js +15 -1
- package/dist/constants/defaults.d.ts +3 -0
- package/dist/constants/defaults.js +4 -1
- package/dist/contracts/base/data-type.d.ts +1 -2
- package/dist/contracts/base/entity-base.d.ts +6 -0
- package/dist/contracts/base/entity-base.js +13 -0
- package/dist/contracts/base/entity-construction-args.d.ts +2 -0
- package/dist/contracts/base/entity-construction-args.js +1 -0
- package/dist/contracts/base/entity-definition.js +1 -1
- package/dist/contracts/base/entity.d.ts +26 -0
- package/dist/contracts/base/entity.js +19 -1
- package/dist/contracts/base/member-group.js +3 -0
- package/dist/contracts/base/property-definitions/string-property-definition.js +1 -1
- package/dist/contracts/base/related-path.d.ts +12 -0
- package/dist/contracts/base/related-path.js +2 -0
- package/dist/contracts/base/relation-definition.d.ts +5 -0
- package/dist/contracts/base/relation-definition.js +4 -0
- package/dist/contracts/base/rendition.d.ts +1 -1
- package/dist/contracts/base/string-content-type.d.ts +4 -4
- package/dist/contracts/base/string-content-type.js +4 -4
- package/dist/contracts/upload/upload-source.d.ts +5 -0
- package/dist/contracts/upload/upload-source.js +2 -0
- package/dist/converters/all-facet-values-children-converter.d.ts +21 -0
- package/dist/converters/all-facet-values-children-converter.js +45 -0
- package/dist/dirty-value-calculator.js +1 -5
- package/dist/error-messages.d.ts +1 -0
- package/dist/error-messages.js +1 -0
- package/dist/link-helper.d.ts +14 -0
- package/dist/link-helper.js +31 -0
- package/dist/link.d.ts +1 -1
- package/dist/link.js +3 -3
- package/dist/mappers/entity-mapper.d.ts +1 -0
- package/dist/mappers/entity-mapper.js +10 -0
- package/dist/mappers/filter-operator-mapper.d.ts +5 -0
- package/dist/mappers/filter-operator-mapper.js +14 -0
- package/dist/mappers/property-mapper.js +2 -11
- package/dist/mappers/related-path-mapper.d.ts +5 -0
- package/dist/mappers/related-path-mapper.js +30 -0
- package/dist/models/aggregate-resources/aggregate-resource.d.ts +14 -0
- package/dist/models/aggregate-resources/aggregate-resource.js +53 -0
- package/dist/models/aggregate-resources/aggregated-entity-resource.d.ts +11 -0
- package/dist/models/aggregate-resources/aggregated-entity-resource.js +30 -0
- package/dist/models/entity-resource.d.ts +3 -0
- package/dist/models/entity-resource.js +12 -0
- package/dist/models/pages/page-resource.d.ts +2 -2
- package/dist/models/pages/page-resource.js +1 -1
- package/dist/models/policies/policy-resource.js +2 -2
- package/dist/models/property-definition-resource.js +1 -1
- package/dist/models/search/all-facet-values-response.d.ts +12 -0
- package/dist/models/search/all-facet-values-response.js +41 -0
- package/dist/models/search/all-facets-request.d.ts +16 -0
- package/dist/models/search/all-facets-request.js +51 -0
- package/dist/models/search/grouped-view-response-resource.js +1 -1
- package/dist/models/search/search-request.d.ts +2 -3
- package/dist/models/search/search-response.d.ts +3 -2
- package/dist/models/search/search-response.js +4 -2
- package/dist/models/upload/array-buffer-upload-source.d.ts +0 -0
- package/dist/models/upload/array-buffer-upload-source.js +16 -0
- package/dist/models/upload/create-upload-response.d.ts +5 -0
- package/dist/models/upload/create-upload-response.js +31 -0
- package/dist/models/upload/http-upload-source.d.ts +11 -0
- package/dist/models/upload/http-upload-source.js +34 -0
- package/dist/models/upload/local-upload-source.d.ts +10 -0
- package/dist/models/upload/local-upload-source.js +49 -0
- package/dist/models/upload/upload-action.d.ts +6 -0
- package/dist/models/upload/upload-action.js +37 -0
- package/dist/models/upload/upload-configuration.d.ts +6 -0
- package/dist/models/upload/upload-configuration.js +37 -0
- package/dist/models/upload/upload-request-wrapper.d.ts +8 -0
- package/dist/models/upload/upload-request-wrapper.js +39 -0
- package/dist/models/upload/upload-request.d.ts +10 -0
- package/dist/models/upload/upload-request.js +18 -0
- package/dist/models/user-entity-permissions-resource.d.ts +14 -0
- package/dist/models/user-entity-permissions-resource.js +69 -0
- package/dist/models/versionining/compatibility.d.ts +17 -0
- package/dist/models/versionining/compatibility.js +21 -0
- package/dist/utilities/array-utilities.d.ts +1 -0
- package/dist/utilities/array-utilities.js +15 -0
- package/package.json +6 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AllFacetsRequest = void 0;
|
|
13
|
+
const ta_json_1 = require("ta-json");
|
|
14
|
+
const field_filter_request_resource_1 = require("./field-filter-request-resource");
|
|
15
|
+
let AllFacetsRequest = class AllFacetsRequest {
|
|
16
|
+
constructor(init) {
|
|
17
|
+
this.culture = "Invariant";
|
|
18
|
+
this.filters = [];
|
|
19
|
+
Object.assign(this, init);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
ta_json_1.JsonProperty("facetField"),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], AllFacetsRequest.prototype, "facetField", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
ta_json_1.JsonProperty("query"),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], AllFacetsRequest.prototype, "query", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
ta_json_1.JsonProperty("searchConfigurationName"),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], AllFacetsRequest.prototype, "searchConfigurationName", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
ta_json_1.JsonProperty("culture"),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], AllFacetsRequest.prototype, "culture", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
ta_json_1.JsonProperty("component"),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], AllFacetsRequest.prototype, "componentId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
ta_json_1.JsonProperty("filters"),
|
|
44
|
+
ta_json_1.JsonElementType(field_filter_request_resource_1.FieldFilterRequestResource),
|
|
45
|
+
__metadata("design:type", Array)
|
|
46
|
+
], AllFacetsRequest.prototype, "filters", void 0);
|
|
47
|
+
AllFacetsRequest = __decorate([
|
|
48
|
+
ta_json_1.JsonObject(),
|
|
49
|
+
__metadata("design:paramtypes", [Object])
|
|
50
|
+
], AllFacetsRequest);
|
|
51
|
+
exports.AllFacetsRequest = AllFacetsRequest;
|
|
@@ -32,7 +32,7 @@ let GroupedViewResponseResource = class GroupedViewResponseResource {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
__decorate([
|
|
35
|
-
ta_json_1.JsonProperty("
|
|
35
|
+
ta_json_1.JsonProperty("available_groups"),
|
|
36
36
|
ta_json_1.JsonElementType(group_category_1.GroupCategory),
|
|
37
37
|
__metadata("design:type", Array)
|
|
38
38
|
], GroupedViewResponseResource.prototype, "availableGroups", void 0);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Moment } from "moment";
|
|
2
1
|
import CultureInfo from "../../culture-info";
|
|
3
2
|
import { AggregationRequestResource } from "./aggregation-request-resource";
|
|
4
3
|
import { FieldFilterRequestResource } from "./field-filter-request-resource";
|
|
@@ -29,8 +28,8 @@ export declare class SearchRequest implements ISearchRequest {
|
|
|
29
28
|
fields: Array<string>;
|
|
30
29
|
savedSelection?: number;
|
|
31
30
|
view: string;
|
|
32
|
-
calendarStartDate?: Date |
|
|
33
|
-
calendarStopDate?: Date |
|
|
31
|
+
calendarStartDate?: Date | string;
|
|
32
|
+
calendarStopDate?: Date | string;
|
|
34
33
|
selectionPool?: SelectionPoolFilterResource;
|
|
35
34
|
aggregations: Array<AggregationRequestResource>;
|
|
36
35
|
nestedRelations?: Array<NestedRelationInfo>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Nullable } from "../../base-types";
|
|
1
2
|
import { EntityResource } from "../entity-resource";
|
|
2
3
|
import Resource from "../resource";
|
|
3
4
|
import { IEntityResourceContainer } from "../resource-containers/entity-resource-container";
|
|
@@ -26,8 +27,8 @@ export declare class SearchResponse extends Resource implements ISearchResponse
|
|
|
26
27
|
clearFilters: string;
|
|
27
28
|
items: Array<EntityResource>;
|
|
28
29
|
superFacet?: number;
|
|
29
|
-
aggregations
|
|
30
|
-
groupedView
|
|
30
|
+
aggregations?: Nullable<AggregationResponseResource>;
|
|
31
|
+
groupedView?: Nullable<GroupedViewResponseResource>;
|
|
31
32
|
getEntityResources(): Array<EntityResource>;
|
|
32
33
|
getFieldFiltersResources(): Array<FieldFilterResponseResource>;
|
|
33
34
|
getFullTextFilterResources(): Array<FullTextResponseResource>;
|
|
@@ -111,11 +111,13 @@ __decorate([
|
|
|
111
111
|
], SearchResponse.prototype, "superFacet", void 0);
|
|
112
112
|
__decorate([
|
|
113
113
|
ta_json_1.JsonProperty("aggregations"),
|
|
114
|
-
|
|
114
|
+
ta_json_1.JsonType(aggregation_response_resource_1.AggregationResponseResource),
|
|
115
|
+
__metadata("design:type", Object)
|
|
115
116
|
], SearchResponse.prototype, "aggregations", void 0);
|
|
116
117
|
__decorate([
|
|
117
118
|
ta_json_1.JsonProperty("grouped_view"),
|
|
118
|
-
|
|
119
|
+
ta_json_1.JsonType(grouped_view_response_resource_1.GroupedViewResponseResource),
|
|
120
|
+
__metadata("design:type", Object)
|
|
119
121
|
], SearchResponse.prototype, "groupedView", void 0);
|
|
120
122
|
SearchResponse = __decorate([
|
|
121
123
|
ta_json_1.JsonObject()
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Not exported for now
|
|
3
|
+
// import { ReadableUploadSource } from "../../base-types";
|
|
4
|
+
// import { IUploadSource } from "../../contracts/upload/upload-source";
|
|
5
|
+
// import Guard from "../../guard";
|
|
6
|
+
// export class ArrayBufferUploadSource implements IUploadSource {
|
|
7
|
+
// constructor(private buffer: ArrayBuffer, name: string) {
|
|
8
|
+
// Guard.notNull(buffer);
|
|
9
|
+
// Guard.stringNotNullOrEmpty(name);
|
|
10
|
+
// this.name = name;
|
|
11
|
+
// }
|
|
12
|
+
// name: string;
|
|
13
|
+
// getReadableSourceAsync(): Promise<ReadableUploadSource> {
|
|
14
|
+
// return Promise.resolve(this.buffer);
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateUploadResponse = void 0;
|
|
13
|
+
const ta_json_1 = require("ta-json");
|
|
14
|
+
let CreateUploadResponse = class CreateUploadResponse {
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
ta_json_1.JsonProperty("upload_identifier"),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], CreateUploadResponse.prototype, "uploadIdentifier", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
ta_json_1.JsonProperty("file_identifier"),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CreateUploadResponse.prototype, "fileIdentifier", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
ta_json_1.JsonProperty("storage_identifier"),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], CreateUploadResponse.prototype, "storageIdentifier", void 0);
|
|
28
|
+
CreateUploadResponse = __decorate([
|
|
29
|
+
ta_json_1.JsonObject()
|
|
30
|
+
], CreateUploadResponse);
|
|
31
|
+
exports.CreateUploadResponse = CreateUploadResponse;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="urijs" />
|
|
2
|
+
import { ReadableUploadSource } from "../../base-types";
|
|
3
|
+
import { IUploadSource } from "../../contracts/upload/upload-source";
|
|
4
|
+
export declare class HttpUploadSource implements IUploadSource {
|
|
5
|
+
private uri;
|
|
6
|
+
private static HTTP_SCHEMA;
|
|
7
|
+
private static HTTPS_SCHEMA;
|
|
8
|
+
constructor(uri: URI, name?: string);
|
|
9
|
+
name: string;
|
|
10
|
+
getReadableSourceAsync(): Promise<ReadableUploadSource>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.HttpUploadSource = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
class HttpUploadSource {
|
|
18
|
+
constructor(uri, name = "") {
|
|
19
|
+
this.uri = uri;
|
|
20
|
+
if (uri.scheme() !== HttpUploadSource.HTTP_SCHEMA && uri.scheme() !== HttpUploadSource.HTTPS_SCHEMA) {
|
|
21
|
+
throw Error(`'${uri.protocol}' is not a valid upload source.`);
|
|
22
|
+
}
|
|
23
|
+
this.name = name.length > 0 ? name : uri.filename();
|
|
24
|
+
}
|
|
25
|
+
getReadableSourceAsync() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield axios_1.default.get(this.uri.href(), { responseType: "arraybuffer" });
|
|
28
|
+
return response.data;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.HttpUploadSource = HttpUploadSource;
|
|
33
|
+
HttpUploadSource.HTTP_SCHEMA = "http";
|
|
34
|
+
HttpUploadSource.HTTPS_SCHEMA = "https";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReadableUploadSource } from "../../base-types";
|
|
2
|
+
import { IUploadSource } from "../../contracts/upload/upload-source";
|
|
3
|
+
export declare class LocalUploadSource implements IUploadSource {
|
|
4
|
+
private _uri;
|
|
5
|
+
constructor(path: string, name?: string);
|
|
6
|
+
name: string;
|
|
7
|
+
getReadableSourceAsync(): Promise<ReadableUploadSource>;
|
|
8
|
+
private isStandardBrowserEnv;
|
|
9
|
+
private ensureNonBrowserEnvironment;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LocalUploadSource = void 0;
|
|
16
|
+
const urijs_1 = __importDefault(require("urijs"));
|
|
17
|
+
class LocalUploadSource {
|
|
18
|
+
constructor(path, name = "") {
|
|
19
|
+
this.ensureNonBrowserEnvironment();
|
|
20
|
+
this._uri = new urijs_1.default(path);
|
|
21
|
+
if (this._uri.protocol() !== "file") {
|
|
22
|
+
throw new Error("Invalid protocol. Only paths using the file protocol are supported.");
|
|
23
|
+
}
|
|
24
|
+
this.name = name.length > 0 ? name : this._uri.filename();
|
|
25
|
+
}
|
|
26
|
+
getReadableSourceAsync() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
this.ensureNonBrowserEnvironment();
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
+
const fs = require("fs");
|
|
31
|
+
const buffer = fs.readFileSync(this._uri.path());
|
|
32
|
+
return Promise.resolve(buffer);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// https://github.com/axios/axios/blob/16aa2ce7fa42e7c46407b78966b7521d8e588a72/lib/utils.js#L208-L218
|
|
36
|
+
isStandardBrowserEnv() {
|
|
37
|
+
if (typeof navigator !== "undefined" &&
|
|
38
|
+
(navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
42
|
+
}
|
|
43
|
+
ensureNonBrowserEnvironment() {
|
|
44
|
+
if (this.isStandardBrowserEnv()) {
|
|
45
|
+
throw Error("LocalUploadSource is not supported when running in a browser environment.");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.LocalUploadSource = LocalUploadSource;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UploadAction = void 0;
|
|
16
|
+
const ta_json_1 = require("ta-json");
|
|
17
|
+
const guard_1 = __importDefault(require("../../guard"));
|
|
18
|
+
let UploadAction = class UploadAction {
|
|
19
|
+
constructor(name, parameters) {
|
|
20
|
+
guard_1.default.stringNotNullOrEmpty(name);
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.parameters = parameters;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
__decorate([
|
|
26
|
+
ta_json_1.JsonProperty("name"),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], UploadAction.prototype, "name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
ta_json_1.JsonProperty("parameters"),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], UploadAction.prototype, "parameters", void 0);
|
|
33
|
+
UploadAction = __decorate([
|
|
34
|
+
ta_json_1.JsonObject(),
|
|
35
|
+
__metadata("design:paramtypes", [String, Object])
|
|
36
|
+
], UploadAction);
|
|
37
|
+
exports.UploadAction = UploadAction;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UploadConfiguration = void 0;
|
|
16
|
+
const ta_json_1 = require("ta-json");
|
|
17
|
+
const guard_1 = __importDefault(require("../../guard"));
|
|
18
|
+
let UploadConfiguration = class UploadConfiguration {
|
|
19
|
+
constructor(name, parameters) {
|
|
20
|
+
guard_1.default.stringNotNullOrEmpty(name);
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.parameters = parameters;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
__decorate([
|
|
26
|
+
ta_json_1.JsonProperty("name"),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], UploadConfiguration.prototype, "name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
ta_json_1.JsonProperty("parameters"),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], UploadConfiguration.prototype, "parameters", void 0);
|
|
33
|
+
UploadConfiguration = __decorate([
|
|
34
|
+
ta_json_1.JsonObject(),
|
|
35
|
+
__metadata("design:paramtypes", [String, Object])
|
|
36
|
+
], UploadConfiguration);
|
|
37
|
+
exports.UploadConfiguration = UploadConfiguration;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UploadAction } from "./upload-action";
|
|
2
|
+
import { UploadConfiguration } from "./upload-configuration";
|
|
3
|
+
export declare class UploadRequestWrapper {
|
|
4
|
+
fileName: string;
|
|
5
|
+
fileSize: number;
|
|
6
|
+
uploadConfiguration: UploadConfiguration;
|
|
7
|
+
action: UploadAction;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UploadRequestWrapper = void 0;
|
|
13
|
+
const ta_json_1 = require("ta-json");
|
|
14
|
+
const upload_action_1 = require("./upload-action");
|
|
15
|
+
const upload_configuration_1 = require("./upload-configuration");
|
|
16
|
+
let UploadRequestWrapper = class UploadRequestWrapper {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
ta_json_1.JsonProperty("file_name"),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], UploadRequestWrapper.prototype, "fileName", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
ta_json_1.JsonProperty("file_size"),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], UploadRequestWrapper.prototype, "fileSize", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
ta_json_1.JsonProperty("upload_configuration"),
|
|
28
|
+
ta_json_1.JsonElementType(upload_configuration_1.UploadConfiguration),
|
|
29
|
+
__metadata("design:type", upload_configuration_1.UploadConfiguration)
|
|
30
|
+
], UploadRequestWrapper.prototype, "uploadConfiguration", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
ta_json_1.JsonProperty("action"),
|
|
33
|
+
ta_json_1.JsonElementType(upload_action_1.UploadAction),
|
|
34
|
+
__metadata("design:type", upload_action_1.UploadAction)
|
|
35
|
+
], UploadRequestWrapper.prototype, "action", void 0);
|
|
36
|
+
UploadRequestWrapper = __decorate([
|
|
37
|
+
ta_json_1.JsonObject()
|
|
38
|
+
], UploadRequestWrapper);
|
|
39
|
+
exports.UploadRequestWrapper = UploadRequestWrapper;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MapStringTo } from "../../base-types";
|
|
2
|
+
import { IUploadSource } from "../../contracts/upload/upload-source";
|
|
3
|
+
export declare class UploadRequest {
|
|
4
|
+
constructor(source: IUploadSource, configurationName: string, actionName: string);
|
|
5
|
+
source: IUploadSource;
|
|
6
|
+
configurationName: string;
|
|
7
|
+
configurationParameters?: MapStringTo<unknown>;
|
|
8
|
+
actionName: string;
|
|
9
|
+
actionParameters?: MapStringTo<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UploadRequest = void 0;
|
|
7
|
+
const guard_1 = __importDefault(require("../../guard"));
|
|
8
|
+
class UploadRequest {
|
|
9
|
+
constructor(source, configurationName, actionName) {
|
|
10
|
+
guard_1.default.notNull(source);
|
|
11
|
+
guard_1.default.stringNotNullOrEmpty(configurationName);
|
|
12
|
+
guard_1.default.stringNotNullOrEmpty(actionName);
|
|
13
|
+
this.source = source;
|
|
14
|
+
this.configurationName = configurationName;
|
|
15
|
+
this.actionName = actionName;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.UploadRequest = UploadRequest;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Link from "../link";
|
|
2
|
+
import Resource from "./resource";
|
|
3
|
+
export declare class EntityPermissionPolicy {
|
|
4
|
+
isGroupPolicy: boolean;
|
|
5
|
+
policy: Link;
|
|
6
|
+
policyRuleIdentifiers: Array<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare class EntityPermission {
|
|
9
|
+
permission: string;
|
|
10
|
+
policies: Array<EntityPermissionPolicy>;
|
|
11
|
+
}
|
|
12
|
+
export declare class UserEntityPermissionsResource extends Resource {
|
|
13
|
+
permissions: Array<EntityPermission>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UserEntityPermissionsResource = exports.EntityPermission = exports.EntityPermissionPolicy = void 0;
|
|
16
|
+
const ta_json_1 = require("ta-json");
|
|
17
|
+
const link_1 = __importDefault(require("../link"));
|
|
18
|
+
const resource_1 = __importDefault(require("./resource"));
|
|
19
|
+
let EntityPermissionPolicy = class EntityPermissionPolicy {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.policyRuleIdentifiers = [];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorate([
|
|
25
|
+
ta_json_1.JsonProperty("is_group_policy"),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], EntityPermissionPolicy.prototype, "isGroupPolicy", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
ta_json_1.JsonProperty("policy"),
|
|
30
|
+
__metadata("design:type", link_1.default)
|
|
31
|
+
], EntityPermissionPolicy.prototype, "policy", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
ta_json_1.JsonProperty("rule_identifiers"),
|
|
34
|
+
ta_json_1.JsonElementType(String),
|
|
35
|
+
__metadata("design:type", Array)
|
|
36
|
+
], EntityPermissionPolicy.prototype, "policyRuleIdentifiers", void 0);
|
|
37
|
+
EntityPermissionPolicy = __decorate([
|
|
38
|
+
ta_json_1.JsonObject()
|
|
39
|
+
], EntityPermissionPolicy);
|
|
40
|
+
exports.EntityPermissionPolicy = EntityPermissionPolicy;
|
|
41
|
+
let EntityPermission = class EntityPermission {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.policies = [];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorate([
|
|
47
|
+
ta_json_1.JsonProperty("permission"),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], EntityPermission.prototype, "permission", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
ta_json_1.JsonProperty("policies"),
|
|
52
|
+
ta_json_1.JsonElementType(EntityPermissionPolicy),
|
|
53
|
+
__metadata("design:type", Array)
|
|
54
|
+
], EntityPermission.prototype, "policies", void 0);
|
|
55
|
+
EntityPermission = __decorate([
|
|
56
|
+
ta_json_1.JsonObject()
|
|
57
|
+
], EntityPermission);
|
|
58
|
+
exports.EntityPermission = EntityPermission;
|
|
59
|
+
let UserEntityPermissionsResource = class UserEntityPermissionsResource extends resource_1.default {
|
|
60
|
+
};
|
|
61
|
+
__decorate([
|
|
62
|
+
ta_json_1.JsonProperty("permissions"),
|
|
63
|
+
ta_json_1.JsonElementType(EntityPermission),
|
|
64
|
+
__metadata("design:type", Array)
|
|
65
|
+
], UserEntityPermissionsResource.prototype, "permissions", void 0);
|
|
66
|
+
UserEntityPermissionsResource = __decorate([
|
|
67
|
+
ta_json_1.JsonObject()
|
|
68
|
+
], UserEntityPermissionsResource);
|
|
69
|
+
exports.UserEntityPermissionsResource = UserEntityPermissionsResource;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Compatibility = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Describes the compatibility types.
|
|
6
|
+
*/
|
|
7
|
+
var Compatibility;
|
|
8
|
+
(function (Compatibility) {
|
|
9
|
+
/**
|
|
10
|
+
* Compatible.
|
|
11
|
+
*/
|
|
12
|
+
Compatibility[Compatibility["Ok"] = 0] = "Ok";
|
|
13
|
+
/**
|
|
14
|
+
* SDK is older.
|
|
15
|
+
*/
|
|
16
|
+
Compatibility[Compatibility["SdkOld"] = 1] = "SdkOld";
|
|
17
|
+
/**
|
|
18
|
+
* SDK is newer.
|
|
19
|
+
*/
|
|
20
|
+
Compatibility[Compatibility["SdkNew"] = 2] = "SdkNew";
|
|
21
|
+
})(Compatibility = exports.Compatibility || (exports.Compatibility = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function chunk<T>(array: Array<T>, size: number): Array<Array<T>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chunk = void 0;
|
|
4
|
+
function chunk(array, size) {
|
|
5
|
+
const chunks = [];
|
|
6
|
+
const tmp = [...array];
|
|
7
|
+
if (size <= 0) {
|
|
8
|
+
return chunks;
|
|
9
|
+
}
|
|
10
|
+
while (tmp.length) {
|
|
11
|
+
chunks.push(tmp.splice(0, size));
|
|
12
|
+
}
|
|
13
|
+
return chunks;
|
|
14
|
+
}
|
|
15
|
+
exports.chunk = chunk;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore/sc-contenthub-webclient-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Sitecore Content Hub WebClient SDK.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && npm run test && tsc && npm run lint",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"lint": "eslint . --ext .ts,.tsx",
|
|
10
10
|
"test": "jest --forceExit --verbose --detectOpenHandles",
|
|
11
11
|
"watch-test": "npm run test -- --watchAll",
|
|
12
|
-
"clean": "rimraf dist/"
|
|
12
|
+
"clean": "rimraf dist/",
|
|
13
|
+
"version": "echo $npm_package_version"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -43,15 +44,9 @@
|
|
|
43
44
|
"types": "dist/index.d.ts",
|
|
44
45
|
"license": "MIT",
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@types/urijs": "^1.19.9",
|
|
47
47
|
"axios": "^0.19.2",
|
|
48
|
-
"axios-debug-log": "^0.7.0",
|
|
49
48
|
"axios-extensions": "^3.1.3",
|
|
50
|
-
"dotenv": "^8.2.0",
|
|
51
49
|
"http-status-codes": "^1.4.0",
|
|
52
|
-
"json-stable-stringify": "^1.0.1",
|
|
53
|
-
"lodash": "^4.17.15",
|
|
54
|
-
"moment": "^2.26.0",
|
|
55
50
|
"ow": "0.15.0",
|
|
56
51
|
"string-format": "^2.0.0",
|
|
57
52
|
"ta-json": "^2.5.0",
|
|
@@ -59,12 +54,13 @@
|
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@types/dotenv": "^8.2.0",
|
|
57
|
+
"@types/form-data": "2.2.1",
|
|
62
58
|
"@types/jest": "^25.2.3",
|
|
63
|
-
"@types/json-stable-stringify": "^1.0.32",
|
|
64
|
-
"@types/lodash": "^4.14.155",
|
|
65
59
|
"@types/node": "^14.0.13",
|
|
60
|
+
"@types/urijs": "^1.19.9",
|
|
66
61
|
"@typescript-eslint/eslint-plugin": "^3.3.0",
|
|
67
62
|
"@typescript-eslint/parser": "^3.3.0",
|
|
63
|
+
"dotenv": "^8.2.0",
|
|
68
64
|
"eslint": "^7.2.0",
|
|
69
65
|
"eslint-config-prettier": "^6.11.0",
|
|
70
66
|
"eslint-plugin-prettier": "^3.1.4",
|