@skmtc/core 0.45.0 → 0.47.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 (187) hide show
  1. package/esm/anchors/attribute.js +3 -2
  2. package/esm/context/CoreContext.d.ts +1 -1
  3. package/esm/context/CoreContext.js +1 -1
  4. package/esm/context/GenerateContext.d.ts +13 -10
  5. package/esm/context/GenerateContext.js +36 -25
  6. package/esm/context/ParseContext.d.ts +3 -0
  7. package/esm/context/ParseContext.js +151 -39
  8. package/esm/context/generateTypes.d.ts +7 -6
  9. package/esm/dsl/GeneratorKeys.d.ts +21 -15
  10. package/esm/dsl/GeneratorKeys.js +16 -11
  11. package/esm/dsl/Inserted.d.ts +1 -1
  12. package/esm/dsl/Inserted.js +1 -1
  13. package/esm/dsl/model/ModelDriver.d.ts +6 -5
  14. package/esm/dsl/model/ModelDriver.js +22 -20
  15. package/esm/dsl/model/toModelEntry.d.ts +18 -18
  16. package/esm/dsl/model/toModelEntry.js +9 -9
  17. package/esm/dsl/model/toModelProjectionBase.d.ts +17 -16
  18. package/esm/dsl/model/toModelProjectionBase.js +12 -8
  19. package/esm/dsl/model/types.d.ts +26 -17
  20. package/esm/dsl/operation/gql/toGqlOperationProjectionBase.d.ts +2 -2
  21. package/esm/dsl/operation/gql/toGqlOperationProjectionBase.js +2 -2
  22. package/esm/dsl/operation/oas/toOasOperationProjectionBase.d.ts +2 -2
  23. package/esm/dsl/operation/oas/toOasOperationProjectionBase.js +2 -2
  24. package/esm/dsl/webhook/toWebhookProjectionBase.d.ts +2 -2
  25. package/esm/dsl/webhook/toWebhookProjectionBase.js +2 -2
  26. package/esm/helpers/collateExamples.js +35 -17
  27. package/esm/helpers/refFns.d.ts +108 -43
  28. package/esm/helpers/refFns.js +166 -57
  29. package/esm/mod.d.ts +1 -0
  30. package/esm/mod.js +1 -0
  31. package/esm/oas/document/Document.d.ts +6 -0
  32. package/esm/oas/document/Document.js +44 -2
  33. package/esm/oas/intersection/Intersection.d.ts +122 -0
  34. package/esm/oas/intersection/Intersection.js +266 -0
  35. package/esm/oas/mediaType/jsonMediaType.d.ts +1 -1
  36. package/esm/oas/mediaType/jsonMediaType.js +3 -3
  37. package/esm/oas/ref/DanglingRefError.d.ts +5 -2
  38. package/esm/oas/ref/DanglingRefError.js +4 -3
  39. package/esm/oas/ref/Ref.d.ts +23 -12
  40. package/esm/oas/ref/Ref.js +68 -72
  41. package/esm/oas/requestBody/RequestBody.d.ts +1 -1
  42. package/esm/oas/requestBody/RequestBody.js +1 -1
  43. package/esm/oas/response/Response.d.ts +1 -1
  44. package/esm/oas/response/Response.js +1 -1
  45. package/esm/oas/schema/Schema.d.ts +4 -2
  46. package/esm/oas/schema/siblings.d.ts +10 -2
  47. package/esm/oas/schema/siblings.js +87 -22
  48. package/esm/oas/schemaPath/traverseSchema.d.ts +2 -0
  49. package/esm/oas/schemaPath/traverseSchema.js +51 -5
  50. package/esm/parse/allOfSystem.d.ts +3 -0
  51. package/esm/parse/allOfSystem.js +2 -1
  52. package/esm/parse/keptIntersection.d.ts +53 -0
  53. package/esm/parse/keptIntersection.js +155 -0
  54. package/esm/parse/keptRefs.d.ts +23 -0
  55. package/esm/parse/keptRefs.js +59 -0
  56. package/esm/parse/toCyclicRefs.d.ts +8 -0
  57. package/esm/parse/toCyclicRefs.js +126 -0
  58. package/esm/parse/toDeclaredTypes.d.ts +20 -0
  59. package/esm/parse/toDeclaredTypes.js +43 -0
  60. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +8 -4
  61. package/esm/parse/v3-0/_merge-all-of/merge-union.js +7 -1
  62. package/esm/parse/v3-0/_merge-all-of/merge.js +13 -0
  63. package/esm/parse/v3-0/_merge-all-of/types.d.ts +3 -0
  64. package/esm/parse/v3-0/intersection/toIntersection.d.ts +12 -0
  65. package/esm/parse/v3-0/intersection/toIntersection.js +61 -0
  66. package/esm/parse/v3-0/ref/toRefTargetV3.d.ts +23 -0
  67. package/esm/parse/v3-0/ref/toRefTargetV3.js +70 -0
  68. package/esm/parse/v3-0/schema/toSchemasV3.js +13 -1
  69. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +8 -4
  70. package/esm/parse/v3-1/_merge-all-of/merge-union.js +7 -1
  71. package/esm/parse/v3-1/_merge-all-of/merge.js +13 -0
  72. package/esm/parse/v3-1/_merge-all-of/types.d.ts +3 -0
  73. package/esm/parse/v3-1/intersection/toIntersection.d.ts +12 -0
  74. package/esm/parse/v3-1/intersection/toIntersection.js +61 -0
  75. package/esm/parse/v3-1/ref/toRefTargetV3.d.ts +23 -0
  76. package/esm/parse/v3-1/ref/toRefTargetV3.js +70 -0
  77. package/esm/parse/v3-1/schema/toSchemasV3.js +15 -2
  78. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +8 -4
  79. package/esm/parse/v3-2/_merge-all-of/merge-union.js +7 -1
  80. package/esm/parse/v3-2/_merge-all-of/merge.js +13 -0
  81. package/esm/parse/v3-2/_merge-all-of/types.d.ts +3 -0
  82. package/esm/parse/v3-2/intersection/toIntersection.d.ts +12 -0
  83. package/esm/parse/v3-2/intersection/toIntersection.js +61 -0
  84. package/esm/parse/v3-2/ref/toRefTargetV3.d.ts +23 -0
  85. package/esm/parse/v3-2/ref/toRefTargetV3.js +70 -0
  86. package/esm/parse/v3-2/schema/toSchemasV3.js +15 -2
  87. package/esm/types/GeneratorType.d.ts +1 -1
  88. package/esm/types/ProjectionOptions.d.ts +1 -1
  89. package/esm/types/ProjectionOptions.js +1 -1
  90. package/esm/types/RefName.d.ts +3 -3
  91. package/esm/types/Settings.d.ts +9 -0
  92. package/esm/types/Settings.js +2 -1
  93. package/esm/types/TypeSystem.d.ts +20 -5
  94. package/package.json +1 -1
  95. package/script/anchors/attribute.js +3 -2
  96. package/script/context/CoreContext.d.ts +1 -1
  97. package/script/context/CoreContext.js +1 -1
  98. package/script/context/GenerateContext.d.ts +13 -10
  99. package/script/context/GenerateContext.js +36 -25
  100. package/script/context/ParseContext.d.ts +3 -0
  101. package/script/context/ParseContext.js +150 -38
  102. package/script/context/generateTypes.d.ts +7 -6
  103. package/script/dsl/GeneratorKeys.d.ts +21 -15
  104. package/script/dsl/GeneratorKeys.js +16 -11
  105. package/script/dsl/Inserted.d.ts +1 -1
  106. package/script/dsl/Inserted.js +1 -1
  107. package/script/dsl/model/ModelDriver.d.ts +6 -5
  108. package/script/dsl/model/ModelDriver.js +22 -20
  109. package/script/dsl/model/toModelEntry.d.ts +18 -18
  110. package/script/dsl/model/toModelEntry.js +9 -9
  111. package/script/dsl/model/toModelProjectionBase.d.ts +17 -16
  112. package/script/dsl/model/toModelProjectionBase.js +12 -8
  113. package/script/dsl/model/types.d.ts +26 -17
  114. package/script/dsl/operation/gql/toGqlOperationProjectionBase.d.ts +2 -2
  115. package/script/dsl/operation/gql/toGqlOperationProjectionBase.js +2 -2
  116. package/script/dsl/operation/oas/toOasOperationProjectionBase.d.ts +2 -2
  117. package/script/dsl/operation/oas/toOasOperationProjectionBase.js +2 -2
  118. package/script/dsl/webhook/toWebhookProjectionBase.d.ts +2 -2
  119. package/script/dsl/webhook/toWebhookProjectionBase.js +2 -2
  120. package/script/helpers/collateExamples.js +35 -17
  121. package/script/helpers/refFns.d.ts +108 -43
  122. package/script/helpers/refFns.js +180 -59
  123. package/script/mod.d.ts +1 -0
  124. package/script/mod.js +1 -0
  125. package/script/oas/document/Document.d.ts +6 -0
  126. package/script/oas/document/Document.js +44 -2
  127. package/script/oas/intersection/Intersection.d.ts +122 -0
  128. package/script/oas/intersection/Intersection.js +270 -0
  129. package/script/oas/mediaType/jsonMediaType.d.ts +1 -1
  130. package/script/oas/mediaType/jsonMediaType.js +3 -3
  131. package/script/oas/ref/DanglingRefError.d.ts +5 -2
  132. package/script/oas/ref/DanglingRefError.js +4 -3
  133. package/script/oas/ref/Ref.d.ts +23 -12
  134. package/script/oas/ref/Ref.js +67 -71
  135. package/script/oas/requestBody/RequestBody.d.ts +1 -1
  136. package/script/oas/requestBody/RequestBody.js +1 -1
  137. package/script/oas/response/Response.d.ts +1 -1
  138. package/script/oas/response/Response.js +1 -1
  139. package/script/oas/schema/Schema.d.ts +4 -2
  140. package/script/oas/schema/siblings.d.ts +10 -2
  141. package/script/oas/schema/siblings.js +89 -23
  142. package/script/oas/schemaPath/traverseSchema.d.ts +2 -0
  143. package/script/oas/schemaPath/traverseSchema.js +50 -4
  144. package/script/parse/allOfSystem.d.ts +3 -0
  145. package/script/parse/allOfSystem.js +2 -1
  146. package/script/parse/keptIntersection.d.ts +53 -0
  147. package/script/parse/keptIntersection.js +164 -0
  148. package/script/parse/keptRefs.d.ts +23 -0
  149. package/script/parse/keptRefs.js +63 -0
  150. package/script/parse/toCyclicRefs.d.ts +8 -0
  151. package/script/parse/toCyclicRefs.js +130 -0
  152. package/script/parse/toDeclaredTypes.d.ts +20 -0
  153. package/script/parse/toDeclaredTypes.js +48 -0
  154. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +8 -4
  155. package/script/parse/v3-0/_merge-all-of/merge-union.js +7 -1
  156. package/script/parse/v3-0/_merge-all-of/merge.js +13 -0
  157. package/script/parse/v3-0/_merge-all-of/types.d.ts +3 -0
  158. package/script/parse/v3-0/intersection/toIntersection.d.ts +12 -0
  159. package/script/parse/v3-0/intersection/toIntersection.js +65 -0
  160. package/script/parse/v3-0/ref/toRefTargetV3.d.ts +23 -0
  161. package/script/parse/v3-0/ref/toRefTargetV3.js +74 -0
  162. package/script/parse/v3-0/schema/toSchemasV3.js +13 -1
  163. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +8 -4
  164. package/script/parse/v3-1/_merge-all-of/merge-union.js +7 -1
  165. package/script/parse/v3-1/_merge-all-of/merge.js +13 -0
  166. package/script/parse/v3-1/_merge-all-of/types.d.ts +3 -0
  167. package/script/parse/v3-1/intersection/toIntersection.d.ts +12 -0
  168. package/script/parse/v3-1/intersection/toIntersection.js +65 -0
  169. package/script/parse/v3-1/ref/toRefTargetV3.d.ts +23 -0
  170. package/script/parse/v3-1/ref/toRefTargetV3.js +74 -0
  171. package/script/parse/v3-1/schema/toSchemasV3.js +15 -2
  172. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +8 -4
  173. package/script/parse/v3-2/_merge-all-of/merge-union.js +7 -1
  174. package/script/parse/v3-2/_merge-all-of/merge.js +13 -0
  175. package/script/parse/v3-2/_merge-all-of/types.d.ts +3 -0
  176. package/script/parse/v3-2/intersection/toIntersection.d.ts +12 -0
  177. package/script/parse/v3-2/intersection/toIntersection.js +65 -0
  178. package/script/parse/v3-2/ref/toRefTargetV3.d.ts +23 -0
  179. package/script/parse/v3-2/ref/toRefTargetV3.js +74 -0
  180. package/script/parse/v3-2/schema/toSchemasV3.js +15 -2
  181. package/script/types/GeneratorType.d.ts +1 -1
  182. package/script/types/ProjectionOptions.d.ts +1 -1
  183. package/script/types/ProjectionOptions.js +1 -1
  184. package/script/types/RefName.d.ts +3 -3
  185. package/script/types/Settings.d.ts +9 -0
  186. package/script/types/Settings.js +2 -1
  187. package/script/types/TypeSystem.d.ts +20 -5
