@fluid-experimental/property-changeset 1.2.3-83900 → 2.0.0-internal.1.0.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/changeset.d.ts +39 -45
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +39 -45
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +3 -3
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +45 -47
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +2 -2
- package/dist/changeset_operations/indexedCollection.js +2 -2
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +9 -9
- package/dist/helpers/typeidHelper.js +9 -9
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/pathHelper.d.ts +4 -4
- package/dist/pathHelper.js +4 -4
- package/dist/pathHelper.js.map +1 -1
- package/dist/templateValidator.d.ts +6 -6
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +66 -58
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/utils.d.ts +7 -7
- package/dist/utils.js +9 -9
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +4 -4
- package/dist/validationResultBuilder.js +4 -4
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/changeset.js +39 -45
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +45 -47
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +2 -2
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/helpers/typeidHelper.js +9 -9
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/pathHelper.js +4 -4
- package/lib/pathHelper.js.map +1 -1
- package/lib/templateValidator.js +66 -58
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js +9 -9
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.js +4 -4
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +3 -3
|
@@ -19,22 +19,22 @@ export declare class ValidationResultBuilder {
|
|
|
19
19
|
private readonly _result;
|
|
20
20
|
/**
|
|
21
21
|
* Instantiates a ValidationResultBuilder
|
|
22
|
-
* @param in_typeid A template typeid.
|
|
22
|
+
* @param in_typeid - A template typeid.
|
|
23
23
|
*/
|
|
24
24
|
constructor(in_typeid: string);
|
|
25
25
|
/**
|
|
26
26
|
* Add a validation error.
|
|
27
|
-
* @param {Error} in_error An Error instance.
|
|
27
|
+
* @param {Error} in_error - An Error instance.
|
|
28
28
|
*/
|
|
29
29
|
get result(): SchemaValidationResult;
|
|
30
30
|
/**
|
|
31
31
|
* Add a validation error.
|
|
32
|
-
* @param in_error An Error instance.
|
|
32
|
+
* @param in_error - An Error instance.
|
|
33
33
|
*/
|
|
34
34
|
addError(in_error: Error): void;
|
|
35
35
|
/**
|
|
36
36
|
* Add a validation warning.
|
|
37
|
-
* @param in_msg A warning description.
|
|
37
|
+
* @param in_msg - A warning description.
|
|
38
38
|
*/
|
|
39
39
|
addWarning(in_msg: string): void;
|
|
40
40
|
/**
|
|
@@ -13,7 +13,7 @@ exports.ValidationResultBuilder = void 0;
|
|
|
13
13
|
class ValidationResultBuilder {
|
|
14
14
|
/**
|
|
15
15
|
* Instantiates a ValidationResultBuilder
|
|
16
|
-
* @param in_typeid A template typeid.
|
|
16
|
+
* @param in_typeid - A template typeid.
|
|
17
17
|
*/
|
|
18
18
|
constructor(in_typeid) {
|
|
19
19
|
this._result = {
|
|
@@ -29,14 +29,14 @@ class ValidationResultBuilder {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Add a validation error.
|
|
32
|
-
* @param {Error} in_error An Error instance.
|
|
32
|
+
* @param {Error} in_error - An Error instance.
|
|
33
33
|
*/
|
|
34
34
|
get result() {
|
|
35
35
|
return this._result;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Add a validation error.
|
|
39
|
-
* @param in_error An Error instance.
|
|
39
|
+
* @param in_error - An Error instance.
|
|
40
40
|
*/
|
|
41
41
|
addError(in_error) {
|
|
42
42
|
this._result.isValid = false;
|
|
@@ -47,7 +47,7 @@ class ValidationResultBuilder {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Add a validation warning.
|
|
50
|
-
* @param in_msg A warning description.
|
|
50
|
+
* @param in_msg - A warning description.
|
|
51
51
|
*/
|
|
52
52
|
addWarning(in_msg) {
|
|
53
53
|
this._result.warnings.push(in_msg);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validationResultBuilder.js","sourceRoot":"","sources":["../src/validationResultBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;;;GAIG;;;AAWH,MAAa,uBAAuB;IAGhC;;;OAGG;IACH,YAAY,SAAiB;QACzB,IAAI,CAAC,OAAO,GAAG;YACX,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE;SACtB,CAAC;QAEF,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;SACnC;IACL,CAAC;IAED;;;OAGG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,QAAe;QAC3B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;QAC7B,8CAA8C;QAC9C,IAAI,QAAQ,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtC;IACL,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAChC,CAAC;CACJ;AAzDD,0DAyDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * The ValidationResultBuilder maintains validation context that ultimately gets returned as a\n * single result.\n */\n\n export declare interface SchemaValidationResult {\n isValid: boolean;\n errors: Error[];\n warnings: string[];\n resolvedTypes: string[];\n unresolvedTypes: string[];\n typeid?: string;\n}\n\nexport class ValidationResultBuilder {\n private readonly _result: SchemaValidationResult;\n\n /**\n * Instantiates a ValidationResultBuilder\n * @param in_typeid A template typeid.\n */\n constructor(in_typeid: string) {\n this._result = {\n isValid: true,\n errors: [],\n warnings: [],\n resolvedTypes: [],\n unresolvedTypes: [],\n };\n\n if (in_typeid) {\n this._result.typeid = in_typeid;\n }\n }\n\n /**\n * Add a validation error.\n * @param {Error} in_error An Error instance.\n */\n public get result() {\n return this._result;\n }\n\n /**\n * Add a validation error.\n * @param in_error An Error instance.\n */\n public addError(in_error: Error) {\n this._result.isValid = false;\n // remove empty error messages before logging.\n if (in_error.message) {\n this._result.errors.push(in_error);\n }\n }\n\n /**\n * Add a validation warning.\n * @param in_msg A warning description.\n */\n public addWarning(in_msg: string) {\n this._result.warnings.push(in_msg);\n }\n\n /**\n * Fetches the boolean validation result.\n * @return True if validation produced no error, false otherwise. Warnings don't affect\n * this value.\n */\n public isValid(): boolean {\n return this._result.isValid;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validationResultBuilder.js","sourceRoot":"","sources":["../src/validationResultBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;;;GAIG;;;AAWH,MAAa,uBAAuB;IAGhC;;;OAGG;IACH,YAAY,SAAiB;QACzB,IAAI,CAAC,OAAO,GAAG;YACX,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE;SACtB,CAAC;QAEF,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;SACnC;IACL,CAAC;IAED;;;OAGG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,QAAe;QAC3B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;QAC7B,8CAA8C;QAC9C,IAAI,QAAQ,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtC;IACL,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAChC,CAAC;CACJ;AAzDD,0DAyDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * The ValidationResultBuilder maintains validation context that ultimately gets returned as a\n * single result.\n */\n\n export declare interface SchemaValidationResult {\n isValid: boolean;\n errors: Error[];\n warnings: string[];\n resolvedTypes: string[];\n unresolvedTypes: string[];\n typeid?: string;\n}\n\nexport class ValidationResultBuilder {\n private readonly _result: SchemaValidationResult;\n\n /**\n * Instantiates a ValidationResultBuilder\n * @param in_typeid - A template typeid.\n */\n constructor(in_typeid: string) {\n this._result = {\n isValid: true,\n errors: [],\n warnings: [],\n resolvedTypes: [],\n unresolvedTypes: [],\n };\n\n if (in_typeid) {\n this._result.typeid = in_typeid;\n }\n }\n\n /**\n * Add a validation error.\n * @param {Error} in_error - An Error instance.\n */\n public get result() {\n return this._result;\n }\n\n /**\n * Add a validation error.\n * @param in_error - An Error instance.\n */\n public addError(in_error: Error) {\n this._result.isValid = false;\n // remove empty error messages before logging.\n if (in_error.message) {\n this._result.errors.push(in_error);\n }\n }\n\n /**\n * Add a validation warning.\n * @param in_msg - A warning description.\n */\n public addWarning(in_msg: string) {\n this._result.warnings.push(in_msg);\n }\n\n /**\n * Fetches the boolean validation result.\n * @return True if validation produced no error, false otherwise. Warnings don't affect\n * this value.\n */\n public isValid(): boolean {\n return this._result.isValid;\n }\n}\n"]}
|
package/lib/changeset.js
CHANGED
|
@@ -118,12 +118,12 @@ export class ChangeSet {
|
|
|
118
118
|
/**
|
|
119
119
|
* Applies a changeset to a given property (recursively). The ChangeSet is assumed to be relative to the same
|
|
120
120
|
* property root and it will be applied behind the base ChangeSet (assuming that the changes are relative to the
|
|
121
|
-
* state after the base ChangeSet has been applied. It will change the base ChangeSet.
|
|
121
|
+
* state after the base ChangeSet has been applied. It will change the base ChangeSet).
|
|
122
122
|
*
|
|
123
|
-
* @param io_basePropertyChanges
|
|
124
|
-
* @param in_appliedPropertyChanges - The ChangeSet to apply to this state
|
|
125
|
-
* @param in_removeEmpty
|
|
126
|
-
* @param in_options - Optional additional parameters
|
|
123
|
+
* @param io_basePropertyChanges - The ChangeSet describing the initial state.
|
|
124
|
+
* @param in_appliedPropertyChanges - The ChangeSet to apply to this state.
|
|
125
|
+
* @param in_removeEmpty - Should empty ChangeSets be removed?
|
|
126
|
+
* @param in_options - Optional additional parameters.
|
|
127
127
|
*/
|
|
128
128
|
_performApplyAfterOnProperty(io_basePropertyChanges, in_appliedPropertyChanges, in_removeEmpty, in_options) {
|
|
129
129
|
// Apply dynamic property operations
|
|
@@ -187,14 +187,14 @@ export class ChangeSet {
|
|
|
187
187
|
/**
|
|
188
188
|
* Decides based on the given Typeid which applyAfter operation to perform.
|
|
189
189
|
* Note: This function is not directly called on the ChangeSet but on the object containing it together with a key
|
|
190
|
-
*
|
|
190
|
+
* since it needs to be able to overwrite this entry
|
|
191
191
|
*
|
|
192
|
-
* @param in_changedKey
|
|
193
|
-
* @param in_baseChanges
|
|
194
|
-
* @param in_appliedPropertyChanges - The object containing the ChangeSet with the modification
|
|
195
|
-
* @param in_typeid
|
|
196
|
-
* @param in_removeEmpty
|
|
197
|
-
* @param in_options - Optional additional parameters
|
|
192
|
+
* @param in_changedKey - The key of the entry in the object.
|
|
193
|
+
* @param in_baseChanges - The object containing the state before the applyAfter.
|
|
194
|
+
* @param in_appliedPropertyChanges - The object containing the ChangeSet with the modification.
|
|
195
|
+
* @param in_typeid - The typeid of the property to modify.
|
|
196
|
+
* @param in_removeEmpty - Should empty ChangeSets be removed?
|
|
197
|
+
* @param in_options - Optional additional parameters.
|
|
198
198
|
*/
|
|
199
199
|
performApplyAfterOnPropertyWithTypeid(in_changedKey, in_baseChanges, in_appliedPropertyChanges, in_typeid, in_removeEmpty, in_options) {
|
|
200
200
|
const splitTypeid = extractContext(in_typeid);
|
|
@@ -318,12 +318,11 @@ export class ChangeSet {
|
|
|
318
318
|
* this class and transforms it in such a way that it can be applied after this ChangeSet. The function will modify
|
|
319
319
|
* the supplied ChangeSet
|
|
320
320
|
*
|
|
321
|
-
* @param io_changeSet
|
|
322
|
-
*
|
|
323
|
-
* @param
|
|
324
|
-
* @param in_options - Optional additional parameters
|
|
321
|
+
* @param io_changeSet - The ChangeSet that is rebased behind the state obtained by application of this ChangeSet.
|
|
322
|
+
* @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict.
|
|
323
|
+
* @param in_options - Optional additional parameters.
|
|
325
324
|
* @returns The rebased ChangeSet (the same object as io_changeSet, it will be
|
|
326
|
-
*
|
|
325
|
+
* modified in place).
|
|
327
326
|
*/
|
|
328
327
|
_rebaseChangeSet(io_changeSet, out_conflicts, in_options) {
|
|
329
328
|
// We actually only pass this request to the recursive internal function
|
|
@@ -332,14 +331,10 @@ export class ChangeSet {
|
|
|
332
331
|
/**
|
|
333
332
|
* Internal helper function that performs a rebase on a single property
|
|
334
333
|
*
|
|
335
|
-
* @param in_ownPropertyChangeSet -
|
|
336
|
-
*
|
|
337
|
-
* @param
|
|
338
|
-
*
|
|
339
|
-
* @param in_basePath -
|
|
340
|
-
* Base path to get to the property processed by this function
|
|
341
|
-
* @param out_conflicts -
|
|
342
|
-
* A list of paths that resulted in conflicts together with the type of the conflict
|
|
334
|
+
* @param in_ownPropertyChangeSet - The ChangeSet for the property stored in this class
|
|
335
|
+
* @param io_rebasePropertyChangeSet - The ChangeSet for the property to be rebased
|
|
336
|
+
* @param in_basePath - Base path to get to the property processed by this function
|
|
337
|
+
* @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict
|
|
343
338
|
* @param in_options - Optional additional parameters
|
|
344
339
|
* @returns The rebased ChangeSet for this property
|
|
345
340
|
*/
|
|
@@ -471,23 +466,22 @@ export class ChangeSet {
|
|
|
471
466
|
return io_rebasePropertyChangeSet;
|
|
472
467
|
}
|
|
473
468
|
/**
|
|
474
|
-
* Decides based on the given Typeid which rebase operation to perform
|
|
475
|
-
*
|
|
476
|
-
*
|
|
469
|
+
* Decides based on the given Typeid which rebase operation to perform.
|
|
470
|
+
*
|
|
471
|
+
* @remarks Note: This function is not directly called on the ChangeSet but on the object containing it together
|
|
472
|
+
* with a key since it needs to be able to overwrite this entry
|
|
477
473
|
*
|
|
478
|
-
* @param in_key
|
|
479
|
-
* @param in_ownPropertyChangeSet
|
|
480
|
-
*
|
|
481
|
-
* @param
|
|
482
|
-
*
|
|
483
|
-
* @param
|
|
484
|
-
* @param
|
|
485
|
-
* @param in_removeEmpty - Should empty ChangeSets be removed?
|
|
486
|
-
* @param out_conflicts - A list of paths that resulted in
|
|
487
|
-
* conflicts together with the type of the conflict
|
|
474
|
+
* @param in_key - The key of the entry in the object
|
|
475
|
+
* @param in_ownPropertyChangeSet - The object containing the ChangeSet for the property stored in this class.
|
|
476
|
+
* @param io_rebasePropertyChangeSet - The object containing the ChangeSet for the property to be rebased.
|
|
477
|
+
* @param in_typeid - The typeid of the property to rebase.
|
|
478
|
+
* @param in_basePath - Base path to get to the property processed by this function.
|
|
479
|
+
* @param in_removeEmpty - Should empty ChangeSets be removed?
|
|
480
|
+
* @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict.
|
|
488
481
|
*
|
|
489
482
|
* @returns Has there been a simple set collision? Those have to be handled separately
|
|
490
|
-
*
|
|
483
|
+
*
|
|
484
|
+
* @privateRemarks TODO: We should unify the handling of set collisions
|
|
491
485
|
* @private
|
|
492
486
|
*/
|
|
493
487
|
rebaseChangeSetForPropertyEntryWithTypeid(in_key, in_ownPropertyChangeSet, io_rebasePropertyChangeSet, in_typeid, in_basePath, in_removeEmpty, out_conflicts, in_options) {
|
|
@@ -536,10 +530,10 @@ export class ChangeSet {
|
|
|
536
530
|
return false;
|
|
537
531
|
}
|
|
538
532
|
/**
|
|
539
|
-
*
|
|
533
|
+
* Recursive helper function for ChangeSet.prototype._toReversibleChangeSet
|
|
540
534
|
* which converts a irreversible changeset to a reversible changeset
|
|
541
535
|
* or updates the former state of a reversible changeset
|
|
542
|
-
* @param in_context
|
|
536
|
+
* @param in_context - The traversal context.
|
|
543
537
|
*/
|
|
544
538
|
_recursivelyBuildReversibleChangeSet(in_context) {
|
|
545
539
|
const opType = in_context.getOperationType();
|
|
@@ -738,7 +732,7 @@ export class ChangeSet {
|
|
|
738
732
|
* WARNING: This function is still experimental and needs more testing
|
|
739
733
|
* and it's set to private for now. It will be converted to a public API function
|
|
740
734
|
* in a later release.
|
|
741
|
-
* @param in_oldSerializedState
|
|
735
|
+
* @param in_oldSerializedState - The old state.
|
|
742
736
|
*/
|
|
743
737
|
_toReversibleChangeSet(in_oldSerializedState) {
|
|
744
738
|
ConsoleUtils.assert(in_oldSerializedState !== undefined, `${MSG.ASSERTION_FAILED}Missing function parameter "in_oldSerializedState" of "_toReversibleChangeSet".`);
|
|
@@ -884,8 +878,8 @@ export class ChangeSet {
|
|
|
884
878
|
}
|
|
885
879
|
/**
|
|
886
880
|
* Helper function to extract the first level paths from a given change set
|
|
887
|
-
* @param in_changeSet The ChangeSet to extract paths from
|
|
888
|
-
* @param isPrimitiveCollection Is this a primitive type collection?
|
|
881
|
+
* @param in_changeSet - The ChangeSet to extract paths from.
|
|
882
|
+
* @param isPrimitiveCollection - Is this a primitive type collection?
|
|
889
883
|
*
|
|
890
884
|
* @returns List of paths found at the first level of the change set
|
|
891
885
|
*/
|
|
@@ -906,7 +900,7 @@ export class ChangeSet {
|
|
|
906
900
|
}
|
|
907
901
|
/**
|
|
908
902
|
* recursive helper function for ChangeSet.prototype._toInverseChangeSet
|
|
909
|
-
* @param in_context
|
|
903
|
+
* @param in_context - The traversal context.
|
|
910
904
|
*/
|
|
911
905
|
_recursivelyInvertReversibleChangeset(in_context) {
|
|
912
906
|
in_context.setUserData(in_context.getUserData() || {});
|