@fgv/ts-json 3.0.1-alpha.6 → 4.0.1
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/CHANGELOG.json +27 -0
- package/CHANGELOG.md +16 -1
- package/dist/ts-json.d.ts +154 -155
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/packlets/context/compositeJsonMap.d.ts +2 -2
- package/lib/packlets/context/compositeJsonMap.js +2 -2
- package/lib/packlets/context/compositeJsonMap.js.map +1 -1
- package/lib/packlets/context/contextHelpers.d.ts +2 -2
- package/lib/packlets/context/contextHelpers.js +2 -2
- package/lib/packlets/context/contextHelpers.js.map +1 -1
- package/lib/packlets/context/jsonContext.d.ts +5 -5
- package/lib/packlets/context/jsonContext.js.map +1 -1
- package/lib/packlets/converters/converters.d.ts +2 -2
- package/lib/packlets/converters/converters.js +2 -2
- package/lib/packlets/converters/converters.js.map +1 -1
- package/lib/packlets/converters/jsonConverter.d.ts +6 -6
- package/lib/packlets/converters/jsonConverter.js +6 -6
- package/lib/packlets/converters/jsonConverter.js.map +1 -1
- package/lib/packlets/editor/common.d.ts +6 -6
- package/lib/packlets/editor/common.js.map +1 -1
- package/lib/packlets/editor/index.d.ts +2 -2
- package/lib/packlets/editor/index.d.ts.map +1 -1
- package/lib/packlets/editor/index.js +3 -1
- package/lib/packlets/editor/index.js.map +1 -1
- package/lib/packlets/editor/jsonEditor.d.ts +24 -24
- package/lib/packlets/editor/jsonEditor.js +21 -21
- package/lib/packlets/editor/jsonEditor.js.map +1 -1
- package/lib/packlets/editor/jsonEditorRule.d.ts +17 -17
- package/lib/packlets/editor/jsonEditorRule.js +4 -4
- package/lib/packlets/editor/jsonEditorRule.js.map +1 -1
- package/lib/packlets/editor/jsonEditorState.d.ts +20 -20
- package/lib/packlets/editor/jsonEditorState.js +17 -17
- package/lib/packlets/editor/jsonEditorState.js.map +1 -1
- package/lib/packlets/editor/jsonReferenceMap.d.ts +12 -13
- package/lib/packlets/editor/jsonReferenceMap.d.ts.map +1 -1
- package/lib/packlets/editor/jsonReferenceMap.js +7 -8
- package/lib/packlets/editor/jsonReferenceMap.js.map +1 -1
- package/lib/packlets/editor/rules/conditional.d.ts +17 -17
- package/lib/packlets/editor/rules/conditional.js +12 -12
- package/lib/packlets/editor/rules/conditional.js.map +1 -1
- package/lib/packlets/editor/rules/multivalue.d.ts +13 -13
- package/lib/packlets/editor/rules/multivalue.js +11 -11
- package/lib/packlets/editor/rules/multivalue.js.map +1 -1
- package/lib/packlets/editor/rules/references.d.ts +12 -12
- package/lib/packlets/editor/rules/references.js +11 -11
- package/lib/packlets/editor/rules/references.js.map +1 -1
- package/lib/packlets/editor/rules/templates.d.ts +14 -14
- package/lib/packlets/editor/rules/templates.js +12 -12
- package/lib/packlets/editor/rules/templates.js.map +1 -1
- package/package.json +14 -14
package/dist/ts-json.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class CompositeJsonMap implements IJsonReferenceMap {
|
|
|
45
45
|
*/
|
|
46
46
|
has(key: string): boolean;
|
|
47
47
|
/**
|
|
48
|
-
* Gets a
|
|
48
|
+
* Gets a JSON object specified by key.
|
|
49
49
|
* @param key - The key of the object to be retrieved.
|
|
50
50
|
* @param context - An optional {@link IJsonContext | JSON Context} used to format the object.
|
|
51
51
|
* @returns `Success` with the formatted object if successful. `Failure` with detail `'unknown'`
|
|
@@ -54,7 +54,7 @@ export declare class CompositeJsonMap implements IJsonReferenceMap {
|
|
|
54
54
|
*/
|
|
55
55
|
getJsonObject(key: string, context?: IJsonContext): DetailedResult<JsonObject, JsonReferenceMapFailureReason>;
|
|
56
56
|
/**
|
|
57
|
-
* Gets a
|
|
57
|
+
* Gets a JSON value specified by key.
|
|
58
58
|
* @param key - The key of the object to be retrieved.
|
|
59
59
|
* @param context - An optional {@link IJsonContext | JSON Context} used to format the value.
|
|
60
60
|
* @returns `Success` with the formatted object if successful. `Failure` with detail `'unknown'`
|
|
@@ -110,7 +110,7 @@ export declare class ConditionalJsonConverter extends JsonEditorConverter {
|
|
|
110
110
|
export declare type ConditionalJsonConverterOptions = Omit<TemplatedJsonConverterOptions, 'useConditionalNames'>;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* The {@link
|
|
113
|
+
* The {@link EditorRules.ConditionalJsonEditorRule | ConditionalJsonEditorRule} evaluates
|
|
114
114
|
* properties with conditional keys, omitting non-matching keys and merging keys that match,
|
|
115
115
|
* or default keys only if no other keys match.
|
|
116
116
|
*
|
|
@@ -122,30 +122,30 @@ export declare type ConditionalJsonConverterOptions = Omit<TemplatedJsonConverte
|
|
|
122
122
|
*/
|
|
123
123
|
declare class ConditionalJsonEditorRule extends JsonEditorRuleBase {
|
|
124
124
|
/**
|
|
125
|
-
* Stored fully-resolved {@link
|
|
125
|
+
* Stored fully-resolved {@link EditorRules.IConditionalJsonRuleOptions | options} for this
|
|
126
126
|
* rule.
|
|
127
127
|
* @public
|
|
128
128
|
*/
|
|
129
129
|
protected _options?: IConditionalJsonRuleOptions;
|
|
130
130
|
/**
|
|
131
|
-
* Creates a new {@link
|
|
132
|
-
* @param options - Optional {@link
|
|
131
|
+
* Creates a new {@link EditorRules.ConditionalJsonEditorRule | ConditionalJsonEditorRule}.
|
|
132
|
+
* @param options - Optional {@link EditorRules.IConditionalJsonRuleOptions | configuration options}
|
|
133
133
|
* used for this rule.
|
|
134
134
|
*/
|
|
135
135
|
constructor(options?: IConditionalJsonRuleOptions);
|
|
136
136
|
/**
|
|
137
|
-
* Creates a new {@link
|
|
138
|
-
* @param options - Optional {@link
|
|
137
|
+
* Creates a new {@link EditorRules.ConditionalJsonEditorRule | ConditionalJsonEditorRule}.
|
|
138
|
+
* @param options - Optional {@link EditorRules.IConditionalJsonRuleOptions | configuration options}
|
|
139
139
|
* used for this rule.
|
|
140
140
|
*/
|
|
141
141
|
static create(options?: IConditionalJsonRuleOptions): Result<ConditionalJsonEditorRule>;
|
|
142
142
|
/**
|
|
143
143
|
* Evaluates a property for conditional application.
|
|
144
144
|
* @param key - The key of the property to be considered
|
|
145
|
-
* @param value - The
|
|
146
|
-
* @param state - The {@link
|
|
145
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
146
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
147
147
|
* @returns Returns `Success` with detail `'deferred'` and a
|
|
148
|
-
* {@link
|
|
148
|
+
* {@link EditorRules.IConditionalJsonDeferredObject | IConditionalJsonDeferredObject}.
|
|
149
149
|
* for a matching, default or unconditional key. Returns `Failure` with detail `'ignore'` for
|
|
150
150
|
* a non-matching conditional, or with detail `'error'` if an error occurs. Otherwise
|
|
151
151
|
* fails with detail `'inapplicable'`.
|
|
@@ -155,17 +155,17 @@ declare class ConditionalJsonEditorRule extends JsonEditorRuleBase {
|
|
|
155
155
|
* Finalizes any deferred conditional properties. If the only deferred property is
|
|
156
156
|
* default, that property is emitted. Otherwise all matching properties are emitted.
|
|
157
157
|
* @param finalized - The deferred properties to be considered for merge.
|
|
158
|
-
* @param __state - The {@link
|
|
158
|
+
* @param __state - The {@link JsonEditorState | editor state} for the object
|
|
159
159
|
* being edited.
|
|
160
160
|
*/
|
|
161
161
|
finalizeProperties(finalized: JsonObject[], __state: JsonEditorState): DetailedResult<JsonObject[], JsonEditFailureReason>;
|
|
162
162
|
/**
|
|
163
163
|
* Determines if a given property key is conditional. Derived classes can override this
|
|
164
164
|
* method to use a different format for conditional properties.
|
|
165
|
-
* @param value - The
|
|
166
|
-
* @param state - The {@link
|
|
165
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
166
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
167
167
|
* @returns `Success` with detail `'deferred'` and a
|
|
168
|
-
* {@link
|
|
168
|
+
* {@link EditorRules.IConditionalJsonKeyResult | IConditionalJsonKeyResult} describing the
|
|
169
169
|
* match for a default or matching conditional property. Returns `Failure` with detail `'ignore'`
|
|
170
170
|
* for a non-matching conditional property. Fails with detail `'error'` if an error occurs
|
|
171
171
|
* or with detail `'inapplicable'` if the key does not represent a conditional property.
|
|
@@ -193,7 +193,7 @@ declare class ConditionalJsonEditorRule extends JsonEditorRuleBase {
|
|
|
193
193
|
export declare function contextFromConverterOptions(partial?: Partial<IJsonConverterOptions>): IJsonContext | undefined;
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* Creates a new {@link
|
|
196
|
+
* Creates a new {@link JsonEditor | JsonEditor} from an optionally supplied partial
|
|
197
197
|
* {@link IJsonConverterOptions | JSON converter options}.
|
|
198
198
|
* Expands supplied options with default values and constructs an editor with
|
|
199
199
|
* matching configuration and defined rules.
|
|
@@ -240,8 +240,8 @@ declare namespace EditorRules {
|
|
|
240
240
|
export { EditorRules }
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* On a successful match, the {@link
|
|
244
|
-
* stores a {@link
|
|
243
|
+
* On a successful match, the {@link EditorRules.ConditionalJsonEditorRule | ConditionalJsonEditorRule}
|
|
244
|
+
* stores a {@link EditorRules.IConditionalJsonDeferredObject | IConditionalJsonDeferredObject} describing the
|
|
245
245
|
* matching result, to be resolved at finalization time.
|
|
246
246
|
* @public
|
|
247
247
|
*/
|
|
@@ -250,7 +250,7 @@ declare interface IConditionalJsonDeferredObject extends IConditionalJsonKeyResu
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
|
-
* Returned by {@link
|
|
253
|
+
* Returned by {@link EditorRules.ConditionalJsonEditorRule._tryParseCondition | ConditionalJsonEditorRule._tryParseCondition}
|
|
254
254
|
* to indicate whether a successful match was due to a matching condition or a default value.
|
|
255
255
|
* @public
|
|
256
256
|
*/
|
|
@@ -259,7 +259,7 @@ declare interface IConditionalJsonKeyResult extends JsonObject {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
* Configuration options for the {@link
|
|
262
|
+
* Configuration options for the {@link EditorRules.ConditionalJsonEditorRule | ConditionalJsonEditorRule}.
|
|
263
263
|
* @public
|
|
264
264
|
*/
|
|
265
265
|
declare interface IConditionalJsonRuleOptions extends Partial<IJsonEditorOptions> {
|
|
@@ -271,13 +271,13 @@ declare interface IConditionalJsonRuleOptions extends Partial<IJsonEditorOptions
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
|
-
* A specialized JSON editor which does a deep clone of a supplied
|
|
274
|
+
* A specialized JSON editor which does a deep clone of a supplied `JsonValue`.
|
|
275
275
|
* @public
|
|
276
276
|
*/
|
|
277
277
|
export declare interface IJsonCloneEditor {
|
|
278
278
|
/**
|
|
279
|
-
* Returns a deep clone of a supplied
|
|
280
|
-
* @param src - The
|
|
279
|
+
* Returns a deep clone of a supplied `JsonValue`.
|
|
280
|
+
* @param src - The `JsonValue` to be cloned.
|
|
281
281
|
* @param context - An optional {@link IJsonContext | JSON context} used for clone
|
|
282
282
|
* conversion operations.
|
|
283
283
|
*/
|
|
@@ -392,7 +392,7 @@ export declare interface IJsonConverterOptions {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
|
-
* Initialization options for a {@link
|
|
395
|
+
* Initialization options for a {@link JsonEditor | JsonEditor}.
|
|
396
396
|
* @public
|
|
397
397
|
*/
|
|
398
398
|
export declare interface IJsonEditorOptions {
|
|
@@ -401,29 +401,29 @@ export declare interface IJsonEditorOptions {
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
/**
|
|
404
|
-
* An {@link
|
|
405
|
-
* rule to be applied by a {@link
|
|
404
|
+
* An {@link IJsonEditorRule | IJsonEditorRule} represents a single configurable
|
|
405
|
+
* rule to be applied by a {@link JsonEditor | JsonEditor}.
|
|
406
406
|
* @public
|
|
407
407
|
*/
|
|
408
408
|
export declare interface IJsonEditorRule {
|
|
409
409
|
/**
|
|
410
|
-
* Called by a {@link
|
|
410
|
+
* Called by a {@link JsonEditor | JsonEditor} to possibly edit one of the properties being
|
|
411
411
|
* merged into a target object.
|
|
412
412
|
* @param key - The key of the property to be edited.
|
|
413
|
-
* @param value - The
|
|
414
|
-
* @param state - {@link
|
|
415
|
-
* @returns If the property was edited, returns `Success` with a
|
|
413
|
+
* @param value - The `JsonValue` of the property to be edited.
|
|
414
|
+
* @param state - {@link JsonEditorState | Editor state} which applies to the edit.
|
|
415
|
+
* @returns If the property was edited, returns `Success` with a `JsonObject` containing
|
|
416
416
|
* the edited results and with detail `'edited'`. If this property should be deferred for later consideration
|
|
417
|
-
* or merge, `Success` with detail `'deferred'` and a
|
|
417
|
+
* or merge, `Success` with detail `'deferred'` and a `JsonObject` to be finalized. If
|
|
418
418
|
* the rule does not affect this property, returns `Failure` with detail `'inapplicable'`. If an error occurred
|
|
419
419
|
* while processing the error, returns `Failure` with detail `'error'`.
|
|
420
420
|
*/
|
|
421
421
|
editProperty(key: string, value: JsonValue, state: JsonEditorState): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;
|
|
422
422
|
/**
|
|
423
|
-
* Called by a {@link
|
|
424
|
-
* @param value - The
|
|
425
|
-
* @param state - {@link
|
|
426
|
-
* @returns Returns `Success` with the
|
|
423
|
+
* Called by a {@link JsonEditor | JsonEditor} to possibly edit a property value or array element.
|
|
424
|
+
* @param value - The `JsonValue` of the property to be edited.
|
|
425
|
+
* @param state - {@link JsonEditorState | Editor state} which applies to the edit.
|
|
426
|
+
* @returns Returns `Success` with the `JsonValue` to be inserted, with detail `'edited'` if
|
|
427
427
|
* the value was edited. Returns `Failure` with `'inapplicable'` if the rule does not affect this value.
|
|
428
428
|
* Fails with detail `'ignore'` if the value is to be ignored, or with `'error'` if an error occurs.
|
|
429
429
|
*/
|
|
@@ -431,8 +431,8 @@ export declare interface IJsonEditorRule {
|
|
|
431
431
|
/**
|
|
432
432
|
* Called for each rule after all properties have been merged. Any properties that were deferred
|
|
433
433
|
* during the initial edit pass are supplied as input.
|
|
434
|
-
* @param deferred - Any
|
|
435
|
-
* @param state - {@link
|
|
434
|
+
* @param deferred - Any JSON objects that were deferred during the first edit pass.
|
|
435
|
+
* @param state - {@link JsonEditorState | Editor state} which applies to the edit.
|
|
436
436
|
* @returns On `Success` return, any returned objects are merged in order and finalization
|
|
437
437
|
* is stopped. Finalization is also stopped on `Failure` with detail `'ignore'`. On `Failure`
|
|
438
438
|
* with detail `'inapplicable'`, finalization continues with the next rule. Fails with an
|
|
@@ -442,7 +442,7 @@ export declare interface IJsonEditorRule {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
|
-
* Validation options for a {@link
|
|
445
|
+
* Validation options for a {@link JsonEditor | JsonEditor}.
|
|
446
446
|
* @public
|
|
447
447
|
*/
|
|
448
448
|
export declare interface IJsonEditorValidationOptions {
|
|
@@ -470,7 +470,7 @@ export declare interface IJsonEditorValidationOptions {
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
/**
|
|
473
|
-
* Interface for a simple map that returns named
|
|
473
|
+
* Interface for a simple map that returns named `JsonValue` values with templating,
|
|
474
474
|
* conditional logic, and external reference lookups applied using an optionally supplied context.
|
|
475
475
|
* @public
|
|
476
476
|
*/
|
|
@@ -489,20 +489,20 @@ export declare interface IJsonReferenceMap {
|
|
|
489
489
|
*/
|
|
490
490
|
has(key: string): boolean;
|
|
491
491
|
/**
|
|
492
|
-
* Gets a
|
|
492
|
+
* Gets a `JsonObject` specified by key.
|
|
493
493
|
* @param key - The key of the object to be retrieved.
|
|
494
494
|
* @param context - Optional {@link IJsonContext | IJsonContext} used to construct
|
|
495
495
|
* the object.
|
|
496
|
-
* @returns `Success` with the formatted
|
|
496
|
+
* @returns `Success` with the formatted JsonObject if successful. `Failure`
|
|
497
497
|
* with detail `'unknown'` if no such object exists, or `Failure` with detail `'error'` if
|
|
498
498
|
* the object was found but could not be formatted.
|
|
499
499
|
*/
|
|
500
500
|
getJsonObject(key: string, context?: IJsonContext): DetailedResult<JsonObject, JsonReferenceMapFailureReason>;
|
|
501
501
|
/**
|
|
502
|
-
* Gets a
|
|
502
|
+
* Gets a `JsonValue` specified by key.
|
|
503
503
|
* @param key - The key of the object to be retrieved.
|
|
504
504
|
* @param context - Optional {@link IJsonContext | JSON Context} used to format the value
|
|
505
|
-
* @returns `Success` with the formatted
|
|
505
|
+
* @returns `Success` with the formatted `JsonValue` if successful. `Failure`
|
|
506
506
|
* with detail `'unknown'` if no such object exists, or `Failure` with detail `'error'` if
|
|
507
507
|
* the object was found but could not be formatted.
|
|
508
508
|
*/
|
|
@@ -545,7 +545,7 @@ declare interface IMultiValuePropertyParts {
|
|
|
545
545
|
readonly propertyValues: string[];
|
|
546
546
|
/**
|
|
547
547
|
* If `true`, the resolved values are added as an array
|
|
548
|
-
* with the name of the {@link
|
|
548
|
+
* with the name of the {@link EditorRules.IMultiValuePropertyParts.propertyVariable | propertyVariable}.
|
|
549
549
|
* If false, values are added as individual properties with names that correspond the value.
|
|
550
550
|
*/
|
|
551
551
|
readonly asArray: boolean;
|
|
@@ -567,13 +567,13 @@ export declare interface IReferenceMapKeyPolicyValidateOptions {
|
|
|
567
567
|
* Initialization options for a {@link SimpleJsonMap | SimpleJsonMap}.
|
|
568
568
|
* @public
|
|
569
569
|
*/
|
|
570
|
-
declare interface ISimpleJsonMapOptions {
|
|
570
|
+
export declare interface ISimpleJsonMapOptions {
|
|
571
571
|
keyPolicy?: ReferenceMapKeyPolicy<JsonValue>;
|
|
572
572
|
editor?: JsonEditor;
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
/**
|
|
576
|
-
* Configuration options for the {@link
|
|
576
|
+
* Configuration options for the {@link EditorRules.TemplatedJsonEditorRule | Templated JSON editor rule}.
|
|
577
577
|
* @public
|
|
578
578
|
*/
|
|
579
579
|
declare interface ITemplatedJsonRuleOptions extends Partial<IJsonEditorOptions> {
|
|
@@ -596,7 +596,7 @@ declare const json: JsonConverter;
|
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* A simple validating {@link JsonConverter | JSON converter}. Converts `unknown` to a
|
|
599
|
-
*
|
|
599
|
+
* `JsonArray`, or fails if the unknown contains invalid JSON or is
|
|
600
600
|
* not an array.
|
|
601
601
|
* @public
|
|
602
602
|
*/
|
|
@@ -692,7 +692,7 @@ export declare class JsonContextHelper {
|
|
|
692
692
|
*/
|
|
693
693
|
extendRefs(refs?: IJsonReferenceMap[]): Result<IJsonReferenceMap | undefined>;
|
|
694
694
|
/**
|
|
695
|
-
* Applies
|
|
695
|
+
* Applies static `JsonContextHelper.extendContext` to the
|
|
696
696
|
* {@link IJsonContext | IJsonContext} associated with this helper.
|
|
697
697
|
* @param add - Optional initializer containing {@link VariableValue | variable values} and/or
|
|
698
698
|
* {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.
|
|
@@ -705,7 +705,7 @@ export declare class JsonContextHelper {
|
|
|
705
705
|
refs?: IJsonReferenceMap[];
|
|
706
706
|
}): Result<IJsonContext | undefined>;
|
|
707
707
|
/**
|
|
708
|
-
* Applies
|
|
708
|
+
* Applies static `JsonContextHelper.mergeContext` to the
|
|
709
709
|
* {@link IJsonContext | IJsonContext} associated with this helper.
|
|
710
710
|
* @param add - Optional initializer containing {@link VariableValue | variable values} and/or
|
|
711
711
|
* {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.
|
|
@@ -753,48 +753,48 @@ export declare type JsonEditFailureReason = 'ignore' | 'inapplicable' | 'edited'
|
|
|
753
753
|
*/
|
|
754
754
|
export declare class JsonEditor implements IJsonCloneEditor {
|
|
755
755
|
/**
|
|
756
|
-
* Default singleton {@link
|
|
756
|
+
* Default singleton {@link JsonEditor | JsonEditor}.
|
|
757
757
|
* @internal
|
|
758
758
|
*/
|
|
759
759
|
protected static _default?: JsonEditor;
|
|
760
760
|
/**
|
|
761
|
-
* Full set of {@link
|
|
761
|
+
* Full set of {@link IJsonEditorOptions | editor options} in effect for this editor.
|
|
762
762
|
*/
|
|
763
763
|
options: IJsonEditorOptions;
|
|
764
764
|
/**
|
|
765
|
-
* The set of {@link
|
|
765
|
+
* The set of {@link IJsonEditorRule | editor rules} applied by this editor.
|
|
766
766
|
* @internal
|
|
767
767
|
*/
|
|
768
768
|
protected _rules: IJsonEditorRule[];
|
|
769
769
|
/**
|
|
770
|
-
* Protected constructor for {@link
|
|
771
|
-
* External consumers should instantiate via the {@link
|
|
772
|
-
* @param options - Optional partial {@link
|
|
770
|
+
* Protected constructor for {@link JsonEditor | JsonEditor} and derived classes.
|
|
771
|
+
* External consumers should instantiate via the {@link JsonEditor.create | create static method}.
|
|
772
|
+
* @param options - Optional partial {@link IJsonEditorOptions | editor options} for the
|
|
773
773
|
* constructed editor.
|
|
774
|
-
* @param rules - Any {@link
|
|
774
|
+
* @param rules - Any {@link IJsonEditorRule | editor rules} to be applied by the editor.
|
|
775
775
|
* @internal
|
|
776
776
|
*/
|
|
777
777
|
protected constructor(options?: Partial<IJsonEditorOptions>, rules?: IJsonEditorRule[]);
|
|
778
778
|
/**
|
|
779
|
-
* Default singleton {@link
|
|
779
|
+
* Default singleton {@link JsonEditor | JsonEditor} for simple use. Applies all rules
|
|
780
780
|
* but with no default context.
|
|
781
781
|
*/
|
|
782
782
|
static get default(): JsonEditor;
|
|
783
783
|
/**
|
|
784
|
-
* Constructs a new {@link
|
|
785
|
-
* @param options - Optional partial {@link
|
|
784
|
+
* Constructs a new {@link JsonEditor | JsonEditor}.
|
|
785
|
+
* @param options - Optional partial {@link IJsonEditorOptions | editor options} for the
|
|
786
786
|
* constructed editor.
|
|
787
|
-
* @param rules - Optional set of {@link
|
|
788
|
-
* @readonly A new {@link
|
|
787
|
+
* @param rules - Optional set of {@link IJsonEditorRule | editor rules} to be applied by the editor.
|
|
788
|
+
* @readonly A new {@link JsonEditor | JsonEditor}.
|
|
789
789
|
*/
|
|
790
790
|
static create(options?: Partial<IJsonEditorOptions>, rules?: IJsonEditorRule[]): Result<JsonEditor>;
|
|
791
791
|
/**
|
|
792
792
|
* Gets the default set of rules to be applied for a given set of options.
|
|
793
793
|
* By default, all available rules (templates, conditionals, multi-value and references)
|
|
794
794
|
* are applied.
|
|
795
|
-
* @param options - Optional partial {@link
|
|
795
|
+
* @param options - Optional partial {@link IJsonEditorOptions | editor options} for
|
|
796
796
|
* all rules.
|
|
797
|
-
* @returns Default {@link
|
|
797
|
+
* @returns Default {@link IJsonEditorRule | editor rules} with any supplied options
|
|
798
798
|
* applied.
|
|
799
799
|
*/
|
|
800
800
|
static getDefaultRules(options?: IJsonEditorOptions): Result<IJsonEditorRule[]>;
|
|
@@ -804,21 +804,21 @@ export declare class JsonEditor implements IJsonCloneEditor {
|
|
|
804
804
|
protected static _getDefaultOptions(options?: Partial<IJsonEditorOptions>): Result<IJsonEditorOptions>;
|
|
805
805
|
/**
|
|
806
806
|
* Merges a supplied source object into a supplied target, updating the target object.
|
|
807
|
-
* @param target - The target
|
|
808
|
-
* @param src - The source
|
|
807
|
+
* @param target - The target `JsonObject` to be updated
|
|
808
|
+
* @param src - The source `JsonObject` to be merged
|
|
809
809
|
* @param runtimeContext - An optional {@link IJsonContext | IJsonContext} supplying variables
|
|
810
810
|
* and references.
|
|
811
|
-
* @returns `Success` with the original source
|
|
811
|
+
* @returns `Success` with the original source `JsonObject` if merge was successful.
|
|
812
812
|
* Returns `Failure` with details if an error occurs.
|
|
813
813
|
*/
|
|
814
814
|
mergeObjectInPlace(target: JsonObject, src: JsonObject, runtimeContext?: IJsonContext): Result<JsonObject>;
|
|
815
815
|
/**
|
|
816
816
|
* Merges multiple supplied source objects into a supplied target, updating the target
|
|
817
817
|
* object and using the default context supplied at creation time.
|
|
818
|
-
* @param target - The target
|
|
819
|
-
* @param srcObjects -
|
|
818
|
+
* @param target - The target `JsonObject` to be updated
|
|
819
|
+
* @param srcObjects - `JsonObject`s to be merged into the target object, in the order
|
|
820
820
|
* supplied.
|
|
821
|
-
* @returns `Success` with the original source
|
|
821
|
+
* @returns `Success` with the original source `JsonObject` if merge was successful.
|
|
822
822
|
* Returns `Failure` with details if an error occurs.
|
|
823
823
|
*/
|
|
824
824
|
mergeObjectsInPlace(target: JsonObject, srcObjects: JsonObject[]): Result<JsonObject>;
|
|
@@ -827,16 +827,16 @@ export declare class JsonEditor implements IJsonCloneEditor {
|
|
|
827
827
|
* object and using an optional {@link IJsonContext | context} supplied in the call.
|
|
828
828
|
* @param context - An optional {@link IJsonContext | IJsonContext} supplying variables and
|
|
829
829
|
* references.
|
|
830
|
-
* @param base - The base
|
|
830
|
+
* @param base - The base `JsonObject` to be updated
|
|
831
831
|
* @param srcObjects - Objects to be merged into the target object, in the order supplied.
|
|
832
|
-
* @returns `Success` with the original source
|
|
832
|
+
* @returns `Success` with the original source `JsonObject` if merge was successful.
|
|
833
833
|
* Returns `Failure` with details if an error occurs.
|
|
834
834
|
*/
|
|
835
835
|
mergeObjectsInPlaceWithContext(context: IJsonContext | undefined, base: JsonObject, srcObjects: JsonObject[]): Result<JsonObject>;
|
|
836
836
|
/**
|
|
837
|
-
* Deep clones a supplied
|
|
837
|
+
* Deep clones a supplied `JsonValue`, applying all editor rules and a default
|
|
838
838
|
* or optionally supplied context
|
|
839
|
-
* @param src - The
|
|
839
|
+
* @param src - The `JsonValue` to be cloned.
|
|
840
840
|
* @param context - An optional {@link IJsonContext | JSON context} supplying variables and references.
|
|
841
841
|
*/
|
|
842
842
|
clone(src: JsonValue, context?: IJsonContext): DetailedResult<JsonValue, JsonEditFailureReason>;
|
|
@@ -895,90 +895,90 @@ export declare class JsonEditor implements IJsonCloneEditor {
|
|
|
895
895
|
}
|
|
896
896
|
|
|
897
897
|
/**
|
|
898
|
-
* A thin wrapper to allow an arbitrary {@link
|
|
898
|
+
* A thin wrapper to allow an arbitrary {@link JsonEditor | JsonEditor} to be used via the
|
|
899
899
|
* \@fgv/ts-utils `Converter` pattern.
|
|
900
900
|
* @public
|
|
901
901
|
*/
|
|
902
902
|
export declare class JsonEditorConverter extends Conversion.BaseConverter<JsonValue, IJsonContext> {
|
|
903
903
|
readonly editor: JsonEditor;
|
|
904
904
|
/**
|
|
905
|
-
* Constructs a new {@link
|
|
905
|
+
* Constructs a new {@link JsonEditor | JsonEditor}Converter which uses the supplied editor
|
|
906
906
|
* @param editor -
|
|
907
907
|
*/
|
|
908
908
|
constructor(editor: JsonEditor);
|
|
909
909
|
/**
|
|
910
|
-
* Constructs a new {@link
|
|
910
|
+
* Constructs a new {@link JsonEditor | JsonEditor}Converter which uses the supplied editor
|
|
911
911
|
* @param editor -
|
|
912
912
|
*/
|
|
913
913
|
static createWithEditor(editor: JsonEditor): Result<JsonEditorConverter>;
|
|
914
914
|
/**
|
|
915
915
|
* Gets a derived converter which fails if the resulting converted
|
|
916
|
-
*
|
|
916
|
+
* `JsonValue` is not a `JsonObject`.
|
|
917
917
|
*/
|
|
918
918
|
object(): Converter<JsonObject, IJsonContext>;
|
|
919
919
|
/**
|
|
920
920
|
* Gets a derived converter which fails if the resulting converted
|
|
921
|
-
*
|
|
921
|
+
* `JsonValue` is not a `JsonArray`.
|
|
922
922
|
*/
|
|
923
923
|
array(): Converter<JsonArray, IJsonContext>;
|
|
924
924
|
protected _convert(from: unknown, context?: IJsonContext): Result<JsonValue>;
|
|
925
925
|
}
|
|
926
926
|
|
|
927
927
|
/**
|
|
928
|
-
* Default base implementation of {@link
|
|
928
|
+
* Default base implementation of {@link IJsonEditorRule | IJsonEditorRule} returns inapplicable for all operations so that
|
|
929
929
|
* derived classes need only implement the operations they actually support.
|
|
930
930
|
* @public
|
|
931
931
|
*/
|
|
932
|
-
declare class JsonEditorRuleBase implements IJsonEditorRule {
|
|
932
|
+
export declare class JsonEditorRuleBase implements IJsonEditorRule {
|
|
933
933
|
/**
|
|
934
|
-
* {@inheritdoc
|
|
934
|
+
* {@inheritdoc IJsonEditorRule.editProperty}
|
|
935
935
|
*/
|
|
936
936
|
editProperty(__key: string, __value: JsonValue, __state: JsonEditorState): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;
|
|
937
937
|
/**
|
|
938
|
-
* {@inheritdoc
|
|
938
|
+
* {@inheritdoc IJsonEditorRule.editValue}
|
|
939
939
|
*/
|
|
940
940
|
editValue(__value: JsonValue, __state: JsonEditorState): DetailedResult<JsonValue, JsonEditFailureReason>;
|
|
941
941
|
/**
|
|
942
|
-
* {@inheritdoc
|
|
942
|
+
* {@inheritdoc IJsonEditorRule.finalizeProperties}
|
|
943
943
|
*/
|
|
944
944
|
finalizeProperties(__deferred: JsonObject[], __state: JsonEditorState): DetailedResult<JsonObject[], JsonEditFailureReason>;
|
|
945
945
|
}
|
|
946
946
|
|
|
947
947
|
/**
|
|
948
|
-
* Represents the internal state of a {@link
|
|
948
|
+
* Represents the internal state of a {@link JsonEditor | JsonEditor}.
|
|
949
949
|
* @public
|
|
950
950
|
*/
|
|
951
951
|
export declare class JsonEditorState {
|
|
952
952
|
/**
|
|
953
|
-
* Static global counter used to assign each {@link
|
|
953
|
+
* Static global counter used to assign each {@link JsonEditorState | JsonEditorState}
|
|
954
954
|
* a unique identifier.
|
|
955
955
|
* @internal
|
|
956
956
|
*/
|
|
957
957
|
protected static _nextId: number;
|
|
958
958
|
/**
|
|
959
|
-
* The {@link
|
|
959
|
+
* The {@link IJsonCloneEditor | editor} for which this state applies.
|
|
960
960
|
*/
|
|
961
961
|
readonly editor: IJsonCloneEditor;
|
|
962
962
|
/**
|
|
963
|
-
* Fully resolved {@link
|
|
963
|
+
* Fully resolved {@link IJsonEditorOptions | editor options} that apply
|
|
964
964
|
* to the operation for which this state applies.
|
|
965
965
|
*/
|
|
966
966
|
readonly options: IJsonEditorOptions;
|
|
967
967
|
/**
|
|
968
|
-
* Any deferred
|
|
968
|
+
* Any deferred JSON objects to be merged during finalization.
|
|
969
969
|
* @internal
|
|
970
970
|
*/
|
|
971
971
|
protected readonly _deferred: JsonObject[];
|
|
972
972
|
/**
|
|
973
|
-
* Unique global identifier for this {@link
|
|
973
|
+
* Unique global identifier for this {@link JsonEditorState | state object}.
|
|
974
974
|
* @internal
|
|
975
975
|
*/
|
|
976
976
|
protected readonly _id: number;
|
|
977
977
|
/**
|
|
978
|
-
* Constructs a new {@link
|
|
979
|
-
* @param editor - The {@link
|
|
978
|
+
* Constructs a new {@link JsonEditorState | JsonEditorState}.
|
|
979
|
+
* @param editor - The {@link IJsonCloneEditor | editor} to which this state
|
|
980
980
|
* applies.
|
|
981
|
-
* @param baseOptions - The {@link
|
|
981
|
+
* @param baseOptions - The {@link IJsonEditorOptions | editor options} that
|
|
982
982
|
* apply to this rule.
|
|
983
983
|
* @param runtimeContext - An optional {@link IJsonContext | JSON context} to be used
|
|
984
984
|
* for json value conversion.
|
|
@@ -989,31 +989,31 @@ export declare class JsonEditorState {
|
|
|
989
989
|
*/
|
|
990
990
|
get context(): IJsonContext | undefined;
|
|
991
991
|
/**
|
|
992
|
-
* An array of
|
|
992
|
+
* An array of JSON objects that were deferred for merge during
|
|
993
993
|
* finalization.
|
|
994
994
|
*/
|
|
995
995
|
get deferred(): JsonObject[];
|
|
996
996
|
/**
|
|
997
997
|
* Merges an optional {@link IJsonContext | JSON context} into a supplied set
|
|
998
|
-
* of {@link
|
|
999
|
-
* @param options - The {@link
|
|
998
|
+
* of {@link IJsonEditorOptions | JSON editor options}.
|
|
999
|
+
* @param options - The {@link IJsonEditorOptions | IJsonEditorOptions} into
|
|
1000
1000
|
* which the the new context is to be merged.
|
|
1001
1001
|
* @param context - The {@link IJsonContext | JSON context} to be merged into the
|
|
1002
1002
|
* editor options.
|
|
1003
|
-
* @returns `Success` with the supplied {@link
|
|
1004
|
-
* there was nothing to merge, or aa new {@link
|
|
1003
|
+
* @returns `Success` with the supplied {@link IJsonEditorOptions | options} if
|
|
1004
|
+
* there was nothing to merge, or aa new {@link IJsonEditorOptions | IJsonEditorOptions}
|
|
1005
1005
|
* constructed from the base options merged with the supplied context. Returns `Failure`
|
|
1006
1006
|
* with more information if an error occurs.
|
|
1007
1007
|
* @internal
|
|
1008
1008
|
*/
|
|
1009
1009
|
protected static _getEffectiveOptions(options: IJsonEditorOptions, context?: IJsonContext): Result<IJsonEditorOptions>;
|
|
1010
1010
|
/**
|
|
1011
|
-
* Adds a supplied
|
|
1012
|
-
* @param obj - The
|
|
1011
|
+
* Adds a supplied `JsonObject` to the deferred list.
|
|
1012
|
+
* @param obj - The `JsonObject` to be deferred.
|
|
1013
1013
|
*/
|
|
1014
1014
|
defer(obj: JsonObject): void;
|
|
1015
1015
|
/**
|
|
1016
|
-
* Gets a {@link TemplateVars | TemplateVars} from the context of this {@link
|
|
1016
|
+
* Gets a {@link TemplateVars | TemplateVars} from the context of this {@link JsonEditorState | JsonEditorState},
|
|
1017
1017
|
* or from an optional supplied {@link IJsonContext | IJsonContext} if the current state has no default
|
|
1018
1018
|
* context.
|
|
1019
1019
|
* @param defaultContext - An optional default {@link IJsonContext | IJsonContext} to use as `TemplateVars`
|
|
@@ -1032,7 +1032,7 @@ export declare class JsonEditorState {
|
|
|
1032
1032
|
*/
|
|
1033
1033
|
getRefs(defaultContext?: IJsonContext): IJsonReferenceMap | undefined;
|
|
1034
1034
|
/**
|
|
1035
|
-
* Gets the context of this {@link
|
|
1035
|
+
* Gets the context of this {@link JsonEditorState | JsonEditorState} or an optionally
|
|
1036
1036
|
* supplied default context if this state has no context.
|
|
1037
1037
|
* @param defaultContext - The default {@link IJsonContext | JSON context} to use as default
|
|
1038
1038
|
* if this state has no context.
|
|
@@ -1056,9 +1056,9 @@ export declare class JsonEditorState {
|
|
|
1056
1056
|
/**
|
|
1057
1057
|
* Helper method to constructs `DetailedFailure` with appropriate details and messaging
|
|
1058
1058
|
* for various validation failures.
|
|
1059
|
-
* @param rule - The {@link
|
|
1059
|
+
* @param rule - The {@link JsonEditorValidationRules | validation rule} that failed.
|
|
1060
1060
|
* @param message - A string message describing the failed validation.
|
|
1061
|
-
* @param validation - The {@link
|
|
1061
|
+
* @param validation - The {@link IJsonEditorValidationOptions | validation options}
|
|
1062
1062
|
* in effect.
|
|
1063
1063
|
* @returns A `DetailedFailure` with appropriate detail and message.
|
|
1064
1064
|
*/
|
|
@@ -1066,14 +1066,14 @@ export declare class JsonEditorState {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
/**
|
|
1069
|
-
* Possible validation rules for a {@link
|
|
1069
|
+
* Possible validation rules for a {@link JsonEditor | JsonEditor}.
|
|
1070
1070
|
* @public
|
|
1071
1071
|
*/
|
|
1072
1072
|
export declare type JsonEditorValidationRules = 'invalidPropertyName' | 'invalidPropertyValue' | 'undefinedPropertyValue';
|
|
1073
1073
|
|
|
1074
1074
|
/**
|
|
1075
1075
|
* A simple validating {@link JsonConverter | JSON converter}. Converts unknown
|
|
1076
|
-
* to a
|
|
1076
|
+
* to a `JsonObject`, or fails if the `unknown` contains invalid
|
|
1077
1077
|
* JSON or is not an object.
|
|
1078
1078
|
* @public
|
|
1079
1079
|
*/
|
|
@@ -1111,7 +1111,7 @@ declare type MapOrRecord<T> = Map<string, T> | Record<string, T>;
|
|
|
1111
1111
|
export declare function mergeDefaultJsonConverterOptions(partial?: Partial<IJsonConverterOptions>): IJsonConverterOptions;
|
|
1112
1112
|
|
|
1113
1113
|
/**
|
|
1114
|
-
* The {@link
|
|
1114
|
+
* The {@link EditorRules.MultiValueJsonEditorRule | Multi-Value JSON editor rule}
|
|
1115
1115
|
* expands matching keys multiple times, projecting the value into the template
|
|
1116
1116
|
* context for any child objects rendered by the rule.
|
|
1117
1117
|
*
|
|
@@ -1124,26 +1124,26 @@ export declare function mergeDefaultJsonConverterOptions(partial?: Partial<IJson
|
|
|
1124
1124
|
*/
|
|
1125
1125
|
declare class MultiValueJsonEditorRule extends JsonEditorRuleBase {
|
|
1126
1126
|
/**
|
|
1127
|
-
* Stored fully-resolved {@link
|
|
1127
|
+
* Stored fully-resolved {@link IJsonEditorOptions | editor options}
|
|
1128
1128
|
* for this rule.
|
|
1129
1129
|
* @public
|
|
1130
1130
|
*/
|
|
1131
1131
|
protected _options?: IJsonEditorOptions;
|
|
1132
1132
|
/**
|
|
1133
|
-
* Creates a new {@link
|
|
1134
|
-
* @param options - Optional {@link
|
|
1133
|
+
* Creates a new {@link EditorRules.MultiValueJsonEditorRule | MultiValueJsonEditorRule}.
|
|
1134
|
+
* @param options - Optional {@link IJsonEditorOptions | configuration options}.
|
|
1135
1135
|
*/
|
|
1136
1136
|
constructor(options?: IJsonEditorOptions);
|
|
1137
1137
|
/**
|
|
1138
|
-
* Creates a new {@link
|
|
1139
|
-
* @param options - Optional {@link
|
|
1138
|
+
* Creates a new {@link EditorRules.MultiValueJsonEditorRule | MultiValueJsonEditorRule}.
|
|
1139
|
+
* @param options - Optional {@link IJsonEditorOptions | configuration options}.
|
|
1140
1140
|
*/
|
|
1141
1141
|
static create(options?: IJsonEditorOptions): Result<MultiValueJsonEditorRule>;
|
|
1142
1142
|
/**
|
|
1143
1143
|
* Evaluates a property for multi-value expansion.
|
|
1144
1144
|
* @param key - The key of the property to be considered
|
|
1145
|
-
* @param value - The
|
|
1146
|
-
* @param state - The {@link
|
|
1145
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
1146
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1147
1147
|
* @returns `Success` with an object containing the fully-resolved child values to be merged for
|
|
1148
1148
|
* matching multi-value property. Returns `Failure` with detail `'error'` if an error occurs or
|
|
1149
1149
|
* with detail `'inapplicable'` if the property key is not a conditional property.
|
|
@@ -1151,7 +1151,7 @@ declare class MultiValueJsonEditorRule extends JsonEditorRuleBase {
|
|
|
1151
1151
|
editProperty(key: string, value: JsonValue, state: JsonEditorState): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;
|
|
1152
1152
|
/**
|
|
1153
1153
|
* Extends the {@link IJsonContext | current context} with a supplied state and values.
|
|
1154
|
-
* @param state - The {@link
|
|
1154
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1155
1155
|
* @param values - An array of {@link VariableValue | VariableValue} to be added to the
|
|
1156
1156
|
* context.
|
|
1157
1157
|
* @returns The extended {@link IJsonContext | context}.
|
|
@@ -1161,10 +1161,10 @@ declare class MultiValueJsonEditorRule extends JsonEditorRuleBase {
|
|
|
1161
1161
|
/**
|
|
1162
1162
|
* Determines if a given property key is multi-value. Derived classes can override this
|
|
1163
1163
|
* method to use a different format for multi-value properties.
|
|
1164
|
-
* @param value - The
|
|
1165
|
-
* @param state - The {@link
|
|
1164
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
1165
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1166
1166
|
* @returns `Success` with detail `'deferred'` and an
|
|
1167
|
-
* {@link
|
|
1167
|
+
* {@link EditorRules.IMultiValuePropertyParts | IMultiValuePropertyParts}
|
|
1168
1168
|
* describing the match for matching multi-value property. Returns `Failure` with detail `'error'` if an error occurs
|
|
1169
1169
|
* or with detail `'inapplicable'` if the key does not represent a multi-value property.
|
|
1170
1170
|
* @public
|
|
@@ -1181,18 +1181,18 @@ export declare class PrefixedJsonMap extends SimpleJsonMap {
|
|
|
1181
1181
|
/**
|
|
1182
1182
|
* Constructs a new {@link PrefixedJsonMap | PrefixedJsonMap} from the supplied values
|
|
1183
1183
|
* @param prefix - A string prefix to be enforced for and added to key names as necessary
|
|
1184
|
-
* @param values - A string-keyed Map or Record of the
|
|
1184
|
+
* @param values - A string-keyed Map or Record of the `JsonValue` to be returned
|
|
1185
1185
|
* @param context - Optional {@link IJsonContext | JSON Context} used to format returned values
|
|
1186
|
-
* @param editor - Optional {@link
|
|
1186
|
+
* @param editor - Optional {@link JsonEditor | JsonEditor} used to format returned values
|
|
1187
1187
|
* @public
|
|
1188
1188
|
*/
|
|
1189
1189
|
protected constructor(values?: MapOrRecord<JsonValue>, context?: IJsonContext, options?: ISimpleJsonMapOptions);
|
|
1190
1190
|
/**
|
|
1191
1191
|
* Creates a new {@link PrefixedJsonMap | PrefixedJsonMap} from the supplied values
|
|
1192
1192
|
* @param prefix - A string prefix to be enforced for and added to key names as necessary
|
|
1193
|
-
* @param values - A string-keyed Map or Record of the
|
|
1193
|
+
* @param values - A string-keyed Map or Record of the `JsonValue` to be returned
|
|
1194
1194
|
* @param context - Optional {@link IJsonContext | JSON Context} used to format returned values
|
|
1195
|
-
* @param editor - Optional {@link
|
|
1195
|
+
* @param editor - Optional {@link JsonEditor | JsonEditor} used to format returned values
|
|
1196
1196
|
* @returns `Success` with a {@link PrefixedJsonMap | PrefixedJsonMap} or `Failure` with a message
|
|
1197
1197
|
* if an error occurs.
|
|
1198
1198
|
*/
|
|
@@ -1201,9 +1201,9 @@ export declare class PrefixedJsonMap extends SimpleJsonMap {
|
|
|
1201
1201
|
* Creates a new {@link PrefixedJsonMap | PrefixedJsonMap} from the supplied values
|
|
1202
1202
|
* @param prefixOptions - A KeyPrefixOptions indicating the prefix to enforce and whether that prefix should
|
|
1203
1203
|
* be added automatically if necessary (default true)
|
|
1204
|
-
* @param values - A string-keyed Map or record of the
|
|
1204
|
+
* @param values - A string-keyed Map or record of the `JsonValue` to be returned
|
|
1205
1205
|
* @param context - Optional {@link IJsonContext | JSON Context} used to format returned values
|
|
1206
|
-
* @param editor - Optional {@link
|
|
1206
|
+
* @param editor - Optional {@link JsonEditor | JsonEditor} used to format returned values
|
|
1207
1207
|
*/
|
|
1208
1208
|
static createPrefixed(prefixOptions: IKeyPrefixOptions, values?: MapOrRecord<JsonValue>, context?: IJsonContext, editor?: JsonEditor): Result<PrefixedJsonMap>;
|
|
1209
1209
|
/**
|
|
@@ -1219,7 +1219,7 @@ export declare class PrefixedJsonMap extends SimpleJsonMap {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
1221
|
/**
|
|
1222
|
-
* The {@link
|
|
1222
|
+
* The {@link EditorRules.ReferenceJsonEditorRule | Reference JSON editor rule} replaces property
|
|
1223
1223
|
* keys or values that match some known object with a copy of that referenced object, formatted
|
|
1224
1224
|
* according to the current context.
|
|
1225
1225
|
*
|
|
@@ -1241,40 +1241,40 @@ export declare class PrefixedJsonMap extends SimpleJsonMap {
|
|
|
1241
1241
|
*/
|
|
1242
1242
|
declare class ReferenceJsonEditorRule extends JsonEditorRuleBase {
|
|
1243
1243
|
/**
|
|
1244
|
-
* Stored fully-resolved {@link
|
|
1244
|
+
* Stored fully-resolved {@link IJsonEditorOptions | editor options} for this rule.
|
|
1245
1245
|
* @public
|
|
1246
1246
|
*/
|
|
1247
1247
|
protected _options?: IJsonEditorOptions;
|
|
1248
1248
|
/**
|
|
1249
|
-
* Creates a new {@link
|
|
1250
|
-
* @param options - Optional {@link
|
|
1249
|
+
* Creates a new {@link EditorRules.ReferenceJsonEditorRule | ReferenceJsonEditorRule}.
|
|
1250
|
+
* @param options - Optional {@link IJsonEditorOptions | configuration options} for this rule.
|
|
1251
1251
|
*/
|
|
1252
1252
|
constructor(options?: IJsonEditorOptions);
|
|
1253
1253
|
/**
|
|
1254
|
-
* Creates a new {@link
|
|
1255
|
-
* @param options - Optional {@link
|
|
1254
|
+
* Creates a new {@link EditorRules.ReferenceJsonEditorRule | ReferenceJsonEditorRule}.
|
|
1255
|
+
* @param options - Optional {@link IJsonEditorOptions | configuration options} for this rule.
|
|
1256
1256
|
*/
|
|
1257
1257
|
static create(options?: IJsonEditorOptions): Result<ReferenceJsonEditorRule>;
|
|
1258
1258
|
/**
|
|
1259
1259
|
* Evaluates a property for reference expansion.
|
|
1260
1260
|
* @param key - The key of the property to be considered.
|
|
1261
|
-
* @param value - The
|
|
1262
|
-
* @param state - The {@link
|
|
1263
|
-
* @returns If the reference is successful, returns `Success` with a
|
|
1261
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
1262
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1263
|
+
* @returns If the reference is successful, returns `Success` with a `JsonObject`
|
|
1264
1264
|
* to be flattened and merged into the current object. Returns `Failure` with detail `'inapplicable'`
|
|
1265
1265
|
* for non-reference keys or with detail `'error'` if an error occurs.
|
|
1266
1266
|
*/
|
|
1267
1267
|
editProperty(key: string, value: JsonValue, state: JsonEditorState): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;
|
|
1268
1268
|
/**
|
|
1269
1269
|
* Evaluates a property, array or literal value for reference replacement.
|
|
1270
|
-
* @param value - The
|
|
1271
|
-
* @param state - The {@link
|
|
1270
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
1271
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1272
1272
|
*/
|
|
1273
1273
|
editValue(value: JsonValue, state: JsonEditorState): DetailedResult<JsonValue, JsonEditFailureReason>;
|
|
1274
1274
|
/**
|
|
1275
1275
|
* Gets the template variables to use given the value of some property whose name matched a
|
|
1276
1276
|
* resource plus the base template context.
|
|
1277
|
-
* @param state - The {@link
|
|
1277
|
+
* @param state - The {@link JsonEditorState | editor state} to be extended.
|
|
1278
1278
|
* @param supplied - The string or object supplied in the source json.
|
|
1279
1279
|
* @internal
|
|
1280
1280
|
*/
|
|
@@ -1391,7 +1391,7 @@ export declare type RichJsonConverterOptions = Omit<ConditionalJsonConverterOpti
|
|
|
1391
1391
|
|
|
1392
1392
|
/**
|
|
1393
1393
|
* A {@link SimpleJsonMap | SimpleJsonMap } presents a view of a simple map
|
|
1394
|
-
* of
|
|
1394
|
+
* of JSON values.
|
|
1395
1395
|
* @public
|
|
1396
1396
|
*/
|
|
1397
1397
|
export declare class SimpleJsonMap extends SimpleJsonMapBase<JsonValue> {
|
|
@@ -1401,7 +1401,7 @@ export declare class SimpleJsonMap extends SimpleJsonMapBase<JsonValue> {
|
|
|
1401
1401
|
protected _editor?: JsonEditor;
|
|
1402
1402
|
/**
|
|
1403
1403
|
* Constructs a new {@link SimpleJsonMap | SimpleJsonMap} from the supplied objects
|
|
1404
|
-
* @param values - A string-keyed `Map` or `Record` of the
|
|
1404
|
+
* @param values - A string-keyed `Map` or `Record` of the `JsonValue`
|
|
1405
1405
|
* to be returned.
|
|
1406
1406
|
* @param context - Optional {@link IJsonContext | IJsonContext} used to format returned values.
|
|
1407
1407
|
* @param options - Optional {@link ISimpleJsonMapOptions | ISimpleJsonMapOptions} for initialization.
|
|
@@ -1410,7 +1410,7 @@ export declare class SimpleJsonMap extends SimpleJsonMapBase<JsonValue> {
|
|
|
1410
1410
|
protected constructor(values?: MapOrRecord<JsonValue>, context?: IJsonContext, options?: ISimpleJsonMapOptions);
|
|
1411
1411
|
/**
|
|
1412
1412
|
* Creates a new {@link SimpleJsonMap | SimpleJsonMap} from the supplied objects
|
|
1413
|
-
* @param values - A string-keyed `Map` or `Record` of the
|
|
1413
|
+
* @param values - A string-keyed `Map` or `Record` of the `JsonValue`
|
|
1414
1414
|
* to be returned.
|
|
1415
1415
|
* @param context - Optional {@link IJsonContext | IJsonContext} used to format returned values.
|
|
1416
1416
|
* @param options - Optional {@link ISimpleJsonMapOptions | ISimpleJsonMapOptions} for initialization.
|
|
@@ -1419,7 +1419,7 @@ export declare class SimpleJsonMap extends SimpleJsonMapBase<JsonValue> {
|
|
|
1419
1419
|
*/
|
|
1420
1420
|
static createSimple(values?: MapOrRecord<JsonValue>, context?: IJsonContext, options?: ISimpleJsonMapOptions): Result<SimpleJsonMap>;
|
|
1421
1421
|
/**
|
|
1422
|
-
* Gets a
|
|
1422
|
+
* Gets a `JsonValue` specified by key.
|
|
1423
1423
|
* @param key - key of the value to be retrieved
|
|
1424
1424
|
* @param context - Optional {@link IJsonContext | JSON context} used to format the value
|
|
1425
1425
|
* @returns Success with the formatted object if successful. Failure with detail 'unknown'
|
|
@@ -1436,7 +1436,6 @@ export declare class SimpleJsonMap extends SimpleJsonMapBase<JsonValue> {
|
|
|
1436
1436
|
/**
|
|
1437
1437
|
* Abstract base class with common functionality for simple
|
|
1438
1438
|
* {@link IJsonReferenceMap | reference map} implementations.
|
|
1439
|
-
* {@link JsonValue | json values}.
|
|
1440
1439
|
* @public
|
|
1441
1440
|
*/
|
|
1442
1441
|
declare abstract class SimpleJsonMapBase<T> implements IJsonReferenceMap {
|
|
@@ -1487,7 +1486,7 @@ declare abstract class SimpleJsonMapBase<T> implements IJsonReferenceMap {
|
|
|
1487
1486
|
*/
|
|
1488
1487
|
has(key: string): boolean;
|
|
1489
1488
|
/**
|
|
1490
|
-
* Gets a
|
|
1489
|
+
* Gets a `JsonObject` specified by key.
|
|
1491
1490
|
* @param key - key of the object to be retrieved
|
|
1492
1491
|
* @param context - optional {@link IJsonContext | JSON context} used to format the
|
|
1493
1492
|
* returned object.
|
|
@@ -1498,7 +1497,7 @@ declare abstract class SimpleJsonMapBase<T> implements IJsonReferenceMap {
|
|
|
1498
1497
|
*/
|
|
1499
1498
|
getJsonObject(key: string, context?: IJsonContext): DetailedResult<JsonObject, JsonReferenceMapFailureReason>;
|
|
1500
1499
|
/**
|
|
1501
|
-
* Gets a
|
|
1500
|
+
* Gets a `JsonValue` specified by key.
|
|
1502
1501
|
* @param key - key of the value to be retrieved
|
|
1503
1502
|
* @param context - Optional {@link IJsonContext | JSON context} used to format the value
|
|
1504
1503
|
* @returns Success with the formatted object if successful. Failure with detail 'unknown'
|
|
@@ -1553,34 +1552,34 @@ declare abstract class SimpleJsonMapBase<T> implements IJsonReferenceMap {
|
|
|
1553
1552
|
export declare type TemplatedJsonConverterOptions = Omit<IJsonConverterOptions, 'useNameTemplates' | 'useValueTemplates' | 'useMultiValueTemplateNames'>;
|
|
1554
1553
|
|
|
1555
1554
|
/**
|
|
1556
|
-
* The {@link
|
|
1555
|
+
* The {@link EditorRules.TemplatedJsonEditorRule | Templated JSON editor rule} applies mustache rendering as
|
|
1557
1556
|
* appropriate to any keys or values in the object being edited.
|
|
1558
1557
|
* @public
|
|
1559
1558
|
*/
|
|
1560
1559
|
declare class TemplatedJsonEditorRule extends JsonEditorRuleBase {
|
|
1561
1560
|
/**
|
|
1562
|
-
* Fully-resolved {@link
|
|
1561
|
+
* Fully-resolved {@link EditorRules.ITemplatedJsonRuleOptions | configuration options} for this rule.
|
|
1563
1562
|
* @public
|
|
1564
1563
|
*/
|
|
1565
1564
|
protected _options?: ITemplatedJsonRuleOptions;
|
|
1566
1565
|
/**
|
|
1567
|
-
* Creates a new {@link
|
|
1568
|
-
* @param options - Optional {@link
|
|
1566
|
+
* Creates a new {@link EditorRules.TemplatedJsonEditorRule | TemplatedJsonEditorRule}.
|
|
1567
|
+
* @param options - Optional {@link EditorRules.ITemplatedJsonRuleOptions | configuration options}
|
|
1569
1568
|
* for this rule.
|
|
1570
1569
|
*/
|
|
1571
1570
|
constructor(options?: ITemplatedJsonRuleOptions);
|
|
1572
1571
|
/**
|
|
1573
|
-
* Creates a new {@link
|
|
1574
|
-
* @param options - Optional {@link
|
|
1572
|
+
* Creates a new {@link EditorRules.TemplatedJsonEditorRule | TemplatedJsonEditorRule}.
|
|
1573
|
+
* @param options - Optional {@link EditorRules.ITemplatedJsonRuleOptions | configuration options}
|
|
1575
1574
|
* for this rule.
|
|
1576
1575
|
*/
|
|
1577
1576
|
static create(options?: ITemplatedJsonRuleOptions): Result<TemplatedJsonEditorRule>;
|
|
1578
1577
|
/**
|
|
1579
1578
|
* Evaluates a property name for template rendering.
|
|
1580
1579
|
* @param key - The key of the property to be considered.
|
|
1581
|
-
* @param value - The
|
|
1582
|
-
* @param state - The {@link
|
|
1583
|
-
* @returns `Success` with detail `'edited'` and an
|
|
1580
|
+
* @param value - The `JsonValue` of the property to be considered.
|
|
1581
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1582
|
+
* @returns `Success` with detail `'edited'` and an `JsonObject` to
|
|
1584
1583
|
* be flattened and merged if the key contained a template. Returns `Failure` with detail `'error'`
|
|
1585
1584
|
* if an error occurred or with detail `'inapplicable'` if the property key does not contain
|
|
1586
1585
|
* a template or if name rendering is disabled.
|
|
@@ -1588,17 +1587,17 @@ declare abstract class SimpleJsonMapBase<T> implements IJsonReferenceMap {
|
|
|
1588
1587
|
editProperty(key: string, value: JsonValue, state: JsonEditorState): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;
|
|
1589
1588
|
/**
|
|
1590
1589
|
* Evaluates a property, array or literal value for template rendering.
|
|
1591
|
-
* @param value - The
|
|
1592
|
-
* @param state - The {@link
|
|
1590
|
+
* @param value - The `JsonValue` to be edited.
|
|
1591
|
+
* @param state - The {@link JsonEditorState | editor state} for the object being edited.
|
|
1593
1592
|
* @returns `Success` with detail `'edited'` if the value contained a template and was edited.
|
|
1594
1593
|
* Returns `Failure` with `'ignore'` if the rendered value should be ignored, with `'error'` if
|
|
1595
1594
|
* an error occurs, or with `'inapplicable'` if the value was not a string with a template.
|
|
1596
1595
|
*/
|
|
1597
1596
|
editValue(value: JsonValue, state: JsonEditorState): DetailedResult<JsonValue, JsonEditFailureReason>;
|
|
1598
1597
|
/**
|
|
1599
|
-
* Renders a single template string for a supplied {@link
|
|
1598
|
+
* Renders a single template string for a supplied {@link JsonEditorState | editor state}.
|
|
1600
1599
|
* @param template - The mustache template to be rendered.
|
|
1601
|
-
* @param state - The {@link
|
|
1600
|
+
* @param state - The {@link JsonEditorState | editor state} used to render the template.
|
|
1602
1601
|
* @returns `Success` if the template is rendered. Returns `Failure` with detail `'error'` if the
|
|
1603
1602
|
* template could not be rendered (e.g. due to syntax errors) or with detail `'inapplicable'` if the
|
|
1604
1603
|
* string is not a template.
|