@@ -3,7 +3,7 @@ import type { GenerateContextType, InsertModelOptions } from '../../context/gene
3
3
  import type { ContentSettings } from '../ContentSettings.js';
4
4
  import type { GeneratedDefinition } from '../GeneratedValue.js';
5
5
  import type { GeneratedValue } from '../GeneratedValue.js';
6
- import type { RefName } from '../../types/RefName.js';
6
+ import { type RefParts } from '../../helpers/refFns.js';
7
7
  /**
8
8
  * The `insertModel` call plus the context. The Driver defaults `variant`
9
9
  * to `'main'` and `noExport` to `false`, and reads the caller's options
@@ -12,8 +12,9 @@ import type { RefName } from '../../types/RefName.js';
12
12
  type CreateModelArgs<V extends GeneratedValue, EnrichmentType, ProjectionOptions> = {
13
13
  context: GenerateContextType;
14
14
  projection: ModelProjection<V, EnrichmentType, ProjectionOptions>;
15
- refName: RefName;
16
- rootRef?: RefName;
15
+ /** The model's ref; an `OasRef` fits it. */
16
+ ref: RefParts;
17
+ rootRef?: RefParts;
17
18
  } & InsertModelOptions<ProjectionOptions>;
18
19
  /**
19
20
  * Driver for the model insertion lifecycle.
@@ -27,11 +28,11 @@ type CreateModelArgs<V extends GeneratedValue, EnrichmentType, ProjectionOptions
27
28
  export declare class ModelDriver<V extends GeneratedValue, EnrichmentType, ProjectionOptions = undefined> {
28
29
  context: GenerateContextType;
29
30
  projection: ModelProjection<V, EnrichmentType, ProjectionOptions>;
30
- refName: RefName;
31
+ ref: RefParts;
31
32
  settings: ContentSettings<EnrichmentType>;
32
33
  destinationPath?: string;
33
34
  definition: GeneratedDefinition<V>;
34
- rootRef?: RefName;
35
+ rootRef?: RefParts;
35
36
  noExport: boolean;
36
37
  variant: string;
37
38
  /** The caller's options, as passed to `insertModel`. */
