@skmtc/core 0.47.4 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/esm/context/CoreContext.d.ts +1 -1
  2. package/esm/context/CoreContext.js +6 -2
  3. package/esm/context/GenerateContext.d.ts +15 -4
  4. package/esm/context/GenerateContext.js +40 -34
  5. package/esm/context/ParseContext.d.ts +4 -4
  6. package/esm/context/ParseContext.js +6 -6
  7. package/esm/context/RenderContext.d.ts +3 -2
  8. package/esm/context/RenderContext.js +6 -5
  9. package/esm/context/generateTypes.d.ts +10 -6
  10. package/esm/context/tryParseAt.d.ts +1 -1
  11. package/esm/context/tryParseAt.js +1 -1
  12. package/esm/dsl/ContentSettings.d.ts +17 -12
  13. package/esm/dsl/ContentSettings.js +13 -9
  14. package/esm/dsl/Inserted.d.ts +4 -3
  15. package/esm/dsl/Inserted.js +2 -2
  16. package/esm/dsl/PendingDefinition.d.ts +3 -2
  17. package/esm/dsl/driverFiles.d.ts +46 -0
  18. package/esm/dsl/driverFiles.js +31 -0
  19. package/esm/dsl/model/ModelDriver.d.ts +5 -7
  20. package/esm/dsl/model/ModelDriver.js +12 -29
  21. package/esm/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
  22. package/esm/dsl/operation/gql/GqlOperationDriver.js +15 -12
  23. package/esm/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
  24. package/esm/dsl/operation/oas/OasOperationDriver.js +11 -14
  25. package/esm/dsl/webhook/WebhookDriver.d.ts +1 -1
  26. package/esm/dsl/webhook/WebhookDriver.js +15 -12
  27. package/esm/enrichments/EnrichmentAudit.d.ts +1 -1
  28. package/esm/enrichments/EnrichmentWarning.d.ts +1 -1
  29. package/esm/enrichments/findUnknownKeys.d.ts +1 -1
  30. package/esm/enrichments/findUnknownKeys.js +1 -1
  31. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  32. package/esm/enrichments/parseEnrichmentUmbrella.js +1 -1
  33. package/esm/enrichments/parseEnrichmentValue.d.ts +2 -2
  34. package/esm/enrichments/parseEnrichmentValue.js +2 -2
  35. package/esm/enrichments/readEnrichments.d.ts +4 -4
  36. package/esm/enrichments/readEnrichments.js +4 -4
  37. package/esm/enrichments/validateConfig.d.ts +1 -1
  38. package/esm/helpers/applyGeneratedSuffix.d.ts +1 -1
  39. package/esm/helpers/applyGeneratedSuffix.js +1 -1
  40. package/esm/helpers/getByWorkspacePath.d.ts +9 -0
  41. package/esm/helpers/getByWorkspacePath.js +10 -0
  42. package/esm/helpers/normalizeWorkspacePath.d.ts +26 -3
  43. package/esm/helpers/normalizeWorkspacePath.js +17 -2
  44. package/esm/oas/array/Array.d.ts +2 -2
  45. package/esm/oas/array/Array.js +2 -2
  46. package/esm/oas/boolean/Boolean.d.ts +2 -2
  47. package/esm/oas/boolean/Boolean.js +2 -2
  48. package/esm/oas/integer/Integer.d.ts +2 -2
  49. package/esm/oas/integer/Integer.js +2 -2
  50. package/esm/oas/intersection/Intersection.d.ts +3 -3
  51. package/esm/oas/intersection/Intersection.js +3 -3
  52. package/esm/oas/number/Number.d.ts +2 -2
  53. package/esm/oas/number/Number.js +2 -2
  54. package/esm/oas/object/Object.d.ts +2 -2
  55. package/esm/oas/object/Object.js +2 -2
  56. package/esm/oas/operation/Operation.d.ts +1 -1
  57. package/esm/oas/operation/Operation.js +1 -1
  58. package/esm/oas/operation/toEffectiveParameters.d.ts +2 -2
  59. package/esm/oas/operation/toEffectiveParameters.js +2 -2
  60. package/esm/oas/ref/DanglingRefError.d.ts +1 -1
  61. package/esm/oas/ref/DanglingRefError.js +1 -1
  62. package/esm/oas/ref/Ref.d.ts +2 -2
  63. package/esm/oas/ref/Ref.js +2 -2
  64. package/esm/oas/string/String.d.ts +2 -2
  65. package/esm/oas/string/String.js +2 -2
  66. package/esm/oas/union/Union.d.ts +3 -3
  67. package/esm/oas/union/Union.js +3 -3
  68. package/esm/oas/unknown/Unknown.d.ts +2 -2
  69. package/esm/oas/unknown/Unknown.js +2 -2
  70. package/esm/parse/allOfSystem.d.ts +4 -4
  71. package/esm/parse/allOfSystem.js +2 -2
  72. package/esm/parse/anyOfSystem.d.ts +5 -5
  73. package/esm/parse/anyOfSystem.js +4 -4
  74. package/esm/parse/keptRefs.d.ts +2 -2
  75. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  76. package/esm/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  77. package/esm/parse/v3-0/_merge-all-of/merge.js +2 -2
  78. package/esm/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  79. package/esm/parse/v3-0/ref/toRefV31.js +1 -1
  80. package/esm/parse/v3-0/schema/toSchemasV3.js +3 -3
  81. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  82. package/esm/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  83. package/esm/parse/v3-1/_merge-all-of/merge.js +2 -2
  84. package/esm/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  85. package/esm/parse/v3-1/ref/toRefV31.js +1 -1
  86. package/esm/parse/v3-1/schema/toSchemasV3.js +3 -3
  87. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  88. package/esm/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  89. package/esm/parse/v3-2/_merge-all-of/merge.js +2 -2
  90. package/esm/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  91. package/esm/parse/v3-2/ref/toRefV31.js +1 -1
  92. package/esm/parse/v3-2/schema/toSchemasV3.js +3 -3
  93. package/esm/run/toEnrichmentDefaults.d.ts +1 -1
  94. package/esm/run/toEnrichmentDefaults.js +1 -1
  95. package/esm/types/EnrichmentDefaults.d.ts +1 -1
  96. package/esm/types/EnrichmentDefaults.js +1 -1
  97. package/esm/types/Enrichments.d.ts +1 -1
  98. package/esm/types/Manifest.d.ts +1 -1
  99. package/esm/types/ModuleSelect.d.ts +1 -1
  100. package/esm/types/Settings.d.ts +29 -11
  101. package/esm/types/Settings.js +13 -6
  102. package/esm/types/Variant.d.ts +3 -3
  103. package/esm/types/Variant.js +3 -3
  104. package/package.json +1 -1
  105. package/script/context/CoreContext.d.ts +1 -1
  106. package/script/context/CoreContext.js +6 -2
  107. package/script/context/GenerateContext.d.ts +15 -4
  108. package/script/context/GenerateContext.js +38 -32
  109. package/script/context/ParseContext.d.ts +4 -4
  110. package/script/context/ParseContext.js +6 -6
  111. package/script/context/RenderContext.d.ts +3 -2
  112. package/script/context/RenderContext.js +6 -5
  113. package/script/context/generateTypes.d.ts +10 -6
  114. package/script/context/tryParseAt.d.ts +1 -1
  115. package/script/context/tryParseAt.js +1 -1
  116. package/script/dsl/ContentSettings.d.ts +17 -12
  117. package/script/dsl/ContentSettings.js +13 -9
  118. package/script/dsl/Inserted.d.ts +4 -3
  119. package/script/dsl/Inserted.js +2 -2
  120. package/script/dsl/PendingDefinition.d.ts +3 -2
  121. package/script/dsl/driverFiles.d.ts +46 -0
  122. package/script/dsl/driverFiles.js +38 -0
  123. package/script/dsl/model/ModelDriver.d.ts +5 -7
  124. package/script/dsl/model/ModelDriver.js +12 -29
  125. package/script/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
  126. package/script/dsl/operation/gql/GqlOperationDriver.js +15 -12
  127. package/script/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
  128. package/script/dsl/operation/oas/OasOperationDriver.js +11 -14
  129. package/script/dsl/webhook/WebhookDriver.d.ts +1 -1
  130. package/script/dsl/webhook/WebhookDriver.js +15 -12
  131. package/script/enrichments/EnrichmentAudit.d.ts +1 -1
  132. package/script/enrichments/EnrichmentWarning.d.ts +1 -1
  133. package/script/enrichments/findUnknownKeys.d.ts +1 -1
  134. package/script/enrichments/findUnknownKeys.js +1 -1
  135. package/script/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  136. package/script/enrichments/parseEnrichmentUmbrella.js +1 -1
  137. package/script/enrichments/parseEnrichmentValue.d.ts +2 -2
  138. package/script/enrichments/parseEnrichmentValue.js +2 -2
  139. package/script/enrichments/readEnrichments.d.ts +4 -4
  140. package/script/enrichments/readEnrichments.js +4 -4
  141. package/script/enrichments/validateConfig.d.ts +1 -1
  142. package/script/helpers/applyGeneratedSuffix.d.ts +1 -1
  143. package/script/helpers/applyGeneratedSuffix.js +1 -1
  144. package/script/helpers/getByWorkspacePath.d.ts +9 -0
  145. package/script/helpers/getByWorkspacePath.js +14 -0
  146. package/script/helpers/normalizeWorkspacePath.d.ts +26 -3
  147. package/script/helpers/normalizeWorkspacePath.js +19 -3
  148. package/script/oas/array/Array.d.ts +2 -2
  149. package/script/oas/array/Array.js +2 -2
  150. package/script/oas/boolean/Boolean.d.ts +2 -2
  151. package/script/oas/boolean/Boolean.js +2 -2
  152. package/script/oas/integer/Integer.d.ts +2 -2
  153. package/script/oas/integer/Integer.js +2 -2
  154. package/script/oas/intersection/Intersection.d.ts +3 -3
  155. package/script/oas/intersection/Intersection.js +3 -3
  156. package/script/oas/number/Number.d.ts +2 -2
  157. package/script/oas/number/Number.js +2 -2
  158. package/script/oas/object/Object.d.ts +2 -2
  159. package/script/oas/object/Object.js +2 -2
  160. package/script/oas/operation/Operation.d.ts +1 -1
  161. package/script/oas/operation/Operation.js +1 -1
  162. package/script/oas/operation/toEffectiveParameters.d.ts +2 -2
  163. package/script/oas/operation/toEffectiveParameters.js +2 -2
  164. package/script/oas/ref/DanglingRefError.d.ts +1 -1
  165. package/script/oas/ref/DanglingRefError.js +1 -1
  166. package/script/oas/ref/Ref.d.ts +2 -2
  167. package/script/oas/ref/Ref.js +2 -2
  168. package/script/oas/string/String.d.ts +2 -2
  169. package/script/oas/string/String.js +2 -2
  170. package/script/oas/union/Union.d.ts +3 -3
  171. package/script/oas/union/Union.js +3 -3
  172. package/script/oas/unknown/Unknown.d.ts +2 -2
  173. package/script/oas/unknown/Unknown.js +2 -2
  174. package/script/parse/allOfSystem.d.ts +4 -4
  175. package/script/parse/allOfSystem.js +2 -2
  176. package/script/parse/anyOfSystem.d.ts +5 -5
  177. package/script/parse/anyOfSystem.js +4 -4
  178. package/script/parse/keptRefs.d.ts +2 -2
  179. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  180. package/script/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  181. package/script/parse/v3-0/_merge-all-of/merge.js +2 -2
  182. package/script/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  183. package/script/parse/v3-0/ref/toRefV31.js +1 -1
  184. package/script/parse/v3-0/schema/toSchemasV3.js +3 -3
  185. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  186. package/script/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  187. package/script/parse/v3-1/_merge-all-of/merge.js +2 -2
  188. package/script/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  189. package/script/parse/v3-1/ref/toRefV31.js +1 -1
  190. package/script/parse/v3-1/schema/toSchemasV3.js +3 -3
  191. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  192. package/script/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  193. package/script/parse/v3-2/_merge-all-of/merge.js +2 -2
  194. package/script/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  195. package/script/parse/v3-2/ref/toRefV31.js +1 -1
  196. package/script/parse/v3-2/schema/toSchemasV3.js +3 -3
  197. package/script/run/toEnrichmentDefaults.d.ts +1 -1
  198. package/script/run/toEnrichmentDefaults.js +1 -1
  199. package/script/types/EnrichmentDefaults.d.ts +1 -1
  200. package/script/types/EnrichmentDefaults.js +1 -1
  201. package/script/types/Enrichments.d.ts +1 -1
  202. package/script/types/Manifest.d.ts +1 -1
  203. package/script/types/ModuleSelect.d.ts +1 -1
  204. package/script/types/Settings.d.ts +29 -11
  205. package/script/types/Settings.js +14 -7
  206. package/script/types/Variant.d.ts +3 -3
  207. package/script/types/Variant.js +3 -3
