@fgv/ts-json 5.0.0-2 → 5.0.0-21

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.
Files changed (94) hide show
  1. package/.vscode/launch.json +16 -0
  2. package/.vscode/settings.json +32 -0
  3. package/config/api-extractor.json +343 -0
  4. package/config/rig.json +16 -0
  5. package/dist/ts-json.d.ts +719 -28
  6. package/dist/tsdoc-metadata.json +1 -1
  7. package/lib/index.d.ts +2 -0
  8. package/lib/index.js +25 -0
  9. package/lib/packlets/diff/detailedDiff.d.ts +375 -0
  10. package/lib/packlets/diff/detailedDiff.js +342 -0
  11. package/lib/packlets/diff/index.d.ts +3 -0
  12. package/lib/packlets/diff/index.js +40 -0
  13. package/lib/packlets/diff/threeWayDiff.d.ts +263 -0
  14. package/lib/packlets/diff/threeWayDiff.js +261 -0
  15. package/lib/packlets/diff/utils.d.ts +6 -0
  16. package/lib/packlets/diff/utils.js +62 -0
  17. package/lib/packlets/editor/common.d.ts +6 -0
  18. package/lib/packlets/editor/jsonEditor.d.ts +57 -28
  19. package/lib/packlets/editor/jsonEditor.js +101 -32
  20. package/lib/test/legacy/jsonConverter.conditional.test.d.ts +2 -0
  21. package/lib/test/legacy/jsonEditor/rules/conditional.test.d.ts +2 -0
  22. package/lib/test/legacy/jsonEditor/rules/multivalue.test.d.ts +2 -0
  23. package/lib/test/legacy/jsonEditor/rules/references.test.d.ts +2 -0
  24. package/lib/test/legacy/jsonEditor/rules/templates.test.d.ts +2 -0
  25. package/lib/test/unit/contextHelpers.test.d.ts +2 -0
  26. package/lib/test/unit/converters.test.d.ts +2 -0
  27. package/lib/test/unit/diff/jsonDiff.test.d.ts +2 -0
  28. package/lib/test/unit/jsonConverter.test.d.ts +2 -0
  29. package/lib/test/unit/jsonEditor/jsonEditor.test.d.ts +2 -0
  30. package/lib/test/unit/jsonEditor/templateContext.test.d.ts +2 -0
  31. package/lib/test/unit/jsonReferenceMap.test.d.ts +2 -0
  32. package/package.json +11 -11
  33. package/src/index.ts +29 -0
  34. package/src/packlets/context/compositeJsonMap.ts +120 -0
  35. package/src/packlets/context/contextHelpers.ts +221 -0
  36. package/src/packlets/context/index.ts +33 -0
  37. package/src/packlets/context/jsonContext.ts +133 -0
  38. package/src/packlets/converters/converters.ts +117 -0
  39. package/src/packlets/converters/index.ts +26 -0
  40. package/src/packlets/converters/jsonConverter.ts +476 -0
  41. package/src/packlets/diff/detailedDiff.ts +585 -0
  42. package/src/packlets/diff/index.ts +24 -0
  43. package/src/packlets/diff/threeWayDiff.ts +420 -0
  44. package/src/packlets/diff/utils.ts +66 -0
  45. package/src/packlets/editor/common.ts +125 -0
  46. package/src/packlets/editor/index.ts +36 -0
  47. package/src/packlets/editor/jsonEditor.ts +523 -0
  48. package/src/packlets/editor/jsonEditorRule.ts +117 -0
  49. package/src/packlets/editor/jsonEditorState.ts +225 -0
  50. package/src/packlets/editor/jsonReferenceMap.ts +516 -0
  51. package/src/packlets/editor/rules/conditional.ts +222 -0
  52. package/src/packlets/editor/rules/index.ts +25 -0
  53. package/src/packlets/editor/rules/multivalue.ts +206 -0
  54. package/src/packlets/editor/rules/references.ts +177 -0
  55. package/src/packlets/editor/rules/templates.ts +159 -0
  56. package/CHANGELOG.md +0 -115
  57. package/lib/index.d.ts.map +0 -1
  58. package/lib/index.js.map +0 -1
  59. package/lib/packlets/context/compositeJsonMap.d.ts.map +0 -1
  60. package/lib/packlets/context/compositeJsonMap.js.map +0 -1
  61. package/lib/packlets/context/contextHelpers.d.ts.map +0 -1
  62. package/lib/packlets/context/contextHelpers.js.map +0 -1
  63. package/lib/packlets/context/index.d.ts.map +0 -1
  64. package/lib/packlets/context/index.js.map +0 -1
  65. package/lib/packlets/context/jsonContext.d.ts.map +0 -1
  66. package/lib/packlets/context/jsonContext.js.map +0 -1
  67. package/lib/packlets/converters/converters.d.ts.map +0 -1
  68. package/lib/packlets/converters/converters.js.map +0 -1
  69. package/lib/packlets/converters/index.d.ts.map +0 -1
  70. package/lib/packlets/converters/index.js.map +0 -1
  71. package/lib/packlets/converters/jsonConverter.d.ts.map +0 -1
  72. package/lib/packlets/converters/jsonConverter.js.map +0 -1
  73. package/lib/packlets/editor/common.d.ts.map +0 -1
  74. package/lib/packlets/editor/common.js.map +0 -1
  75. package/lib/packlets/editor/index.d.ts.map +0 -1
  76. package/lib/packlets/editor/index.js.map +0 -1
  77. package/lib/packlets/editor/jsonEditor.d.ts.map +0 -1
  78. package/lib/packlets/editor/jsonEditor.js.map +0 -1
  79. package/lib/packlets/editor/jsonEditorRule.d.ts.map +0 -1
  80. package/lib/packlets/editor/jsonEditorRule.js.map +0 -1
  81. package/lib/packlets/editor/jsonEditorState.d.ts.map +0 -1
  82. package/lib/packlets/editor/jsonEditorState.js.map +0 -1
  83. package/lib/packlets/editor/jsonReferenceMap.d.ts.map +0 -1
  84. package/lib/packlets/editor/jsonReferenceMap.js.map +0 -1
  85. package/lib/packlets/editor/rules/conditional.d.ts.map +0 -1
  86. package/lib/packlets/editor/rules/conditional.js.map +0 -1
  87. package/lib/packlets/editor/rules/index.d.ts.map +0 -1
  88. package/lib/packlets/editor/rules/index.js.map +0 -1
  89. package/lib/packlets/editor/rules/multivalue.d.ts.map +0 -1
  90. package/lib/packlets/editor/rules/multivalue.js.map +0 -1
  91. package/lib/packlets/editor/rules/references.d.ts.map +0 -1
  92. package/lib/packlets/editor/rules/references.js.map +0 -1
  93. package/lib/packlets/editor/rules/templates.d.ts.map +0 -1
  94. package/lib/packlets/editor/rules/templates.js.map +0 -1
