@sitecore/sc-contenthub-webclient-sdk 1.0.6 → 1.1.0
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/dist/clients/commands-client.d.ts +10 -0
- package/dist/clients/commands-client.js +9 -1
- package/dist/clients/internal-client.js +1 -0
- package/dist/clients/notifications-client.js +1 -1
- package/dist/clients/raw-client.js +1 -0
- package/dist/clients/request-message.js +1 -0
- package/dist/clients/response-handler.js +2 -0
- package/dist/clients/schema-querying.js +1 -0
- package/dist/clients/upload-client.js +1 -0
- package/dist/contracts/base/culture-insensitive-property.d.ts +1 -1
- package/dist/contracts/base/culture-insensitive-property.js +2 -2
- package/dist/contracts/base/culture-sensitive-property.d.ts +1 -1
- package/dist/contracts/base/culture-sensitive-property.js +7 -5
- package/dist/contracts/base/entity.d.ts +18 -0
- package/dist/contracts/base/member-condition.js +20 -20
- package/dist/contracts/base/member-definition.d.ts +10 -0
- package/dist/contracts/base/member-definition.js +8 -0
- package/dist/contracts/base/property-definition.d.ts +10 -0
- package/dist/contracts/base/property-definition.js +8 -0
- package/dist/contracts/base/property-manager.js +3 -1
- package/dist/contracts/base/property.d.ts +3 -1
- package/dist/contracts/base/property.js +2 -1
- package/dist/contracts/base/relation.d.ts +8 -2
- package/dist/contracts/base/relation.js +4 -3
- package/dist/contracts/base/relations/child-to-many-parents-relation.d.ts +10 -1
- package/dist/contracts/base/relations/child-to-many-parents-relation.js +5 -2
- package/dist/contracts/base/relations/child-to-one-parent-relation.d.ts +9 -2
- package/dist/contracts/base/relations/child-to-one-parent-relation.js +8 -2
- package/dist/contracts/base/relations/parent-to-many-children-relation.d.ts +10 -1
- package/dist/contracts/base/relations/parent-to-many-children-relation.js +5 -2
- package/dist/contracts/base/relations/parent-to-one-child-relation.d.ts +9 -2
- package/dist/contracts/base/relations/parent-to-one-child-relation.js +8 -2
- package/dist/converters/aggregated-entity-relations-converter.d.ts +19 -0
- package/dist/converters/aggregated-entity-relations-converter.js +40 -0
- package/dist/converters/date-converter.d.ts +11 -0
- package/dist/converters/date-converter.js +18 -0
- package/dist/converters/file-version-converter.d.ts +4 -4
- package/dist/converters/file-version-converter.js +6 -6
- package/dist/converters/index.d.ts +1 -0
- package/dist/converters/index.js +1 -0
- package/dist/factories/property-factory.js +1 -1
- package/dist/link-helper.d.ts +8 -6
- package/dist/link-helper.js +33 -22
- package/dist/logging/logger-base.js +1 -0
- package/dist/mappers/condition-mapper.js +2 -2
- package/dist/mappers/entity-mapper.js +34 -7
- package/dist/mappers/load-options-mapper.js +4 -2
- package/dist/mappers/member-condition-mapper.js +2 -2
- package/dist/mappers/member-definition-mapper.js +15 -2
- package/dist/mappers/member-security-mapper.js +2 -2
- package/dist/mappers/option-list-mapper.js +3 -3
- package/dist/mappers/property-mapper.js +34 -17
- package/dist/mappers/querying-mapper.js +6 -6
- package/dist/mappers/relation-cardinality-mapper.js +1 -1
- package/dist/mappers/relation-mapper.d.ts +1 -1
- package/dist/mappers/relation-mapper.js +63 -23
- package/dist/mappers/rendition-mapper.d.ts +3 -0
- package/dist/mappers/rendition-mapper.js +10 -0
- package/dist/mappers/rules-mapper.js +2 -2
- package/dist/mappers/typed-entity-creator.js +19 -18
- package/dist/models/aggregate-resources/aggregate-resource.d.ts +2 -1
- package/dist/models/aggregate-resources/aggregate-resource.js +2 -1
- package/dist/models/aggregate-resources/aggregated-entity-resource.js +2 -2
- package/dist/models/entity-resource.d.ts +2 -0
- package/dist/models/entity-resource.js +12 -0
- package/dist/models/member-definition-resource.d.ts +2 -0
- package/dist/models/member-definition-resource.js +8 -0
- package/dist/models/pages/page-component-resource.d.ts +2 -1
- package/dist/models/pages/page-component-resource.js +4 -0
- package/dist/models/property-definition-resource.d.ts +3 -0
- package/dist/models/property-definition-resource.js +12 -0
- package/dist/models/search/requested-filter-type.d.ts +2 -1
- package/dist/models/search/requested-filter-type.js +1 -0
- package/dist/models/upload/array-buffer-upload-source.js +15 -15
- package/package.json +3 -3
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { IExtendedContentHubClient } from "./extended-client";
|
|
2
|
+
import { ResponseMessage } from "./response-message";
|
|
2
3
|
export interface ICommandsClient {
|
|
4
|
+
/**
|
|
5
|
+
* Executes a Content Hub command.
|
|
6
|
+
* @param namespace - The name of the folder containing the command
|
|
7
|
+
* @param command - The name of the command
|
|
8
|
+
* @param args - The arguments of the command or null/undefined if the command has no arguments
|
|
9
|
+
* @returns The raw HTTP response.
|
|
10
|
+
*/
|
|
11
|
+
executeCommandRawAsync(namespace: string, command: string, args?: unknown): Promise<ResponseMessage<unknown>>;
|
|
3
12
|
/**
|
|
4
13
|
* Executes a Content Hub command.
|
|
5
14
|
* @param namespace - The name of the folder containing the command
|
|
@@ -12,5 +21,6 @@ export interface ICommandsClient {
|
|
|
12
21
|
export declare class CommandsClient implements ICommandsClient {
|
|
13
22
|
private readonly _client;
|
|
14
23
|
constructor(client: IExtendedContentHubClient);
|
|
24
|
+
executeCommandRawAsync(namespace: string, command: string, args?: unknown): Promise<ResponseMessage<unknown>>;
|
|
15
25
|
executeCommandAsync(namespace: string, command: string, args?: unknown): Promise<unknown>;
|
|
16
26
|
}
|
|
@@ -21,7 +21,7 @@ class CommandsClient {
|
|
|
21
21
|
guard_1.default.notNull(client);
|
|
22
22
|
this._client = client;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
executeCommandRawAsync(namespace, command, args = null) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
guard_1.default.stringNotNullOrEmpty(namespace);
|
|
27
27
|
guard_1.default.stringNotNullOrEmpty(command);
|
|
@@ -29,6 +29,14 @@ class CommandsClient {
|
|
|
29
29
|
const content = ta_json_1.TaJson.serialize(args !== null && args !== void 0 ? args : {});
|
|
30
30
|
const response = yield this._client.raw.postAsync(link.href, content);
|
|
31
31
|
response_handler_1.ResponseHandler.handleErrors(response);
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
executeCommandAsync(namespace, command, args = null) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
guard_1.default.stringNotNullOrEmpty(namespace);
|
|
38
|
+
guard_1.default.stringNotNullOrEmpty(command);
|
|
39
|
+
const response = yield this.executeCommandRawAsync(namespace, command, args);
|
|
32
40
|
let result = null;
|
|
33
41
|
if (response.content != null) {
|
|
34
42
|
result = response.content;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* istanbul ignore file */
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -26,7 +26,7 @@ class NotificationsClient {
|
|
|
26
26
|
this._client = client;
|
|
27
27
|
}
|
|
28
28
|
//! Not necessary for now, can be added later (lots of boilerplate)
|
|
29
|
-
// public async getMailTemplateAsync(name: string, loadConfiguration: Nullable<IEntityLoadConfiguration> = null)
|
|
29
|
+
// // public async getMailTemplateAsync(name: string, loadConfiguration: Nullable<IEntityLoadConfiguration> = null)
|
|
30
30
|
sendConfirmationEmailAsync(users) {
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
let userIds = [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* istanbul ignore file */
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -68,6 +68,7 @@ class ResponseHandler {
|
|
|
68
68
|
if (responseMessage.statusCode !== HttpStatus.BAD_REQUEST) {
|
|
69
69
|
throw new argument_error_1.ArgumentError(`Can not process failed request with status code '${responseMessage.statusCode}'.`);
|
|
70
70
|
}
|
|
71
|
+
/* istanbul ignore if */
|
|
71
72
|
if (responseMessage.content != null) {
|
|
72
73
|
let json;
|
|
73
74
|
if (typeof responseMessage.content === "string") {
|
|
@@ -102,6 +103,7 @@ class ResponseHandler {
|
|
|
102
103
|
throw new argument_error_1.ArgumentError(`Can not process successful request (code: ${responseMessage.statusCode}).`);
|
|
103
104
|
}
|
|
104
105
|
let message = null;
|
|
106
|
+
/* istanbul ignore if */
|
|
105
107
|
if (responseMessage.content != null) {
|
|
106
108
|
let json;
|
|
107
109
|
try {
|
|
@@ -34,6 +34,7 @@ class SchemaQuerying {
|
|
|
34
34
|
const routes = yield this._client.api.getApiRoutesAsync();
|
|
35
35
|
const queryEndpoint = routes[api_1.QUERY.templateName];
|
|
36
36
|
let uri;
|
|
37
|
+
/* istanbul ignore next */
|
|
37
38
|
if (queryEndpoint.templated) {
|
|
38
39
|
const uriTemplate = new URITemplate_1.default(queryEndpoint.href);
|
|
39
40
|
uri = uriTemplate.expand({});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* istanbul ignore file */
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,7 +19,7 @@ export declare class CultureInsensitiveProperty<T extends PropertyDataType | unk
|
|
|
19
19
|
isTracking: boolean;
|
|
20
20
|
readonly isMultiLanguage: false;
|
|
21
21
|
get isDirty(): boolean;
|
|
22
|
-
constructor(name: string, typeInfo: TypeInfo<T, B>, value?: B extends true ? Nullable<Array<Type<T>>> : Nullable<Type<T
|
|
22
|
+
constructor(name: string, typeInfo: TypeInfo<T, B>, value?: B extends true ? Nullable<Array<Type<T>>> : Nullable<Type<T>>, hasDataSource?: boolean);
|
|
23
23
|
getValue(): B extends true ? Nullable<Array<Type<T>>> : Nullable<Type<T>>;
|
|
24
24
|
setValue(value: B extends true ? Nullable<Array<Type<T>>> : Nullable<Type<T>>): void;
|
|
25
25
|
getTypeName(): string;
|
|
@@ -7,8 +7,8 @@ exports.CultureInsensitiveProperty = void 0;
|
|
|
7
7
|
const dirty_value_calculator_1 = __importDefault(require("../../dirty-value-calculator"));
|
|
8
8
|
const property_1 = require("./property");
|
|
9
9
|
class CultureInsensitiveProperty extends property_1.PropertyBase {
|
|
10
|
-
constructor(name, typeInfo, value) {
|
|
11
|
-
super(name, typeInfo);
|
|
10
|
+
constructor(name, typeInfo, value, hasDataSource = false) {
|
|
11
|
+
super(name, typeInfo, hasDataSource);
|
|
12
12
|
this.isMultiLanguage = false;
|
|
13
13
|
if (value !== undefined) {
|
|
14
14
|
this._value = value; //TODO clone?
|
|
@@ -35,7 +35,7 @@ export declare class CultureSensitiveProperty<T extends PropertyDataType | unkno
|
|
|
35
35
|
readonly isMultiLanguage: true;
|
|
36
36
|
isTracking: boolean;
|
|
37
37
|
get isDirty(): boolean;
|
|
38
|
-
constructor(name: string, typeInfo: TypeInfo<T, B>, loadedCultures: Array<CultureInfo>, values?: PropertyValuePerCulture<T, B
|
|
38
|
+
constructor(name: string, typeInfo: TypeInfo<T, B>, loadedCultures: Array<CultureInfo>, values?: PropertyValuePerCulture<T, B>, hasDataSource?: boolean);
|
|
39
39
|
getTypeName(): string;
|
|
40
40
|
getValue(culture: CultureInfo): PropertyValue<T, B>;
|
|
41
41
|
getValues(cultures?: Array<CultureInfo>): PropertyValuePerCulture<T, B>;
|
|
@@ -8,16 +8,18 @@ const dirty_value_calculator_1 = __importDefault(require("../../dirty-value-calc
|
|
|
8
8
|
const guard_1 = __importDefault(require("../../guard"));
|
|
9
9
|
const property_1 = require("./property");
|
|
10
10
|
class CultureSensitiveProperty extends property_1.PropertyBase {
|
|
11
|
-
constructor(name, typeInfo, loadedCultures, values) {
|
|
12
|
-
super(name, typeInfo);
|
|
11
|
+
constructor(name, typeInfo, loadedCultures, values, hasDataSource = false) {
|
|
12
|
+
super(name, typeInfo, hasDataSource);
|
|
13
13
|
this._dirtyValueCalculators = {};
|
|
14
14
|
guard_1.default.arrayNotEmpty(loadedCultures);
|
|
15
15
|
loadedCultures.forEach(guard_1.default.notInvariantCulture);
|
|
16
16
|
this.isMultiLanguage = true;
|
|
17
|
-
this._values = {};
|
|
18
17
|
this._loadedCultures = [...new Set(loadedCultures)];
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
this._values = this._loadedCultures.reduce((defaultValues, culture) => {
|
|
19
|
+
defaultValues[culture] = null;
|
|
20
|
+
return defaultValues;
|
|
21
|
+
}, {});
|
|
22
|
+
if (values != null) {
|
|
21
23
|
Object.keys(values).forEach((culture) => {
|
|
22
24
|
this._values[culture] = values[culture]; //? Deep copy?
|
|
23
25
|
});
|
|
@@ -15,6 +15,7 @@ import { IRelation } from "./relation";
|
|
|
15
15
|
import { RelationRole } from "./relation-role";
|
|
16
16
|
import { IRendition } from "./rendition";
|
|
17
17
|
import IResource from "./resource";
|
|
18
|
+
import Link from "link";
|
|
18
19
|
/**
|
|
19
20
|
* Interface for an entity.
|
|
20
21
|
*/
|
|
@@ -80,6 +81,15 @@ export interface IEntity extends IResource, IDirtyTracking {
|
|
|
80
81
|
* Gets or sets a value indicating whether the entity is the default for the given entity definition for the current user.
|
|
81
82
|
*/
|
|
82
83
|
isCurrentUserDefault?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Gets or sets a value indicating whether this language is supported ootb or not.
|
|
86
|
+
* This value will only be set for Portal.Language entities.
|
|
87
|
+
*/
|
|
88
|
+
languageSupportedOotb?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Gets or sets a value indicating whether this entity has at least one public link.
|
|
91
|
+
*/
|
|
92
|
+
hasPublicLink?: boolean;
|
|
83
93
|
/**
|
|
84
94
|
* Gets or sets a value indicating whether the entity is enabled or not.
|
|
85
95
|
*/
|
|
@@ -110,6 +120,14 @@ export interface IEntity extends IResource, IDirtyTracking {
|
|
|
110
120
|
* Checks if lazy loading is possible. Lazy loading is only possible on persisted entities.
|
|
111
121
|
*/
|
|
112
122
|
readonly canDoLazyLoading: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Gets the link to fetch the roles for this entity.
|
|
125
|
+
*/
|
|
126
|
+
roles?: Link;
|
|
127
|
+
/**
|
|
128
|
+
* Gets the link to fetch the permissions for this entity.
|
|
129
|
+
*/
|
|
130
|
+
permissions?: Link;
|
|
113
131
|
/**
|
|
114
132
|
* Gets property by its name.
|
|
115
133
|
* @param name - The name of the property
|
|
@@ -29,26 +29,26 @@ MemberCondition = __decorate([
|
|
|
29
29
|
__metadata("design:paramtypes", [String])
|
|
30
30
|
], MemberCondition);
|
|
31
31
|
exports.MemberCondition = MemberCondition;
|
|
32
|
-
// /**
|
|
33
|
-
// * Condition triggered on the value of the property member or ancestor id of the relation.
|
|
34
|
-
// */
|
|
35
|
-
// export class MemberValueCondition extends MemberCondition {
|
|
36
|
-
// /**
|
|
37
|
-
// * Non {@link null} case insensitive and culture agnostic value which is compared against
|
|
38
|
-
// * entity property value or relation member taxonomy ancestors. Possible types of this
|
|
39
|
-
// * value are {@link string} or {@link number}.
|
|
40
|
-
// * Note that an empty string is treated as unspecified value not triggering the condition.
|
|
41
|
-
// */
|
|
42
|
-
// @JsonProperty("value")
|
|
43
|
-
// value: number|string;
|
|
44
|
-
//
|
|
45
|
-
// constructor(memberName: string, value: number|string) {
|
|
46
|
-
// super(memberName);
|
|
47
|
-
// Guard.notNullOrUndefined(value);
|
|
48
|
-
//
|
|
49
|
-
// this.value = value;
|
|
50
|
-
// }
|
|
51
|
-
// }
|
|
32
|
+
// // /**
|
|
33
|
+
// // * Condition triggered on the value of the property member or ancestor id of the relation.
|
|
34
|
+
// // */
|
|
35
|
+
// // export class MemberValueCondition extends MemberCondition {
|
|
36
|
+
// // /**
|
|
37
|
+
// // * Non {@link null} case insensitive and culture agnostic value which is compared against
|
|
38
|
+
// // * entity property value or relation member taxonomy ancestors. Possible types of this
|
|
39
|
+
// // * value are {@link string} or {@link number}.
|
|
40
|
+
// // * Note that an empty string is treated as unspecified value not triggering the condition.
|
|
41
|
+
// // */
|
|
42
|
+
// // @JsonProperty("value")
|
|
43
|
+
// // value: number|string;
|
|
44
|
+
// //
|
|
45
|
+
// // constructor(memberName: string, value: number|string) {
|
|
46
|
+
// // super(memberName);
|
|
47
|
+
// // Guard.notNullOrUndefined(value);
|
|
48
|
+
// //
|
|
49
|
+
// // this.value = value;
|
|
50
|
+
// // }
|
|
51
|
+
// // }
|
|
52
52
|
/**
|
|
53
53
|
* Condition triggered if the relation does not have ancestor of given definition id.
|
|
54
54
|
*/
|
|
@@ -51,6 +51,14 @@ export interface IMemberDefinition {
|
|
|
51
51
|
* Collection of the culture specific help text.
|
|
52
52
|
*/
|
|
53
53
|
helpText: MapCultureTo<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates whether this member definition can trigger conditional members.
|
|
56
|
+
*/
|
|
57
|
+
canTriggerConditionalMembers: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether this member definition can write.
|
|
60
|
+
*/
|
|
61
|
+
canWrite: boolean;
|
|
54
62
|
}
|
|
55
63
|
export declare abstract class MemberDefinition implements IMemberDefinition {
|
|
56
64
|
readonly type: DataType;
|
|
@@ -61,6 +69,8 @@ export declare abstract class MemberDefinition implements IMemberDefinition {
|
|
|
61
69
|
labels: MapCultureTo<string>;
|
|
62
70
|
helpText: MapCultureTo<string>;
|
|
63
71
|
conditions: Array<IMemberCondition>;
|
|
72
|
+
canTriggerConditionalMembers: boolean;
|
|
73
|
+
canWrite: boolean;
|
|
64
74
|
get isConditional(): boolean;
|
|
65
75
|
abstract get definitionType(): MemberDefinitionType;
|
|
66
76
|
constructor(name: string, type: DataType);
|
|
@@ -93,6 +93,14 @@ __decorate([
|
|
|
93
93
|
ta_json_1.JsonElementType(member_condition_1.MemberCondition),
|
|
94
94
|
__metadata("design:type", Array)
|
|
95
95
|
], MemberDefinition.prototype, "conditions", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
ta_json_1.JsonProperty("can_trigger_conditional_members"),
|
|
98
|
+
__metadata("design:type", Boolean)
|
|
99
|
+
], MemberDefinition.prototype, "canTriggerConditionalMembers", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
ta_json_1.JsonProperty("can_write"),
|
|
102
|
+
__metadata("design:type", Boolean)
|
|
103
|
+
], MemberDefinition.prototype, "canWrite", void 0);
|
|
96
104
|
MemberDefinition = __decorate([
|
|
97
105
|
ta_json_1.JsonObject(),
|
|
98
106
|
ta_json_1.JsonDiscriminatorProperty("type"),
|
|
@@ -44,6 +44,14 @@ export interface IPropertyDefinition extends IMemberDefinition {
|
|
|
44
44
|
* Indicates whether the property value is included in the collection of words used for auto-complete functionality.
|
|
45
45
|
*/
|
|
46
46
|
includeInCompletion: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Indicates whether this member definition should be stored.
|
|
49
|
+
*/
|
|
50
|
+
storedInGraph: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Indicates whether this member definition will be ignored during imports.
|
|
53
|
+
*/
|
|
54
|
+
ignoreOnExport: boolean;
|
|
47
55
|
}
|
|
48
56
|
export declare class PropertyDefinition extends MemberDefinition implements IPropertyDefinition {
|
|
49
57
|
indexed: boolean;
|
|
@@ -54,6 +62,8 @@ export declare class PropertyDefinition extends MemberDefinition implements IPro
|
|
|
54
62
|
boost: boolean;
|
|
55
63
|
includeInContent: boolean;
|
|
56
64
|
includeInCompletion: boolean;
|
|
65
|
+
ignoreOnExport: boolean;
|
|
66
|
+
storedInGraph: boolean;
|
|
57
67
|
get dataType(): PropertyDataType;
|
|
58
68
|
get definitionType(): MemberDefinitionType;
|
|
59
69
|
constructor(name: string, type: PropertyDataType);
|
|
@@ -67,6 +67,14 @@ __decorate([
|
|
|
67
67
|
ta_json_1.JsonProperty("included_in_completion"),
|
|
68
68
|
__metadata("design:type", Boolean)
|
|
69
69
|
], PropertyDefinition.prototype, "includeInCompletion", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
ta_json_1.JsonProperty("ignore_on_export"),
|
|
72
|
+
__metadata("design:type", Boolean)
|
|
73
|
+
], PropertyDefinition.prototype, "ignoreOnExport", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
ta_json_1.JsonProperty("stored_in_graph"),
|
|
76
|
+
__metadata("design:type", Boolean)
|
|
77
|
+
], PropertyDefinition.prototype, "storedInGraph", void 0);
|
|
70
78
|
PropertyDefinition = __decorate([
|
|
71
79
|
ta_json_1.JsonObject(),
|
|
72
80
|
__metadata("design:paramtypes", [String, String])
|
|
@@ -91,7 +91,9 @@ class PropertyManager {
|
|
|
91
91
|
importMissingProperties(entity) {
|
|
92
92
|
guard_1.default.notNullOrUndefined(entity);
|
|
93
93
|
for (const property of entity.properties) {
|
|
94
|
-
this._properties[property.name]
|
|
94
|
+
if (!this._properties[property.name]) {
|
|
95
|
+
this._properties[property.name] = property;
|
|
96
|
+
}
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
fetchPropertyAsync(name) {
|
|
@@ -3,12 +3,14 @@ import { IMember, MemberBase } from "./member";
|
|
|
3
3
|
export interface IProperty extends IMember {
|
|
4
4
|
readonly dataType: PropertyDataType | unknown;
|
|
5
5
|
readonly isMultiLanguage: boolean;
|
|
6
|
+
readonly hasDataSource: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare abstract class PropertyBase<T extends PropertyDataType | unknown, B extends boolean> extends MemberBase implements IProperty {
|
|
8
9
|
readonly dataType: T | unknown;
|
|
9
10
|
readonly isMultiValue: B;
|
|
10
11
|
readonly isMultiLanguage: boolean;
|
|
11
|
-
|
|
12
|
+
readonly hasDataSource: boolean;
|
|
13
|
+
protected constructor(name: string, typeInfo: TypeInfo<T, B>, hasDataSource?: boolean);
|
|
12
14
|
protected abstract getTypeName(): string;
|
|
13
15
|
/**
|
|
14
16
|
* Returns a string representation of the current property instance.
|
|
@@ -9,12 +9,13 @@ const data_type_1 = require("./data-type");
|
|
|
9
9
|
const member_1 = require("./member");
|
|
10
10
|
const member_definition_type_1 = require("./member-definition-type");
|
|
11
11
|
class PropertyBase extends member_1.MemberBase {
|
|
12
|
-
constructor(name, typeInfo) {
|
|
12
|
+
constructor(name, typeInfo, hasDataSource = false) {
|
|
13
13
|
super(name, member_definition_type_1.MemberDefinitionType.Property);
|
|
14
14
|
this.isMultiLanguage = false;
|
|
15
15
|
guard_1.default.notNullOrUndefined(typeInfo);
|
|
16
16
|
this.dataType = typeInfo.type;
|
|
17
17
|
this.isMultiValue = typeInfo.isArray;
|
|
18
|
+
this.hasDataSource = hasDataSource;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Returns a string representation of the current property instance.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../..";
|
|
1
2
|
import DirtyValueCalculator from "../../dirty-value-calculator";
|
|
2
3
|
import { IMember, MemberBase } from "./member";
|
|
3
4
|
import { RelationRole } from "./relation-role";
|
|
@@ -17,6 +18,10 @@ export interface IRelation extends IMember {
|
|
|
17
18
|
* Indicates if multiple values can be linked in the relation's direction.
|
|
18
19
|
*/
|
|
19
20
|
readonly isMultiValue: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Linked entities properties.
|
|
23
|
+
*/
|
|
24
|
+
readonly properties: MapNumberTo<MapStringTo<Object_Unknown>>;
|
|
20
25
|
/**
|
|
21
26
|
* Gets the ids of the linked entities.
|
|
22
27
|
*
|
|
@@ -44,8 +49,9 @@ export interface IRelation extends IMember {
|
|
|
44
49
|
export declare abstract class RelationBase extends MemberBase implements IRelation {
|
|
45
50
|
abstract readonly role: RelationRole;
|
|
46
51
|
abstract readonly isMultiValue: boolean;
|
|
52
|
+
readonly properties: MapNumberTo<MapStringTo<Object_Unknown>>;
|
|
47
53
|
protected _dirtyValueCalculator: DirtyValueCalculator;
|
|
48
|
-
protected constructor(name: string);
|
|
54
|
+
protected constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
49
55
|
abstract getIds(): Array<number>;
|
|
50
56
|
abstract setIds(ids: Array<number>): void;
|
|
51
57
|
abstract clear(): void;
|
|
@@ -66,7 +72,7 @@ export interface IChildRelation extends IRelation {
|
|
|
66
72
|
}
|
|
67
73
|
export declare abstract class ChildRelationBase extends RelationBase implements IChildRelation {
|
|
68
74
|
inheritsSecurity: boolean;
|
|
69
|
-
|
|
75
|
+
constructor(name: string, properties: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
70
76
|
}
|
|
71
77
|
/** Base interface for all parent relations. */
|
|
72
78
|
export interface IParentRelation extends IRelation {
|
|
@@ -5,8 +5,9 @@ const member_1 = require("./member");
|
|
|
5
5
|
const member_definition_type_1 = require("./member-definition-type");
|
|
6
6
|
const relation_role_1 = require("./relation-role");
|
|
7
7
|
class RelationBase extends member_1.MemberBase {
|
|
8
|
-
constructor(name) {
|
|
8
|
+
constructor(name, properties = null) {
|
|
9
9
|
super(name, member_definition_type_1.MemberDefinitionType.Relation);
|
|
10
|
+
this.properties = properties == null ? {} : properties;
|
|
10
11
|
}
|
|
11
12
|
getTypeName() {
|
|
12
13
|
return relation_role_1.RelationRole[this.role];
|
|
@@ -32,8 +33,8 @@ class RelationBase extends member_1.MemberBase {
|
|
|
32
33
|
}
|
|
33
34
|
exports.RelationBase = RelationBase;
|
|
34
35
|
class ChildRelationBase extends RelationBase {
|
|
35
|
-
constructor(name) {
|
|
36
|
-
super(name);
|
|
36
|
+
constructor(name, properties) {
|
|
37
|
+
super(name, properties);
|
|
37
38
|
this.inheritsSecurity = true;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../../..";
|
|
1
2
|
import { ChildRelationBase, IChildRelation } from "../relation";
|
|
2
3
|
import { RelationRole } from "../relation-role";
|
|
3
4
|
import { IToManyRelation } from "./to-many-relation";
|
|
@@ -9,6 +10,13 @@ export interface IChildToManyParentsRelation extends IChildRelation, IToManyRela
|
|
|
9
10
|
* The list of parent ids.
|
|
10
11
|
*/
|
|
11
12
|
readonly parents: Array<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the properties for a parent.
|
|
15
|
+
*
|
|
16
|
+
* If no properties are found, an empty list is returned.
|
|
17
|
+
* @param id - The id of the parent to get properties for
|
|
18
|
+
*/
|
|
19
|
+
getParentProperties(id: number): MapStringTo<Object_Unknown>;
|
|
12
20
|
}
|
|
13
21
|
export declare class ChildToManyParentsRelation extends ChildRelationBase implements IChildToManyParentsRelation {
|
|
14
22
|
private _parents;
|
|
@@ -16,7 +24,7 @@ export declare class ChildToManyParentsRelation extends ChildRelationBase implem
|
|
|
16
24
|
readonly isMultiValue: boolean;
|
|
17
25
|
get isDirty(): boolean;
|
|
18
26
|
get parents(): Array<number>;
|
|
19
|
-
constructor(name: string);
|
|
27
|
+
constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
20
28
|
getIds(): Array<number>;
|
|
21
29
|
setIds(ids: Array<number>): void;
|
|
22
30
|
clear(): void;
|
|
@@ -24,4 +32,5 @@ export declare class ChildToManyParentsRelation extends ChildRelationBase implem
|
|
|
24
32
|
addRange(ids: Array<number>): void;
|
|
25
33
|
startTracking(): void;
|
|
26
34
|
markClean(): void;
|
|
35
|
+
getParentProperties(id: number): MapStringTo<Object_Unknown>;
|
|
27
36
|
}
|
|
@@ -9,8 +9,8 @@ const guard_1 = __importDefault(require("../../../guard"));
|
|
|
9
9
|
const relation_1 = require("../relation");
|
|
10
10
|
const relation_role_1 = require("../relation-role");
|
|
11
11
|
class ChildToManyParentsRelation extends relation_1.ChildRelationBase {
|
|
12
|
-
constructor(name) {
|
|
13
|
-
super(name);
|
|
12
|
+
constructor(name, properties = null) {
|
|
13
|
+
super(name, properties);
|
|
14
14
|
this._parents = [];
|
|
15
15
|
this.role = relation_role_1.RelationRole.Child;
|
|
16
16
|
this.isMultiValue = true;
|
|
@@ -63,5 +63,8 @@ class ChildToManyParentsRelation extends relation_1.ChildRelationBase {
|
|
|
63
63
|
this._dirtyValueCalculator.setOriginalValue(this._parents);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
getParentProperties(id) {
|
|
67
|
+
return this.properties[id] == null ? {} : this.properties[id];
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
exports.ChildToManyParentsRelation = ChildToManyParentsRelation;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Nullable } from "../../../base-types";
|
|
1
|
+
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../../../base-types";
|
|
2
2
|
import { ChildRelationBase, IChildRelation } from "../relation";
|
|
3
3
|
import { RelationRole } from "../relation-role";
|
|
4
4
|
import { IToOneRelation } from "./to-one-relation";
|
|
@@ -7,6 +7,12 @@ export interface IChildToOneParentRelation extends IChildRelation, IToOneRelatio
|
|
|
7
7
|
* The parent id or null.
|
|
8
8
|
*/
|
|
9
9
|
parent: Nullable<number>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the properties for a parent.
|
|
12
|
+
*
|
|
13
|
+
* If no properties are found, an empty list is returned.
|
|
14
|
+
*/
|
|
15
|
+
getParentProperties(): MapStringTo<Object_Unknown>;
|
|
10
16
|
}
|
|
11
17
|
export declare class ChildToOneParentRelation extends ChildRelationBase implements IChildToOneParentRelation {
|
|
12
18
|
private _parent;
|
|
@@ -15,7 +21,7 @@ export declare class ChildToOneParentRelation extends ChildRelationBase implemen
|
|
|
15
21
|
get isDirty(): boolean;
|
|
16
22
|
get parent(): Nullable<number>;
|
|
17
23
|
set parent(id: Nullable<number>);
|
|
18
|
-
constructor(name: string);
|
|
24
|
+
constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
19
25
|
getIds(): Array<number>;
|
|
20
26
|
setIds(ids: Array<number>): void;
|
|
21
27
|
clear(): void;
|
|
@@ -23,4 +29,5 @@ export declare class ChildToOneParentRelation extends ChildRelationBase implemen
|
|
|
23
29
|
setId(id: Nullable<number>): void;
|
|
24
30
|
startTracking(): void;
|
|
25
31
|
markClean(): void;
|
|
32
|
+
getParentProperties(): MapStringTo<Object_Unknown>;
|
|
26
33
|
}
|
|
@@ -9,8 +9,8 @@ const guard_1 = __importDefault(require("../../../guard"));
|
|
|
9
9
|
const relation_1 = require("../relation");
|
|
10
10
|
const relation_role_1 = require("../relation-role");
|
|
11
11
|
class ChildToOneParentRelation extends relation_1.ChildRelationBase {
|
|
12
|
-
constructor(name) {
|
|
13
|
-
super(name);
|
|
12
|
+
constructor(name, properties = null) {
|
|
13
|
+
super(name, properties);
|
|
14
14
|
this._parent = null;
|
|
15
15
|
this.role = relation_role_1.RelationRole.Child;
|
|
16
16
|
this.isMultiValue = false;
|
|
@@ -70,5 +70,11 @@ class ChildToOneParentRelation extends relation_1.ChildRelationBase {
|
|
|
70
70
|
this._dirtyValueCalculator.setOriginalValue(this._parent);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
getParentProperties() {
|
|
74
|
+
if (this._parent == null) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
return this.properties[this._parent] == null ? {} : this.properties[this._parent];
|
|
78
|
+
}
|
|
73
79
|
}
|
|
74
80
|
exports.ChildToOneParentRelation = ChildToOneParentRelation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../../..";
|
|
1
2
|
import { IParentRelation, RelationBase } from "../relation";
|
|
2
3
|
import { RelationRole } from "../relation-role";
|
|
3
4
|
import { IToManyRelation } from "./to-many-relation";
|
|
@@ -9,6 +10,13 @@ export interface IParentToManyChildrenRelation extends IParentRelation, IToManyR
|
|
|
9
10
|
* The list of children ids.
|
|
10
11
|
*/
|
|
11
12
|
readonly children: Array<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the properties for a child.
|
|
15
|
+
*
|
|
16
|
+
* If no properties are found, an empty list is returned.
|
|
17
|
+
* @param id - The id of the child to get properties for
|
|
18
|
+
*/
|
|
19
|
+
getChildProperties(id: number): MapStringTo<Object_Unknown>;
|
|
12
20
|
}
|
|
13
21
|
export declare class ParentToManyChildrenRelation extends RelationBase implements IParentToManyChildrenRelation {
|
|
14
22
|
private _children;
|
|
@@ -16,7 +24,7 @@ export declare class ParentToManyChildrenRelation extends RelationBase implement
|
|
|
16
24
|
readonly isMultiValue: boolean;
|
|
17
25
|
get isDirty(): boolean;
|
|
18
26
|
get children(): Array<number>;
|
|
19
|
-
constructor(name: string);
|
|
27
|
+
constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
20
28
|
getIds(): Array<number>;
|
|
21
29
|
setIds(ids: Array<number>): void;
|
|
22
30
|
clear(): void;
|
|
@@ -24,4 +32,5 @@ export declare class ParentToManyChildrenRelation extends RelationBase implement
|
|
|
24
32
|
addRange(ids: Array<number>): void;
|
|
25
33
|
startTracking(): void;
|
|
26
34
|
markClean(): void;
|
|
35
|
+
getChildProperties(id: number): MapStringTo<Object_Unknown>;
|
|
27
36
|
}
|
|
@@ -9,8 +9,8 @@ const guard_1 = __importDefault(require("../../../guard"));
|
|
|
9
9
|
const relation_1 = require("../relation");
|
|
10
10
|
const relation_role_1 = require("../relation-role");
|
|
11
11
|
class ParentToManyChildrenRelation extends relation_1.RelationBase {
|
|
12
|
-
constructor(name) {
|
|
13
|
-
super(name);
|
|
12
|
+
constructor(name, properties = null) {
|
|
13
|
+
super(name, properties);
|
|
14
14
|
this._children = [];
|
|
15
15
|
this.role = relation_role_1.RelationRole.Parent;
|
|
16
16
|
this.isMultiValue = true;
|
|
@@ -63,5 +63,8 @@ class ParentToManyChildrenRelation extends relation_1.RelationBase {
|
|
|
63
63
|
this._dirtyValueCalculator.setOriginalValue(this._children);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
getChildProperties(id) {
|
|
67
|
+
return this.properties[id] == null ? {} : this.properties[id];
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
exports.ParentToManyChildrenRelation = ParentToManyChildrenRelation;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Nullable } from "../../../base-types";
|
|
1
|
+
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../../../base-types";
|
|
2
2
|
import { IParentRelation, RelationBase } from "../relation";
|
|
3
3
|
import { RelationRole } from "../relation-role";
|
|
4
4
|
import { IToOneRelation } from "./to-one-relation";
|
|
@@ -10,6 +10,12 @@ export interface IParentToOneChildRelation extends IParentRelation, IToOneRelati
|
|
|
10
10
|
* The child id.
|
|
11
11
|
*/
|
|
12
12
|
child: Nullable<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the properties for a child.
|
|
15
|
+
*
|
|
16
|
+
* If no properties are found, an empty list is returned.
|
|
17
|
+
*/
|
|
18
|
+
getChildProperties(): MapStringTo<Object_Unknown>;
|
|
13
19
|
}
|
|
14
20
|
export declare class ParentToOneChildRelation extends RelationBase implements IParentToOneChildRelation {
|
|
15
21
|
private _child;
|
|
@@ -18,7 +24,7 @@ export declare class ParentToOneChildRelation extends RelationBase implements IP
|
|
|
18
24
|
get child(): Nullable<number>;
|
|
19
25
|
set child(id: Nullable<number>);
|
|
20
26
|
get isDirty(): boolean;
|
|
21
|
-
constructor(name: string);
|
|
27
|
+
constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>);
|
|
22
28
|
getIds(): Array<number>;
|
|
23
29
|
setIds(ids: Array<number>): void;
|
|
24
30
|
clear(): void;
|
|
@@ -26,4 +32,5 @@ export declare class ParentToOneChildRelation extends RelationBase implements IP
|
|
|
26
32
|
setId(id: Nullable<number>): void;
|
|
27
33
|
startTracking(): void;
|
|
28
34
|
markClean(): void;
|
|
35
|
+
getChildProperties(): MapStringTo<Object_Unknown>;
|
|
29
36
|
}
|