@@ -4,7 +4,7 @@ import { formatEnrichmentPath } from './EnrichmentWarning.js';
4
4
  * `value` parsed through a generator's enrichment schema. Enrichments are
5
5
  * typed configuration, so a value that does not match throws, and the run
6
6
  * fails. The message lists every value that does not match, at its place in
7
- * `client.json`, so the user can fix them all in one pass.
7
+ * `skmtc.config.json`, so the user can fix them all in one pass.
8
8
  */
9
9
  export const parseEnrichmentValue = ({ schema, value, generatorId, toRoutingPath }) => {
10
10
  const result = v.safeParse(schema, value);
@@ -19,7 +19,7 @@ export const parseEnrichmentValue = ({ schema, value, generatorId, toRoutingPath
19
19
  const header = generatorId === undefined
20
20
  ? 'Stack enrichments do not match the schema a generator reads them with.'
21
21
  : `Enrichments for '${generatorId}' do not match its enrichment schema.`;
22
- throw new Error([`${header} Fix them in client.json (settings.enrichments):`, ...lines].join('\n'));
22
+ throw new Error([`${header} Fix them in skmtc.config.json (settings.enrichments):`, ...lines].join('\n'));
23
23
  };
24
24
  /** What to do about one value: a scope the generator does not read takes no value at all. */
25
25
  const toFix = (issue, generatorId) => {
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Typed readers for the run-constant enrichment scopes.
3
3
  *
4
4
  * Three enrichment scopes share one storage namespace
5
- * (`client.json#settings.enrichments`), distinguished only by where they
5
+ * (`skmtc.config.json#settings.enrichments`), distinguished only by where they
6
6
  * sit and how often they vary:
7
7
  *
8
8
  * - **subject** — `[id][subject][variant]`, resolved *per item* by the
@@ -36,7 +36,7 @@ type EnrichmentReadContext = {
36
36
  /**
37
37
  * Read this generator's **generator-scoped** enrichment — the
38
38
  * run-constant leaf at
39
- * `client.json#settings.enrichments[generatorId]._generator`, validated
39
+ * `skmtc.config.json#settings.enrichments[generatorId]._generator`, validated
40
40
  * through the generator's own schema (typically declared as
41
41
  * `toGeneratorEnrichmentSchema` on its entry, and reused here).
42
42
  *
@@ -47,13 +47,13 @@ type EnrichmentReadContext = {
47
47
  * config passes `v.optional(v.object({...}))`.
48
48
  *
49
49
  * @throws on a malformed block, naming each wrong value's place in
50
- * `client.json`. The item is recorded as `error`, and the run fails once
50
+ * `skmtc.config.json`. The item is recorded as `error`, and the run fails once
51
51
  * every generator has run, exactly as for a bad subject leaf.
52
52
  */
53
53
  export declare const toGeneratorEnrichment: <EnrichmentType>(context: EnrichmentReadContext, generatorId: string, schema: v.GenericSchema<EnrichmentType>) => EnrichmentType;
54
54
  /**
55
55
  * Read the **stack-scoped** enrichment — the run-constant leaf at
56
- * `client.json#settings.enrichments._stack`, validated through the
56
+ * `skmtc.config.json#settings.enrichments._stack`, validated through the
57
57
  * caller's schema.
58
58
  *
59
59
  * The stack leaf is a single bag shared by every generator in the
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Typed readers for the run-constant enrichment scopes.
3
3
  *
4
4
  * Three enrichment scopes share one storage namespace
5
- * (`client.json#settings.enrichments`), distinguished only by where they
5
+ * (`skmtc.config.json#settings.enrichments`), distinguished only by where they
6
6
  * sit and how often they vary:
7
7
  *
8
8
  * - **subject** — `[id][subject][variant]`, resolved *per item* by the
@@ -28,7 +28,7 @@ import { parseEnrichmentValue } from './parseEnrichmentValue.js';
28
28
  /**
29
29
  * Read this generator's **generator-scoped** enrichment — the
30
30
  * run-constant leaf at
31
- * `client.json#settings.enrichments[generatorId]._generator`, validated
31
+ * `skmtc.config.json#settings.enrichments[generatorId]._generator`, validated
32
32
  * through the generator's own schema (typically declared as
33
33
  * `toGeneratorEnrichmentSchema` on its entry, and reused here).
34
34
  *
@@ -39,7 +39,7 @@ import { parseEnrichmentValue } from './parseEnrichmentValue.js';
39
39
  * config passes `v.optional(v.object({...}))`.
40
40
  *
41
41
  * @throws on a malformed block, naming each wrong value's place in
42
- * `client.json`. The item is recorded as `error`, and the run fails once
42
+ * `skmtc.config.json`. The item is recorded as `error`, and the run fails once
43
43
  * every generator has run, exactly as for a bad subject leaf.
44
44
  */
45
45
  export const toGeneratorEnrichment = (context, generatorId, schema) => parseEnrichmentValue({
@@ -50,7 +50,7 @@ export const toGeneratorEnrichment = (context, generatorId, schema) => parseEnri
50
50
  });
51
51
  /**
52
52
  * Read the **stack-scoped** enrichment — the run-constant leaf at
53
- * `client.json#settings.enrichments._stack`, validated through the
53
+ * `skmtc.config.json#settings.enrichments._stack`, validated through the
54
54
  * caller's schema.
55
55
  *
56
56
  * The stack leaf is a single bag shared by every generator in the
@@ -9,7 +9,7 @@ export type EnrichmentValidationScope = 'subject' | 'generator' | 'stack';
9
9
  * One enrichment value that fails its generator's Valibot enrichment
10
10
  * schema — the authoritative validation verdict. Produced by
11
11
  * {@link validateConfig}; the routing fields locate the offending leaf in
12
- * `client.json#settings.enrichments`:
12
+ * `skmtc.config.json#settings.enrichments`:
13
13
  *
14
14
  * - **operation subject** — `subject` = path, `method` = HTTP method
15
15
  * - **model subject** — `subject` = refName (no `method`)
@@ -3,7 +3,7 @@
3
3
  * engine when a projection's `toExportPath` result is stored into
4
4
  * `ContentSettings` (see `GenerateContext.to*ContentSettings`).
5
5
  * Consumers override it per project via
6
- * `client.json#settings.generatedSuffix`; setting it to `''` disables
6
+ * `skmtc.config.json#settings.generatedSuffix`; setting it to `''` disables
7
7
  * injection entirely.
8
8
  */
9
9
  export declare const DEFAULT_GENERATED_SUFFIX = ".generated";
@@ -4,7 +4,7 @@ import { extname } from '../deps/jsr.io/@std/path/1.1.6/posix/extname.js';
4
4
  * engine when a projection's `toExportPath` result is stored into
5
5
  * `ContentSettings` (see `GenerateContext.to*ContentSettings`).
6
6
  * Consumers override it per project via
7
- * `client.json#settings.generatedSuffix`; setting it to `''` disables
7
+ * `skmtc.config.json#settings.generatedSuffix`; setting it to `''` disables
8
8
  * injection entirely.
9
9
  */
10
10
  export const DEFAULT_GENERATED_SUFFIX = '.generated';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The value at `path` in a map keyed by normalized workspace paths, such as
3
+ * the engine's files. A path that is a key is normalized already, so only a
4
+ * path that is no key is normalized, and looked up again.
5
+ *
6
+ * Throws, as {@link normalizeWorkspacePath} does, for a path that is no key
7
+ * and cannot name a file below `basePath`.
8
+ */
9
+ export declare const getByWorkspacePath: <Value>(map: ReadonlyMap<string, Value>, path: string) => Value | undefined;
@@ -0,0 +1,10 @@
1
+ import { normalizeWorkspacePath } from './normalizeWorkspacePath.js';
2
+ /**
3
+ * The value at `path` in a map keyed by normalized workspace paths, such as
4
+ * the engine's files. A path that is a key is normalized already, so only a
5
+ * path that is no key is normalized, and looked up again.
6
+ *
7
+ * Throws, as {@link normalizeWorkspacePath} does, for a path that is no key
8
+ * and cannot name a file below `basePath`.
9
+ */
10
+ export const getByWorkspacePath = (map, path) => map.get(path) ?? map.get(normalizeWorkspacePath(path));
@@ -1,3 +1,17 @@
1
+ import type { Brand } from '../types/Brand.js';
2
+ /**
3
+ * A workspace path in its one spelling. Only this module makes one:
4
+ * {@link normalizeWorkspacePath}, and
5
+ * {@link applyGeneratedSuffixToWorkspacePath} for one with the suffix
6
+ * inserted. The engine keys files by it, so a value of this type finds its
7
+ * file without being normalized again.
8
+ */
9
+ export type WorkspacePath = Brand<string, 'WorkspacePath'>;
10
+ /**
11
+ * `Path`, unless it is already a {@link WorkspacePath}: normalizing one
12
+ * again is a compile error.
13
+ */
14
+ export type UncheckedPath<Path extends string> = Path extends WorkspacePath ? never : Path;
1
15
  /**
2
16
  * Options for {@link normalizeWorkspacePath} and {@link toNormalizedWorkspacePath}.
3
17
  */
@@ -13,7 +27,7 @@ export type NormalizeWorkspacePathOptions = {
13
27
  export declare const hasParentSegment: (path: string) => boolean;
14
28
  /**
15
29
  * Whether a path is absolute on either host: a POSIX root, a Windows drive
16
- * (`C:\`, `C:/`) or a UNC share. Checked on every host, so a client.json
30
+ * (`C:\`, `C:/`) or a UNC share. Checked on every host, so a skmtc.config.json
17
31
  * written on Windows is rejected the same way on Linux.
18
32
  */
19
33
  export declare const isAbsolutePath: (path: string) => boolean;
@@ -50,7 +64,9 @@ export declare const toNormalizedWorkspacePath: (path: string, { generatorId }?:
50
64
  * return one as `@/types/User.ts`, `./types/User.ts`, `/types/User.ts`,
51
65
  * `types/User.ts`, or with Windows separators; the engine stores this form
52
66
  * and nothing else, so file-map keys, import modules and the ejected lookup
53
- * always agree. The result is a fixed point.
67
+ * always agree. The result is a fixed point, and is typed
68
+ * {@link WorkspacePath} so that passing it in again does not compile: a
69
+ * value of that type is already in this form.
54
70
  *
55
71
  * Throws in the cases {@link toNormalizedWorkspacePath} throws.
56
72
  *
@@ -61,4 +77,11 @@ export declare const toNormalizedWorkspacePath: (path: string, { generatorId }?:
61
77
  * normalizeWorkspacePath('../User.ts') // throws
62
78
  * ```
63
79
  */
64
- export declare const normalizeWorkspacePath: (path: string, options?: NormalizeWorkspacePathOptions) => string;
80
+ export declare const normalizeWorkspacePath: <Path extends string>(path: UncheckedPath<Path>, options?: NormalizeWorkspacePathOptions) => WorkspacePath;
81
+ /**
82
+ * `path` with the generated-file suffix inserted ({@link applyGeneratedSuffix}),
83
+ * still a {@link WorkspacePath}. A suffix with no separator only lengthens the
84
+ * last segment of a path in its one spelling, so the result is in that
85
+ * spelling too; a suffix with one is normalized with the path.
86
+ */
87
+ export declare const applyGeneratedSuffixToWorkspacePath: (path: WorkspacePath, suffix: string, options?: NormalizeWorkspacePathOptions) => WorkspacePath;
@@ -2,6 +2,7 @@ import { normalize } from '../deps/jsr.io/@std/path/1.1.6/posix/normalize.js';
2
2
  import { isAbsolute as isPosixAbsolute } from '../deps/jsr.io/@std/path/1.1.6/posix/is_absolute.js';
3
3
  import { isAbsolute as isWindowsAbsolute } from '../deps/jsr.io/@std/path/1.1.6/windows/is_absolute.js';
4
4
  import { toWorkspacePath } from './toWorkspacePath.js';
5
+ import { applyGeneratedSuffix } from './applyGeneratedSuffix.js';
5
6
  /**
6
7
  * Whether a path contains a `..` parent-reference segment. `..` is a parent
7
8
  * reference only as a whole segment — a directory name that merely contains
@@ -10,7 +11,7 @@ import { toWorkspacePath } from './toWorkspacePath.js';
10
11
  export const hasParentSegment = (path) => path.split(/[/\\]/).some(segment => segment === '..');
11
12
  /**
12
13
  * Whether a path is absolute on either host: a POSIX root, a Windows drive
13
- * (`C:\`, `C:/`) or a UNC share. Checked on every host, so a client.json
14
+ * (`C:\`, `C:/`) or a UNC share. Checked on every host, so a skmtc.config.json
14
15
  * written on Windows is rejected the same way on Linux.
15
16
  */
16
17
  export const isAbsolutePath = (path) => isPosixAbsolute(path.replaceAll('\\', '/')) || isWindowsAbsolute(path);
@@ -69,7 +70,9 @@ export const toNormalizedWorkspacePath = (path, { generatorId } = {}) => {
69
70
  * return one as `@/types/User.ts`, `./types/User.ts`, `/types/User.ts`,
70
71
  * `types/User.ts`, or with Windows separators; the engine stores this form
71
72
  * and nothing else, so file-map keys, import modules and the ejected lookup
72
- * always agree. The result is a fixed point.
73
+ * always agree. The result is a fixed point, and is typed
74
+ * {@link WorkspacePath} so that passing it in again does not compile: a
75
+ * value of that type is already in this form.
73
76
  *
74
77
  * Throws in the cases {@link toNormalizedWorkspacePath} throws.
75
78
  *
@@ -81,6 +84,18 @@ export const toNormalizedWorkspacePath = (path, { generatorId } = {}) => {
81
84
  * ```
82
85
  */
83
86
  export const normalizeWorkspacePath = (path, options = {}) => `@/${toNormalizedWorkspacePath(path, options)}`;
87
+ /**
88
+ * `path` with the generated-file suffix inserted ({@link applyGeneratedSuffix}),
89
+ * still a {@link WorkspacePath}. A suffix with no separator only lengthens the
90
+ * last segment of a path in its one spelling, so the result is in that
91
+ * spelling too; a suffix with one is normalized with the path.
92
+ */
93
+ export const applyGeneratedSuffixToWorkspacePath = (path, suffix, options = {}) => {
94
+ const suffixed = applyGeneratedSuffix(path, suffix);
95
+ return /[/\\]/.test(suffix)
96
+ ? normalizeWorkspacePath(suffixed, options)
97
+ : suffixed;
98
+ };
84
99
  /**
85
100
  * Separator swap, then every anchor spelling goes (`@/`, `./`, a leading
86
101
  * `/` — {@link toWorkspacePath}), then POSIX normalize of what is left so
@@ -111,8 +111,8 @@ export declare class OasArray<Nullable extends boolean | undefined = boolean | u
111
111
  */
112
112
  deprecated: boolean | undefined;
113
113
  /**
114
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
115
- * `system.not: unknown`: the document says "not something", and core does
114
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
115
+ * `parse.not: unknown`: the document says "not something", and core does
116
116
  * not read what. `undefined` otherwise.
117
117
  */
118
118
  not: OasUnknown | undefined;
@@ -154,8 +154,8 @@ export class OasArray extends OasBase {
154
154
  value: void 0
155
155
  });
156
156
  /**
157
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
158
- * `system.not: unknown`: the document says "not something", and core does
157
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
158
+ * `parse.not: unknown`: the document says "not something", and core does
159
159
  * not read what. `undefined` otherwise.
160
160
  */
161
161
  Object.defineProperty(this, "not", {
@@ -84,8 +84,8 @@ export declare class OasBoolean<Nullable extends boolean | undefined = boolean |
84
84
  * instance (via the {@link OasBase} base).
85
85
  */
86
86
  /**
87
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
88
- * `system.not: unknown`: the document says "not something", and core does
87
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
88
+ * `parse.not: unknown`: the document says "not something", and core does
89
89
  * not read what. `undefined` otherwise.
90
90
  */
91
91
  not: OasUnknown | undefined;
@@ -115,8 +115,8 @@ export class OasBoolean extends OasBase {
115
115
  * instance (via the {@link OasBase} base).
116
116
  */
117
117
  /**
118
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
119
- * `system.not: unknown`: the document says "not something", and core does
118
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
119
+ * `parse.not: unknown`: the document says "not something", and core does
120
120
  * not read what. `undefined` otherwise.
121
121
  */
122
122
  Object.defineProperty(this, "not", {
@@ -118,8 +118,8 @@ export declare class OasInteger<Nullable extends boolean | undefined = boolean |
118
118
  */
119
119
  deprecated: boolean | undefined;
120
120
  /**
121
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
122
- * `system.not: unknown`: the document says "not something", and core does
121
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
122
+ * `parse.not: unknown`: the document says "not something", and core does
123
123
  * not read what. `undefined` otherwise.
124
124
  */
125
125
  not: OasUnknown | undefined;
@@ -167,8 +167,8 @@ export class OasInteger extends OasBase {
167
167
  value: void 0
168
168
  });
169
169
  /**
170
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
171
- * `system.not: unknown`: the document says "not something", and core does
170
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
171
+ * `parse.not: unknown`: the document says "not something", and core does
172
172
  * not read what. `undefined` otherwise.
173
173
  */
174
174
  Object.defineProperty(this, "not", {
@@ -37,7 +37,7 @@ export type IntersectionFields = {
37
37
  * An `allOf` that keeps at least one reference: a value matches every member.
38
38
  *
39
39
  * Core merges the members of an `allOf` into one schema. A reference that
40
- * `client.json` `system.intersections` keeps is not merged: the schema is an
40
+ * `skmtc.config.json` `parse.intersections` keeps is not merged: the schema is an
41
41
  * `OasIntersection` of the kept references, and at most one other member, which
42
42
  * the other members of the `allOf` merge into. By default those are the
43
43
  * references that close a cycle.
@@ -83,8 +83,8 @@ export declare class OasIntersection extends OasBase {
83
83
  /** The default value. */
84
84
  default?: unknown;
85
85
  /**
86
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
87
- * `system.not: unknown`. `undefined` otherwise.
86
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
87
+ * `parse.not: unknown`. `undefined` otherwise.
88
88
  */
89
89
  not: OasUnknown | undefined;
90
90
  constructor(fields: IntersectionFields, context?: ParseContextType);
@@ -13,7 +13,7 @@ import { DanglingRefError } from '../ref/DanglingRefError.js';
13
13
  * An `allOf` that keeps at least one reference: a value matches every member.
14
14
  *
15
15
  * Core merges the members of an `allOf` into one schema. A reference that
16
- * `client.json` `system.intersections` keeps is not merged: the schema is an
16
+ * `skmtc.config.json` `parse.intersections` keeps is not merged: the schema is an
17
17
  * `OasIntersection` of the kept references, and at most one other member, which
18
18
  * the other members of the `allOf` merge into. By default those are the
19
19
  * references that close a cycle.
@@ -126,8 +126,8 @@ export class OasIntersection extends OasBase {
126
126
  value: void 0
127
127
  });
128
128
  /**
129
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
130
- * `system.not: unknown`. `undefined` otherwise.
129
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
130
+ * `parse.not: unknown`. `undefined` otherwise.
131
131
  */
132
132
  Object.defineProperty(this, "not", {
133
133
  enumerable: true,
@@ -118,8 +118,8 @@ export declare class OasNumber<Nullable extends boolean | undefined = boolean |
118
118
  */
119
119
  deprecated: boolean | undefined;
120
120
  /**
121
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
122
- * `system.not: unknown`: the document says "not something", and core does
121
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
122
+ * `parse.not: unknown`: the document says "not something", and core does
123
123
  * not read what. `undefined` otherwise.
124
124
  */
125
125
  not: OasUnknown | undefined;
@@ -167,8 +167,8 @@ export class OasNumber extends OasBase {
167
167
  value: void 0
168
168
  });
169
169
  /**
170
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
171
- * `system.not: unknown`: the document says "not something", and core does
170
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
171
+ * `parse.not: unknown`: the document says "not something", and core does
172
172
  * not read what. `undefined` otherwise.
173
173
  */
174
174
  Object.defineProperty(this, "not", {
@@ -224,8 +224,8 @@ export declare class OasObject<Nullable extends boolean | undefined = boolean |
224
224
  * ```
225
225
  */
226
226
  /**
227
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
228
- * `system.not: unknown`: the document says "not something", and core does
227
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
228
+ * `parse.not: unknown`: the document says "not something", and core does
229
229
  * not read what. `undefined` otherwise.
230
230
  */
231
231
  not: OasUnknown | undefined;
@@ -260,8 +260,8 @@ export class OasObject extends OasBase {
260
260
  * ```
261
261
  */
262
262
  /**
263
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
264
- * `system.not: unknown`: the document says "not something", and core does
263
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
264
+ * `parse.not: unknown`: the document says "not something", and core does
265
265
  * not read what. `undefined` otherwise.
266
266
  */
267
267
  Object.defineProperty(this, "not", {
@@ -153,7 +153,7 @@ export declare class OasOperation extends OasBase {
153
153
  * The path item's come first.
154
154
  *
155
155
  * References stay references, so a caller can resolve each one on its own.
156
- * A reference that names nothing (kept when `system.danglingRefs` lists
156
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
157
157
  * `parameter`) keeps its place, and resolving it throws `DanglingRefError`.
158
158
  * {@link OasOperation.toParams} resolves them all.
159
159
  *
@@ -226,7 +226,7 @@ export class OasOperation extends OasBase {
226
226
  * The path item's come first.
227
227
  *
228
228
  * References stay references, so a caller can resolve each one on its own.
229
- * A reference that names nothing (kept when `system.danglingRefs` lists
229
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
230
230
  * `parameter`) keeps its place, and resolving it throws `DanglingRefError`.
231
231
  * {@link OasOperation.toParams} resolves them all.
232
232
  *
@@ -12,14 +12,14 @@ type ToEffectiveParametersArgs = {
12
12
  * them: the path item's first, then its own. An own parameter with the same
13
13
  * name and location replaces the path item's. References stay references.
14
14
  *
15
- * A reference that names nothing (kept when `system.danglingRefs` lists
15
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
16
16
  * `parameter`) has no name or location. It keeps its place, and only the
17
17
  * same `$ref` replaces it.
18
18
  */
19
19
  export declare const toEffectiveParameters: ({ own, shared }: ToEffectiveParametersArgs) => Parameter[];
20
20
  /**
21
21
  * True for a parameter `$ref` that names nothing in the document, which the
22
- * parser keeps when `system.danglingRefs` lists `parameter`.
22
+ * parser keeps when `parse.danglingRefs` lists `parameter`.
23
23
  */
24
24
  export declare const namesNothing: (parameter: Parameter) => boolean;
25
25
  export {};
@@ -4,7 +4,7 @@ import { DanglingRefError } from '../ref/DanglingRefError.js';
4
4
  * them: the path item's first, then its own. An own parameter with the same
5
5
  * name and location replaces the path item's. References stay references.
6
6
  *
7
- * A reference that names nothing (kept when `system.danglingRefs` lists
7
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
8
8
  * `parameter`) has no name or location. It keeps its place, and only the
9
9
  * same `$ref` replaces it.
10
10
  */
@@ -14,7 +14,7 @@ export const toEffectiveParameters = ({ own = [], shared = [] }) => {
14
14
  };
15
15
  /**
16
16
  * True for a parameter `$ref` that names nothing in the document, which the
17
- * parser keeps when `system.danglingRefs` lists `parameter`.
17
+ * parser keeps when `parse.danglingRefs` lists `parameter`.
18
18
  */
19
19
  export const namesNothing = (parameter) => {
20
20
  if (!parameter.isRef()) {
@@ -18,7 +18,7 @@ type DanglingRefErrorOptions = {
18
18
  * component.
19
19
  *
20
20
  * By default the parser removes what holds such a reference, so a generator
21
- * never meets one. When `client.json` `system.danglingRefs` lists the
21
+ * never meets one. When `skmtc.config.json` `parse.danglingRefs` lists the
22
22
  * reference's kind, it stays, and a generator that resolves it can catch
23
23
  * this error and render something else in its place. Test for it with
24
24
  * {@link DanglingRefError.is}, not `instanceof`.
@@ -7,7 +7,7 @@ import "../../_dnt.polyfills.js";
7
7
  * component.
8
8
  *
9
9
  * By default the parser removes what holds such a reference, so a generator
10
- * never meets one. When `client.json` `system.danglingRefs` lists the
10
+ * never meets one. When `skmtc.config.json` `parse.danglingRefs` lists the
11
11
  * reference's kind, it stays, and a generator that resolves it can catch
12
12
  * this error and render something else in its place. Test for it with
13
13
  * {@link DanglingRefError.is}, not `instanceof`.
@@ -241,7 +241,7 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
241
241
  * @returns The resolved component
242
242
  * @throws {DanglingRefError} when a reference on the chain names nothing,
243
243
  * or the chain loops ({@link toLoop}), so it never reaches a component.
244
- * The parser keeps either one only when `system.danglingRefs` lists its kind.
244
+ * The parser keeps either one only when `parse.danglingRefs` lists its kind.
245
245
  * @throws Error when a reference on the chain names a component of another
246
246
  * kind (see {@link resolveOnce})
247
247
  */
@@ -264,7 +264,7 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
264
264
  *
265
265
  * @returns Either the resolved component or another reference in the chain
266
266
  * @throws {DanglingRefError} when the reference names nothing in the
267
- * document (kept when `client.json` `system.danglingRefs` lists its kind),
267
+ * document (kept when `skmtc.config.json` `parse.danglingRefs` lists its kind),
268
268
  * including a `$ref` with no name, such as `#/components/schemas/`
269
269
  * @throws Error when it names a component of another kind, such as a
270
270
  * `requestBody` ref to `#/components/schemas/…`
@@ -438,7 +438,7 @@ export class OasRef extends OasBase {
438
438
  * @returns The resolved component
439
439
  * @throws {DanglingRefError} when a reference on the chain names nothing,
440
440
  * or the chain loops ({@link toLoop}), so it never reaches a component.
441
- * The parser keeps either one only when `system.danglingRefs` lists its kind.
441
+ * The parser keeps either one only when `parse.danglingRefs` lists its kind.
442
442
  * @throws Error when a reference on the chain names a component of another
443
443
  * kind (see {@link resolveOnce})
444
444
  */
@@ -465,7 +465,7 @@ export class OasRef extends OasBase {
465
465
  *
466
466
  * @returns Either the resolved component or another reference in the chain
467
467
  * @throws {DanglingRefError} when the reference names nothing in the
468
- * document (kept when `client.json` `system.danglingRefs` lists its kind),
468
+ * document (kept when `skmtc.config.json` `parse.danglingRefs` lists its kind),
469
469
  * including a `$ref` with no name, such as `#/components/schemas/`
470
470
  * @throws Error when it names a component of another kind, such as a
471
471
  * `requestBody` ref to `#/components/schemas/…`
@@ -104,8 +104,8 @@ export declare class OasString<Nullable extends boolean | undefined = boolean |
104
104
  */
105
105
  deprecated: boolean | undefined;
106
106
  /**
107
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
108
- * `system.not: unknown`: the document says "not something", and core does
107
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
108
+ * `parse.not: unknown`: the document says "not something", and core does
109
109
  * not read what. `undefined` otherwise.
110
110
  */
111
111
  not: OasUnknown | undefined;
@@ -147,8 +147,8 @@ export class OasString extends OasBase {
147
147
  value: void 0
148
148
  });
149
149
  /**
150
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
151
- * `system.not: unknown`: the document says "not something", and core does
150
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
151
+ * `parse.not: unknown`: the document says "not something", and core does
152
152
  * not read what. `undefined` otherwise.
153
153
  */
154
154
  Object.defineProperty(this, "not", {
@@ -188,8 +188,8 @@ export declare class OasUnion extends OasBase {
188
188
  */
189
189
  default?: unknown;
190
190
  /**
191
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
192
- * `system.not: unknown`: the document says "not something", and core does
191
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
192
+ * `parse.not: unknown`: the document says "not something", and core does
193
193
  * not read what. `undefined` otherwise.
194
194
  */
195
195
  not: OasUnknown | undefined;
@@ -217,7 +217,7 @@ export declare class OasUnion extends OasBase {
217
217
  * property, and that allows only string literals for it. No value may
218
218
  * belong to two members. A member that is a union, or anything other than
219
219
  * an object, makes it `false`, as does a reference on the way that names
220
- * nothing in the document (kept when `system.danglingRefs` lists `schema`).
220
+ * nothing in the document (kept when `parse.danglingRefs` lists `schema`).
221
221
  *
222
222
  * It reads the schemas only. A generator may refuse more: one that leaves
223
223
  * out `readOnly` properties cannot discriminate on one.
@@ -216,8 +216,8 @@ export class OasUnion extends OasBase {
216
216
  value: void 0
217
217
  });
218
218
  /**
219
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
220
- * `system.not: unknown`: the document says "not something", and core does
219
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
220
+ * `parse.not: unknown`: the document says "not something", and core does
221
221
  * not read what. `undefined` otherwise.
222
222
  */
223
223
  Object.defineProperty(this, "not", {
@@ -285,7 +285,7 @@ export class OasUnion extends OasBase {
285
285
  * property, and that allows only string literals for it. No value may
286
286
  * belong to two members. A member that is a union, or anything other than
287
287
  * an object, makes it `false`, as does a reference on the way that names
288
- * nothing in the document (kept when `system.danglingRefs` lists `schema`).
288
+ * nothing in the document (kept when `parse.danglingRefs` lists `schema`).
289
289
  *
290
290
  * It reads the schemas only. A generator may refuse more: one that leaves
291
291
  * out `readOnly` properties cannot discriminate on one.
@@ -44,8 +44,8 @@ export declare class OasUnknown extends OasBase {
44
44
  /** Whether the unknown type is nullable */
45
45
  nullable: boolean | undefined;
46
46
  /**
47
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
48
- * `system.not: unknown`: the document says "not something", and core does
47
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
48
+ * `parse.not: unknown`: the document says "not something", and core does
49
49
  * not read what. `undefined` otherwise.
50
50
  */
51
51
  not: OasUnknown | undefined;
@@ -71,8 +71,8 @@ export class OasUnknown extends OasBase {
71
71
  value: void 0
72
72
  });
73
73
  /**
74
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
75
- * `system.not: unknown`: the document says "not something", and core does
74
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
75
+ * `parse.not: unknown`: the document says "not something", and core does
76
76
  * not read what. `undefined` otherwise.
77
77
  */
78
78
  Object.defineProperty(this, "not", {