@peterhauge/apiops-cli 0.2.1-alpha.0 → 0.3.0-alpha.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.
- package/README.md +167 -169
- package/dist/cli/extract-command.d.ts +2 -2
- package/dist/cli/extract-command.d.ts.map +1 -1
- package/dist/cli/extract-command.js +3 -5
- package/dist/cli/extract-command.js.map +1 -1
- package/dist/cli/index.js +2 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-command.d.ts +1 -1
- package/dist/cli/init-command.js +1 -1
- package/dist/cli/publish-command.d.ts +2 -2
- package/dist/cli/publish-command.js +3 -3
- package/dist/clients/apim-client.d.ts +16 -5
- package/dist/clients/apim-client.d.ts.map +1 -1
- package/dist/clients/apim-client.js +22 -7
- package/dist/clients/apim-client.js.map +1 -1
- package/dist/clients/artifact-store.d.ts +4 -4
- package/dist/clients/artifact-store.d.ts.map +1 -1
- package/dist/clients/artifact-store.js +10 -4
- package/dist/clients/artifact-store.js.map +1 -1
- package/dist/clients/iapim-client.d.ts +14 -2
- package/dist/clients/iapim-client.d.ts.map +1 -1
- package/dist/clients/iapim-client.js +1 -1
- package/dist/clients/iartifact-store.d.ts +10 -5
- package/dist/clients/iartifact-store.d.ts.map +1 -1
- package/dist/clients/iartifact-store.js +1 -1
- package/dist/lib/cloud-config.d.ts +1 -1
- package/dist/lib/cloud-config.js +1 -1
- package/dist/lib/config-loader.d.ts +2 -7
- package/dist/lib/config-loader.d.ts.map +1 -1
- package/dist/lib/config-loader.js +3 -22
- package/dist/lib/config-loader.js.map +1 -1
- package/dist/lib/dependency-graph.d.ts +1 -1
- package/dist/lib/dependency-graph.js +1 -1
- package/dist/lib/exit-codes.d.ts +1 -1
- package/dist/lib/exit-codes.js +1 -1
- package/dist/lib/logger.js +1 -1
- package/dist/lib/parallel-runner.d.ts +2 -2
- package/dist/lib/parallel-runner.js +2 -2
- package/dist/lib/resource-path.d.ts +1 -1
- package/dist/lib/resource-path.js +1 -1
- package/dist/lib/resource-uri.d.ts +1 -1
- package/dist/lib/resource-uri.js +1 -1
- package/dist/lib/workspace-link.d.ts +31 -3
- package/dist/lib/workspace-link.d.ts.map +1 -1
- package/dist/lib/workspace-link.js +49 -3
- package/dist/lib/workspace-link.js.map +1 -1
- package/dist/models/config.d.ts +2 -4
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/config.js +1 -1
- package/dist/models/resource-types.d.ts +1 -1
- package/dist/models/resource-types.d.ts.map +1 -1
- package/dist/models/resource-types.js +5 -3
- package/dist/models/resource-types.js.map +1 -1
- package/dist/models/types.d.ts +22 -1
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js +1 -1
- package/dist/services/api-extractor.d.ts +1 -1
- package/dist/services/api-extractor.d.ts.map +1 -1
- package/dist/services/api-extractor.js +29 -127
- package/dist/services/api-extractor.js.map +1 -1
- package/dist/services/api-publisher.d.ts +1 -1
- package/dist/services/api-publisher.d.ts.map +1 -1
- package/dist/services/api-publisher.js +50 -18
- package/dist/services/api-publisher.js.map +1 -1
- package/dist/services/delete-unmatched-service.d.ts +1 -1
- package/dist/services/delete-unmatched-service.js +1 -1
- package/dist/services/dry-run-reporter.d.ts +1 -1
- package/dist/services/dry-run-reporter.js +1 -1
- package/dist/services/extract-service.d.ts +1 -1
- package/dist/services/extract-service.js +1 -1
- package/dist/services/filter-service.d.ts +19 -1
- package/dist/services/filter-service.d.ts.map +1 -1
- package/dist/services/filter-service.js +40 -2
- package/dist/services/filter-service.js.map +1 -1
- package/dist/services/git-diff-service.d.ts +1 -1
- package/dist/services/git-diff-service.js +1 -1
- package/dist/services/identity-guide-service.d.ts +1 -1
- package/dist/services/identity-guide-service.js +12 -12
- package/dist/services/init-service.d.ts +1 -1
- package/dist/services/init-service.js +1 -1
- package/dist/services/override-merger.d.ts +1 -1
- package/dist/services/override-merger.js +1 -1
- package/dist/services/product-extractor.d.ts +1 -1
- package/dist/services/product-extractor.d.ts.map +1 -1
- package/dist/services/product-extractor.js +27 -26
- package/dist/services/product-extractor.js.map +1 -1
- package/dist/services/product-publisher.d.ts.map +1 -1
- package/dist/services/product-publisher.js +25 -9
- package/dist/services/product-publisher.js.map +1 -1
- package/dist/services/prompt-service.d.ts +1 -1
- package/dist/services/prompt-service.js +1 -1
- package/dist/services/publish-service.d.ts +1 -1
- package/dist/services/publish-service.js +1 -1
- package/dist/services/resource-extractor.d.ts +1 -1
- package/dist/services/resource-extractor.js +1 -1
- package/dist/services/resource-publisher.d.ts +9 -1
- package/dist/services/resource-publisher.d.ts.map +1 -1
- package/dist/services/resource-publisher.js +30 -9
- package/dist/services/resource-publisher.js.map +1 -1
- package/dist/services/secret-redactor.d.ts +1 -1
- package/dist/services/secret-redactor.js +1 -1
- package/dist/services/transitive-resolver.d.ts +1 -1
- package/dist/services/transitive-resolver.js +1 -1
- package/dist/services/workspace-extractor.d.ts +7 -1
- package/dist/services/workspace-extractor.d.ts.map +1 -1
- package/dist/services/workspace-extractor.js +75 -10
- package/dist/services/workspace-extractor.js.map +1 -1
- package/dist/templates/azure-devops/extract-pipeline.d.ts +1 -1
- package/dist/templates/azure-devops/extract-pipeline.js +142 -142
- package/dist/templates/azure-devops/publish-pipeline.d.ts +1 -1
- package/dist/templates/azure-devops/publish-pipeline.js +114 -114
- package/dist/templates/configs/filter-config.d.ts +1 -1
- package/dist/templates/configs/filter-config.d.ts.map +1 -1
- package/dist/templates/configs/filter-config.js +118 -109
- package/dist/templates/configs/filter-config.js.map +1 -1
- package/dist/templates/configs/override-config.d.ts +1 -1
- package/dist/templates/configs/override-config.d.ts.map +1 -1
- package/dist/templates/configs/override-config.js +92 -91
- package/dist/templates/configs/override-config.js.map +1 -1
- package/dist/templates/github-actions/extract-workflow.d.ts +1 -1
- package/dist/templates/github-actions/extract-workflow.js +119 -119
- package/dist/templates/github-actions/publish-workflow.d.ts +1 -1
- package/dist/templates/github-actions/publish-workflow.d.ts.map +1 -1
- package/dist/templates/github-actions/publish-workflow.js +147 -104
- package/dist/templates/github-actions/publish-workflow.js.map +1 -1
- package/package.json +69 -69
package/README.md
CHANGED
|
@@ -1,169 +1,167 @@
|
|
|
1
|
-
# apiops
|
|
2
|
-
|
|
3
|
-
`apiops` is a CLI tool for Azure API Management (APIM) configuration-as-code. Extract your APIM service configuration to local artifact files, publish those artifacts back to Azure, and scaffold CI/CD pipelines — all from the command line.
|
|
4
|
-
|
|
5
|
-
| | |
|
|
6
|
-
|---|---|
|
|
7
|
-
| **Source code** | [github.com/Azure/apiops-cli](https://github.com/Azure/apiops-cli) |
|
|
8
|
-
| **Issues** | [GitHub Issues](https://github.com/Azure/apiops-cli/issues) |
|
|
9
|
-
| **Architecture** | [docs/architecture.md](./docs/architecture.md) |
|
|
10
|
-
|
|
11
|
-
## Getting started
|
|
12
|
-
|
|
13
|
-
**Prerequisites:** An Azure subscription with an existing APIM resource, and Node.js ≥ 22.
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install -g @peterhauge/apiops-cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Authentication
|
|
20
|
-
|
|
21
|
-
`apiops` uses [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) `DefaultAzureCredential` for authentication.
|
|
22
|
-
|
|
23
|
-
### Generated GitHub Actions workflows (`apiops init`)
|
|
24
|
-
|
|
25
|
-
Workflows scaffolded by `apiops init` authenticate via **OIDC (workload identity federation)** — no client secret is stored or needed. Run `apiops init` and use the generated `identity-setup.prompt.md` to create an Azure AD application with federated credentials for your GitHub repository.
|
|
26
|
-
|
|
27
|
-
Required repository secrets: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`
|
|
28
|
-
|
|
29
|
-
### Local CLI / other CI systems
|
|
30
|
-
|
|
31
|
-
When running `apiops` outside a GitHub Actions OIDC context you can supply credentials explicitly:
|
|
32
|
-
|
|
33
|
-
- **Environment variables:** `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID`
|
|
34
|
-
- **CLI flags:** `--client-id`, `--client-secret`, `--tenant-id`, `--subscription-id`
|
|
35
|
-
- **Managed Identity / Workload Identity:** Supported automatically via `DefaultAzureCredential` when running on Azure-hosted infrastructure (VMs, App Service, etc.) or in Azure Pipelines with workload identity federation configured.
|
|
36
|
-
|
|
37
|
-
## Commands
|
|
38
|
-
|
|
39
|
-
### `apiops extract`
|
|
40
|
-
|
|
41
|
-
Extract APIM service configuration to local artifact files.
|
|
42
|
-
|
|
43
|
-
| Flag | Default | Description |
|
|
44
|
-
|------|---------|-------------|
|
|
45
|
-
| `--resource-group <rg>` | *(required)* | Azure resource group |
|
|
46
|
-
| `--service-name <name>` | *(required)* | APIM service name |
|
|
47
|
-
| `--output <dir>` | `./apim-artifacts` | Output directory |
|
|
48
|
-
| `--filter <path>` | | Extract only matching resources |
|
|
49
|
-
| `--no-transitive` | | Skip transitive dependencies |
|
|
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
|
-
apiops init
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
|
137
|
-
|
|
138
|
-
| `--
|
|
139
|
-
| `--
|
|
140
|
-
| `--
|
|
141
|
-
| `--
|
|
142
|
-
| `--
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
trademarks or logos
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
[MIT](./LICENSE.md)
|
|
1
|
+
# apiops
|
|
2
|
+
|
|
3
|
+
`apiops` is a CLI tool for Azure API Management (APIM) configuration-as-code. Extract your APIM service configuration to local artifact files, publish those artifacts back to Azure, and scaffold CI/CD pipelines — all from the command line.
|
|
4
|
+
|
|
5
|
+
| | |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Source code** | [github.com/Azure/apiops-cli](https://github.com/Azure/apiops-cli) |
|
|
8
|
+
| **Issues** | [GitHub Issues](https://github.com/Azure/apiops-cli/issues) |
|
|
9
|
+
| **Architecture** | [docs/architecture.md](./docs/architecture.md) |
|
|
10
|
+
|
|
11
|
+
## Getting started
|
|
12
|
+
|
|
13
|
+
**Prerequisites:** An Azure subscription with an existing APIM resource, and Node.js ≥ 22.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @peterhauge/apiops-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Authentication
|
|
20
|
+
|
|
21
|
+
`apiops` uses [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) `DefaultAzureCredential` for authentication.
|
|
22
|
+
|
|
23
|
+
### Generated GitHub Actions workflows (`apiops init`)
|
|
24
|
+
|
|
25
|
+
Workflows scaffolded by `apiops init` authenticate via **OIDC (workload identity federation)** — no client secret is stored or needed. Run `apiops init` and use the generated `identity-setup.prompt.md` to create an Azure AD application with federated credentials for your GitHub repository.
|
|
26
|
+
|
|
27
|
+
Required repository secrets: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`
|
|
28
|
+
|
|
29
|
+
### Local CLI / other CI systems
|
|
30
|
+
|
|
31
|
+
When running `apiops` outside a GitHub Actions OIDC context you can supply credentials explicitly:
|
|
32
|
+
|
|
33
|
+
- **Environment variables:** `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID`
|
|
34
|
+
- **CLI flags:** `--client-id`, `--client-secret`, `--tenant-id`, `--subscription-id`
|
|
35
|
+
- **Managed Identity / Workload Identity:** Supported automatically via `DefaultAzureCredential` when running on Azure-hosted infrastructure (VMs, App Service, etc.) or in Azure Pipelines with workload identity federation configured.
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
### `apiops extract`
|
|
40
|
+
|
|
41
|
+
Extract APIM service configuration to local artifact files.
|
|
42
|
+
|
|
43
|
+
| Flag | Default | Description |
|
|
44
|
+
|------|---------|-------------|
|
|
45
|
+
| `--resource-group <rg>` | *(required)* | Azure resource group |
|
|
46
|
+
| `--service-name <name>` | *(required)* | APIM service name |
|
|
47
|
+
| `--output <dir>` | `./apim-artifacts` | Output directory |
|
|
48
|
+
| `--filter <path>` | | Extract only matching resources |
|
|
49
|
+
| `--no-transitive` | | Skip transitive dependencies |
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
apiops extract --help
|
|
53
|
+
|
|
54
|
+
# Basic extraction to the default output directory
|
|
55
|
+
apiops extract \
|
|
56
|
+
--resource-group <rg> \
|
|
57
|
+
--service-name <name> \
|
|
58
|
+
--output ./apim-artifacts
|
|
59
|
+
|
|
60
|
+
# Extract a filtered subset of resources
|
|
61
|
+
apiops extract \
|
|
62
|
+
--resource-group <rg> \
|
|
63
|
+
--service-name <name> \
|
|
64
|
+
--filter ./filter.yaml
|
|
65
|
+
|
|
66
|
+
# Authenticate explicitly with a service principal
|
|
67
|
+
apiops extract \
|
|
68
|
+
--resource-group <rg> \
|
|
69
|
+
--service-name <name> \
|
|
70
|
+
--client-id $AZURE_CLIENT_ID \
|
|
71
|
+
--client-secret $AZURE_CLIENT_SECRET \
|
|
72
|
+
--tenant-id $AZURE_TENANT_ID \
|
|
73
|
+
--subscription-id $AZURE_SUBSCRIPTION_ID
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### `apiops publish`
|
|
77
|
+
|
|
78
|
+
Publish local artifact files to an Azure APIM service.
|
|
79
|
+
|
|
80
|
+
| Flag | Default | Description |
|
|
81
|
+
|------|---------|-------------|
|
|
82
|
+
| `--resource-group <rg>` | *(required)* | Azure resource group |
|
|
83
|
+
| `--service-name <name>` | *(required)* | APIM service name |
|
|
84
|
+
| `--source <dir>` | `./apim-artifacts` | Source artifacts directory |
|
|
85
|
+
| `--overrides <path>` | | Path to overrides file |
|
|
86
|
+
| `--commit-id <sha>` | | Git commit SHA for incremental publish |
|
|
87
|
+
| `--dry-run` | | Preview changes without applying |
|
|
88
|
+
| `--delete-unmatched` | | Delete resources not in artifacts (mutually exclusive with `--commit-id`) |
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
apiops publish --help
|
|
92
|
+
|
|
93
|
+
# Preview changes without applying them
|
|
94
|
+
apiops publish \
|
|
95
|
+
--resource-group <rg> \
|
|
96
|
+
--service-name <name> \
|
|
97
|
+
--dry-run
|
|
98
|
+
|
|
99
|
+
# Publish and remove resources not present in the local artifacts
|
|
100
|
+
apiops publish \
|
|
101
|
+
--resource-group <rg> \
|
|
102
|
+
--service-name <name> \
|
|
103
|
+
--delete-unmatched
|
|
104
|
+
|
|
105
|
+
# Incremental publish for a specific commit
|
|
106
|
+
apiops publish \
|
|
107
|
+
--resource-group <rg> \
|
|
108
|
+
--service-name <name> \
|
|
109
|
+
--commit-id <sha>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `apiops init`
|
|
113
|
+
|
|
114
|
+
Scaffold a new APIM artifacts repository with CI/CD pipelines.
|
|
115
|
+
|
|
116
|
+
| Flag | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `--cli-package <path>` | Path to a local `.tgz` tarball |
|
|
119
|
+
| `--ci <platform>` | `github-actions` or `azure-devops` |
|
|
120
|
+
| `--environments <list>` | Comma-separated environments (e.g. `dev,prod`) |
|
|
121
|
+
| `--non-interactive` | Skip all prompts |
|
|
122
|
+
| `--force` | Overwrite existing files |
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
apiops init --help
|
|
126
|
+
|
|
127
|
+
apiops init \
|
|
128
|
+
--ci github-actions \
|
|
129
|
+
--environments dev,prod
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Global options
|
|
133
|
+
|
|
134
|
+
| Option | Default | Description |
|
|
135
|
+
|--------|---------|-------------|
|
|
136
|
+
| `--subscription-id <id>` | `AZURE_SUBSCRIPTION_ID` env var | Azure subscription ID |
|
|
137
|
+
| `--cloud <name>` | `public` | `public`, `china`, `usgov`, `germany` |
|
|
138
|
+
| `--log-level <level>` | `info` | `debug`, `info`, `warn`, `error` |
|
|
139
|
+
| `--format <type>` | `text` | `text` or `json` |
|
|
140
|
+
| `--client-id <id>` | `AZURE_CLIENT_ID` env var | Service principal client ID |
|
|
141
|
+
| `--client-secret <secret>` | `AZURE_CLIENT_SECRET` env var | Service principal secret |
|
|
142
|
+
| `--tenant-id <id>` | `AZURE_TENANT_ID` env var | Azure AD tenant ID |
|
|
143
|
+
|
|
144
|
+
## Contributing
|
|
145
|
+
|
|
146
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to build, test, debug, and submit changes.
|
|
147
|
+
|
|
148
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
149
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
|
|
150
|
+
[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
151
|
+
|
|
152
|
+
## Security
|
|
153
|
+
|
|
154
|
+
Please do not report security vulnerabilities through public GitHub issues. Instead, please follow the instructions in
|
|
155
|
+
our [SECURITY.md](./SECURITY.md).
|
|
156
|
+
|
|
157
|
+
## Trademarks
|
|
158
|
+
|
|
159
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
160
|
+
trademarks or logos is subject to and must follow
|
|
161
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
162
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
163
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
[MIT](./LICENSE.md)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Extract command CLI registration
|
|
3
3
|
* Commander subcommand with --resource-group, --service-name, --output,
|
|
4
|
-
* --filter, --no-transitive
|
|
4
|
+
* --filter, --no-transitive flags.
|
|
5
5
|
* Includes --format json: machine-readable JSON output mode.
|
|
6
6
|
*/
|
|
7
7
|
import { Command } from 'commander';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-command.d.ts","sourceRoot":"","sources":["../../src/cli/extract-command.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-command.d.ts","sourceRoot":"","sources":["../../src/cli/extract-command.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAqB9C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Extract command CLI registration
|
|
5
5
|
* Commander subcommand with --resource-group, --service-name, --output,
|
|
6
|
-
* --filter, --no-transitive
|
|
6
|
+
* --filter, --no-transitive flags.
|
|
7
7
|
* Includes --format json: machine-readable JSON output mode.
|
|
8
8
|
*/
|
|
9
9
|
import { Command } from 'commander';
|
|
@@ -24,7 +24,6 @@ export function createExtractCommand() {
|
|
|
24
24
|
.option('--output <dir>', 'Output directory path', './apim-artifacts')
|
|
25
25
|
.option('--filter <path>', 'Filter configuration YAML file')
|
|
26
26
|
.option('--no-transitive', 'Disable transitive dependency inclusion')
|
|
27
|
-
.option('--spec-format <format>', 'API specification format (openapi-v2-json, openapi-v3-json, openapi-v3-yaml)')
|
|
28
27
|
.action(async (options, command) => {
|
|
29
28
|
const globalOpts = command.optsWithGlobals();
|
|
30
29
|
await executeExtract(options, globalOpts);
|
|
@@ -70,7 +69,6 @@ async function executeExtract(options, globalOpts) {
|
|
|
70
69
|
outputDir: options.output,
|
|
71
70
|
filter: filterConfig,
|
|
72
71
|
includeTransitive: options.transitive,
|
|
73
|
-
specFormat: options.specFormat,
|
|
74
72
|
logLevel: parseLogLevel(globalOpts.logLevel ?? 'info'),
|
|
75
73
|
};
|
|
76
74
|
// Create client and store
|
|
@@ -88,7 +86,7 @@ async function executeExtract(options, globalOpts) {
|
|
|
88
86
|
process.exit(result.exitCode);
|
|
89
87
|
}
|
|
90
88
|
/**
|
|
91
|
-
*
|
|
89
|
+
* JSON output mode for extract.
|
|
92
90
|
* Machine-readable JSON to stdout with resource counts and file paths.
|
|
93
91
|
*/
|
|
94
92
|
function outputJson(result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-command.js","sourceRoot":"","sources":["../../src/cli/extract-command.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAoB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-command.js","sourceRoot":"","sources":["../../src/cli/extract-command.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAoB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,aAAa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
|
package/dist/cli/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Commander program entry point
|
|
6
6
|
* Sets up global options and subcommand registration pattern
|
|
7
7
|
*/
|
|
8
8
|
import { Command, Option } from 'commander';
|
|
@@ -24,7 +24,6 @@ program
|
|
|
24
24
|
.addOption(new Option('--log-level <level>', 'Log level: debug, info, warn, or error')
|
|
25
25
|
.choices(['debug', 'info', 'warn', 'error'])
|
|
26
26
|
.default('info'))
|
|
27
|
-
.option('--otel <path>', 'Path to OpenTelemetry config YAML')
|
|
28
27
|
.option('--format <type>', 'Output format: text or json', 'text')
|
|
29
28
|
.option('--subscription-id <id>', 'Azure subscription ID')
|
|
30
29
|
.option('--cloud <name>', 'Sovereign cloud: public, china, usgov, germany', 'public')
|
|
@@ -35,7 +34,7 @@ program
|
|
|
35
34
|
program.hook('preAction', (thisCommand) => {
|
|
36
35
|
const opts = thisCommand.optsWithGlobals();
|
|
37
36
|
logger.configure({ level: parseLogLevel(opts.logLevel ?? 'info') });
|
|
38
|
-
//
|
|
37
|
+
// Set DefaultAzureCredential env vars from explicit auth flags.
|
|
39
38
|
// This ensures the ServicePrincipal credential is tried first,
|
|
40
39
|
// avoiding interactive browser prompts in CI/CD pipelines.
|
|
41
40
|
if (opts.clientId) {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC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C,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/cli/init-command.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Publish command CLI registration
|
|
3
3
|
* Commander subcommand with --resource-group, --service-name, --source,
|
|
4
4
|
* --overrides, --dry-run, --delete-unmatched flags.
|
|
5
|
-
* Includes --format json: machine-readable JSON output mode
|
|
5
|
+
* Includes --format json: machine-readable JSON output mode.
|
|
6
6
|
*/
|
|
7
7
|
import { Command } from 'commander';
|
|
8
8
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Publish command CLI registration
|
|
5
5
|
* Commander subcommand with --resource-group, --service-name, --source,
|
|
6
6
|
* --overrides, --dry-run, --delete-unmatched flags.
|
|
7
|
-
* Includes --format json: machine-readable JSON output mode
|
|
7
|
+
* Includes --format json: machine-readable JSON output mode.
|
|
8
8
|
*/
|
|
9
9
|
import { Command } from 'commander';
|
|
10
10
|
import { runPublish } from '../services/publish-service.js';
|
|
@@ -105,7 +105,7 @@ export function hasMutuallyExclusivePublishOptions(deleteUnmatched, commitId) {
|
|
|
105
105
|
return deleteUnmatched && Boolean(commitId);
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* JSON output mode for publish.
|
|
109
109
|
* Machine-readable JSON to stdout with action list and summary.
|
|
110
110
|
*/
|
|
111
111
|
function outputJson(result) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Azure REST HTTP client implementing IApimClient
|
|
3
3
|
* Uses @azure/identity DefaultAzureCredential for auth
|
|
4
4
|
* Handles pagination, retry, rate limiting, and long-running operations
|
|
5
5
|
*/
|
|
6
|
-
import { IApimClient } from './iapim-client.js';
|
|
6
|
+
import { IApimClient, ApiSpecDialect } from './iapim-client.js';
|
|
7
7
|
import { ApimServiceContext, ResourceDescriptor } from '../models/types.js';
|
|
8
8
|
import { ResourceType } from '../models/resource-types.js';
|
|
9
9
|
/**
|
|
@@ -15,6 +15,13 @@ export declare class HttpError extends Error {
|
|
|
15
15
|
readonly code?: string | undefined;
|
|
16
16
|
constructor(status: number, message: string, code?: string | undefined);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when the error indicates an association link already exists.
|
|
20
|
+
* APIM returns HTTP 409 Conflict ("Link already exists between specified ...")
|
|
21
|
+
* when an association is re-created; the desired end state is already in place,
|
|
22
|
+
* so callers treat it as an idempotent success rather than a failure.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isLinkAlreadyExistsError(error: unknown): boolean;
|
|
18
25
|
export declare class ApimClient implements IApimClient {
|
|
19
26
|
private credential;
|
|
20
27
|
private readonly authScope;
|
|
@@ -63,7 +70,7 @@ export declare class ApimClient implements IApimClient {
|
|
|
63
70
|
patchResource(context: ApimServiceContext, descriptor: ResourceDescriptor, payload: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
64
71
|
deleteResource(context: ApimServiceContext, descriptor: ResourceDescriptor): Promise<boolean>;
|
|
65
72
|
listApiRevisions(context: ApimServiceContext, apiName: string): AsyncIterable<Record<string, unknown>>;
|
|
66
|
-
getApiSpecification(context: ApimServiceContext, apiName: string, apiType?: string): Promise<{
|
|
73
|
+
getApiSpecification(context: ApimServiceContext, apiName: string, apiType?: string, specDialect?: ApiSpecDialect): Promise<{
|
|
67
74
|
content: string;
|
|
68
75
|
format: 'yaml' | 'json' | 'graphql' | 'wsdl' | 'wadl';
|
|
69
76
|
} | undefined>;
|
|
@@ -94,12 +101,16 @@ export declare class ApimClient implements IApimClient {
|
|
|
94
101
|
* round-tripping is preserved even when the link variant is broken.
|
|
95
102
|
*
|
|
96
103
|
* Additional export formats supported by APIM for type=http REST APIs:
|
|
97
|
-
* swagger-link – Swagger 2.0
|
|
104
|
+
* swagger-link – Swagger 2.0 JSON
|
|
98
105
|
* openapi+json-link – OpenAPI 3.0 JSON
|
|
99
106
|
* wadl-link – WADL
|
|
100
107
|
* These cannot be auto-selected from properties.type alone because all REST APIs
|
|
101
108
|
* (whether originally imported as Swagger 2.0, OpenAPI 3.0, or WADL) share
|
|
102
|
-
* type=http in APIM.
|
|
109
|
+
* type=http in APIM. The caller passes `specDialect` so the export format
|
|
110
|
+
* matches the API's native source format: 'swagger2' exports via `swagger-link`,
|
|
111
|
+
* 'openapi3' (default) via `openapi-link`. This preserves the original format
|
|
112
|
+
* (and its schema/operation metadata) instead of converting Swagger 2.0 to
|
|
113
|
+
* OpenAPI 3.0 on export.
|
|
103
114
|
*
|
|
104
115
|
* Returns undefined for WebSocket APIs — they have no traditional API specification.
|
|
105
116
|
* getApiSpecification will return undefined early when this method returns undefined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apim-client.d.ts","sourceRoot":"","sources":["../../src/clients/apim-client.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"apim-client.d.ts","sourceRoot":"","sources":["../../src/clients/apim-client.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAA0B,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOnF;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;aAEhB,MAAM,EAAE,MAAM;aAEd,IAAI,CAAC,EAAE,MAAM;gBAFb,MAAM,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA;CAKhC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB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