@skmtc/core 0.52.0 → 0.53.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.
@@ -0,0 +1,48 @@
1
+ import type { ToModelEnrichmentsArgs, ToModelExportPathArgs } from './model/types.js';
2
+ import type { ToOasOperationEnrichmentsArgs, ToOasOperationExportPathArgs } from './operation/oas/types.js';
3
+ import type { ToGqlOperationEnrichmentsArgs, ToGqlOperationExportPathArgs } from './operation/gql/types.js';
4
+ import type { ToWebhookEnrichmentsArgs, ToWebhookExportPathArgs } from './webhook/types.js';
5
+ /**
6
+ * A model projection class as a generator's entry declares it: the statics
7
+ * core can read before it constructs anything.
8
+ *
9
+ * The statics are methods, not function properties. TypeScript compares a
10
+ * method's parameters both ways, so projection classes with different
11
+ * enrichment and option types fit in one list.
12
+ */
13
+ export type DeclaredModelProjection = {
14
+ id: string;
15
+ type: 'model';
16
+ toEnrichments(args: ToModelEnrichmentsArgs): unknown;
17
+ toExportPath(args: ToModelExportPathArgs<unknown, unknown>): string;
18
+ };
19
+ /** An OpenAPI operation projection class as an entry declares it. See {@link DeclaredModelProjection}. */
20
+ export type DeclaredOasOperationProjection = {
21
+ id: string;
22
+ type: 'oasOperation';
23
+ toEnrichments(args: ToOasOperationEnrichmentsArgs): unknown;
24
+ toExportPath(args: ToOasOperationExportPathArgs<unknown, unknown>): string;
25
+ };
26
+ /** A webhook projection class as an entry declares it. See {@link DeclaredModelProjection}. */
27
+ export type DeclaredWebhookProjection = {
28
+ id: string;
29
+ type: 'webhook';
30
+ toEnrichments(args: ToWebhookEnrichmentsArgs): unknown;
31
+ toExportPath(args: ToWebhookExportPathArgs<unknown, unknown>): string;
32
+ };
33
+ /** A GraphQL operation projection class as an entry declares it. See {@link DeclaredModelProjection}. */
34
+ export type DeclaredGqlOperationProjection = {
35
+ id: string;
36
+ type: 'gqlOperation';
37
+ toEnrichments(args: ToGqlOperationEnrichmentsArgs): unknown;
38
+ toExportPath(args: ToGqlOperationExportPathArgs<unknown, unknown>): string;
39
+ };
40
+ /**
41
+ * A projection class in an entry's `projections` list.
42
+ *
43
+ * An entry lists every projection class its generator can insert: its own,
44
+ * and each one of another generator that it inserts, such as the model
45
+ * projection an operation generator takes its schemas from. From the list,
46
+ * core can know before a run which files the generator can write.
47
+ */
48
+ export type DeclaredProjection = DeclaredModelProjection | DeclaredOasOperationProjection | DeclaredWebhookProjection | DeclaredGqlOperationProjection;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../DeclaredProjection.js';
1
2
  import type { RefParts } from '../../helpers/refFns.js';
2
3
  import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
3
4
  import type { TransformModelArgs, ToModelPreviewModuleArgs, ToModelEnrichmentsArgs, IsSupportedModelArgs } from './types.js';
@@ -5,6 +6,12 @@ import type { PreviewModule } from '../../types/Preview.js';
5
6
  import type * as v from 'valibot';
