@fgv/ts-res 5.0.0-23 → 5.0.0-25

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/ts-res.d.ts +154 -0
  3. package/lib/packlets/runtime/index.d.ts +1 -0
  4. package/lib/packlets/runtime/index.js +1 -0
  5. package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
  6. package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
  7. package/package.json +12 -12
  8. package/.vscode/4.json +0 -3
  9. package/.vscode/launch.json +0 -16
  10. package/.vscode/settings.json +0 -3
  11. package/config/api-extractor.json +0 -343
  12. package/config/rig.json +0 -16
  13. package/lib/test/data/sample.json +0 -32
  14. package/lib/test/unit/bundle/bundleBuilder.test.d.ts +0 -2
  15. package/lib/test/unit/bundle/bundleLoader.test.d.ts +0 -2
  16. package/lib/test/unit/bundle/bundleUtils.test.d.ts +0 -2
  17. package/lib/test/unit/bundle/convert.test.d.ts +0 -2
  18. package/lib/test/unit/bundle/integration.test.d.ts +0 -2
  19. package/lib/test/unit/bundle/model.test.d.ts +0 -2
  20. package/lib/test/unit/bundle/normalization.test.d.ts +0 -2
  21. package/lib/test/unit/common/conditions.test.d.ts +0 -2
  22. package/lib/test/unit/common/helpers/conditions.test.d.ts +0 -2
  23. package/lib/test/unit/common/helpers/contexts.test.d.ts +0 -2
  24. package/lib/test/unit/common/helpers/qualifierDefaultValues.test.d.ts +0 -2
  25. package/lib/test/unit/common/resources.test.d.ts +0 -2
  26. package/lib/test/unit/conditions/condition.test.d.ts +0 -2
  27. package/lib/test/unit/conditions/conditionCollector.test.d.ts +0 -2
  28. package/lib/test/unit/conditions/conditionScoreAsDefault.test.d.ts +0 -2
  29. package/lib/test/unit/conditions/conditionSet.test.d.ts +0 -2
  30. package/lib/test/unit/conditions/conditionSetCollector.test.d.ts +0 -2
  31. package/lib/test/unit/conditions/conditionToken.test.d.ts +0 -2
  32. package/lib/test/unit/conditions/convert.test.d.ts +0 -2
  33. package/lib/test/unit/config/common.test.d.ts +0 -2
  34. package/lib/test/unit/config/convert.test.d.ts +0 -2
  35. package/lib/test/unit/config/predefined/default.test.d.ts +0 -2
  36. package/lib/test/unit/config/predefined/extended.test.d.ts +0 -2
  37. package/lib/test/unit/config/systemConfiguration.test.d.ts +0 -2
  38. package/lib/test/unit/config/systemConfigurationInitParams.test.d.ts +0 -2
  39. package/lib/test/unit/context/contextToken.test.d.ts +0 -2
  40. package/lib/test/unit/context/convert.test.d.ts +0 -2
  41. package/lib/test/unit/decisions/abstractDecision.test.d.ts +0 -2
  42. package/lib/test/unit/decisions/abstractDecisionCollector.test.d.ts +0 -2
  43. package/lib/test/unit/decisions/candidate.test.d.ts +0 -2
  44. package/lib/test/unit/decisions/concreteDecision.test.d.ts +0 -2
  45. package/lib/test/unit/decisions/decision.test.d.ts +0 -2
  46. package/lib/test/unit/import/collectionImporter.test.d.ts +0 -2
  47. package/lib/test/unit/import/fsItem.test.d.ts +0 -2
  48. package/lib/test/unit/import/fsItemImporter.test.d.ts +0 -2
  49. package/lib/test/unit/import/importContext.test.d.ts +0 -2
  50. package/lib/test/unit/import/importManager.test.d.ts +0 -2
  51. package/lib/test/unit/import/jsonImporter.test.d.ts +0 -2
  52. package/lib/test/unit/import/pathImporter.test.d.ts +0 -2
  53. package/lib/test/unit/qualifier-types/convert.test.d.ts +0 -2
  54. package/lib/test/unit/qualifier-types/helpers.test.d.ts +0 -2
  55. package/lib/test/unit/qualifier-types/languageQualifierType.test.d.ts +0 -2
  56. package/lib/test/unit/qualifier-types/literalQualifierType.test.d.ts +0 -2
  57. package/lib/test/unit/qualifier-types/literalValueHierarchy.test.d.ts +0 -2
  58. package/lib/test/unit/qualifier-types/qualifierType.test.d.ts +0 -2
  59. package/lib/test/unit/qualifier-types/qualifierTypeCollector.test.d.ts +0 -2
  60. package/lib/test/unit/qualifier-types/territoryQualifierType.test.d.ts +0 -2
  61. package/lib/test/unit/qualifier-types/testQualifierType.d.ts +0 -19
  62. package/lib/test/unit/qualifier-types/testQualifierType.js +0 -113
  63. package/lib/test/unit/qualifiers/convert.test.d.ts +0 -2
  64. package/lib/test/unit/qualifiers/qualifierCollector.test.d.ts +0 -2
  65. package/lib/test/unit/qualifiers/qualifierDefaultValue.test.d.ts +0 -2
  66. package/lib/test/unit/qualifiers/qualifierDefaultValueToken.test.d.ts +0 -2
  67. package/lib/test/unit/resource-json/convert.test.d.ts +0 -2
  68. package/lib/test/unit/resource-json/nameInheritance.test.d.ts +0 -2
  69. package/lib/test/unit/resource-json/resourceDeclCollection.test.d.ts +0 -2
  70. package/lib/test/unit/resource-json/resourceDeclTree.test.d.ts +0 -2
  71. package/lib/test/unit/resource-types/derivedResourceType.test.d.ts +0 -2
  72. package/lib/test/unit/resource-types/jsonResourceType.test.d.ts +0 -2
  73. package/lib/test/unit/resource-types/resourceTypeCollector.test.d.ts +0 -2
  74. package/lib/test/unit/resource-types/testDerivedResourceType.d.ts +0 -79
  75. package/lib/test/unit/resource-types/testDerivedResourceType.js +0 -113
  76. package/lib/test/unit/resources/candidateReducer.integration.test.d.ts +0 -2
  77. package/lib/test/unit/resources/candidateReducer.test.d.ts +0 -2
  78. package/lib/test/unit/resources/candidateValue.test.d.ts +0 -2
  79. package/lib/test/unit/resources/candidateValueCollector.test.d.ts +0 -2
  80. package/lib/test/unit/resources/reduceCandidates.test.d.ts +0 -2
  81. package/lib/test/unit/resources/reduceQualifiers.comprehensive.test.d.ts +0 -2
  82. package/lib/test/unit/resources/reduceQualifiers.test.d.ts +0 -2
  83. package/lib/test/unit/resources/resource.test.d.ts +0 -2
  84. package/lib/test/unit/resources/resourceBuilder.test.d.ts +0 -2
  85. package/lib/test/unit/resources/resourceCandidate.test.d.ts +0 -2
  86. package/lib/test/unit/resources/resourceManagerBuilder.clone.test.d.ts +0 -2
  87. package/lib/test/unit/resources/resourceManagerBuilder.getBuiltResourceTree.test.d.ts +0 -2
  88. package/lib/test/unit/resources/resourceManagerBuilder.test.d.ts +0 -2
  89. package/lib/test/unit/runtime/cacheListener.test.d.ts +0 -2
  90. package/lib/test/unit/runtime/cacheMetrics.test.d.ts +0 -2
  91. package/lib/test/unit/runtime/compiledResourceCollection.test.d.ts +0 -2
  92. package/lib/test/unit/runtime/conditionSetResolutionResult.comprehensive.test.d.ts +0 -2
  93. package/lib/test/unit/runtime/conditionSetResolutionResult.test.d.ts +0 -2
  94. package/lib/test/unit/runtime/context/contextQualifierProvider.test.d.ts +0 -2
  95. package/lib/test/unit/runtime/context/contextQualifierProviderValidator.test.d.ts +0 -2
  96. package/lib/test/unit/runtime/context/simpleContextQualifierProvider.test.d.ts +0 -2
  97. package/lib/test/unit/runtime/context/validatingSimpleContextQualifierProvider.test.d.ts +0 -2
  98. package/lib/test/unit/runtime/resource-tree/readOnlyResourceTree.test.d.ts +0 -2
  99. package/lib/test/unit/runtime/resource-tree/resourceTreeChildren.test.d.ts +0 -2
  100. package/lib/test/unit/runtime/resource-tree/resourceTreeChildrenValidator.test.d.ts +0 -2
  101. package/lib/test/unit/runtime/resourceResolver.coverage.test.d.ts +0 -2
  102. package/lib/test/unit/runtime/resourceResolver.defaultResolution.test.d.ts +0 -2
  103. package/lib/test/unit/runtime/resourceResolver.newFeatures.test.d.ts +0 -2
  104. package/lib/test/unit/runtime/resourceResolver.test.d.ts +0 -2
  105. package/lib/test/unit/runtime/validate.test.d.ts +0 -2
  106. package/lib/test/unit/zip-archive/convert.test.d.ts +0 -2
  107. package/lib/test/unit/zip-archive/json.test.d.ts +0 -2
  108. package/lib/test/unit/zip-archive/zipArchiveCreator.test.d.ts +0 -2
  109. package/lib/test/unit/zip-archive/zipArchiveFormat.test.d.ts +0 -2
  110. package/lib/test/unit/zip-archive/zipArchiveIdempotency.test.d.ts +0 -2
  111. package/lib/test/unit/zip-archive/zipArchiveLoader.test.d.ts +0 -2
