-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.ts
More file actions
138 lines (127 loc) · 3.74 KB
/
Copy pathconfig.ts
File metadata and controls
138 lines (127 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/**
* Config interfaces
* ExtractConfig, FilterConfig, PublishConfig, OverrideConfig, InitConfig
*/
import { ApimServiceContext } from './types.js';
import { LogLevel } from '../lib/logger.js';
export interface ExtractConfig {
service: ApimServiceContext;
outputDir: string;
filter?: FilterConfig;
includeTransitive: boolean;
logLevel: LogLevel;
otelConfigPath?: string;
}
/**
* Sub-resource filter for an individual API.
* Only sub-resources listed here are included; undefined means include all.
* An empty array means include NONE of that sub-resource type.
*/
export interface ApiSubFilter {
operations?: string[];
diagnostics?: string[];
schemas?: string[];
releases?: string[];
}
/**
* Sub-resource filter for an individual workspace.
* Specifies exactly which workspace-scoped resources to include.
*/
export interface WorkspaceSubFilter {
apis?: string[];
apiSubFilters?: Record<string, ApiSubFilter>;
backends?: string[];
diagnostics?: string[];
groups?: string[];
loggers?: string[];
namedValues?: string[];
policyFragments?: string[];
products?: string[];
schemas?: string[];
subscriptions?: string[];
tags?: string[];
versionSets?: string[];
}
export interface FilterConfig {
apis?: string[];
/** Per-API sub-resource filters (only for APIs listed with nested object syntax) */
apiSubFilters?: Record<string, ApiSubFilter>;
backends?: string[];
products?: string[];
namedValues?: string[];
loggers?: string[];
diagnostics?: string[];
tags?: string[];
policyFragments?: string[];
gateways?: string[];
versionSets?: string[];
groups?: string[];
subscriptions?: string[];
schemas?: string[];
policies?: string[];
policyRestrictions?: string[];
documentations?: string[];
workspaces?: string[];
/** Per-workspace sub-resource filters (only for workspaces listed with nested object syntax) */
workspaceSubFilters?: Record<string, WorkspaceSubFilter>;
}
export interface PublishConfig {
service: ApimServiceContext;
sourceDir: string;
overrides?: OverrideConfig;
dryRun: boolean;
deleteUnmatched: boolean;
commitId?: string;
logLevel: LogLevel;
otelConfigPath?: string;
}
/**
* A single override entry: properties to deep-merge + optional nested child overrides.
*/
export interface OverrideEntry {
/** Properties to deep-merge into the resource's ARM DTO */
properties: Record<string, unknown>;
/** Nested sub-resource override sections (e.g., diagnostics under an API) */
children?: Record<string, OverrideSection>;
}
/** A section of overrides: resource name → override entry */
export type OverrideSection = Record<string, OverrideEntry>;
/**
* Environment-specific override configuration.
* Supports all Toolkit override sections with generic property passthrough.
* Nested sub-resource overrides (e.g., API diagnostics) are stored in OverrideEntry.children.
*/
export interface OverrideConfig {
namedValues?: OverrideSection;
backends?: OverrideSection;
apis?: OverrideSection;
diagnostics?: OverrideSection;
loggers?: OverrideSection;
policies?: OverrideSection;
gateways?: OverrideSection;
versionSets?: OverrideSection;
groups?: OverrideSection;
subscriptions?: OverrideSection;
products?: OverrideSection;
tags?: OverrideSection;
policyFragments?: OverrideSection;
workspaces?: OverrideSection;
}
export interface InitConfig {
ciProvider?: 'github-actions' | 'azure-devops';
nonInteractive: boolean;
artifactDir: string;
environments: string[];
outputDir: string;
cliPackage?: string;
force: boolean;
}
export interface ConfigureConfig {
artifactDir: string;
environments: string[];
outputDir: string;
nonInteractive: boolean;
force: boolean;
}