6
7
  type ToModelEntryArgs<EnrichmentType = undefined> = {
7
8
  id: string;
9
+ /**
10
+ * Every projection class this generator can insert: its own, and each one
11
+ * of another generator that it inserts. Core reads only their statics. See
12
+ * {@link DeclaredProjection}. Optional.
13
+ */
14
+ projections?: readonly DeclaredProjection[];
8
15
  transform: ({ context, ref, variant }: TransformModelArgs) => void;
9
16
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
10
17
  isSupported?: (args: IsSupportedModelArgs) => boolean;
@@ -20,6 +27,8 @@ type ToModelEntryArgs<EnrichmentType = undefined> = {
20
27
  export type ModelEntry<EnrichmentType = undefined> = {
21
28
  id: string;
22
29
  type: 'model';
30
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
31
+ projections?: readonly DeclaredProjection[];
23
32
  transform: ({ context, ref, variant }: TransformModelArgs) => void;
24
33
  isSupported: (args: IsSupportedModelArgs) => boolean;
25
34
  supportsVariant: () => boolean;
@@ -86,5 +95,5 @@ export type ModelEntry<EnrichmentType = undefined> = {
86
95
  * });
87
96
  * ```
88
97
  */
89
- export declare const toModelEntry: <EnrichmentType = undefined>({ id, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }: ToModelEntryArgs<EnrichmentType>) => ModelEntry<EnrichmentType>;
98
+ export declare const toModelEntry: <EnrichmentType = undefined>({ id, projections, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }: ToModelEntryArgs<EnrichmentType>) => ModelEntry<EnrichmentType>;
90
99
  export {};
@@ -56,10 +56,11 @@
56
56
  * });
57
57
  * ```
58
58
  */
59
- export const toModelEntry = ({ id, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }) => {
59
+ export const toModelEntry = ({ id, projections, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }) => {
60
60
  return {
61
61
  id,
62
62
  type: 'model',
63
+ projections,
63
64
  transform,
64
65
  isSupported: isSupported ?? (() => true),
65
66
  supportsVariant: supportsVariant ?? (() => false),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { GqlOperation } from '../../../gql/operation/GqlOperation.js';
3
4
  import type { EnrichmentRequest } from '../../../types/EnrichmentRequest.js';
@@ -13,6 +14,12 @@ import type { PreviewModule } from '../../../types/Preview.js';
13
14
  */
14
15
  export type ToGqlOperationConfigArgs<EnrichmentType = undefined> = {
15
16
  id: string;
17
+ /**
18
+ * Every projection class this generator can insert: its own, and each one
19
+ * of another generator that it inserts. Core reads only their statics. See
20
+ * {@link DeclaredProjection}. Optional.
21
+ */
22
+ projections?: readonly DeclaredProjection[];
16
23
  transform: ({ context, operation, variant }: TransformGqlOperationArgs) => void;
17
24
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
18
25
  isSupported?: (args: IsSupportedGqlOperationArgs) => boolean;
@@ -27,6 +34,8 @@ export type ToGqlOperationConfigArgs<EnrichmentType = undefined> = {
27
34
  export type GqlOperationEntry<EnrichmentType = undefined> = {
28
35
  id: string;
29
36
  type: 'gqlOperation';
37
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
38
+ projections?: readonly DeclaredProjection[];
30
39
  transform: ({ context, operation, variant }: TransformGqlOperationArgs) => void;
31
40
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
32
41
  isSupported: (args: IsSupportedGqlOperationArgs) => boolean;
@@ -45,4 +54,4 @@ export type GqlOperationEntry<EnrichmentType = undefined> = {
45
54
  * @param config - Configuration object defining operation behavior
46
55
  * @returns Configured operation generator entry ready for pipeline integration
47
56
  */
48
- export declare const toGqlOperationEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }: ToGqlOperationConfigArgs<EnrichmentType>) => GqlOperationEntry<EnrichmentType>;
57
+ export declare const toGqlOperationEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }: ToGqlOperationConfigArgs<EnrichmentType>) => GqlOperationEntry<EnrichmentType>;
@@ -9,10 +9,11 @@
9
9
  * @param config - Configuration object defining operation behavior
10
10
  * @returns Configured operation generator entry ready for pipeline integration
11
11
  */
12
- export const toGqlOperationEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }) => {
12
+ export const toGqlOperationEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }) => {
13
13
  return {
14
14
  id,
15
15
  type: 'gqlOperation',
16
+ projections,
16
17
  transform,
17
18
  toEnrichmentSchema,
18
19
  isSupported: isSupported ?? (() => true),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { OasOperation } from '../../../oas/operation/Operation.js';
3
4
  import type { EnrichmentRequest } from '../../../types/EnrichmentRequest.js';
@@ -13,6 +14,12 @@ import type { PreviewModule } from '../../../types/Preview.js';
13
14
  */
14
15
  export type ToOasOperationConfigArgs<EnrichmentType = undefined> = {
15
16
  id: string;
17
+ /**
18
+ * Every projection class this generator can insert: its own, and each one
19
+ * of another generator that it inserts. Core reads only their statics. See
20
+ * {@link DeclaredProjection}. Optional.
21
+ */
22
+ projections?: readonly DeclaredProjection[];
16
23
  transform: ({ context, operation, variant }: TransformOasOperationArgs) => void;
17
24
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
18
25
  isSupported?: (args: IsSupportedOasOperationArgs) => boolean;
@@ -36,6 +43,8 @@ export type ToOasOperationConfigArgs<EnrichmentType = undefined> = {
36
43
  export type OasOperationEntry<EnrichmentType = undefined> = {
37
44
  id: string;
38
45
  type: 'oasOperation';
46
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
47
+ projections?: readonly DeclaredProjection[];
39
48
  transform: ({ context, operation, variant }: TransformOasOperationArgs) => void;
40
49
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
41
50
  isSupported: (args: IsSupportedOasOperationArgs) => boolean;
@@ -70,4 +79,4 @@ export type OasOperationEntry<EnrichmentType = undefined> = {
70
79
  * });
71
80
  * ```
72
81
  */
73
- export declare const toOasOperationEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToOasOperationConfigArgs<EnrichmentType>) => OasOperationEntry<EnrichmentType>;
82
+ export declare const toOasOperationEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToOasOperationConfigArgs<EnrichmentType>) => OasOperationEntry<EnrichmentType>;
@@ -24,10 +24,11 @@
24
24
  * });
25
25
  * ```
26
26
  */
27
- export const toOasOperationEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
27
+ export const toOasOperationEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
28
28
  return {
29
29
  id,
30
30
  type: 'oasOperation',
31
+ projections,
31
32
  transform,
32
33
  toEnrichmentSchema,
33
34
  isSupported: isSupported ?? (() => true),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { OasWebhook } from '../../oas/webhook/Webhook.js';
3
4
  import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
@@ -14,6 +15,12 @@ import type { PreviewModule } from '../../types/Preview.js';
14
15
  */
15
16
  export type ToWebhookConfigArgs<EnrichmentType = undefined> = {
16
17
  id: string;
18
+ /**
19
+ * Every projection class this generator can insert: its own, and each one
20
+ * of another generator that it inserts. Core reads only their statics. See
21
+ * {@link DeclaredProjection}. Optional.
22
+ */
23
+ projections?: readonly DeclaredProjection[];
17
24
  transform: ({ context, webhook, variant }: TransformWebhookArgs) => void;
18
25
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
19
26
  isSupported?: (args: IsSupportedWebhookArgs) => boolean;
@@ -29,6 +36,8 @@ export type ToWebhookConfigArgs<EnrichmentType = undefined> = {
29
36
  export type WebhookEntry<EnrichmentType = undefined> = {
30
37
  id: string;
31
38
  type: 'webhook';
39
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
40
+ projections?: readonly DeclaredProjection[];
32
41
  transform: ({ context, webhook, variant }: TransformWebhookArgs) => void;
33
42
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
34
43
  isSupported: (args: IsSupportedWebhookArgs) => boolean;
@@ -59,4 +68,4 @@ export type WebhookEntry<EnrichmentType = undefined> = {
59
68
  * });
60
69
  * ```
61
70
  */
62
- export declare const toWebhookEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToWebhookConfigArgs<EnrichmentType>) => WebhookEntry<EnrichmentType>;
71
+ export declare const toWebhookEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToWebhookConfigArgs<EnrichmentType>) => WebhookEntry<EnrichmentType>;
@@ -20,10 +20,11 @@
20
20
  * });
21
21
  * ```
22
22
  */
23
- export const toWebhookEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
23
+ export const toWebhookEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
24
24
  return {
25
25
  id,
26
26
  type: 'webhook',
27
+ projections,
27
28
  transform,
28
29
  toEnrichmentSchema,
29
30
  isSupported: isSupported ?? (() => true),
package/esm/mod.d.ts CHANGED
@@ -92,6 +92,7 @@ export * from './dsl/IdentifierType.js';
92
92
  export * from './dsl/Inserted.js';
93
93
  export * from './dsl/model/ModelDriver.js';
94
94
  export * from './dsl/model/toModelProjectionBase.js';
95
+ export type * from './dsl/DeclaredProjection.js';
95
96
  export * from './dsl/model/toModelEntry.js';
96
97
  export * from './dsl/model/types.js';
97
98
  export * from './dsl/operation/oas/OasOperationDriver.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -0,0 +1,48 @@
1
+ import type { ToModelEnrichmentsArgs, ToModelExportPathArgs } from './model/types.js';
2
+ import type { ToOasOperationEnrichmentsArgs, ToOasOperationExportPathArgs } from './operation/oas/types.js';
3
+ import type { ToGqlOperationEnrichmentsArgs, ToGqlOperationExportPathArgs } from './operation/gql/types.js';
4
+ import type { ToWebhookEnrichmentsArgs, ToWebhookExportPathArgs } from './webhook/types.js';
5
+ /**
6
+ * A model projection class as a generator's entry declares it: the statics
7
+ * core can read before it constructs anything.
8
+ *
9
+ * The statics are methods, not function properties. TypeScript compares a
10
+ * method's parameters both ways, so projection classes with different
11
+ * enrichment and option types fit in one list.
12
+ */
13
+ export type DeclaredModelProjection = {
14
+ id: string;
15
+ type: 'model';
16
+ toEnrichments(args: ToModelEnrichmentsArgs): unknown;
17
+ toExportPath(args: ToModelExportPathArgs<unknown, unknown>): string;
18
+ };
19
+ /** An OpenAPI operation projection class as an entry declares it. See {@link DeclaredModelProjection}. */
20
+ export type DeclaredOasOperationProjection = {
21
+ id: string;
22
+ type: 'oasOperation';
23
+ toEnrichments(args: ToOasOperationEnrichmentsArgs): unknown;
24
+ toExportPath(args: ToOasOperationExportPathArgs<unknown, unknown>): string;
25
+ };
26
+ /** A webhook projection class as an entry declares it. See {@link DeclaredModelProjection}. */
27
+ export type DeclaredWebhookProjection = {
28
+ id: string;
29
+ type: 'webhook';
30
+ toEnrichments(args: ToWebhookEnrichmentsArgs): unknown;
31
+ toExportPath(args: ToWebhookExportPathArgs<unknown, unknown>): string;
32
+ };
33
+ /** A GraphQL operation projection class as an entry declares it. See {@link DeclaredModelProjection}. */
34
+ export type DeclaredGqlOperationProjection = {
35
+ id: string;
36
+ type: 'gqlOperation';
37
+ toEnrichments(args: ToGqlOperationEnrichmentsArgs): unknown;
38
+ toExportPath(args: ToGqlOperationExportPathArgs<unknown, unknown>): string;
39
+ };
40
+ /**
41
+ * A projection class in an entry's `projections` list.
42
+ *
43
+ * An entry lists every projection class its generator can insert: its own,
44
+ * and each one of another generator that it inserts, such as the model
45
+ * projection an operation generator takes its schemas from. From the list,
46
+ * core can know before a run which files the generator can write.
47
+ */
48
+ export type DeclaredProjection = DeclaredModelProjection | DeclaredOasOperationProjection | DeclaredWebhookProjection | DeclaredGqlOperationProjection;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../DeclaredProjection.js';
1
2
  import type { RefParts } from '../../helpers/refFns.js';
2
3
  import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
3
4
  import type { TransformModelArgs, ToModelPreviewModuleArgs, ToModelEnrichmentsArgs, IsSupportedModelArgs } from './types.js';
@@ -5,6 +6,12 @@ import type { PreviewModule } from '../../types/Preview.js';
5
6
  import type * as v from 'valibot';
6
7
  type ToModelEntryArgs<EnrichmentType = undefined> = {
7
8
  id: string;
9
+ /**
10
+ * Every projection class this generator can insert: its own, and each one
11
+ * of another generator that it inserts. Core reads only their statics. See
12
+ * {@link DeclaredProjection}. Optional.
13
+ */
14
+ projections?: readonly DeclaredProjection[];
8
15
  transform: ({ context, ref, variant }: TransformModelArgs) => void;
9
16
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
10
17
  isSupported?: (args: IsSupportedModelArgs) => boolean;
@@ -20,6 +27,8 @@ type ToModelEntryArgs<EnrichmentType = undefined> = {
20
27
  export type ModelEntry<EnrichmentType = undefined> = {
21
28
  id: string;
22
29
  type: 'model';
30
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
31
+ projections?: readonly DeclaredProjection[];
23
32
  transform: ({ context, ref, variant }: TransformModelArgs) => void;
24
33
  isSupported: (args: IsSupportedModelArgs) => boolean;
25
34
  supportsVariant: () => boolean;
@@ -86,5 +95,5 @@ export type ModelEntry<EnrichmentType = undefined> = {
86
95
  * });
87
96
  * ```
88
97
  */
89
- export declare const toModelEntry: <EnrichmentType = undefined>({ id, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }: ToModelEntryArgs<EnrichmentType>) => ModelEntry<EnrichmentType>;
98
+ export declare const toModelEntry: <EnrichmentType = undefined>({ id, projections, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }: ToModelEntryArgs<EnrichmentType>) => ModelEntry<EnrichmentType>;
90
99
  export {};
@@ -59,10 +59,11 @@ exports.toModelEntry = void 0;
59
59
  * });
60
60
  * ```
61
61
  */
62
- const toModelEntry = ({ id, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }) => {
62
+ const toModelEntry = ({ id, projections, transform, isSupported, supportsVariant, toPreviewModule, toEnrichmentSchema, toEnrichmentRequest, toEnrichmentDefaults }) => {
63
63
  return {
64
64
  id,
65
65
  type: 'model',
66
+ projections,
66
67
  transform,
67
68
  isSupported: isSupported ?? (() => true),
68
69
  supportsVariant: supportsVariant ?? (() => false),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { GqlOperation } from '../../../gql/operation/GqlOperation.js';
3
4
  import type { EnrichmentRequest } from '../../../types/EnrichmentRequest.js';
@@ -13,6 +14,12 @@ import type { PreviewModule } from '../../../types/Preview.js';
13
14
  */
14
15
  export type ToGqlOperationConfigArgs<EnrichmentType = undefined> = {
15
16
  id: string;
17
+ /**
18
+ * Every projection class this generator can insert: its own, and each one
19
+ * of another generator that it inserts. Core reads only their statics. See
20
+ * {@link DeclaredProjection}. Optional.
21
+ */
22
+ projections?: readonly DeclaredProjection[];
16
23
  transform: ({ context, operation, variant }: TransformGqlOperationArgs) => void;
17
24
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
18
25
  isSupported?: (args: IsSupportedGqlOperationArgs) => boolean;
@@ -27,6 +34,8 @@ export type ToGqlOperationConfigArgs<EnrichmentType = undefined> = {
27
34
  export type GqlOperationEntry<EnrichmentType = undefined> = {
28
35
  id: string;
29
36
  type: 'gqlOperation';
37
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
38
+ projections?: readonly DeclaredProjection[];
30
39
  transform: ({ context, operation, variant }: TransformGqlOperationArgs) => void;
31
40
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
32
41
  isSupported: (args: IsSupportedGqlOperationArgs) => boolean;
@@ -45,4 +54,4 @@ export type GqlOperationEntry<EnrichmentType = undefined> = {
45
54
  * @param config - Configuration object defining operation behavior
46
55
  * @returns Configured operation generator entry ready for pipeline integration
47
56
  */
48
- export declare const toGqlOperationEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }: ToGqlOperationConfigArgs<EnrichmentType>) => GqlOperationEntry<EnrichmentType>;
57
+ export declare const toGqlOperationEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }: ToGqlOperationConfigArgs<EnrichmentType>) => GqlOperationEntry<EnrichmentType>;
@@ -12,10 +12,11 @@ exports.toGqlOperationEntry = void 0;
12
12
  * @param config - Configuration object defining operation behavior
13
13
  * @returns Configured operation generator entry ready for pipeline integration
14
14
  */
15
- const toGqlOperationEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }) => {
15
+ const toGqlOperationEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest }) => {
16
16
  return {
17
17
  id,
18
18
  type: 'gqlOperation',
19
+ projections,
19
20
  transform,
20
21
  toEnrichmentSchema,
21
22
  isSupported: isSupported ?? (() => true),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { OasOperation } from '../../../oas/operation/Operation.js';
3
4
  import type { EnrichmentRequest } from '../../../types/EnrichmentRequest.js';
@@ -13,6 +14,12 @@ import type { PreviewModule } from '../../../types/Preview.js';
13
14
  */
14
15
  export type ToOasOperationConfigArgs<EnrichmentType = undefined> = {
15
16
  id: string;
17
+ /**
18
+ * Every projection class this generator can insert: its own, and each one
19
+ * of another generator that it inserts. Core reads only their statics. See
20
+ * {@link DeclaredProjection}. Optional.
21
+ */
22
+ projections?: readonly DeclaredProjection[];
16
23
  transform: ({ context, operation, variant }: TransformOasOperationArgs) => void;
17
24
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
18
25
  isSupported?: (args: IsSupportedOasOperationArgs) => boolean;
@@ -36,6 +43,8 @@ export type ToOasOperationConfigArgs<EnrichmentType = undefined> = {
36
43
  export type OasOperationEntry<EnrichmentType = undefined> = {
37
44
  id: string;
38
45
  type: 'oasOperation';
46
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
47
+ projections?: readonly DeclaredProjection[];
39
48
  transform: ({ context, operation, variant }: TransformOasOperationArgs) => void;
40
49
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
41
50
  isSupported: (args: IsSupportedOasOperationArgs) => boolean;
@@ -70,4 +79,4 @@ export type OasOperationEntry<EnrichmentType = undefined> = {
70
79
  * });
71
80
  * ```
72
81
  */
73
- export declare const toOasOperationEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToOasOperationConfigArgs<EnrichmentType>) => OasOperationEntry<EnrichmentType>;
82
+ export declare const toOasOperationEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToOasOperationConfigArgs<EnrichmentType>) => OasOperationEntry<EnrichmentType>;
@@ -27,10 +27,11 @@ exports.toOasOperationEntry = void 0;
27
27
  * });
28
28
  * ```
29
29
  */
30
- const toOasOperationEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
30
+ const toOasOperationEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
31
31
  return {
32
32
  id,
33
33
  type: 'oasOperation',
34
+ projections,
34
35
  transform,
35
36
  toEnrichmentSchema,
36
37
  isSupported: isSupported ?? (() => true),
@@ -1,3 +1,4 @@
1
+ import type { DeclaredProjection } from '../DeclaredProjection.js';
1
2
  import type * as v from 'valibot';
2
3
  import type { OasWebhook } from '../../oas/webhook/Webhook.js';
3
4
  import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
@@ -14,6 +15,12 @@ import type { PreviewModule } from '../../types/Preview.js';
14
15
  */
15
16
  export type ToWebhookConfigArgs<EnrichmentType = undefined> = {
16
17
  id: string;
18
+ /**
19
+ * Every projection class this generator can insert: its own, and each one
20
+ * of another generator that it inserts. Core reads only their statics. See
21
+ * {@link DeclaredProjection}. Optional.
22
+ */
23
+ projections?: readonly DeclaredProjection[];
17
24
  transform: ({ context, webhook, variant }: TransformWebhookArgs) => void;
18
25
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
19
26
  isSupported?: (args: IsSupportedWebhookArgs) => boolean;
@@ -29,6 +36,8 @@ export type ToWebhookConfigArgs<EnrichmentType = undefined> = {
29
36
  export type WebhookEntry<EnrichmentType = undefined> = {
30
37
  id: string;
31
38
  type: 'webhook';
39
+ /** The projection classes the entry declared; absent when it declared none. See {@link DeclaredProjection}. */
40
+ projections?: readonly DeclaredProjection[];
32
41
  transform: ({ context, webhook, variant }: TransformWebhookArgs) => void;
33
42
  toEnrichmentSchema: () => v.GenericSchema<EnrichmentType>;
34
43
  isSupported: (args: IsSupportedWebhookArgs) => boolean;
@@ -59,4 +68,4 @@ export type WebhookEntry<EnrichmentType = undefined> = {
59
68
  * });
60
69
  * ```
61
70
  */
62
- export declare const toWebhookEntry: <EnrichmentType = undefined>({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToWebhookConfigArgs<EnrichmentType>) => WebhookEntry<EnrichmentType>;
71
+ export declare const toWebhookEntry: <EnrichmentType = undefined>({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }: ToWebhookConfigArgs<EnrichmentType>) => WebhookEntry<EnrichmentType>;
@@ -23,10 +23,11 @@ exports.toWebhookEntry = void 0;
23
23
  * });
24
24
  * ```
25
25
  */
26
- const toWebhookEntry = ({ id, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
26
+ const toWebhookEntry = ({ id, projections, transform, toEnrichmentSchema, isSupported, supportsVariant, toPreviewModule, toEnrichmentRequest, toEnrichmentDefaults }) => {
27
27
  return {
28
28
  id,
29
29
  type: 'webhook',
30
+ projections,
30
31
  transform,
31
32
  toEnrichmentSchema,
32
33
  isSupported: isSupported ?? (() => true),
package/script/mod.d.ts CHANGED
@@ -92,6 +92,7 @@ export * from './dsl/IdentifierType.js';
92
92
  export * from './dsl/Inserted.js';
93
93
  export * from './dsl/model/ModelDriver.js';
94
94
  export * from './dsl/model/toModelProjectionBase.js';
95
+ export type * from './dsl/DeclaredProjection.js';
95
96
  export * from './dsl/model/toModelEntry.js';
96
97
  export * from './dsl/model/types.js';
97
98
  export * from './dsl/operation/oas/OasOperationDriver.js';