@@ -1,113 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2025 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || (function () {
40
- var ownKeys = function(o) {
41
- ownKeys = Object.getOwnPropertyNames || function (o) {
42
- var ar = [];
43
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
- return ar;
45
- };
46
- return ownKeys(o);
47
- };
48
- return function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
- __setModuleDefault(result, mod);
53
- return result;
54
- };
55
- })();
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.TestQualifierType = void 0;
58
- const ts_utils_1 = require("@fgv/ts-utils");
59
- const TsRes = __importStar(require("../../../index"));
60
- class TestQualifierType extends TsRes.QualifierTypes.QualifierType {
61
- constructor(params) {
62
- var _a;
63
- super({
64
- name: (_a = params === null || params === void 0 ? void 0 : params.name) !== null && _a !== void 0 ? _a : 'test',
65
- allowContextList: (params === null || params === void 0 ? void 0 : params.allowContextList) === 'true',
66
- index: params === null || params === void 0 ? void 0 : params.index
67
- });
68
- this.systemTypeName = TsRes.Convert.qualifierTypeName
69
- .convert('test')
70
- .orThrow();
71
- }
72
- static create(params) {
73
- return (0, ts_utils_1.captureResult)(() => new TestQualifierType(params));
74
- }
75
- isValidConditionValue(value) {
76
- return true;
77
- }
78
- validateCondition(value, operator) {
79
- return this.isValidConditionValue(value) ? (0, ts_utils_1.succeed)(value) : (0, ts_utils_1.fail)(`Invalid condition value: ${value}`);
80
- }
81
- getConfigurationJson() {
82
- return (0, ts_utils_1.succeed)({
83
- name: this.name,
84
- systemType: 'test',
85
- configuration: {}
86
- });
87
- }
88
- validateConfigurationJson(from) {
89
- // Simple validation for test class
90
- if (typeof from !== 'object' || from === null) {
91
- return (0, ts_utils_1.fail)('Expected object');
92
- }
93
- const obj = from;
94
- if (typeof obj.name !== 'string') {
95
- return (0, ts_utils_1.fail)('name must be string');
96
- }
97
- if (obj.systemType !== 'test') {
98
- return (0, ts_utils_1.fail)('systemType must be test');
99
- }
100
- return (0, ts_utils_1.succeed)(from);
101
- }
102
- _matchOne(condition, context, operator) {
103
- if (condition === context) {
104
- return TsRes.PerfectMatch;
105
- }
106
- if (condition.toLowerCase() === context.toLowerCase()) {
107
- return 0.5;
108
- }
109
- return TsRes.NoMatch;
110
- }
111
- }
112
- exports.TestQualifierType = TestQualifierType;
113
- //# sourceMappingURL=testQualifierType.js.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=convert.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=qualifierCollector.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=qualifierDefaultValue.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=qualifierDefaultValueToken.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=convert.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=nameInheritance.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceDeclCollection.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceDeclTree.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=derivedResourceType.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=jsonResourceType.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceTypeCollector.test.d.ts.map
@@ -1,79 +0,0 @@
1
- import { JsonObject, JsonValue } from '@fgv/ts-json-base';
2
- import { Result } from '@fgv/ts-utils';
3
- import { CandidateCompleteness, ResourceTypeName, ResourceId, IResourceResolver } from '../../../packlets/common';
4
- import { IResourceCandidateValidationProperties, ResourceType } from '../../../packlets/resource-types/resourceType';
5
- import * as ResourceJson from '../../../packlets/resource-json';
6
- /**
7
- * Parameters to create a TestDerivedResourceType instance.
8
- */
9
- export interface ITestDerivedResourceTypeCreateParams {
10
- /**
11
- * Optional key for the new TestDerivedResourceType instance.
12
- * Defaults to 'test-derived'.
13
- */
14
- key?: string;
15
- /**
16
- * Optional index for the new TestDerivedResourceType instance.
17
- */
18
- index?: number;
19
- /**
20
- * Optional template for new instances.
21
- */
22
- template?: JsonObject;
23
- /**
24
- * Optional resource ID to use as a template source.
25
- * When provided, the resource resolver will be used to look up
26
- * this resource and use its value as the template.
27
- */
28
- templateResourceId?: string;
29
- }
30
- /**
31
- * Test data structure for the derived resource type
32
- */
33
- export interface ITestData {
34
- title: string;
35
- description?: string;
36
- metadata?: Record<string, JsonValue>;
37
- }
38
- /**
39
- * Partial test data structure for the derived resource type
40
- */
41
- export interface IPartialTestData {
42
- title?: string;
43
- description?: string;
44
- metadata?: Record<string, JsonValue>;
45
- }
46
- /**
47
- * A derived resource type for testing that demonstrates:
48
- * 1. Custom validation logic
49
- * 2. Using a resource resolver to look up template values
50
- * 3. Type-specific defaults and error handling
51
- */
52
- export declare class TestDerivedResourceType extends ResourceType<ITestData> {
53
- readonly systemTypeName: ResourceTypeName;
54
- private _templateResourceId?;
55
- protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject, templateResourceId?: string);
56
- /**
57
- * Factory method to create a new TestDerivedResourceType instance.
58
- */
59
- static create(params?: ITestDerivedResourceTypeCreateParams): Result<TestDerivedResourceType>;
60
- /**
61
- * Validates a resource candidate declaration with custom logic.
62
- */
63
- validateDeclaration(props: IResourceCandidateValidationProperties): Result<ITestData | IPartialTestData>;
64
- /**
65
- * Validates JSON for this resource type with custom business logic.
66
- */
67
- validate(json: JsonValue, completeness: CandidateCompleteness): Result<IPartialTestData>;
68
- validate(json: JsonValue, completeness: 'full'): Result<ITestData>;
69
- validate(json: JsonValue, completeness: 'partial'): Result<IPartialTestData>;
70
- /**
71
- * Override to demonstrate looking up template values from another resource.
72
- */
73
- getDefaultTemplateCandidate(json?: JsonValue, conditions?: ResourceJson.Json.ConditionSetDecl, resolver?: IResourceResolver): Result<ResourceJson.Json.IChildResourceCandidateDecl>;
74
- /**
75
- * Override createTemplate to add additional validation for the derived type.
76
- */
77
- createTemplate(resourceId: ResourceId, init?: JsonValue, conditions?: ResourceJson.Json.ConditionSetDecl, resolver?: IResourceResolver): Result<ResourceJson.Json.ILooseResourceDecl>;
78
- }
79
- //# sourceMappingURL=testDerivedResourceType.d.ts.map
@@ -1,113 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2025 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.TestDerivedResourceType = void 0;
25
- const ts_utils_1 = require("@fgv/ts-utils");
26
- const common_1 = require("../../../packlets/common");
27
- // eslint-disable-next-line @rushstack/packlets/mechanics
28
- const resourceType_1 = require("../../../packlets/resource-types/resourceType");
29
- /**
30
- * A derived resource type for testing that demonstrates:
31
- * 1. Custom validation logic
32
- * 2. Using a resource resolver to look up template values
33
- * 3. Type-specific defaults and error handling
34
- */
35
- class TestDerivedResourceType extends resourceType_1.ResourceType {
36
- constructor(key, index, template, templateResourceId) {
37
- super(key, index, template);
38
- this.systemTypeName = common_1.Convert.resourceTypeName
39
- .convert('test-derived')
40
- .orThrow();
41
- this._templateResourceId = templateResourceId;
42
- }
43
- /**
44
- * Factory method to create a new TestDerivedResourceType instance.
45
- */
46
- static create(params) {
47
- var _a;
48
- return common_1.Convert.resourceTypeName.convert((_a = params === null || params === void 0 ? void 0 : params.key) !== null && _a !== void 0 ? _a : 'test-derived').onSuccess((key) => {
49
- return (0, ts_utils_1.captureResult)(() => new TestDerivedResourceType(key, params === null || params === void 0 ? void 0 : params.index, params === null || params === void 0 ? void 0 : params.template, params === null || params === void 0 ? void 0 : params.templateResourceId));
50
- });
51
- }
52
- /**
53
- * Validates a resource candidate declaration with custom logic.
54
- */
55
- validateDeclaration(props) {
56
- // Custom validation: merge method must be 'replace' for full candidates
57
- if (props.completeness === 'full' && props.mergeMethod !== 'replace') {
58
- return (0, ts_utils_1.fail)(`${this.key}: Full candidates must use 'replace' merge method, got '${props.mergeMethod}'`);
59
- }
60
- return this.validate(props.json, props.completeness);
61
- }
62
- validate(json, completeness) {
63
- if (typeof json !== 'object' || json === null || Array.isArray(json)) {
64
- return (0, ts_utils_1.fail)(`${this.key}: Expected JSON object, got ${typeof json}`);
65
- }
66
- const obj = json;
67
- // Validate required title field for full resources
68
- if (completeness === 'full' && (typeof obj.title !== 'string' || !obj.title.trim())) {
69
- return (0, ts_utils_1.fail)(`${this.key}: 'title' field is required and must be a non-empty string`);
70
- }
71
- // Validate optional description
72
- if (obj.description !== undefined && typeof obj.description !== 'string') {
73
- return (0, ts_utils_1.fail)(`${this.key}: 'description' field must be a string if provided`);
74
- }
75
- // Validate optional metadata
76
- if (obj.metadata !== undefined) {
77
- if (typeof obj.metadata !== 'object' || obj.metadata === null || Array.isArray(obj.metadata)) {
78
- return (0, ts_utils_1.fail)(`${this.key}: 'metadata' field must be an object if provided`);
79
- }
80
- }
81
- const result = Object.assign(Object.assign(Object.assign({}, (obj.title && { title: obj.title })), (obj.description && { description: obj.description })), (obj.metadata && { metadata: obj.metadata }));
82
- return (0, ts_utils_1.succeed)(result);
83
- }
84
- /**
85
- * Override to demonstrate looking up template values from another resource.
86
- */
87
- getDefaultTemplateCandidate(json, conditions, resolver) {
88
- // If a template resource ID is configured and resolver is available, try to resolve it
89
- if (this._templateResourceId && resolver && !json) {
90
- return resolver
91
- .resolveComposedResourceValue(this._templateResourceId)
92
- .onFailure((error) => (0, ts_utils_1.fail)(`${this.key}: Failed to resolve template resource '${this._templateResourceId}': ${error}`))
93
- .onSuccess((resolvedValue) => {
94
- // Use the resolved value as our JSON template
95
- return super.getDefaultTemplateCandidate(resolvedValue, conditions, resolver);
96
- });
97
- }
98
- // Use provided JSON or fall back to base implementation
99
- return super.getDefaultTemplateCandidate(json, conditions, resolver);
100
- }
101
- /**
102
- * Override createTemplate to add additional validation for the derived type.
103
- */
104
- createTemplate(resourceId, init, conditions, resolver) {
105
- // Additional validation: warn if trying to use resolver functionality without a resolver
106
- if (this._templateResourceId && !resolver) {
107
- return (0, ts_utils_1.fail)(`${this.key}: Template resource ID '${this._templateResourceId}' is configured but no resolver provided`);
108
- }
109
- return super.createTemplate(resourceId, init, conditions, resolver);
110
- }
111
- }
112
- exports.TestDerivedResourceType = TestDerivedResourceType;
113
- //# sourceMappingURL=testDerivedResourceType.js.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=candidateReducer.integration.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=candidateReducer.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=candidateValue.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=candidateValueCollector.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=reduceCandidates.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=reduceQualifiers.comprehensive.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=reduceQualifiers.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resource.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceBuilder.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceCandidate.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceManagerBuilder.clone.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceManagerBuilder.getBuiltResourceTree.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceManagerBuilder.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=cacheListener.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=cacheMetrics.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=compiledResourceCollection.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=conditionSetResolutionResult.comprehensive.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=conditionSetResolutionResult.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=contextQualifierProvider.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=contextQualifierProviderValidator.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=simpleContextQualifierProvider.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=validatingSimpleContextQualifierProvider.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=readOnlyResourceTree.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceTreeChildren.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceTreeChildrenValidator.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceResolver.coverage.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceResolver.defaultResolution.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceResolver.newFeatures.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=resourceResolver.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=validate.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=convert.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=json.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=zipArchiveCreator.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=zipArchiveFormat.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=zipArchiveIdempotency.test.d.ts.map
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=zipArchiveLoader.test.d.ts.map