@@ -1,5 +1,6 @@
1
1
  import { normalizeWorkspacePath } from '../../helpers/normalizeWorkspacePath.js';
2
2
  import { toModelGeneratorKey } from '../GeneratorKeys.js';
3
+ import { toModelKey } from '../../helpers/refFns.js';
3
4
  import { DEFAULT_VARIANT } from '../../types/Variant.js';
4
5
  import { readProjectionOptions, toValueOptions } from '../../types/ProjectionOptions.js';
5
6
  import isEqual from 'lodash-es/isEqual.js';
@@ -32,7 +33,7 @@ export class ModelDriver {
32
33
  writable: true,
33
34
  value: void 0
34
35
  });
35
- Object.defineProperty(this, "refName", {
36
+ Object.defineProperty(this, "ref", {
36
37
  enumerable: true,
37
38
  configurable: true,
38
39
  writable: true,
@@ -81,10 +82,10 @@ export class ModelDriver {
81
82
  writable: true,
82
83
  value: void 0
83
84
  });
84
- const { context, projection, refName, destinationPath, rootRef, noExport = false, variant = DEFAULT_VARIANT } = args;
85
+ const { context, projection, ref, destinationPath, rootRef, noExport = false, variant = DEFAULT_VARIANT } = args;
85
86
  this.context = context;
86
87
  this.projection = projection;
87
- this.refName = refName;
88
+ this.ref = ref;
88
89
  this.destinationPath = destinationPath;
89
90
  this.rootRef = rootRef;
90
91
  this.noExport = noExport;
@@ -125,7 +126,7 @@ export class ModelDriver {
125
126
  getDefinition({ identifier, exportPath }) {
126
127
  const generatorKey = toModelGeneratorKey({
127
128
  generatorId: this.projection.id,
128
- refName: this.refName,
129
+ ref: this.ref,
129
130
  variant: this.settings.variant
130
131
  });
131
132
  const pending = findPending({ context: this.context, name: identifier.name, exportPath });
@@ -158,7 +159,7 @@ export class ModelDriver {
158
159
  projection: this.projection
159
160
  });
160
161
  const value = whilePending({ context: this.context, marker }, () => new this.projection({
161
- refName: this.refName,
162
+ ref: this.ref,
162
163
  context: this.context,
163
164
  settings: this.settings,
164
165
  destinationPath: this.settings.exportPath,
@@ -192,7 +193,7 @@ export class ModelDriver {
192
193
  }
193
194
  const currentKey = toModelGeneratorKey({
194
195
  generatorId: this.projection.id,
195
- refName: this.refName,
196
+ ref: this.ref,
196
197
  variant: this.settings.variant
197
198
  });
198
199
  assertSameKey({
@@ -298,11 +299,11 @@ export const isReferencedBack = ({ context, settings }) => {
298
299
  };
299
300
  /** A model's content settings, once the peer is known to have the variant and to support the model. */
300
301
  const toModelSettings = (args) => {
301
- const { context, projection, refName, variant = DEFAULT_VARIANT } = args;
302
- assertPeerVariantExists({ context, generatorId: projection.id, refName, variant });
303
- assertPeerSupported({ context, projection, refName, variant });
302
+ const { context, projection, ref, variant = DEFAULT_VARIANT } = args;
303
+ assertPeerVariantExists({ context, generatorId: projection.id, ref, variant });
304
+ assertPeerSupported({ context, projection, ref, variant });
304
305
  return context.toModelContentSettings({
305
- refName,
306
+ ref,
306
307
  projection,
307
308
  variant,
308
309
  options: readProjectionOptions(args)
@@ -319,7 +320,7 @@ const toModelSettings = (args) => {
319
320
  * {@link ModelDriver}.
320
321
  */
321
322
  export const toModelRef = (args) => {
322
- const { context, projection, refName, destinationPath, variant = DEFAULT_VARIANT } = args;
323
+ const { context, projection, ref, destinationPath, variant = DEFAULT_VARIANT } = args;
323
324
  const settings = toModelSettings(args);
324
325
  const pending = findPending({
325
326
  context,
@@ -331,7 +332,7 @@ export const toModelRef = (args) => {
331
332
  pending,
332
333
  name: settings.identifier.name,
333
334
  exportPath: settings.exportPath,
334
- generatorKey: toModelGeneratorKey({ generatorId: projection.id, refName, variant }),
335
+ generatorKey: toModelGeneratorKey({ generatorId: projection.id, ref, variant }),
335
336
  options: readProjectionOptions(args),
336
337
  projection
337
338
  });
@@ -375,22 +376,23 @@ export const toModelRef = (args) => {
375
376
  * key. The Driver throws here — loud at the call site — rather than
376
377
  * letting silently-wrong output reach the consumer.
377
378
  */
378
- const assertPeerVariantExists = ({ context, generatorId, refName, variant }) => {
379
+ const assertPeerVariantExists = ({ context, generatorId, ref, variant }) => {
379
380
  if (variant === DEFAULT_VARIANT) {
380
381
  return;
381
382
  }
382
- const modelEnrichments = context.readEnrichment([generatorId, refName]);
383
+ const key = toModelKey(ref);
384
+ const modelEnrichments = context.readEnrichment([generatorId, key]);
383
385
  if (modelEnrichments === null || modelEnrichments === undefined) {
384
- throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${refName}' — ` +
386
+ throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${key}' — ` +
385
387
  `peer has no enrichments configured. Only '${DEFAULT_VARIANT}' is permitted.`);
386
388
  }
387
389
  if (typeof modelEnrichments !== 'object' || Array.isArray(modelEnrichments)) {
388
- throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${refName}' — ` +
390
+ throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${key}' — ` +
389
391
  `peer enrichment is not a variant record.`);
390
392
  }
391
393
  if (!(variant in modelEnrichments)) {
392
394
  const available = Object.keys(modelEnrichments).join(', ');
393
- throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${refName}'. ` +
395
+ throw new Error(`[${generatorId}] Cannot insert variant '${variant}' for '${key}'. ` +
394
396
  `Available variants: ${available}.`);
395
397
  }
396
398
  };
@@ -413,10 +415,10 @@ const assertPeerVariantExists = ({ context, generatorId, refName, variant }) =>
413
415
  * model: `toModelProjectionBase` defaults it to `() => true`, and a
414
416
  * hand-rolled projection may omit it.
415
417
  */
416
- const assertPeerSupported = ({ context, projection, refName, variant }) => {
418
+ const assertPeerSupported = ({ context, projection, ref, variant }) => {
417
419
  const isSupported = projection.isSupported ?? (() => true);
418
- if (!isSupported({ refName, context, variant })) {
419
- throw new Error(`[${projection.id}] Cannot insert '${refName}' — peer generator ` +
420
+ if (!isSupported({ ref, context, variant })) {
421
+ throw new Error(`[${projection.id}] Cannot insert '${toModelKey(ref)}' — peer generator ` +
420
422
  `does not support this model (isSupported returned false).`);
421
423
  }
422
424
  };
@@ -1,11 +1,11 @@
1
- import type { RefName } from '../../types/RefName.js';
1
+ import type { RefParts } from '../../helpers/refFns.js';
2
2
  import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
3
3
  import type { TransformModelArgs, ToModelPreviewModuleArgs, ToModelEnrichmentsArgs, IsSupportedModelArgs } from './types.js';
4
4
  import type { PreviewModule } from '../../types/Preview.js';
5
5
  import type * as v from 'valibot';
6
6
  type ToModelEntryArgs<EnrichmentType = undefined> = {
7
7
  id: string;
8
- transform: ({ context, refName, variant }: TransformModelArgs) => void;
8
+ transform: ({ context, ref, variant }: TransformModelArgs) => void;
9
9
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
10
10
  isSupported?: (args: IsSupportedModelArgs) => boolean;
11
11
  /**
@@ -13,20 +13,20 @@ type ToModelEntryArgs<EnrichmentType = undefined> = {
13
13
  * function returning `false` when omitted.
14
14
  */
15
15
  supportsVariant?: () => boolean;
16
- toPreviewModule?: ({ context, refName, variant }: ToModelPreviewModuleArgs) => PreviewModule;
17
- toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined;
18
- toEnrichmentDefaults?: ({ refName, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType | undefined;
16
+ toPreviewModule?: ({ context, ref, variant }: ToModelPreviewModuleArgs) => PreviewModule;
17
+ toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(ref: RefParts) => EnrichmentRequest<RequestedEnrichment> | undefined;
18
+ toEnrichmentDefaults?: ({ ref, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType | undefined;
19
19
  };
20
20
  export type ModelEntry<EnrichmentType = undefined> = {
21
21
  id: string;
22
22
  type: 'model';
23
- transform: ({ context, refName, variant }: TransformModelArgs) => void;
23
+ transform: ({ context, ref, variant }: TransformModelArgs) => void;
24
24
  isSupported: (args: IsSupportedModelArgs) => boolean;
25
25
  supportsVariant: () => boolean;
26
- toPreviewModule?: ({ context, refName, variant }: ToModelPreviewModuleArgs) => PreviewModule;
26
+ toPreviewModule?: ({ context, ref, variant }: ToModelPreviewModuleArgs) => PreviewModule;
27
27
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
28
- toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined;
29
- toEnrichmentDefaults?: ({ refName, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType | undefined;
28
+ toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(ref: RefParts) => EnrichmentRequest<RequestedEnrichment> | undefined;
29
+ toEnrichmentDefaults?: ({ ref, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType | undefined;
30
30
  };
31
31
  /**
32
32
  * Creates a model transformation entry for the SKMTC pipeline.
@@ -45,7 +45,7 @@ export type ModelEntry<EnrichmentType = undefined> = {
45
45
  * @param args.isSupported - Optional capability gate; a model whose predicate
46
46
  * returns `false` is recorded `notSupported` and its `transform` is skipped.
47
47
  * Resolve the schema inside the predicate when needed
48
- * (`context.resolveSchemaRefOnce(refName)`). Defaults to supporting every model.
48
+ * (`context.resolveSchemaRefOnce(ref)`). Defaults to supporting every model.
49
49
  * @param args.toPreviewModule - Optional function to generate preview modules
50
50
  * @param args.toEnrichmentSchema - Optional function to provide enrichment validation
51
51
  * @param args.toEnrichmentRequest - Optional function to request enrichments
@@ -57,12 +57,12 @@ export type ModelEntry<EnrichmentType = undefined> = {
57
57
  *
58
58
  * const typeScriptModelEntry = toModelEntry({
59
59
  * id: 'typescript-models',
60
- * transform: ({ context, refName }) => {
61
- * context.insertModel(TsModel, refName);
60
+ * transform: ({ context, ref }) => {
61
+ * context.insertModel(TsModel, ref);
62
62
  * },
63
- * toPreviewModule: ({ context, refName }) => ({
63
+ * toPreviewModule: ({ context, ref }) => ({
64
64
  * group: 'forms',
65
- * title: `${refName} Model`,
65
+ * title: `${ref.refName} Model`,
66
66
  * description: 'Generated TypeScript interface'
67
67
  * })
68
68
  * });
@@ -72,15 +72,15 @@ export type ModelEntry<EnrichmentType = undefined> = {
72
72
  * ```typescript
73
73
  * const validationModelEntry = toModelEntry({
74
74
  * id: 'validation-schemas',
75
- * transform: ({ context, refName }) => {
76
- * context.insertModel(ValidationModel, refName);
75
+ * transform: ({ context, ref }) => {
76
+ * context.insertModel(ValidationModel, ref);
77
77
  * },
78
78
  * toEnrichmentSchema: () => v.object({
79
79
  * strict: v.optional(v.boolean()),
80
80
  * nullable: v.optional(v.boolean())
81
81
  * }),
82
- * toEnrichmentRequest: (refName) => ({
83
- * path: `models.${refName}`,
82
+ * toEnrichmentRequest: (ref) => ({
83
+ * path: `models.${ref.refName}`,
84
84
  * schema: enrichmentSchema
85
85
  * })
86
86
  * });
@@ -15,7 +15,7 @@
15
15
  * @param args.isSupported - Optional capability gate; a model whose predicate
16
16
  * returns `false` is recorded `notSupported` and its `transform` is skipped.
17
17
  * Resolve the schema inside the predicate when needed
18
- * (`context.resolveSchemaRefOnce(refName)`). Defaults to supporting every model.
18
+ * (`context.resolveSchemaRefOnce(ref)`). Defaults to supporting every model.
19
19
  * @param args.toPreviewModule - Optional function to generate preview modules
20
20
  * @param args.toEnrichmentSchema - Optional function to provide enrichment validation
21
21
  * @param args.toEnrichmentRequest - Optional function to request enrichments
@@ -27,12 +27,12 @@
27
27
  *
28
28
  * const typeScriptModelEntry = toModelEntry({
29
29
  * id: 'typescript-models',
30
- * transform: ({ context, refName }) => {
31
- * context.insertModel(TsModel, refName);
30
+ * transform: ({ context, ref }) => {
31
+ * context.insertModel(TsModel, ref);
32
32
  * },
33
- * toPreviewModule: ({ context, refName }) => ({
33
+ * toPreviewModule: ({ context, ref }) => ({
34
34
  * group: 'forms',
35
- * title: `${refName} Model`,
35
+ * title: `${ref.refName} Model`,
36
36
  * description: 'Generated TypeScript interface'
37
37
  * })
38
38
  * });
@@ -42,15 +42,15 @@
42
42
  * ```typescript
43
43
  * const validationModelEntry = toModelEntry({
44
44
  * id: 'validation-schemas',
45
- * transform: ({ context, refName }) => {
46
- * context.insertModel(ValidationModel, refName);
45
+ * transform: ({ context, ref }) => {
46
+ * context.insertModel(ValidationModel, ref);
47
47
  * },
48
48
  * toEnrichmentSchema: () => v.object({
49
49
  * strict: v.optional(v.boolean()),
50
50
  * nullable: v.optional(v.boolean())
51
51
  * }),
52
- * toEnrichmentRequest: (refName) => ({
53
- * path: `models.${refName}`,
52
+ * toEnrichmentRequest: (ref) => ({
53
+ * path: `models.${ref.refName}`,
54
54
  * schema: enrichmentSchema
55
55
  * })
56
56
  * });
@@ -1,7 +1,7 @@
1
1
  import type { GenerateContextType, InsertNormalizedModelArgs, InsertNormalizedModelOptions, InsertNormalizedModelReturn } from '../../context/generateTypes.js';
2
2
  import { type ProjectionOptionsArg, type ProjectionOptionsRest } from '../../types/ProjectionOptions.js';
3
3
  import { type PeerInsertOptions } from '../../types/InsertOptions.js';
4
- import type { RefName } from '../../types/RefName.js';
4
+ import { type RefParts } from '../../helpers/refFns.js';
5
5
  import type { ContentSettings } from '../ContentSettings.js';
6
6
  import type { LangSnippetConstructor } from '../Lang.js';
7
7
  import type { IdentifierType } from '../IdentifierType.js';
@@ -21,10 +21,11 @@ import type * as v from 'valibot';
21
21
  export type ModelProjectionArgs<EnrichmentType = undefined, ProjectionOptions = undefined> = {
22
22
  context: GenerateContextType;
23
23
  settings: ContentSettings<EnrichmentType>;
24
- refName: RefName;
24
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
25
+ ref: RefParts;
25
26
  } & ProjectionOptionsArg<ProjectionOptions>;
26
27
  type ToEnrichmentsArgs = {
27
- refName: RefName;
28
+ ref: RefParts;
28
29
  context: GenerateContextType;
29
30
  /** Model variant whose enrichment should be resolved (see {@link Variant}) */
30
31
  variant: string;
@@ -52,7 +53,7 @@ export type ModelProjectionBaseConfig<EnrichmentType = undefined, IdType extends
52
53
  * `type` is bound to that language's `EntityType` vocabulary (the loose
53
54
  * `string` by default). The tightening rides the type argument.
54
55
  */
55
- toIdentifierType: (refName: RefName, context: GenerateContextType) => IdType;
56
+ toIdentifierType: (ref: RefParts, context: GenerateContextType) => IdType;
56
57
  toExportPath: (args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string;
57
58
  /**
58
59
  * Required composite schema for the `{ subject, generator, stack }`
@@ -76,10 +77,12 @@ export type ModelProjectionBaseConfig<EnrichmentType = undefined, IdType extends
76
77
  * `insertModel` (the model counterpart of the operation-reference
77
78
  * protocol). When omitted, advertises support for every model.
78
79
  */
79
- isSupported?: (args: {
80
- refName: RefName;
81
- context: GenerateContextType;
82
- }) => boolean;
80
+ isSupported?: (args: IsSupportedArgs) => boolean;
81
+ };
82
+ /** What a model projection's `isSupported` receives. */
83
+ type IsSupportedArgs = {
84
+ ref: RefParts;
85
+ context: GenerateContextType;
83
86
  };
84
87
  /**
85
88
  * Build a model projection base class from a per-generator config.
@@ -103,7 +106,8 @@ export type ModelProjectionBaseConfig<EnrichmentType = undefined, IdType extends
103
106
  export declare const toModelProjectionBase: <EnrichmentType = undefined, IdType extends IdentifierType = IdentifierType, ProjectionOptions = undefined>(base: LangSnippetConstructor, config: ModelProjectionBaseConfig<EnrichmentType, IdType, ProjectionOptions>) => {
104
107
  new (args: ModelProjectionArgs<EnrichmentType, ProjectionOptions>): {
105
108
  settings: ContentSettings<EnrichmentType>;
106
- refName: RefName;
109
+ /** The ref this model is built for (see {@link RefParts}). */
110
+ ref: RefParts;
107
111
  /** The caller's options. */
108
112
  options: ProjectionOptions;
109
113
  /**
@@ -112,7 +116,7 @@ export declare const toModelProjectionBase: <EnrichmentType = undefined, IdType
112
116
  * unless `noExport` is set. `{ options }` is required when the peer
113
117
  * declares options and refused when it does not.
114
118
  */
115
- insertModel<V extends GeneratedValue, PeerEnrichmentType = undefined, PeerProjectionOptions = undefined>(projection: ModelProjection<V, PeerEnrichmentType, PeerProjectionOptions>, refName: RefName, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions>, PeerProjectionOptions>): Inserted<V, PeerEnrichmentType>;
119
+ insertModel<V extends GeneratedValue, PeerEnrichmentType = undefined, PeerProjectionOptions = undefined>(projection: ModelProjection<V, PeerEnrichmentType, PeerProjectionOptions>, ref: RefParts, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions>, PeerProjectionOptions>): Inserted<V, PeerEnrichmentType>;
116
120
  /**
117
121
  * Insert a related model with reference normalization. If `schema` is a
118
122
  * `$ref`, the referenced name is used; otherwise `fallbackName` applies.
@@ -126,19 +130,16 @@ export declare const toModelProjectionBase: <EnrichmentType = undefined, IdType
126
130
  id: string;
127
131
  type: "model";
128
132
  toIdentifierName: (args: ToModelIdentifierNameArgs<EnrichmentType, ProjectionOptions>) => string;
129
- toIdentifierType: (refName: RefName, context: GenerateContextType) => IdType;
133
+ toIdentifierType: (ref: RefParts, context: GenerateContextType) => IdType;
130
134
  toExportPath: (args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string;
131
- toEnrichments: ({ refName, context, variant }: ToEnrichmentsArgs) => EnrichmentType;
135
+ toEnrichments: ({ ref, context, variant }: ToEnrichmentsArgs) => EnrichmentType;
132
136
  /**
133
137
  * Derive the seed enrichment values for a model from its schema (the CMS
134
138
  * persists these, then the user edits). Returns `undefined` when the
135
139
  * generator declares no `toEnrichmentDefaults` — the common case.
136
140
  */
137
141
  toEnrichmentDefaults: (args: ToEnrichmentsArgs) => EnrichmentType | undefined;
138
- isSupported: (args: {
139
- refName: RefName;
140
- context: GenerateContextType;
141
- }) => boolean;
142
+ isSupported: (args: IsSupportedArgs) => boolean;
142
143
  lang: import("../Lang.js").Lang;
143
144
  };
144
145
  export {};
@@ -1,6 +1,7 @@
1
1
  import { readProjectionOptions } from '../../types/ProjectionOptions.js';
2
2
  import { toPeerInsertOptions } from '../../types/InsertOptions.js';
3
3
  import { toModelGeneratorKey } from '../GeneratorKeys.js';
4
+ import { toModelKey } from '../../helpers/refFns.js';
4
5
  import { DEFAULT_VARIANT } from '../../types/Variant.js';
5
6
  import { parseEnrichmentUmbrella } from '../../enrichments/parseEnrichmentUmbrella.js';
6
7
  /**
@@ -30,7 +31,7 @@ export const toModelProjectionBase = (base, config) => {
30
31
  context: args.context,
31
32
  generatorKey: toModelGeneratorKey({
32
33
  generatorId: config.id,
33
- refName: args.refName,
34
+ ref: args.ref,
34
35
  variant: args.settings.variant ?? DEFAULT_VARIANT
35
36
  })
36
37
  });
@@ -40,7 +41,8 @@ export const toModelProjectionBase = (base, config) => {
40
41
  writable: true,
41
42
  value: void 0
42
43
  });
43
- Object.defineProperty(this, "refName", {
44
+ /** The ref this model is built for (see {@link RefParts}). */
45
+ Object.defineProperty(this, "ref", {
44
46
  enumerable: true,
45
47
  configurable: true,
46
48
  writable: true,
@@ -53,7 +55,7 @@ export const toModelProjectionBase = (base, config) => {
53
55
  writable: true,
54
56
  value: void 0
55
57
  });
56
- this.refName = args.refName;
58
+ this.ref = args.ref;
57
59
  this.settings = args.settings;
58
60
  this.options = readProjectionOptions(args);
59
61
  }
@@ -63,8 +65,8 @@ export const toModelProjectionBase = (base, config) => {
63
65
  * unless `noExport` is set. `{ options }` is required when the peer
64
66
  * declares options and refused when it does not.
65
67
  */
66
- insertModel(projection, refName, ...rest) {
67
- return this.context.insertModel(projection, refName, {
68
+ insertModel(projection, ref, ...rest) {
69
+ return this.context.insertModel(projection, ref, {
68
70
  ...toPeerInsertOptions(rest),
69
71
  destinationPath: this.settings.exportPath
70
72
  });
@@ -115,10 +117,12 @@ export const toModelProjectionBase = (base, config) => {
115
117
  enumerable: true,
116
118
  configurable: true,
117
119
  writable: true,
118
- value: ({ refName, context, variant }) => {
120
+ value: ({ ref, context, variant }) => {
119
121
  // The three enrichment scopes assembled into the umbrella a generator
120
122
  // reads off `this.settings.enrichments`. Subject is per-item
121
- // (`[id][refName][variant]`) — the variant axis is core-owned, and the
123
+ // (`[id][refName][variant]`, or the whole pointer in place of
124
+ // `refName` for a ref that does not point at a component, `toModelKey`)
125
+ // — the variant axis is core-owned, and the
122
126
  // engine has already asserted `'main'` exists; generator and stack are
123
127
  // run-constants (`[id][_generator]`, `[_stack]`). The required composite
124
128
  // schema parses the raw umbrella once — typed, cast-free.
@@ -127,7 +131,7 @@ export const toModelProjectionBase = (base, config) => {
127
131
  return parseEnrichmentUmbrella({
128
132
  context,
129
133
  generatorId: config.id,
130
- subjectSegments: [refName, variant],
134
+ subjectSegments: [toModelKey(ref), variant],
131
135
  schema: config.toEnrichmentSchema()
132
136
  });
133
137
  }
@@ -1,7 +1,7 @@
1
1
  import type { GenerateContextType } from '../../context/generateTypes.js';
2
2
  import type { Lang } from '../Lang.js';
3
3
  import type { ContentSettings } from '../ContentSettings.js';
4
- import type { RefName } from '../../types/RefName.js';
4
+ import type { RefParts } from '../../helpers/refFns.js';
5
5
  import type { IdentifierType } from '../IdentifierType.js';
6
6
  import type { IdentifierBase } from '../IdentifierBase.js';
7
7
  import type { GeneratedValue } from '../GeneratedValue.js';
@@ -16,27 +16,31 @@ import type { ProjectionOptionsArg } from '../../types/ProjectionOptions.js';
16
16
  */
17
17
  export type ModelProjectionConstructorArgs<EnrichmentType = undefined, ProjectionOptions = undefined> = {
18
18
  context: GenerateContextType;
19
- refName: RefName;
19
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
20
+ ref: RefParts;
20
21
  settings: ContentSettings<EnrichmentType>;
21
22
  destinationPath: string;
22
- rootRef?: RefName;
23
+ rootRef?: RefParts;
23
24
  } & ProjectionOptionsArg<ProjectionOptions>;
24
25
  export type WithTransformModel = {
25
- transformModel: (refName: RefName) => void;
26
+ transformModel: (ref: RefParts) => void;
26
27
  };
27
28
  export type ToModelEnrichmentsArgs = {
28
- refName: RefName;
29
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
30
+ ref: RefParts;
29
31
  context: GenerateContextType;
30
32
  /** Model variant whose enrichment should be resolved (see {@link Variant}) */
31
33
  variant: string;
32
34
  };
33
35
  export type TransformModelArgs = {
34
36
  context: GenerateContextType;
35
- refName: RefName;
37
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
38
+ ref: RefParts;
36
39
  /**
37
40
  * The model variant the engine is dispatching for this call. The
38
41
  * engine fans out one `transform` call per variant declared in the
39
- * consumer's `enrichments[id][refName]` block (or just `'main'`
42
+ * consumer's `enrichments[id][refName]` block (the whole pointer for a
43
+ * model that is not a component) (or just `'main'`
40
44
  * when no enrichments are configured). See {@link Variant}.
41
45
  */
42
46
  variant: string;
@@ -46,24 +50,27 @@ export type TransformModelArgs = {
46
50
  * entry/dispatch boundary. The capability counterpart of
47
51
  * {@link TransformModelArgs}: it carries the resolved enrichment umbrella so
48
52
  * the predicate can gate on user config, but no schema — the predicate
49
- * resolves the schema itself (`context.resolveSchemaRefOnce(refName)`)
53
+ * resolves the schema itself (`context.resolveSchemaRefOnce(ref)`)
50
54
  * when it needs it, mirroring how `transform` works.
51
55
  */
52
56
  export type IsSupportedModelArgs = {
53
57
  context: GenerateContextType;
54
- refName: RefName;
58
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
59
+ ref: RefParts;
55
60
  /** Model variant being probed (see {@link Variant}) */
56
61
  variant: string;
57
62
  };
58
63
  export type ToModelPreviewModuleArgs = {
59
64
  context: GenerateContextType;
60
- refName: RefName;
65
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
66
+ ref: RefParts;
61
67
  /** Model variant the preview module describes (see {@link Variant}) */
62
68
  variant: string;
63
69
  };
64
70
  export type ToModelMappingArgs = {
65
71
  context: GenerateContextType;
66
- refName: RefName;
72
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
73
+ ref: RefParts;
67
74
  /** Model variant the mapping module describes (see {@link Variant}) */
68
75
  variant: string;
69
76
  };
@@ -72,13 +79,15 @@ export type ToModelMappingArgs = {
72
79
  * depends on them: definitions are cached by name and export path.
73
80
  */
74
81
  export type ToModelIdentifierNameArgs<EnrichmentType = undefined, ProjectionOptions = undefined> = {
75
- refName: RefName;
82
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
83
+ ref: RefParts;
76
84
  enrichments: EnrichmentType;
77
85
  /** Model variant the identifier should disambiguate (see {@link Variant}) */
78
86
  variant: string;
79
87
  } & ProjectionOptionsArg<ProjectionOptions>;
80
88
  export type ToModelExportPathArgs<EnrichmentType = undefined, ProjectionOptions = undefined> = {
81
- refName: RefName;
89
+ /** The model's ref (see {@link RefParts}); an `OasRef` fits it. */
90
+ ref: RefParts;
82
91
  enrichments: EnrichmentType;
83
92
  /** Model variant the export path should disambiguate (see {@link Variant}) */
84
93
  variant: string;
@@ -95,7 +104,7 @@ export type ToModelExportPathArgs<EnrichmentType = undefined, ProjectionOptions
95
104
  export type ModelProjection<V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined> = {
96
105
  prototype: V;
97
106
  } & {
98
- new ({ context, refName, settings, destinationPath, rootRef, options }: ModelProjectionConstructorArgs<EnrichmentType, ProjectionOptions>): V;
107
+ new ({ context, ref, settings, destinationPath, rootRef, options }: ModelProjectionConstructorArgs<EnrichmentType, ProjectionOptions>): V;
99
108
  id: string;
100
109
  type: 'model';
101
110
  /**
@@ -111,11 +120,11 @@ export type ModelProjection<V extends GeneratedValue, EnrichmentType = undefined
111
120
  * Context-aware, overridable: the non-`name` parts of the identifier
112
121
  * (`type` / `typeName` / `exported`), derived from the schema. The engine
113
122
  * assembles `lang.toIdentifier({ name: toIdentifierName(args),
114
- * ...toIdentifierType(refName, context) })`.
123
+ * ...toIdentifierType(ref, context) })`.
115
124
  */
116
- toIdentifierType: (refName: RefName, context: GenerateContextType) => IdentifierType;
125
+ toIdentifierType: (ref: RefParts, context: GenerateContextType) => IdentifierType;
117
126
  toExportPath: (args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string;
118
- toEnrichments: ({ refName, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType;
127
+ toEnrichments: ({ ref, context, variant }: ToModelEnrichmentsArgs) => EnrichmentType;
119
128
  /**
120
129
  * Family-level capability predicate, surfaced as a static by
121
130
  * `toModelProjectionBase` (default `() => true`). The Driver probes it on
@@ -9,7 +9,7 @@ import type { IdentifierType } from '../../IdentifierType.js';
9
9
  import type { GeneratedValue } from '../../GeneratedValue.js';
10
10
  import type { Inserted } from '../../Inserted.js';
11
11
  import type { ModelProjection, NormalizedModelProjection } from '../../model/types.js';
12
- import type { RefName } from '../../../types/RefName.js';
12
+ import type { RefParts } from '../../../helpers/refFns.js';
13
13
  import type { OasSchema } from '../../../oas/schema/Schema.js';
14
14
  import type { OasRef } from '../../../oas/ref/Ref.js';
15
15
  import type { OasVoid } from '../../../oas/void/Void.js';
@@ -103,7 +103,7 @@ export declare const toGqlOperationProjectionBase: <EnrichmentType = undefined,
103
103
  * `{ options }` is required when the peer declares options and refused
104
104
  * when it does not.
105
105
  */
106
- insertModel<V extends GeneratedValue, PeerEnrichmentType_1 = undefined, PeerProjectionOptions_1 = undefined>(projection: ModelProjection<V, PeerEnrichmentType_1, PeerProjectionOptions_1>, refName: RefName, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions_1>, PeerProjectionOptions_1>): Inserted<V, PeerEnrichmentType_1>;
106
+ insertModel<V extends GeneratedValue, PeerEnrichmentType_1 = undefined, PeerProjectionOptions_1 = undefined>(projection: ModelProjection<V, PeerEnrichmentType_1, PeerProjectionOptions_1>, ref: RefParts, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions_1>, PeerProjectionOptions_1>): Inserted<V, PeerEnrichmentType_1>;
107
107
  /**
108
108
  * Insert a related model with reference normalization. Useful for
109
109
  * schemas that may be either a `$ref` or a concrete object.
@@ -83,8 +83,8 @@ export const toGqlOperationProjectionBase = (base, config) => {
83
83
  * `{ options }` is required when the peer declares options and refused
84
84
  * when it does not.
85
85
  */
86
- insertModel(projection, refName, ...rest) {
87
- return this.context.insertModel(projection, refName, {
86
+ insertModel(projection, ref, ...rest) {
87
+ return this.context.insertModel(projection, ref, {
88
88
  ...toPeerInsertOptions(rest),
89
89
  destinationPath: this.settings.exportPath
90
90
  });
@@ -10,7 +10,7 @@ import type { IdentifierType } from '../../IdentifierType.js';
10
10
  import type { GeneratedValue } from '../../GeneratedValue.js';
11
11
  import type { Inserted } from '../../Inserted.js';
12
12
  import type { ModelProjection, NormalizedModelProjection } from '../../model/types.js';
13
- import type { RefName } from '../../../types/RefName.js';
13
+ import type { RefParts } from '../../../helpers/refFns.js';
14
14
  import type { OasSchema } from '../../../oas/schema/Schema.js';
15
15
  import type { OasRef } from '../../../oas/ref/Ref.js';
16
16
  import type { OasVoid } from '../../../oas/void/Void.js';
@@ -128,7 +128,7 @@ export declare const toOasOperationProjectionBase: <EnrichmentType = undefined,
128
128
  * `{ options }` is required when the peer declares options and refused
129
129
  * when it does not.
130
130
  */
131
- insertModel<V extends GeneratedValue, PeerEnrichmentType_1 = undefined, PeerProjectionOptions_1 = undefined>(projection: ModelProjection<V, PeerEnrichmentType_1, PeerProjectionOptions_1>, refName: RefName, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions_1>, PeerProjectionOptions_1>): Inserted<V, PeerEnrichmentType_1>;
131
+ insertModel<V extends GeneratedValue, PeerEnrichmentType_1 = undefined, PeerProjectionOptions_1 = undefined>(projection: ModelProjection<V, PeerEnrichmentType_1, PeerProjectionOptions_1>, ref: RefParts, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions_1>, PeerProjectionOptions_1>): Inserted<V, PeerEnrichmentType_1>;
132
132
  /**
133
133
  * Insert a related model with reference normalization. Useful for inline
134
134
  * request/response schemas where the schema may be either a `$ref` or a
@@ -100,8 +100,8 @@ export const toOasOperationProjectionBase = (base, config) => {
100
100
  * `{ options }` is required when the peer declares options and refused
101
101
  * when it does not.
102
102
  */
103
- insertModel(projection, refName, ...rest) {
104
- return this.context.insertModel(projection, refName, {
103
+ insertModel(projection, ref, ...rest) {
104
+ return this.context.insertModel(projection, ref, {
105
105
  ...toPeerInsertOptions(rest),
106
106
  destinationPath: this.settings.exportPath
107
107
  });