@@ -0,0 +1,159 @@
1
+ /*
2
+ * Copyright (c) 2020 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+ import { JsonObject, JsonValue } from '@fgv/ts-json-base';
24
+ import { DetailedResult, Result, captureResult, failWithDetail, succeedWithDetail } from '@fgv/ts-utils';
25
+ import { IJsonEditorOptions, JsonEditFailureReason, JsonPropertyEditFailureReason } from '../common';
26
+ import { JsonEditorRuleBase } from '../jsonEditorRule';
27
+ import { JsonEditorState } from '../jsonEditorState';
28
+
29
+ import Mustache from 'mustache';
30
+
31
+ /**
32
+ * Configuration options for the {@link EditorRules.TemplatedJsonEditorRule | Templated JSON editor rule}.
33
+ * @public
34
+ */
35
+ export interface ITemplatedJsonRuleOptions extends Partial<IJsonEditorOptions> {
36
+ /**
37
+ * If `true` (default) then templates in property names are rendered
38
+ */
39
+ useNameTemplates?: boolean;
40
+ /**
41
+ * If `true` (default) then templates in property values are rendered
42
+ */
43
+ useValueTemplates?: boolean;
44
+ }
45
+
46
+ /**
47
+ * The {@link EditorRules.TemplatedJsonEditorRule | Templated JSON editor rule} applies mustache rendering as
48
+ * appropriate to any keys or values in the object being edited.
49
+ * @public
50
+ */
51
+ export class TemplatedJsonEditorRule extends JsonEditorRuleBase {
52
+ /**
53
+ * Fully-resolved {@link EditorRules.ITemplatedJsonRuleOptions | configuration options} for this rule.
54
+ * @public
55
+ */
56
+ protected _options?: ITemplatedJsonRuleOptions;
57
+
58
+ /**
59
+ * Creates a new {@link EditorRules.TemplatedJsonEditorRule | TemplatedJsonEditorRule}.
60
+ * @param options - Optional {@link EditorRules.ITemplatedJsonRuleOptions | configuration options}
61
+ * for this rule.
62
+ */
63
+ public constructor(options?: ITemplatedJsonRuleOptions) {
64
+ super();
65
+ this._options = options;
66
+ }
67
+
68
+ /**
69
+ * Creates a new {@link EditorRules.TemplatedJsonEditorRule | TemplatedJsonEditorRule}.
70
+ * @param options - Optional {@link EditorRules.ITemplatedJsonRuleOptions | configuration options}
71
+ * for this rule.
72
+ */
73
+ public static create(options?: ITemplatedJsonRuleOptions): Result<TemplatedJsonEditorRule> {
74
+ return captureResult(() => new TemplatedJsonEditorRule(options));
75
+ }
76
+
77
+ /**
78
+ * Evaluates a property name for template rendering.
79
+ * @param key - The key of the property to be considered.
80
+ * @param value - The `JsonValue` of the property to be considered.
81
+ * @param state - The {@link JsonEditorState | editor state} for the object being edited.
82
+ * @returns `Success` with detail `'edited'` and an `JsonObject` to
83
+ * be flattened and merged if the key contained a template. Returns `Failure` with detail `'error'`
84
+ * if an error occurred or with detail `'inapplicable'` if the property key does not contain
85
+ * a template or if name rendering is disabled.
86
+ */
87
+ public editProperty(
88
+ key: string,
89
+ value: JsonValue,
90
+ state: JsonEditorState
91
+ ): DetailedResult<JsonObject, JsonPropertyEditFailureReason> {
92
+ /* c8 ignore next 2 */
93
+ const validation = this._options?.validation;
94
+ const useNameTemplates = this._options?.useNameTemplates !== false;
95
+
96
+ if (useNameTemplates !== false) {
97
+ const result = this._render(key, state).onSuccess((newKey) => {
98
+ if (newKey.length < 1) {
99
+ return state.failValidation('invalidPropertyName', `Template "${key}" renders empty name.`);
100
+ }
101
+
102
+ const rtrn: JsonObject = {};
103
+ rtrn[newKey] = value;
104
+ return succeedWithDetail<JsonObject, JsonEditFailureReason>(rtrn, 'edited');
105
+ });
106
+
107
+ if (result.isFailure() && result.detail === 'error') {
108
+ const message = `Cannot render name ${key}: ${result.message}`;
109
+ return state.failValidation('invalidPropertyName', message, validation);
110
+ }
111
+ return result;
112
+ }
113
+ return failWithDetail('inapplicable', 'inapplicable');
114
+ }
115
+
116
+ /**
117
+ * Evaluates a property, array or literal value for template rendering.
118
+ * @param value - The `JsonValue` to be edited.
119
+ * @param state - The {@link JsonEditorState | editor state} for the object being edited.
120
+ * @returns `Success` with detail `'edited'` if the value contained a template and was edited.
121
+ * Returns `Failure` with `'ignore'` if the rendered value should be ignored, with `'error'` if
122
+ * an error occurs, or with `'inapplicable'` if the value was not a string with a template.
123
+ */
124
+ public editValue(
125
+ value: JsonValue,
126
+ state: JsonEditorState
127
+ ): DetailedResult<JsonValue, JsonEditFailureReason> {
128
+ if (this._options?.useValueTemplates !== false && typeof value === 'string' && value.includes('{{')) {
129
+ const renderResult = this._render(value, state).onSuccess((newValue) => {
130
+ return succeedWithDetail(newValue, 'edited');
131
+ });
132
+
133
+ if (renderResult.isFailure() && renderResult.detail === 'error') {
134
+ const message = `Cannot render value: ${renderResult.message}`;
135
+ /* c8 ignore next */
136
+ return state.failValidation('invalidPropertyValue', message, this._options?.validation);
137
+ }
138
+ return renderResult;
139
+ }
140
+ return failWithDetail('inapplicable', 'inapplicable');
141
+ }
142
+
143
+ /**
144
+ * Renders a single template string for a supplied {@link JsonEditorState | editor state}.
145
+ * @param template - The mustache template to be rendered.
146
+ * @param state - The {@link JsonEditorState | editor state} used to render the template.
147
+ * @returns `Success` if the template is rendered. Returns `Failure` with detail `'error'` if the
148
+ * template could not be rendered (e.g. due to syntax errors) or with detail `'inapplicable'` if the
149
+ * string is not a template.
150
+ * @internal
151
+ */
152
+ protected _render(template: string, state: JsonEditorState): DetailedResult<string, JsonEditFailureReason> {
153
+ const vars = state.getVars(this._options?.context);
154
+ if (vars && template.includes('{{')) {
155
+ return captureResult(() => Mustache.render(template, vars)).withDetail('error', 'edited');
156
+ }
157
+ return failWithDetail('inapplicable', 'inapplicable');
158
+ }
159
+ }
package/CHANGELOG.md DELETED
@@ -1,115 +0,0 @@
1
- # Change Log - @fgv/ts-json
2
-
3
- This log was last generated on Thu, 17 Jul 2025 00:13:24 GMT and should not be manually modified.
4
-
5
- ## 5.0.0
6
- Thu, 17 Jul 2025 00:13:24 GMT
7
-
8
- ### Updates
9
-
10
- - upgrade dependencies
11
- - bump version
12
-
13
- ## 4.6.0
14
- Wed, 02 Jul 2025 05:48:16 GMT
15
-
16
- _Version update only_
17
-
18
- ## 4.5.1
19
- Wed, 02 Jul 2025 05:47:11 GMT
20
-
21
- ### Updates
22
-
23
- - update rushstack
24
-
25
- ## 4.5.0
26
- Tue, 01 Jul 2025 03:26:11 GMT
27
-
28
- ### Patches
29
-
30
- - Fix incorrect build script in package.json that was running tests instead of build
31
-
32
- ## 4.4.0
33
- Sat, 01 Feb 2025 17:13:10 GMT
34
-
35
- _Version update only_
36
-
37
- ## 4.3.0
38
- Thu, 30 Jan 2025 00:35:17 GMT
39
-
40
- _Version update only_
41
-
42
- ## 4.2.2
43
- Thu, 23 Jan 2025 06:19:32 GMT
44
-
45
- _Version update only_
46
-
47
- ## 4.2.1
48
- Tue, 21 Jan 2025 04:19:21 GMT
49
-
50
- _Version update only_
51
-
52
- ## 4.2.0
53
- Mon, 20 Jan 2025 09:46:53 GMT
54
-
55
- _Version update only_
56
-
57
- ## 4.1.0
58
- Thu, 09 Jan 2025 05:33:39 GMT
59
-
60
- ### Updates
61
-
62
- - update dependencies
63
-
64
- ## 4.0.2
65
- Tue, 14 May 2024 14:45:53 GMT
66
-
67
- _Version update only_
68
-
69
- ## 4.0.1
70
- Tue, 14 May 2024 05:02:20 GMT
71
-
72
- ### Updates
73
-
74
- - publish
75
-
76
- ## 4.0.0
77
- Tue, 14 May 2024 03:09:27 GMT
78
-
79
- ### Updates
80
-
81
- - update dependencies
82
- - update tsdoc comments and generated docs
83
-
84
- ## 3.0.0
85
- Mon, 22 Jan 2024 07:00:18 GMT
86
-
87
- ### Updates
88
-
89
- - fix export issues
90
- - fix peers
91
- - bump versions
92
- - refactor
93
- - major refactor
94
- - Match ts-utils refactor
95
- - version upgrades
96
- - update dependencies
97
- - update peer dependencies
98
- - bump version
99
-
100
- ## 2.2.0
101
- Thu, 18 Jan 2024 05:45:04 GMT
102
-
103
- ### Updates
104
-
105
- - fix export issues
106
- - fix peers
107
- - bump versions
108
- - refactor
109
- - major refactor
110
- - Match ts-utils refactor
111
- - version upgrades
112
- - update dependencies
113
- - update peer dependencies
114
- - bump version
115
-
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,qDAAmC;AACnC,wDAAsC;AACtC,oDAAkC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './packlets/context';\nexport * from './packlets/converters';\nexport * from './packlets/editor';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compositeJsonMap.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/compositeJsonMap.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAgB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAoD,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAE/F;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAErC;;;;;OAKG;IACH,SAAS,aAAa,IAAI,EAAE,iBAAiB,EAAE;IAI/C;;;;OAIG;WACW,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAIzE;;;;;OAKG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;OAIG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIhC;;;;;;;OAOG;IACI,aAAa,CAClB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,GACrB,cAAc,CAAC,UAAU,EAAE,6BAA6B,CAAC;IAS5D;;;;;;;OAOG;IAEI,YAAY,CACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,GACrB,cAAc,CAAC,SAAS,EAAE,6BAA6B,CAAC;CAW5D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compositeJsonMap.js","sourceRoot":"","sources":["../../../src/packlets/context/composit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,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAC9C,IAAI,MAAM,CAAC,SAAS,EAAE,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;oBACpD,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAA,yBAAc,EAAC,GAAG,GAAG,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAxFD,4CAwFC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { JsonObject, JsonValue, isJsonObject } from '@fgv/ts-json-base';\nimport { DetailedResult, Result, captureResult, failWithDetail, succeedWithDetail } from '@fgv/ts-utils';\nimport { IJsonContext, IJsonReferenceMap, JsonReferenceMapFailureReason } from './jsonContext';\n\n/**\n * A {@link CompositeJsonMap | CompositeJsonMap} presents a composed view of one or more other\n * {@link IJsonReferenceMap | JSON reference maps}.\n * @public\n */\nexport class CompositeJsonMap implements IJsonReferenceMap {\n /**\n * The {@link IJsonReferenceMap | reference maps} from which this map is composed.\n * @internal\n */\n protected _maps: IJsonReferenceMap[];\n\n /**\n * The {@link IJsonReferenceMap | reference maps} from which this map is to be composed.\n * @param maps - An array o {@link IJsonReferenceMap | IJsonReferenceMap} containing the maps\n * from which this map is to be composed.\n * @internal\n */\n protected constructor(maps: IJsonReferenceMap[]) {\n this._maps = maps;\n }\n\n /**\n * Creates a new {@link CompositeJsonMap | CompositeJsonMap} from supplied\n * {@link IJsonReferenceMap | maps}.\n * @param maps - one or more {@link IJsonReferenceMap | object maps} to be composed.\n */\n public static create(maps: IJsonReferenceMap[]): Result<CompositeJsonMap> {\n return captureResult(() => new CompositeJsonMap(maps));\n }\n\n /**\n * Determine if a key might be valid for this map but does not determine\n * if key actually exists. Allows key range to be constrained.\n * @param key - The key to be tested.\n * @returns `true` if the key is in the valid range, `false` otherwise.\n */\n public keyIsInRange(key: string): boolean {\n return this._maps.find((map) => map.keyIsInRange(key)) !== undefined;\n }\n\n /**\n * Determines if an object with the specified key actually exists in the map.\n * @param key - The key to be tested.\n * @returns `true` if an object with the specified key exists, `false` otherwise.\n */\n public has(key: string): boolean {\n return this._maps.find((map) => map.has(key)) !== undefined;\n }\n\n /**\n * Gets a JSON object specified by key.\n * @param key - The key of the object to be retrieved.\n * @param context - An optional {@link IJsonContext | JSON Context} used to format the object.\n * @returns `Success` with the formatted object if successful. `Failure` with detail `'unknown'`\n * if no such object exists, or `Failure` with detail `'error'` if the object was found but\n * could not be formatted.\n */\n public getJsonObject(\n key: string,\n context?: IJsonContext\n ): DetailedResult<JsonObject, JsonReferenceMapFailureReason> {\n return this.getJsonValue(key, context).onSuccess((jv) => {\n if (!isJsonObject(jv)) {\n return failWithDetail(`${key}: not an object`, 'error');\n }\n return succeedWithDetail(jv);\n });\n }\n\n /**\n * Gets a JSON value specified by key.\n * @param key - The key of the object to be retrieved.\n * @param context - An optional {@link IJsonContext | JSON Context} used to format the value.\n * @returns `Success` with the formatted object if successful. `Failure` with detail `'unknown'`\n * if no such object exists, or failure with detail `'error'` if the object was found but\n * could not be formatted.\n */\n // eslint-disable-next-line no-use-before-define\n public getJsonValue(\n key: string,\n context?: IJsonContext\n ): DetailedResult<JsonValue, JsonReferenceMapFailureReason> {\n for (const map of this._maps) {\n if (map.keyIsInRange(key)) {\n const result = map.getJsonValue(key, context);\n if (result.isSuccess() || result.detail === 'error') {\n return result;\n }\n }\n }\n return failWithDetail(`${key}: value not found`, 'unknown');\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contextHelpers.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/contextHelpers.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAA0B,MAAM,eAAe,CAAC;AAE/D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EAEd,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAElC;;;;OAIG;gBACgB,OAAO,CAAC,EAAE,YAAY;IAIzC;;;;;;OAMG;WACW,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAIvE;;;;;;;;;OASG;WACW,iBAAiB,CAC7B,WAAW,EAAE,YAAY,GAAG,SAAS,EACrC,IAAI,CAAC,EAAE,aAAa,EAAE,GACrB,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;IAQnC;;;;;;;;;OASG;WACW,iBAAiB,CAC7B,WAAW,EAAE,YAAY,GAAG,SAAS,EACrC,IAAI,CAAC,EAAE,iBAAiB,EAAE,GACz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gBACF,IAAI,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC;oBACrC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;gBACnC,CAAC;qBAAM,IAAI,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC;oBACpD,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;gBAC3C,CAAC;gBACD,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;;OAOG;IACI,UAAU,CAAC,IAAsB;QACtC,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACI,UAAU,CAAC,IAA0B;QAC1C,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;OAQG;IACI,aAAa,CAAC,GAGpB;QACC,OAAO,iBAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;OAQG;IACI,YAAY,CAAC,KAAoB;QACtC,OAAO,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CACF;AAxLD,8CAwLC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, captureResult, succeed } from '@fgv/ts-utils';\nimport { CompositeJsonMap } from './compositeJsonMap';\nimport {\n IJsonContext,\n IJsonReferenceMap,\n TemplateVars,\n VariableValue,\n defaultExtendVars\n} from './jsonContext';\n\n/**\n * Helper class for working with {@link IJsonContext | IJsonContext} objects.\n * @public\n */\nexport class JsonContextHelper {\n /**\n * The base {@link IJsonContext | context} on which we are operating.\n * @internal\n */\n protected _context?: IJsonContext;\n\n /**\n * Constructs a new {@link JsonContextHelper | JsonContextHelper}.\n * @param context - The base {@link IJsonContext | IJsonContext} on\n * which to operate.\n */\n public constructor(context?: IJsonContext) {\n this._context = context;\n }\n\n /**\n * Creates a new {@link IJsonContext | context}.\n * @param context - The base {@link IJsonContext | IJsonContext} on\n * which to operate.\n * @returns `Success` with the new {@link IJsonContext | IJsonContext},\n * or `Failure` with more information if an error occurs.\n */\n public static create(context?: IJsonContext): Result<JsonContextHelper> {\n return captureResult(() => new JsonContextHelper(context));\n }\n\n /**\n * Static helper to extend context variables for a supplied {@link IJsonContext | IJsonContext}.\n * @param baseContext - The {@link IJsonContext | IJsonContext} to be extended, or `undefined`\n * to start from an empty context.\n * @param vars - Optional {@link VariableValue | variable values} to be added to the\n * {@link IJsonContext | context}.\n * @returns `Success` with a new {@link TemplateVars | TemplateVars} containing the variables\n * from the base context, merged with and overridden by any that were passed in, or `Failure`\n * with a message if an error occurs.\n */\n public static extendContextVars(\n baseContext: IJsonContext | undefined,\n vars?: VariableValue[]\n ): Result<TemplateVars | undefined> {\n if (vars && vars.length > 0) {\n const extend = baseContext?.extendVars ?? defaultExtendVars;\n return extend(baseContext?.vars ?? {}, vars);\n }\n return succeed(baseContext?.vars);\n }\n\n /**\n * Static helper to extend context references for a supplied {@link IJsonContext | IJsonContext}.\n * @param baseContext - The {@link IJsonContext | IJsonContext} to be extended, or `undefined`\n * to start from an empty context.\n * @param refs - Optional {@link IJsonReferenceMap | reference maps} to be added to the\n * {@link IJsonContext | context}.\n * @returns `Success` with a new {@link IJsonReferenceMap | reference map} which projects\n * the references from the base context, merged with and overridden by any that were passed in,\n * or `Failure` with a message if an error occurs.\n */\n public static extendContextRefs(\n baseContext: IJsonContext | undefined,\n refs?: IJsonReferenceMap[]\n ): Result<IJsonReferenceMap | undefined> {\n if (refs && refs.length > 0) {\n const full = baseContext?.refs ? [...refs, baseContext.refs] : refs;\n if (full.length > 1) {\n return CompositeJsonMap.create(full);\n }\n return succeed(full[0]);\n }\n return succeed(baseContext?.refs);\n }\n\n /**\n * Static helper to extend context variables and references for a supplied {@link IJsonContext | IJsonContext}.\n * @param baseContext - The {@link IJsonContext | IJsonContext} to be extended, or `undefined`\n * to start from an empty context.\n * @param add - Optional initializer containing {@link VariableValue | variable values} and/or\n * {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.\n * @returns `Success` with a new {@link IJsonContext | IJsonContext} containing the variables and\n * references from the base context, merged with and overridden by any that were passed in, or\n * `Failure` with a message if an error occurs.\n */\n public static extendContext(\n baseContext?: IJsonContext | undefined,\n add?: { vars?: VariableValue[]; refs?: IJsonReferenceMap[] }\n ): Result<IJsonContext | undefined> {\n return JsonContextHelper.extendContextVars(baseContext, add?.vars || []).onSuccess((vars) => {\n return JsonContextHelper.extendContextRefs(baseContext, add?.refs || []).onSuccess((refs) => {\n if (!vars && !refs && !baseContext?.extendVars) {\n return succeed(undefined);\n }\n const rtrn: IJsonContext = { vars, refs };\n if (baseContext?.extendVars) {\n rtrn.extendVars = baseContext.extendVars;\n }\n return succeed(rtrn);\n });\n });\n }\n\n /**\n * Static helper to merge context variables and references for a supplied {@link IJsonContext | IJsonContext}.\n * @param baseContext - The {@link IJsonContext | IJsonContext} into which variables and references\n * are to be merged, or `undefined` to start from an empty context.\n * @param add - Optional initializer containing {@link VariableValue | variable values} and/or\n * {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.\n * @returns `Success` with a new {@link IJsonContext | IJsonContext} containing the variables and\n * references from the base context, merged with and overridden by any that were passed in, or\n * `Failure` with a message if an error occurs.\n */\n public static mergeContext(\n baseContext: IJsonContext | undefined,\n add: IJsonContext | undefined\n ): Result<IJsonContext | undefined> {\n if (baseContext) {\n if (add) {\n const rtrn: IJsonContext = {\n vars: add.vars ?? baseContext.vars,\n refs: add.refs ?? baseContext.refs\n };\n if (add.hasOwnProperty('extendVars')) {\n rtrn.extendVars = add.extendVars;\n } else if (baseContext.hasOwnProperty('extendVars')) {\n rtrn.extendVars = baseContext.extendVars;\n }\n return succeed(rtrn);\n }\n return succeed(baseContext);\n }\n return succeed(add);\n }\n\n /**\n * Applies {@link JsonContextHelper.extendContextVars | extendContextVars} to the\n * {@link IJsonContext | IJsonContext} associated with this helper.\n * @param vars - Optional {@link VariableValue | variable values} to be added to the\n * @returns `Success` with a new {@link TemplateVars | TemplateVars} containing the variables\n * from the base context, merged with and overridden by any that were passed in, or `Failure`\n * with a message if an error occurs.\n */\n public extendVars(vars?: VariableValue[]): Result<TemplateVars | undefined> {\n return JsonContextHelper.extendContextVars(this._context, vars);\n }\n\n /**\n * Applies {@link JsonContextHelper.extendContextRefs | extendContextRefs} to the\n * {@link IJsonContext | IJsonContext} associated with this helper.\n * @param refs - Optional {@link IJsonReferenceMap | reference maps} to be added to the\n * @returns `Success` with a new {@link IJsonReferenceMap | reference map} which projects\n * the references from the base context, merged with and overridden by any that were passed in,\n * or `Failure` with a message if an error occurs.\n */\n public extendRefs(refs?: IJsonReferenceMap[]): Result<IJsonReferenceMap | undefined> {\n return JsonContextHelper.extendContextRefs(this._context, refs);\n }\n\n /**\n * Applies static `JsonContextHelper.extendContext` to the\n * {@link IJsonContext | IJsonContext} associated with this helper.\n * @param add - Optional initializer containing {@link VariableValue | variable values} and/or\n * {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.\n * @returns `Success` with a new {@link IJsonContext | IJsonContext} containing the variables and\n * references from the base context, merged with and overridden by any that were passed in, or\n * `Failure` with a message if an error occurs.\n */\n public extendContext(add?: {\n vars?: VariableValue[];\n refs?: IJsonReferenceMap[];\n }): Result<IJsonContext | undefined> {\n return JsonContextHelper.extendContext(this._context, add);\n }\n\n /**\n * Applies static `JsonContextHelper.mergeContext` to the\n * {@link IJsonContext | IJsonContext} associated with this helper.\n * @param add - Optional initializer containing {@link VariableValue | variable values} and/or\n * {@link IJsonReferenceMap | reference maps} to be added to the {@link IJsonContext | context}.\n * @returns `Success` with a new {@link IJsonContext | IJsonContext} containing the variables and\n * references from the base context, merged with and overridden by any that were passed in, or\n * `Failure` with a message if an error occurs.\n */\n public mergeContext(merge?: IJsonContext): Result<IJsonContext | undefined> {\n return JsonContextHelper.mergeContext(this._context, merge);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/index.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,6BAA6B,EAC7B,YAAY,EACZ,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EAClB,MAAM,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/context/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mDAAqD;AAA5C,mHAAA,iBAAiB,OAAA;AAC1B,6CAQuB;AADrB,gHAAA,iBAAiB,OAAA","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport { CompositeJsonMap } from './compositeJsonMap';\nexport { JsonContextHelper } from './contextHelpers';\nexport {\n IJsonContext,\n IJsonReferenceMap,\n JsonReferenceMapFailureReason,\n TemplateVars,\n TemplateVarsExtendFunction,\n VariableValue,\n defaultExtendVars\n} from './jsonContext';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonContext.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/jsonContext.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,SA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B,UAAU,CAAC,EAAE,0BAA0B,CAAC;CACzC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonContext.js","sourceRoot":"","sources":["../../../src/packlets/context/jsonContext.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAoCH,8CAUC;AA3CD,4CAAgE;AA0BhE;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,IAA8B,EAC9B,MAAuB;IAEvB,sBAAsB;IACtB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { JsonObject, JsonValue } from '@fgv/ts-json-base';\nimport { DetailedResult, Result, succeed } from '@fgv/ts-utils';\n\n/**\n * Collection of variables used for template replacement in a JSON edit or\n * conversion.\n * @public\n */\nexport type TemplateVars = Record<string, unknown>;\n\n/**\n * Describes one value in a {@link TemplateVars | TemplateVars} collection of\n * variables.\n * @public\n */\nexport type VariableValue = [string, unknown];\n\n/**\n * Function used to create a new collection of {@link TemplateVars | TemplateVars} with\n * one or more new or changed values.\n * @public\n */\nexport type TemplateVarsExtendFunction = (\n base: TemplateVars | undefined,\n values: VariableValue[]\n) => Result<TemplateVars | undefined>;\n\n/**\n * This default implementation of a {@link TemplateVarsExtendFunction | TemplateVarsExtendFunction}\n * creates a new collection via inheritance from the supplied collection.\n * @param base - The base {@link TemplateVars | variables} to be extended.\n * @param values - The {@link VariableValue | values} to be added or overridden in the new variables.\n * @public\n */\nexport function defaultExtendVars(\n base: TemplateVars | undefined,\n values: VariableValue[]\n): Result<TemplateVars | undefined> {\n /* c8 ignore next 1 */\n const rtrn = base ? Object.create(base) : {};\n for (const v of values) {\n rtrn[v[0]] = v[1];\n }\n return succeed(rtrn);\n}\n\n/**\n * Failure reason for {@link IJsonReferenceMap | IJsonReferenceMap} lookup, where `'unknown'`\n * means that the object is not present in the map and `'error'` means\n * that an error occurred while retrieving or converting it.\n * @public\n */\nexport type JsonReferenceMapFailureReason = 'unknown' | 'error';\n\n/**\n * Interface for a simple map that returns named `JsonValue` values with templating,\n * conditional logic, and external reference lookups applied using an optionally supplied context.\n * @public\n */\nexport interface IJsonReferenceMap {\n /**\n * Determine if a key might be valid for this map but does not determine if key actually\n * exists. Allows key range to be constrained.\n * @param key - The key to be tested.\n * @returns `true` if the key is in the valid range, `false` otherwise.\n */\n keyIsInRange(key: string): boolean;\n\n /**\n * Determines if an object with the specified key actually exists in the map.\n * @param key - The key to be tested.\n * @returns `true` if an object with the specified key exists, `false` otherwise.\n */\n has(key: string): boolean;\n\n /**\n * Gets a `JsonObject` specified by key.\n * @param key - The key of the object to be retrieved.\n * @param context - Optional {@link IJsonContext | IJsonContext} used to construct\n * the object.\n * @returns `Success` with the formatted JsonObject if successful. `Failure`\n * with detail `'unknown'` if no such object exists, or `Failure` with detail `'error'` if\n * the object was found but could not be formatted.\n */\n // eslint-disable-next-line no-use-before-define\n getJsonObject(\n key: string,\n context?: IJsonContext\n ): DetailedResult<JsonObject, JsonReferenceMapFailureReason>;\n\n /**\n * Gets a `JsonValue` specified by key.\n * @param key - The key of the object to be retrieved.\n * @param context - Optional {@link IJsonContext | JSON Context} used to format the value\n * @returns `Success` with the formatted `JsonValue` if successful. `Failure`\n * with detail `'unknown'` if no such object exists, or `Failure` with detail `'error'` if\n * the object was found but could not be formatted.\n */\n // eslint-disable-next-line no-use-before-define\n getJsonValue(key: string, context?: IJsonContext): DetailedResult<JsonValue, JsonReferenceMapFailureReason>;\n}\n\n/**\n * Context used to convert or edit JSON objects.\n * @public\n */\nexport interface IJsonContext {\n vars?: TemplateVars;\n refs?: IJsonReferenceMap;\n extendVars?: TemplateVarsExtendFunction;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/packlets/converters/converters.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAEL,+BAA+B,EAC/B,aAAa,EAEb,wBAAwB,EAExB,6BAA6B,EAC9B,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAAE,aAAmC,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,YAAY,CAAiB,CA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AAkD;IAChF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC5B,sBAAsB,GAAG,IAAI,wCAAwB,EAAE,CAAC;QAC1D,CAAC;QACD,OAAO,sBAAsB,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,wCAAwB,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,OAA2C;IAClE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,eAAe,GAAG,IAAI,iCAAiB,EAAE,CAAC;QAC5C,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,iCAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { JsonArray, JsonObject } from '@fgv/ts-json-base';\nimport { Converter } from '@fgv/ts-utils';\nimport { IJsonContext } from '../context';\nimport {\n ConditionalJsonConverter,\n ConditionalJsonConverterOptions,\n JsonConverter,\n RichJsonConverter,\n RichJsonConverterOptions,\n TemplatedJsonConverter,\n TemplatedJsonConverterOptions\n} from './jsonConverter';\n\n/**\n * A simple validating {@link JsonConverter | JSON converter}. Converts unknown to\n * JSON or fails if the unknown contains any invalid JSON values.\n * @public\n */\nexport const json: JsonConverter = new JsonConverter();\n\n/**\n * A simple validating {@link JsonConverter | JSON converter}. Converts unknown\n * to a `JsonObject`, or fails if the `unknown` contains invalid\n * JSON or is not an object.\n * @public\n */\nexport const jsonObject: Converter<JsonObject, IJsonContext> = json.object();\n\n/**\n * A simple validating {@link JsonConverter | JSON converter}. Converts `unknown` to a\n * `JsonArray`, or fails if the unknown contains invalid JSON or is\n * not an array.\n * @public\n */\nexport const jsonArray: Converter<JsonArray, IJsonContext> = json.array();\n\nlet templatedJsonDefault: JsonConverter | undefined;\nlet conditionalJsonDefault: JsonConverter | undefined;\nlet richJsonDefault: JsonConverter | undefined;\n\n/**\n * Helper function which creates a new {@link JsonConverter | JsonConverter} which converts an\n * `unknown` value to JSON, rendering any property names or string values using mustache with\n * the supplied context. See the mustache documentation for details of mustache syntax and view.\n * @param options - {@link TemplatedJsonConverterOptions | Options and context} for\n * the conversion.\n * @public\n */\nexport function templatedJson(options?: Partial<TemplatedJsonConverterOptions>): JsonConverter {\n if (!options) {\n if (!templatedJsonDefault) {\n templatedJsonDefault = new TemplatedJsonConverter();\n }\n return templatedJsonDefault;\n }\n return new TemplatedJsonConverter(options);\n}\n\n/**\n * Helper function which creates a new {@link JsonConverter | JsonConverter} which converts a\n * supplied `unknown` to strongly-typed JSON, by first rendering any property\n * names or string values using mustache with the supplied context, then applying\n * multi-value property expansion and conditional flattening based on property names.\n * @param options - {@link ConditionalJsonConverterOptions | Options and context} for\n * the conversion.\n * @public\n */\nexport function conditionalJson(options?: Partial<ConditionalJsonConverterOptions>): JsonConverter {\n if (!options) {\n if (!conditionalJsonDefault) {\n conditionalJsonDefault = new ConditionalJsonConverter();\n }\n return conditionalJsonDefault;\n }\n return new ConditionalJsonConverter(options);\n}\n\n/**\n * Helper function which creates a new {@link JsonConverter | JsonConverter} which converts a\n * supplied `unknown` to strongly-typed JSON, by first rendering any property\n * names or string values using mustache with the supplied context, then applying\n * multi-value property expansion and conditional flattening based on property names.\n * @param options - {@link RichJsonConverterOptions | Options and context} for\n * the conversion.\n * @public\n */\nexport function richJson(options?: Partial<RichJsonConverterOptions>): JsonConverter {\n if (!options) {\n if (!richJsonDefault) {\n richJsonDefault = new RichJsonConverter();\n }\n return richJsonDefault;\n }\n return new RichJsonConverter(options);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/converters/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/converters/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAA2C;AAGlC,gCAAU;AADnB,kDAAgC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Converters from './converters';\n\nexport * from './jsonConverter';\nexport { Converters };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonConverter.d.ts","sourceRoot":"","sources":["../../../src/packlets/converters/jsonConverter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAgB,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAgC,MAAM,eAAe,CAAC;AAC5F,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAE3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAoD,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;OAQG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;;;;;;;OAQG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,0BAA0B,EAAE,OAAO,CAAC;IAEpC;;;;;;;;OAQG;IACH,0BAA0B,EAAE,OAAO,CAAC;IAEpC;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;IAExC;;;;;;;OAOG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,IAAI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,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7D,CAAC;;AA9BH,8CA+BC;AA9BC;;;GAGG;AACoB,6BAAW,mCAC7B,wBAAwB,CAAC,kBAAkB,KAC9C,aAAa,EAAE,IAAI,IACnB","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { JsonArray, JsonObject, JsonValue, isJsonObject } from '@fgv/ts-json-base';\nimport { Conversion, Converter, Result, captureResult, fail, succeed } from '@fgv/ts-utils';\nimport {\n IJsonContext,\n IJsonReferenceMap,\n TemplateVars,\n TemplateVarsExtendFunction,\n defaultExtendVars\n} from '../context';\n\nimport { EditorRules, IJsonEditorOptions, IJsonEditorRule, JsonEditor } from '../editor';\n\n/**\n * Conversion options for {@link JsonConverter | JsonConverter}.\n * @public\n */\nexport interface IJsonConverterOptions {\n /**\n * If `true` and if template variables are available,\n * then string property values will be rendered using\n * mustache and those variable values. Otherwise string\n * properties are copied without modification.\n *\n * Defaults to `true` if vars are supplied with options,\n * `false` otherwise.\n */\n useValueTemplates: boolean;\n\n /**\n * If `true` and if template variables are available,\n * then property names will be rendered using\n * mustache and those variable values. Otherwise\n * property names are copied without modification.\n *\n * Defaults to `true` if vars are supplied with options,\n * `false` otherwise.\n */\n useNameTemplates: boolean;\n\n /**\n * If `true` and if template variables are available,\n * then string property names will be considered for\n * conditionals.\n *\n * Default is to match {@link IJsonConverterOptions.useNameTemplates | useNameTemplates}.\n */\n useConditionalNames: boolean;\n\n /**\n * If `true` (default) then properties with unconditional names\n * (which start with !) are flattened.\n */\n flattenUnconditionalValues: boolean;\n\n /**\n * If `true` and if both template variables and a\n * context derivation function is available, then properties\n * which match the multi-value name pattern will be expanded.\n * Default matches {@link IJsonConverterOptions.useNameTemplates | useNameTemplates}.\n *\n * Default is `true` unless {@link IJsonConverterOptions.extendVars | extendVars} is\n * explicitly set to `undefined`.\n */\n useMultiValueTemplateNames: boolean;\n\n /**\n * The variables (mustache view) used to render templated string names\n * and properties. See the mustache documentation for details of mustache\n * syntax and the template view.\n */\n vars?: TemplateVars;\n\n /**\n * Method used to extend variables for children of an array node during\n * expansion. Default is to use a built-in extension function unless\n * {@link IJsonConverterOptions.extendVars | extendVars} is explicitly set to undefined.\n */\n extendVars?: TemplateVarsExtendFunction;\n\n /**\n * If `true` and if a {@link IJsonReferenceMap | references map} is supplied\n * in {@link IJsonConverterOptions.refs | refs}, then references in the source\n * object will be replaced with the corresponding value from the reference map.\n *\n * Default is `true` if {@link IJsonConverterOptions.refs | refs} are present in options,\n * `false` otherwise.\n */\n useReferences: boolean;\n\n /**\n * An optional {@link IJsonReferenceMap | reference map} used to insert any references\n * in the converted JSON.\n */\n refs?: IJsonReferenceMap;\n\n /**\n * If {@link IJsonConverterOptions.onInvalidPropertyName | onInvalidPropertyName} is `'error'`\n * (default) then any property name that is invalid after template rendering causes an error\n * and stops conversion. If {@link IJsonConverterOptions.onInvalidPropertyName | onInvalidPropertyName}\n * is `'ignore'`, then names which are invalid after template rendering are passed through unchanged.\n */\n onInvalidPropertyName: 'error' | 'ignore';\n\n /**\n * If {@link IJsonConverterOptions.onInvalidPropertyValue | onInvalidPropertyValue} is `'error'`\n * (default) then any illegal property value causes an error and stops conversion. If\n * {@link IJsonConverterOptions.onInvalidPropertyValue | onInvalidPropertyValue} is `'ignore'` then\n * any invalid property values are silently ignored.\n */\n onInvalidPropertyValue: 'error' | 'ignore';\n\n /**\n * If {@link IJsonConverterOptions.onUndefinedPropertyValue | onUndefinedPropertyValue} is `'error'`,\n * then any property with value `undefined` will cause an error and stop conversion. If\n * {@link IJsonConverterOptions.onUndefinedPropertyValue | onUndefinedPropertyValue} is `'ignore'` (default)\n * then any property with value `undefined` is silently ignored.\n */\n onUndefinedPropertyValue: 'error' | 'ignore';\n}\n\n/**\n * Merges an optionally supplied partial set of {@link IJsonConverterOptions | options} with\n * the default converter options and taking all dynamic rules into account (e.g. template usage enabled\n * if variables are supplied and disabled if not), producing a fully-resolved set of\n * {@link IJsonConverterOptions | IJsonConverterOptions}.\n * @param partial - An optional partial {@link IJsonConverterOptions | IJsonConverterOptions}\n * to be merged.\n * @public\n */\nexport function mergeDefaultJsonConverterOptions(\n partial?: Partial<IJsonConverterOptions>\n): IJsonConverterOptions {\n const haveVars = partial?.vars !== undefined;\n const haveRefs = partial?.refs !== undefined;\n const extender = partial?.hasOwnProperty('extendVars') ? partial.extendVars : defaultExtendVars;\n const haveExtender = extender !== undefined;\n const namesDefault = partial?.useNameTemplates ?? haveVars;\n const conditionsDefault = partial?.useConditionalNames ?? namesDefault;\n\n const options: IJsonConverterOptions = {\n useValueTemplates: partial?.useValueTemplates ?? haveVars,\n useNameTemplates: namesDefault,\n useConditionalNames: conditionsDefault,\n flattenUnconditionalValues: partial?.flattenUnconditionalValues ?? conditionsDefault,\n useMultiValueTemplateNames: partial?.useMultiValueTemplateNames ?? (haveExtender && namesDefault),\n useReferences: partial?.useReferences ?? haveRefs,\n onInvalidPropertyName: partial?.onInvalidPropertyName ?? 'error',\n onInvalidPropertyValue: partial?.onInvalidPropertyValue ?? 'error',\n onUndefinedPropertyValue: partial?.onUndefinedPropertyValue ?? 'ignore',\n extendVars: extender\n };\n if (partial?.vars) {\n options.vars = partial.vars;\n }\n if (partial?.refs) {\n options.refs = partial.refs;\n }\n return options;\n}\n\n/**\n * Creates a new {@link IJsonContext | JSON context} using values supplied in an optional partial\n * {@link IJsonConverterOptions | converter options}.\n * @param partial - Optional partial {@link IJsonConverterOptions | IJsonConverterOptions} used to\n * populate the context.\n * @public\n */\nexport function contextFromConverterOptions(\n partial?: Partial<IJsonConverterOptions>\n): IJsonContext | undefined {\n const context: IJsonContext = {};\n if (partial?.vars) {\n context.vars = partial.vars;\n }\n if (partial?.refs) {\n context.refs = partial.refs;\n }\n if (partial?.hasOwnProperty('extendVars')) {\n context.extendVars = partial.extendVars;\n }\n return context.vars || context.refs || context.extendVars ? context : undefined;\n}\n\n/**\n * Creates a new {@link JsonEditor | JsonEditor} from an optionally supplied partial\n * {@link IJsonConverterOptions | JSON converter options}.\n * Expands supplied options with default values and constructs an editor with\n * matching configuration and defined rules.\n * @param partial - Optional partial {@link IJsonConverterOptions | IJsonConverterOptions}\n * used to create the editor.\n * @public\n */\nexport function converterOptionsToEditor(partial?: Partial<IJsonConverterOptions>): Result<JsonEditor> {\n const converterOptions = mergeDefaultJsonConverterOptions(partial);\n const context = contextFromConverterOptions(partial);\n const validation = {\n onInvalidPropertyName: converterOptions.onInvalidPropertyName,\n onInvalidPropertyValue: converterOptions.onInvalidPropertyValue,\n onUndefinedPropertyValue: converterOptions.onUndefinedPropertyValue\n };\n const editorOptions: IJsonEditorOptions = { context, validation };\n\n const rules: IJsonEditorRule[] = [];\n if (converterOptions.useNameTemplates || converterOptions.useValueTemplates) {\n const templateOptions = {\n ...editorOptions,\n useNameTemplates: converterOptions.useNameTemplates,\n useValueTemplates: converterOptions.useValueTemplates\n };\n rules.push(new EditorRules.TemplatedJsonEditorRule(templateOptions));\n }\n if (converterOptions.useConditionalNames || converterOptions.flattenUnconditionalValues) {\n const conditionalOptions = {\n ...editorOptions,\n flattenUnconditionalValues: converterOptions.flattenUnconditionalValues\n };\n rules.push(new EditorRules.ConditionalJsonEditorRule(conditionalOptions));\n }\n if (converterOptions.useMultiValueTemplateNames) {\n rules.push(new EditorRules.MultiValueJsonEditorRule(editorOptions));\n }\n if (converterOptions.useReferences) {\n rules.push(new EditorRules.ReferenceJsonEditorRule(editorOptions));\n }\n\n return JsonEditor.create(editorOptions, rules);\n}\n\n/**\n * A thin wrapper to allow an arbitrary {@link JsonEditor | JsonEditor} to be used via the\n * \\@fgv/ts-utils `Converter` pattern.\n * @public\n */\nexport class JsonEditorConverter extends Conversion.BaseConverter<JsonValue, IJsonContext> {\n public readonly editor: JsonEditor;\n\n /**\n * Constructs a new {@link JsonEditor | JsonEditor}Converter which uses the supplied editor\n * @param editor -\n */\n public constructor(editor: JsonEditor) {\n super((from, __self, context) => this._convert(from, context), editor.options.context);\n this.editor = editor;\n }\n\n /**\n * Constructs a new {@link JsonEditor | JsonEditor}Converter which uses the supplied editor\n * @param editor -\n */\n public static createWithEditor(editor: JsonEditor): Result<JsonEditorConverter> {\n return captureResult(() => new JsonEditorConverter(editor));\n }\n\n /**\n * Gets a derived converter which fails if the resulting converted\n * `JsonValue` is not a `JsonObject`.\n */\n public object(): Converter<JsonObject, IJsonContext> {\n return this.map((jv) => {\n if (!isJsonObject(jv)) {\n return fail(`Cannot convert \"${JSON.stringify(jv)}\" to JSON object.`);\n }\n return succeed(jv);\n });\n }\n\n /**\n * Gets a derived converter which fails if the resulting converted\n * `JsonValue` is not a `JsonArray`.\n */\n public array(): Converter<JsonArray, IJsonContext> {\n return this.map((jv) => {\n if (!Array.isArray(jv) || typeof jv !== 'object') {\n return fail(`Cannot convert \"${JSON.stringify(jv)}\" to JSON array.`);\n }\n return succeed(jv);\n });\n }\n\n protected _convert(from: unknown, context?: IJsonContext): Result<JsonValue> {\n return this.editor.clone(from as JsonValue, context);\n }\n}\n\n/**\n * An \\@fgv/ts-utils `Converter` from `unknown` to type-safe JSON, optionally\n * rendering any string property names or values using mustache with a supplied view.\n * @public\n */\nexport class JsonConverter extends JsonEditorConverter {\n /**\n * Constructs a new {@link JsonConverter | JsonConverter} with\n * supplied or default options.\n * @param options - Optional partial {@link IJsonConverterOptions | options}\n * to configure the converter.\n */\n public constructor(options?: Partial<IJsonConverterOptions>) {\n const editor = converterOptionsToEditor(options).orThrow();\n super(editor);\n }\n\n /**\n * Creates a new {@link JsonConverter | JsonConverter}.\n * @param options - Optional partial {@link IJsonConverterOptions | options}\n * to configure the converter.\n * @returns `Success` with a new {@link JsonConverter | JsonConverter}, or `Failure`\n * with an informative message if an error occurs.\n */\n public static create(options?: Partial<IJsonConverterOptions>): Result<JsonConverter> {\n return captureResult(() => new JsonConverter(options));\n }\n}\n\n/**\n * Initialization options for a {@link TemplatedJsonConverter | TemplatedJsonConverter}.\n * @public\n */\nexport type TemplatedJsonConverterOptions = Omit<\n IJsonConverterOptions,\n 'useNameTemplates' | 'useValueTemplates' | 'useMultiValueTemplateNames'\n>;\n\n/**\n * An \\@fgv/ts-utils `Converter` from `unknown` to type-safe JSON\n * with mustache template rendering and multi-value property name rules enabled\n * regardless of initial context.\n * @public\n */\nexport class TemplatedJsonConverter extends JsonEditorConverter {\n /**\n * Default {@link IJsonConverterOptions | JSON converter options}\n * to enable templated conversion.\n */\n public static readonly templateOptions: Partial<IJsonConverterOptions> = {\n useNameTemplates: true,\n useValueTemplates: true,\n useMultiValueTemplateNames: true,\n useConditionalNames: false,\n flattenUnconditionalValues: false\n };\n\n /**\n * Constructs a new {@link TemplatedJsonConverter | TemplatedJsonConverter} with\n * supplied or default options.\n * @param options - Optional partial {@link TemplatedJsonConverterOptions | options}\n * to configure the converter.\n */\n public constructor(options?: Partial<TemplatedJsonConverterOptions>) {\n options = { ...options, ...TemplatedJsonConverter.templateOptions };\n const editor = converterOptionsToEditor(options).orThrow();\n super(editor);\n }\n\n /**\n * Constructs a new {@link TemplatedJsonConverter | TemplatedJsonConverter} with\n * supplied or default options.\n * @param options - Optional partial {@link TemplatedJsonConverterOptions | options}\n * to configure the converter.\n */\n public static create(options?: Partial<TemplatedJsonConverterOptions>): Result<JsonConverter> {\n return captureResult(() => new TemplatedJsonConverter(options));\n }\n}\n\n/**\n * Options for a {@link ConditionalJsonConverter | ConditionalJsonConverter}.\n * @public\n */\nexport type ConditionalJsonConverterOptions = Omit<TemplatedJsonConverterOptions, 'useConditionalNames'>;\n\n/**\n * An \\@fgv/ts-utils `Converter` from `unknown` to type-safe JSON with mustache\n * template rendering, multi-value property name and conditional property\n * name rules enabled regardless of initial context.\n * @public\n */\nexport class ConditionalJsonConverter extends JsonEditorConverter {\n /**\n * Default {@link IJsonConverterOptions | JSON converter options}\n * to enable conditional conversion.\n */\n public static readonly conditionalOptions: Partial<IJsonConverterOptions> = {\n ...TemplatedJsonConverter.templateOptions,\n useConditionalNames: true,\n flattenUnconditionalValues: true\n };\n\n /**\n * Constructs a new {@link ConditionalJsonConverter | ConditionalJsonConverter} with supplied or\n * default options.\n * @param options - Optional partial {@link ConditionalJsonConverterOptions | configuration or context}\n * for the converter.\n */\n public constructor(options?: Partial<ConditionalJsonConverterOptions>) {\n options = { ...options, ...ConditionalJsonConverter.conditionalOptions };\n const editor = converterOptionsToEditor(options).orThrow();\n super(editor);\n }\n\n /**\n * Constructs a new {@link ConditionalJsonConverter | ConditionalJsonConverter} with supplied or\n * default options.\n * @param options - Optional partial {@link ConditionalJsonConverterOptions | configuration or context}\n * for the converter.\n */\n public static create(options?: Partial<ConditionalJsonConverterOptions>): Result<JsonConverter> {\n return captureResult(() => new ConditionalJsonConverter(options));\n }\n}\n\n/**\n * Initialization options for a {@link RichJsonConverter | RichJsonConverter}.\n * @public\n */\nexport type RichJsonConverterOptions = Omit<ConditionalJsonConverterOptions, 'useReferences'>;\n\n/**\n * A \\@fgv/ts-utils `Converter` from `unknown` to type-safe JSON with mustache\n * template rendering, multi-value property name, conditional property\n * name, and external reference rules enabled regardless of initial context.\n * @public\n */\nexport class RichJsonConverter extends JsonEditorConverter {\n /**\n * Default {@link IJsonConverterOptions | JSON converter options}\n * to enable rich conversion.\n */\n public static readonly richOptions: Partial<IJsonConverterOptions> = {\n ...ConditionalJsonConverter.conditionalOptions,\n useReferences: true\n };\n\n /**\n * Constructs a new {@link RichJsonConverter | RichJsonConverter} with supplied or\n * default options.\n * @param options - Optional partial {@link RichJsonConverterOptions | configuration or context}\n * for the converter.\n */\n public constructor(options?: Partial<RichJsonConverterOptions>) {\n options = { ...options, ...RichJsonConverter.richOptions };\n const editor = converterOptionsToEditor(options).orThrow();\n super(editor);\n }\n\n /**\n * Constructs a new {@link RichJsonConverter | RichJsonConverter} with supplied or\n * default options\n * @param options - Optional partial {@link RichJsonConverterOptions | configuration or context}\n * for the converter.\n */\n public static create(options?: Partial<RichJsonConverterOptions>): Result<JsonConverter> {\n return captureResult(() => new RichJsonConverter(options));\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/packlets/editor/common.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,qBAAqB,GAAG,UAAU,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GACjC,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,qBAAqB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE1C;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE3C;;;;;OAKG;IACH,wBAAwB,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,4BAA4B,CAAC;IACzC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;CACjG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/editor/common.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { JsonValue } from '@fgv/ts-json-base';\nimport { DetailedResult } from '@fgv/ts-utils';\nimport { IJsonContext } from '../context';\n\n/**\n * Possible `DetailedResult` details for various editor operations.\n * @public\n */\nexport type JsonEditFailureReason = 'ignore' | 'inapplicable' | 'edited' | 'error';\n\n/**\n * Possible `DetailedResult` details for property edit operations.\n * @public\n */\nexport type JsonPropertyEditFailureReason = JsonEditFailureReason | 'deferred';\n\n/**\n * Possible validation rules for a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport type JsonEditorValidationRules =\n | 'invalidPropertyName'\n | 'invalidPropertyValue'\n | 'undefinedPropertyValue';\n\n/**\n * Array merge behavior options for a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport type ArrayMergeBehavior = 'append' | 'replace';\n\n/**\n * Merge options for a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport interface IJsonEditorMergeOptions {\n /**\n * Controls how arrays are merged when combining JSON values.\n * - `'append'` (default): Existing array elements are preserved and new elements are appended\n * - `'replace'`: Existing array is completely replaced with the new array\n */\n arrayMergeBehavior: ArrayMergeBehavior;\n}\n\n/**\n * Validation options for a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport interface IJsonEditorValidationOptions {\n /**\n * If `onInvalidPropertyName` is `'error'` (default) then any property name\n * that is invalid after template rendering causes an error and stops\n * conversion. If `onInvalidPropertyName` is `'ignore'`, then names which\n * are invalid after template rendering are passed through unchanged.\n */\n onInvalidPropertyName: 'error' | 'ignore';\n\n /**\n * If `onInvalidPropertyValue` is `'error'` (default) then any illegal\n * property value other than `undefined` causes an error and stops\n * conversion. If `onInvalidPropertyValue` is `'ignore'` then any\n * invalid property values are silently ignored.\n */\n onInvalidPropertyValue: 'error' | 'ignore';\n\n /**\n * If `onUndefinedPropertyValue` is `'error'`, then any property with\n * value `undefined` will cause an error and stop conversion. If\n * `onUndefinedPropertyValue` is `'ignore'` (default) then any\n * property with value `undefined` is silently ignored.\n */\n onUndefinedPropertyValue: 'error' | 'ignore';\n}\n\n/**\n * Initialization options for a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport interface IJsonEditorOptions {\n context?: IJsonContext;\n validation: IJsonEditorValidationOptions;\n merge?: IJsonEditorMergeOptions;\n}\n\n/**\n * A specialized JSON editor which does a deep clone of a supplied `JsonValue`.\n * @public\n */\nexport interface IJsonCloneEditor {\n /**\n * Returns a deep clone of a supplied `JsonValue`.\n * @param src - The `JsonValue` to be cloned.\n * @param context - An optional {@link IJsonContext | JSON context} used for clone\n * conversion operations.\n */\n clone(src: JsonValue, context?: IJsonContext): DetailedResult<JsonValue, JsonEditFailureReason>;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/editor/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,WAAW,MAAM,SAAS,CAAC;AAEvC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,qCAAqC,EACrC,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/editor/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qDAAuC;AAa9B,kCAAW;AAXpB,2CAAyB;AACzB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mDAAuE;AAA7C,oHAAA,kBAAkB,OAAA;AAC5C,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,uDAM4B;AAH1B,mHAAA,eAAe,OAAA;AACf,yHAAA,qBAAqB,OAAA;AACrB,iHAAA,aAAa,OAAA","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as EditorRules from './rules';\n\nexport * from './common';\nexport { JsonEditor } from './jsonEditor';\nexport { IJsonEditorRule, JsonEditorRuleBase } from './jsonEditorRule';\nexport { JsonEditorState } from './jsonEditorState';\nexport {\n IReferenceMapKeyPolicyValidateOptions,\n ISimpleJsonMapOptions,\n PrefixedJsonMap,\n ReferenceMapKeyPolicy,\n SimpleJsonMap\n} from './jsonReferenceMap';\nexport { EditorRules };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonEditor.d.ts","sourceRoot":"","s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C;CACF;AA7XD,gCA6XC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n DetailedResult,\n Result,\n captureResult,\n fail,\n failWithDetail,\n mapDetailedResults,\n mapResults,\n succeed,\n succeedWithDetail\n} from '@fgv/ts-utils';\nimport {\n ConditionalJsonEditorRule,\n MultiValueJsonEditorRule,\n ReferenceJsonEditorRule,\n TemplatedJsonEditorRule\n} from './rules';\n\nimport {\n JsonArray,\n JsonObject,\n JsonValue,\n isJsonArray,\n isJsonObject,\n isJsonPrimitive\n} from '@fgv/ts-json-base';\nimport { IJsonContext } from '../context';\nimport {\n IJsonCloneEditor,\n IJsonEditorMergeOptions,\n IJsonEditorOptions,\n IJsonEditorValidationOptions,\n JsonEditFailureReason,\n JsonPropertyEditFailureReason\n} from './common';\n\nimport { IJsonEditorRule } from './jsonEditorRule';\nimport { JsonEditorState } from './jsonEditorState';\n\n/**\n * A {@link JsonEditor | JsonEditor} can be used to edit JSON objects in place or to\n * clone any JSON value, applying a default context and optional set of editor rules that\n * were supplied at initialization.\n * @public\n */\nexport class JsonEditor implements IJsonCloneEditor {\n /**\n * Default singleton {@link JsonEditor | JsonEditor}.\n * @internal\n */\n protected static _default?: JsonEditor;\n\n /**\n * Full set of {@link IJsonEditorOptions | editor options} in effect for this editor.\n */\n public options: IJsonEditorOptions;\n\n /**\n * The set of {@link IJsonEditorRule | editor rules} applied by this editor.\n * @internal\n */\n protected _rules: IJsonEditorRule[];\n\n /**\n * Protected constructor for {@link JsonEditor | JsonEditor} and derived classes.\n * External consumers should instantiate via the {@link JsonEditor.create | create static method}.\n * @param options - Optional partial {@link IJsonEditorOptions | editor options} for the\n * constructed editor.\n * @param rules - Any {@link IJsonEditorRule | editor rules} to be applied by the editor.\n * @internal\n */\n protected constructor(options?: Partial<IJsonEditorOptions>, rules?: IJsonEditorRule[]) {\n this.options = JsonEditor._getDefaultOptions(options).orThrow();\n this._rules = rules || JsonEditor.getDefaultRules(this.options).orThrow();\n }\n\n /**\n * Default singleton {@link JsonEditor | JsonEditor} for simple use. Applies all rules\n * but with no default context.\n */\n public static get default(): JsonEditor {\n if (!JsonEditor._default) {\n const rules = this.getDefaultRules().orDefault();\n JsonEditor._default = new JsonEditor(undefined, rules);\n }\n return JsonEditor._default;\n }\n\n /**\n * Constructs a new {@link JsonEditor | JsonEditor}.\n * @param options - Optional partial {@link IJsonEditorOptions | editor options} for the\n * constructed editor.\n * @param rules - Optional set of {@link IJsonEditorRule | editor rules} to be applied by the editor.\n * @readonly A new {@link JsonEditor | JsonEditor}.\n */\n public static create(options?: Partial<IJsonEditorOptions>, rules?: IJsonEditorRule[]): Result<JsonEditor> {\n return captureResult(() => new JsonEditor(options, rules));\n }\n\n /**\n * Gets the default set of rules to be applied for a given set of options.\n * By default, all available rules (templates, conditionals, multi-value and references)\n * are applied.\n * @param options - Optional partial {@link IJsonEditorOptions | editor options} for\n * all rules.\n * @returns Default {@link IJsonEditorRule | editor rules} with any supplied options\n * applied.\n */\n public static getDefaultRules(options?: IJsonEditorOptions): Result<IJsonEditorRule[]> {\n return mapResults<IJsonEditorRule>([\n TemplatedJsonEditorRule.create(options),\n ConditionalJsonEditorRule.create(options),\n MultiValueJsonEditorRule.create(options),\n ReferenceJsonEditorRule.create(options)\n ]);\n }\n\n /**\n * @internal\n */\n protected static _getDefaultOptions(options?: Partial<IJsonEditorOptions>): Result<IJsonEditorOptions> {\n const context: IJsonContext | undefined = options?.context;\n let validation: IJsonEditorValidationOptions | undefined = options?.validation;\n if (validation === undefined) {\n validation = {\n onInvalidPropertyName: 'error',\n onInvalidPropertyValue: 'error',\n onUndefinedPropertyValue: 'ignore'\n };\n }\n let merge: IJsonEditorMergeOptions | undefined = options?.merge;\n if (merge === undefined) {\n merge = {\n arrayMergeBehavior: 'append'\n };\n }\n return succeed({ context, validation, merge });\n }\n\n /**\n * Merges a supplied source object into a supplied target, updating the target object.\n * @param target - The target `JsonObject` to be updated\n * @param src - The source `JsonObject` to be merged\n * @param runtimeContext - An optional {@link IJsonContext | IJsonContext} supplying variables\n * and references.\n * @returns `Success` with the original source `JsonObject` if merge was successful.\n * Returns `Failure` with details if an error occurs.\n */\n public mergeObjectInPlace(\n target: JsonObject,\n src: JsonObject,\n runtimeContext?: IJsonContext\n ): Result<JsonObject> {\n const state = new JsonEditorState(this, this.options, runtimeContext);\n return this._mergeObjectInPlace(target, src, state).onSuccess((merged) => {\n return this._finalizeAndMerge(merged, state);\n });\n }\n\n /**\n * Merges multiple supplied source objects into a supplied target, updating the target\n * object and using the default context supplied at creation time.\n * @param target - The target `JsonObject` to be updated\n * @param srcObjects - `JsonObject`s to be merged into the target object, in the order\n * supplied.\n * @returns `Success` with the original source `JsonObject` if merge was successful.\n * Returns `Failure` with details if an error occurs.\n */\n public mergeObjectsInPlace(target: JsonObject, srcObjects: JsonObject[]): Result<JsonObject> {\n return this.mergeObjectsInPlaceWithContext(this.options.context, target, srcObjects);\n }\n\n /**\n * Merges multiple supplied source objects into a supplied target, updating the target\n * object and using an optional {@link IJsonContext | context} supplied in the call.\n * @param context - An optional {@link IJsonContext | IJsonContext} supplying variables and\n * references.\n * @param base - The base `JsonObject` to be updated\n * @param srcObjects - Objects to be merged into the target object, in the order supplied.\n * @returns `Success` with the original source `JsonObject` if merge was successful.\n * Returns `Failure` with details if an error occurs.\n */\n public mergeObjectsInPlaceWithContext(\n context: IJsonContext | undefined,\n base: JsonObject,\n srcObjects: JsonObject[]\n ): Result<JsonObject> {\n for (const src of srcObjects) {\n const mergeResult = this.mergeObjectInPlace(base, src, context);\n if (mergeResult.isFailure()) {\n return mergeResult.withFailureDetail('error');\n }\n }\n return succeedWithDetail(base);\n }\n\n /**\n * Deep clones a supplied `JsonValue`, applying all editor rules and a default\n * or optionally supplied context\n * @param src - The `JsonValue` to be cloned.\n * @param context - An optional {@link IJsonContext | JSON context} supplying variables and references.\n */\n public clone(src: JsonValue, context?: IJsonContext): DetailedResult<JsonValue, JsonEditFailureReason> {\n const state = new JsonEditorState(this, this.options, context);\n let value = src;\n let valueResult = this._editValue(src, state);\n\n while (valueResult.isSuccess()) {\n value = valueResult.value;\n valueResult = this._editValue(value, state);\n }\n\n if (valueResult.detail === 'error' || valueResult.detail === 'ignore') {\n return valueResult;\n }\n\n if (isJsonPrimitive(value) || value === null) {\n return succeedWithDetail(value, 'edited');\n } else if (isJsonObject(value)) {\n return this.mergeObjectInPlace({}, value, state.context).withFailureDetail('error');\n } else if (isJsonArray(value)) {\n return this._cloneArray(value, state.context);\n } else if (value === undefined) {\n return state.failValidation('undefinedPropertyValue');\n }\n return state.failValidation(\n 'invalidPropertyValue',\n `Cannot convert invalid JSON: \"${JSON.stringify(value)}\"`\n );\n }\n\n /**\n *\n * @param target -\n * @param src -\n * @param state -\n * @returns\n * @internal\n */\n protected _mergeObjectInPlace(\n target: JsonObject,\n src: JsonObject,\n state: JsonEditorState\n ): Result<JsonObject> {\n for (const key in src) {\n if (src.hasOwnProperty(key)) {\n const propResult = this._editProperty(key, src[key], state);\n if (propResult.isSuccess()) {\n if (propResult.detail === 'deferred') {\n state.defer(propResult.value);\n } else {\n const mergeResult = this._mergeObjectInPlace(target, propResult.value, state);\n if (mergeResult.isFailure()) {\n return mergeResult;\n }\n }\n } else if (propResult.detail === 'inapplicable') {\n const valueResult = this.clone(src[key], state.context).onSuccess((cloned) => {\n return this._mergeClonedProperty(target, key, cloned, state);\n });\n\n if (valueResult.isFailure() && valueResult.detail === 'error') {\n return fail(`${key}: ${valueResult.message}`);\n }\n } else if (propResult.detail !== 'ignore') {\n return fail(`${key}: ${propResult.message}`);\n }\n } else {\n return fail(`${key}: Cannot merge inherited properties`);\n }\n }\n return succeed(target);\n }\n\n /**\n *\n * @param src -\n * @param context -\n * @returns\n * @internal\n */\n protected _cloneArray(\n src: JsonArray,\n context?: IJsonContext\n ): DetailedResult<JsonArray, JsonEditFailureReason> {\n const results = src.map((v) => {\n return this.clone(v, context);\n });\n\n return mapDetailedResults<JsonValue, JsonEditFailureReason>(results, ['ignore'])\n .onSuccess((converted) => {\n return succeed(converted);\n })\n .withFailureDetail('error');\n }\n\n /**\n *\n * @param target -\n * @param key -\n * @param newValue -\n * @param state -\n * @returns\n * @internal\n */\n protected _mergeClonedProperty(\n target: JsonObject,\n key: string,\n newValue: JsonValue,\n state: JsonEditorState\n ): DetailedResult<JsonValue, JsonEditFailureReason> {\n const existing = target[key];\n\n // merge is called right after clone so this should never happen\n // since clone itself will have failed\n\n if (isJsonPrimitive(newValue)) {\n target[key] = newValue;\n return succeedWithDetail(newValue, 'edited');\n }\n\n if (isJsonObject(newValue)) {\n if (isJsonObject(existing)) {\n return this.mergeObjectInPlace(existing, newValue, state.context).withFailureDetail('error');\n }\n target[key] = newValue;\n return succeedWithDetail(newValue, 'edited');\n }\n\n /* c8 ignore else */\n if (isJsonArray(newValue)) {\n if (isJsonArray(existing)) {\n /* c8 ignore next 1 - ?? is defense in depth */\n const arrayMergeBehavior = state.options.merge?.arrayMergeBehavior ?? 'append';\n switch (arrayMergeBehavior) {\n case 'append':\n target[key] = existing.concat(...newValue);\n break;\n case 'replace':\n target[key] = newValue;\n break;\n /* c8 ignore next 2 - exhaustive switch for ArrayMergeBehavior type */\n default:\n return failWithDetail(`Invalid array merge behavior: ${arrayMergeBehavior as string}`, 'error');\n }\n return succeedWithDetail(target[key], 'edited');\n }\n target[key] = newValue;\n return succeedWithDetail(newValue, 'edited');\n }\n /* c8 ignore start */\n return failWithDetail(`Invalid JSON: ${JSON.stringify(newValue)}`, 'error');\n } /* c8 ignore stop */\n\n /**\n *\n * @param key -\n * @param value -\n * @param state -\n * @returns\n * @internal\n */\n protected _editProperty(\n key: string,\n value: JsonValue,\n state: JsonEditorState\n ): DetailedResult<JsonObject, JsonPropertyEditFailureReason> {\n for (const rule of this._rules) {\n const ruleResult = rule.editProperty(key, value, state);\n if (ruleResult.isSuccess() || ruleResult.detail !== 'inapplicable') {\n return ruleResult;\n }\n }\n return failWithDetail('inapplicable', 'inapplicable');\n }\n\n /**\n *\n * @param value -\n * @param state -\n * @returns\n * @internal\n */\n protected _editValue(\n value: JsonValue,\n state: JsonEditorState\n ): DetailedResult<JsonValue, JsonEditFailureReason> {\n for (const rule of this._rules) {\n const ruleResult = rule.editValue(value, state);\n if (ruleResult.isSuccess() || ruleResult.detail !== 'inapplicable') {\n return ruleResult;\n }\n }\n return failWithDetail('inapplicable', 'inapplicable');\n }\n\n /**\n *\n * @param target -\n * @param state -\n * @returns\n * @internal\n */\n protected _finalizeAndMerge(\n target: JsonObject,\n state: JsonEditorState\n ): DetailedResult<JsonObject, JsonEditFailureReason> {\n const deferred = state.deferred;\n if (deferred.length > 0) {\n for (const rule of this._rules) {\n const ruleResult = rule.finalizeProperties(deferred, state);\n if (ruleResult.isSuccess()) {\n return this.mergeObjectsInPlaceWithContext(\n state.context,\n target,\n ruleResult.value\n ).withFailureDetail('error');\n } else if (ruleResult.detail === 'ignore') {\n succeedWithDetail(target, 'edited');\n } else if (ruleResult.detail !== 'inapplicable') {\n return failWithDetail(ruleResult.message, ruleResult.detail);\n }\n }\n }\n return succeedWithDetail(target, 'edited');\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonEditorRule.d.ts","sourceRoot":"","sources":["../../../src/packlets/editor/jsonEditorRule.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;OAWG;IACH,YAAY,CACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,eAAe,GACrB,cAAc,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,GAAG,cAAc,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEtG;;;;;;;;;OASG;IACH,kBAAkB,CAChB,QAAQ,EAAE,UAAU,EAAE,EACtB,KAAK,EAAE,eAAe,GACrB,cAAc,CAAC,UAAU,EAAE,EAAE,qBAAqB,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IACxD;;OAEG;IAEI,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC,UAAU,EAAE,6BAA6B,CAAC;IAK5D;;OAEG;IACI,SAAS,CACd,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC,SAAS,EAAE,qBAAqB,CAAC;IAInD;;OAEG;IACI,kBAAkB,CACvB,UAAU,EAAE,UAAU,EAAE,EACxB,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC,UAAU,EAAE,EAAE,qBAAqB,CAAC;CAGvD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonEditorRule.js","sourceRoot":"","sources":["../../../src/packlets/editor/jsonEditorRule.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAGH,4CAA+D;AAuD/D;;;;GAIG;AACH,MAAa,kBAAkB;IAC7B;;OAEG;IACH,qBAAqB;IACd,YAAY,CACjB,KAAa,EACb,OAAkB,EAClB,OAAwB;QAExB,OAAO,IAAA,yBAAc,EAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC;IACD,oBAAoB;IAEpB;;OAEG;IACI,SAAS,CACd,OAAkB,EAClB,OAAwB;QAExB,OAAO,IAAA,yBAAc,EAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACI,kBAAkB,CACvB,UAAwB,EACxB,OAAwB;QAExB,OAAO,IAAA,yBAAc,EAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC;CACF;AAjCD,gDAiCC","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { JsonObject, JsonValue } from '@fgv/ts-json-base';\nimport { DetailedResult, failWithDetail } from '@fgv/ts-utils';\nimport { JsonEditFailureReason, JsonPropertyEditFailureReason } from './common';\n\nimport { JsonEditorState } from './jsonEditorState';\n\n/**\n * An {@link IJsonEditorRule | IJsonEditorRule} represents a single configurable\n * rule to be applied by a {@link JsonEditor | JsonEditor}.\n * @public\n */\nexport interface IJsonEditorRule {\n /**\n * Called by a {@link JsonEditor | JsonEditor} to possibly edit one of the properties being\n * merged into a target object.\n * @param key - The key of the property to be edited.\n * @param value - The `JsonValue` of the property to be edited.\n * @param state - {@link JsonEditorState | Editor state} which applies to the edit.\n * @returns If the property was edited, returns `Success` with a `JsonObject` containing\n * the edited results and with detail `'edited'`. If this property should be deferred for later consideration\n * or merge, `Success` with detail `'deferred'` and a `JsonObject` to be finalized. If\n * the rule does not affect this property, returns `Failure` with detail `'inapplicable'`. If an error occurred\n * while processing the error, returns `Failure` with detail `'error'`.\n */\n editProperty(\n key: string,\n value: JsonValue,\n state: JsonEditorState\n ): DetailedResult<JsonObject, JsonPropertyEditFailureReason>;\n\n /**\n * Called by a {@link JsonEditor | JsonEditor} to possibly edit a property value or array element.\n * @param value - The `JsonValue` of the property to be edited.\n * @param state - {@link JsonEditorState | Editor state} which applies to the edit.\n * @returns Returns `Success` with the `JsonValue` to be inserted, with detail `'edited'` if\n * the value was edited. Returns `Failure` with `'inapplicable'` if the rule does not affect this value.\n * Fails with detail `'ignore'` if the value is to be ignored, or with `'error'` if an error occurs.\n */\n editValue(value: JsonValue, state: JsonEditorState): DetailedResult<JsonValue, JsonEditFailureReason>;\n\n /**\n * Called for each rule after all properties have been merged. Any properties that were deferred\n * during the initial edit pass are supplied as input.\n * @param deferred - Any JSON objects that were deferred during the first edit pass.\n * @param state - {@link JsonEditorState | Editor state} which applies to the edit.\n * @returns On `Success` return, any returned objects are merged in order and finalization\n * is stopped. Finalization is also stopped on `Failure` with detail `'ignore'`. On `Failure`\n * with detail `'inapplicable'`, finalization continues with the next rule. Fails with an\n * error detail `'error'` and an informative message if an error occurs.\n */\n finalizeProperties(\n deferred: JsonObject[],\n state: JsonEditorState\n ): DetailedResult<JsonObject[], JsonEditFailureReason>;\n}\n\n/**\n * Default base implementation of {@link IJsonEditorRule | IJsonEditorRule} returns inapplicable for all operations so that\n * derived classes need only implement the operations they actually support.\n * @public\n */\nexport class JsonEditorRuleBase implements IJsonEditorRule {\n /**\n * {@inheritdoc IJsonEditorRule.editProperty}\n */\n /* c8 ignore start */\n public editProperty(\n __key: string,\n __value: JsonValue,\n __state: JsonEditorState\n ): DetailedResult<JsonObject, JsonPropertyEditFailureReason> {\n return failWithDetail('inapplicable', 'inapplicable');\n }\n /* c8 ignore stop */\n\n /**\n * {@inheritdoc IJsonEditorRule.editValue}\n */\n public editValue(\n __value: JsonValue,\n __state: JsonEditorState\n ): DetailedResult<JsonValue, JsonEditFailureReason> {\n return failWithDetail('inapplicable', 'inapplicable');\n }\n\n /**\n * {@inheritdoc IJsonEditorRule.finalizeProperties}\n */\n public finalizeProperties(\n __deferred: JsonObject[],\n __state: JsonEditorState\n ): DetailedResult<JsonObject[], JsonEditFailureReason> {\n return failWithDetail('inapplicable', 'inapplicable');\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonEditorState.d.ts","sourceRoot":"","sources":["../../../src/packlets/editor/jsonEditorState.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,EAA2B,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAqB,YAAY,EAA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