bump-cli 2.9.12 → 2.10.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 +21 -5
- package/dist/api/models.d.ts +4 -2
- package/dist/core/overlay.js +1 -1
- package/dist/core/schemas/arazzo-schemas/index.d.ts +7 -0
- package/dist/core/schemas/arazzo-schemas/index.js +8 -0
- package/dist/core/schemas/arazzo-schemas/v1.0/schema.json +792 -0
- package/dist/core/schemas/flower-schemas/v0.1/schema.json +146 -5
- package/dist/core/workflow-deploy.js +2 -3
- package/dist/definition.d.ts +22 -9
- package/dist/definition.js +129 -74
- package/oclif.manifest.json +9 -7
- package/package.json +5 -5
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"$ref": "#/definitions/schema"
|
|
55
55
|
},
|
|
56
56
|
"outputs": {
|
|
57
|
-
"$ref": "#/definitions/
|
|
57
|
+
"$ref": "#/definitions/expressionMap"
|
|
58
58
|
},
|
|
59
59
|
"steps": {
|
|
60
60
|
"type": "array",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"type": "string"
|
|
76
76
|
},
|
|
77
77
|
"outputs": {
|
|
78
|
-
"$ref": "#/definitions/
|
|
78
|
+
"$ref": "#/definitions/expressionMap"
|
|
79
79
|
},
|
|
80
80
|
"request": {
|
|
81
81
|
"type": "object",
|
|
@@ -83,13 +83,38 @@
|
|
|
83
83
|
"method": {
|
|
84
84
|
"type": "string"
|
|
85
85
|
},
|
|
86
|
-
"query": {
|
|
87
|
-
"$ref": "#/definitions/schema"
|
|
88
|
-
},
|
|
89
86
|
"url": {
|
|
90
87
|
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"headers": {
|
|
90
|
+
"$ref": "#/definitions/expressionMap"
|
|
91
|
+
},
|
|
92
|
+
"query": {
|
|
93
|
+
"$ref": "#/definitions/expressionMap"
|
|
94
|
+
},
|
|
95
|
+
"body": {
|
|
96
|
+
"$ref": "#/definitions/expressionMap"
|
|
91
97
|
}
|
|
92
98
|
}
|
|
99
|
+
},
|
|
100
|
+
"actions": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"items": {
|
|
103
|
+
"oneOf": [
|
|
104
|
+
{
|
|
105
|
+
"$ref": "#/definitions/next"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"$ref": "#/definitions/retry"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"$ref": "#/definitions/goto"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"$ref": "#/definitions/end"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
93
118
|
}
|
|
94
119
|
},
|
|
95
120
|
"required": [
|
|
@@ -97,6 +122,122 @@
|
|
|
97
122
|
"request"
|
|
98
123
|
]
|
|
99
124
|
},
|
|
125
|
+
"action": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"required": [
|
|
128
|
+
"do"
|
|
129
|
+
],
|
|
130
|
+
"properties": {
|
|
131
|
+
"id": {
|
|
132
|
+
"type": "string"
|
|
133
|
+
},
|
|
134
|
+
"when": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"description": "A runtime expression conditioning this action"
|
|
137
|
+
},
|
|
138
|
+
"do": {
|
|
139
|
+
"type": "string"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"discriminator": {
|
|
143
|
+
"propertyName": "do",
|
|
144
|
+
"mapping": {
|
|
145
|
+
"next": "#/definitions/next",
|
|
146
|
+
"retry": "#/definitions/retry",
|
|
147
|
+
"goto": "#/definitions/goto",
|
|
148
|
+
"end": "#/definitions/end"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"next": {
|
|
153
|
+
"allOf": [
|
|
154
|
+
{
|
|
155
|
+
"$ref": "#/definitions/action"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"type": "object",
|
|
159
|
+
"properties": {
|
|
160
|
+
"do": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"const": "next"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"retry": {
|
|
169
|
+
"allOf": [
|
|
170
|
+
{
|
|
171
|
+
"$ref": "#/definitions/action"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "object",
|
|
175
|
+
"properties": {
|
|
176
|
+
"do": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"const": "retry"
|
|
179
|
+
},
|
|
180
|
+
"wait": {
|
|
181
|
+
"type": "integer",
|
|
182
|
+
"description": "Number of seconds to wait",
|
|
183
|
+
"default": 5
|
|
184
|
+
},
|
|
185
|
+
"max_retry": {
|
|
186
|
+
"type": "integer",
|
|
187
|
+
"description": "Maximum number of subsequent retries to execute",
|
|
188
|
+
"default": 5
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"goto": {
|
|
195
|
+
"allOf": [
|
|
196
|
+
{
|
|
197
|
+
"$ref": "#/definitions/action"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"type": "object",
|
|
201
|
+
"required": [
|
|
202
|
+
"step"
|
|
203
|
+
],
|
|
204
|
+
"properties": {
|
|
205
|
+
"do": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"const": "goto"
|
|
208
|
+
},
|
|
209
|
+
"step": {
|
|
210
|
+
"type": "string",
|
|
211
|
+
"description": "The target step ID to jump to"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
"end": {
|
|
218
|
+
"allOf": [
|
|
219
|
+
{
|
|
220
|
+
"$ref": "#/definitions/action"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"type": "object",
|
|
224
|
+
"properties": {
|
|
225
|
+
"do": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"const": "end"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"expressionMap": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"description": "A map of names to runtime expressions.",
|
|
236
|
+
"additionalProperties": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "A runtime expression."
|
|
239
|
+
}
|
|
240
|
+
},
|
|
100
241
|
"schema": {
|
|
101
242
|
"allOf": [
|
|
102
243
|
{
|
|
@@ -28,9 +28,8 @@ export class WorkflowDeploy {
|
|
|
28
28
|
}
|
|
29
29
|
async run(workflowDefinition, mcpServer, token) {
|
|
30
30
|
let version;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
};
|
|
31
|
+
const [definition, references] = await workflowDefinition.extractDefinition();
|
|
32
|
+
const request = { definition, references };
|
|
34
33
|
// eslint-disable-next-line prefer-const
|
|
35
34
|
version = await this.createWorkflowVersion(mcpServer, request, token);
|
|
36
35
|
return version;
|
package/dist/definition.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSONSchema4, JSONSchema4Array, JSONSchema4Object, JSONSchema6, JSONSchema6Object, JSONSchema7 } from 'json-schema';
|
|
2
|
-
type
|
|
2
|
+
type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
3
3
|
declare class SupportedFormat {
|
|
4
|
-
static readonly
|
|
5
|
-
static readonly
|
|
6
|
-
static readonly
|
|
4
|
+
static readonly arazzo: Record<string, JSONSchema>;
|
|
5
|
+
static readonly asyncapi: Record<string, JSONSchema>;
|
|
6
|
+
static readonly flower: Record<string, JSONSchema>;
|
|
7
|
+
static readonly openapi: Record<string, JSONSchema>;
|
|
7
8
|
}
|
|
8
9
|
declare class API {
|
|
9
10
|
readonly definition: APIDefinition;
|
|
@@ -13,30 +14,38 @@ declare class API {
|
|
|
13
14
|
readonly references: APIReference[];
|
|
14
15
|
readonly specName?: string;
|
|
15
16
|
readonly version?: string;
|
|
16
|
-
constructor(location: string,
|
|
17
|
+
constructor(location: string, data: Record<string, JSONSchemaWithRaw>);
|
|
18
|
+
static isArazzo(definition: JSONSchema4Object | JSONSchema6Object): definition is Arazzo;
|
|
17
19
|
static isAsyncAPI(definition: JSONSchema4Object | JSONSchema6Object): definition is AsyncAPI;
|
|
18
20
|
static isFlower(definition: JSONSchema4Object | JSONSchema6Object): definition is Flower;
|
|
19
21
|
static isOpenAPI(definition: JSONSchema4Object | JSONSchema6Object): definition is OpenAPI;
|
|
20
22
|
static isOpenAPIOverlay(definition: JSONSchema4Object | JSONSchema6Object): definition is OpenAPIOverlay;
|
|
23
|
+
static isSupportedFormat(definition: JSONSchema4Object | JSONSchema6Object): definition is APIDefinition;
|
|
21
24
|
static load(path: string): Promise<API>;
|
|
22
25
|
applyOverlay(overlayPath: string): Promise<void>;
|
|
23
26
|
extractDefinition(outputPath?: string, overlays?: string[] | undefined): Promise<[string, APIReference[]]>;
|
|
24
|
-
getSpec(definition: APIDefinition):
|
|
27
|
+
getSpec(definition: APIDefinition): JSONSchema | undefined;
|
|
25
28
|
getSpecName(definition: APIDefinition): string | undefined;
|
|
26
29
|
getVersion(definition: APIDefinition): string | undefined;
|
|
27
30
|
guessFormat(output?: string): string;
|
|
28
31
|
isMainRefPath(path: string): boolean;
|
|
29
|
-
resolveContent(values: SpecSchema): [string, APIDefinition];
|
|
30
|
-
resolveRelativeLocation(absPath: string): string;
|
|
31
32
|
serializeDefinition(outputPath?: string): string;
|
|
32
33
|
versionWithoutPatch(): string;
|
|
34
|
+
private _resolveArazzoSourceDescriptions;
|
|
35
|
+
private _resolveContentFrom;
|
|
36
|
+
private _resolveRelativeLocation;
|
|
33
37
|
private url;
|
|
34
38
|
}
|
|
39
|
+
type JSONSchemaWithRaw = {
|
|
40
|
+
readonly parsed?: JSONSchema4 | JSONSchema4Object | JSONSchema6 | JSONSchema6Object | string;
|
|
41
|
+
readonly raw?: string;
|
|
42
|
+
};
|
|
35
43
|
type APIReference = {
|
|
36
44
|
content: string;
|
|
37
45
|
location: string;
|
|
46
|
+
name?: string;
|
|
38
47
|
};
|
|
39
|
-
type APIDefinition = AsyncAPI | Flower | OpenAPI | OpenAPIOverlay;
|
|
48
|
+
type APIDefinition = Arazzo | AsyncAPI | Flower | OpenAPI | OpenAPIOverlay;
|
|
40
49
|
type InfoObject = {
|
|
41
50
|
readonly description?: string;
|
|
42
51
|
readonly title: string;
|
|
@@ -59,4 +68,8 @@ type AsyncAPI = {
|
|
|
59
68
|
type Flower = {
|
|
60
69
|
readonly flower: string;
|
|
61
70
|
} & JSONSchema4Object;
|
|
71
|
+
type Arazzo = {
|
|
72
|
+
readonly arazzo: string;
|
|
73
|
+
readonly info: InfoObject;
|
|
74
|
+
} & JSONSchema4Object;
|
|
62
75
|
export { API, APIDefinition, OpenAPI, OpenAPIOverlay, SupportedFormat };
|
package/dist/definition.js
CHANGED
|
@@ -5,9 +5,11 @@ import { parseWithPointers, safeStringify } from '@stoplight/yaml';
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
import { default as nodePath } from 'node:path';
|
|
7
7
|
import { Overlay } from './core/overlay.js';
|
|
8
|
+
import arazzoSchemas from './core/schemas/arazzo-schemas/index.js';
|
|
8
9
|
import flowerSchemas from './core/schemas/flower-schemas/index.js';
|
|
9
10
|
import openapiSchemas from './core/schemas/oas-schemas/index.js';
|
|
10
11
|
class SupportedFormat {
|
|
12
|
+
static arazzo = arazzoSchemas.schemas;
|
|
11
13
|
static asyncapi = {
|
|
12
14
|
'2.0': asyncapi.schemas['2.0.0'],
|
|
13
15
|
'2.1': asyncapi.schemas['2.1.0'],
|
|
@@ -17,15 +19,8 @@ class SupportedFormat {
|
|
|
17
19
|
'2.5': asyncapi.schemas['2.5.0'],
|
|
18
20
|
'2.6': asyncapi.schemas['2.6.0'],
|
|
19
21
|
};
|
|
20
|
-
static flower =
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
static openapi = {
|
|
24
|
-
'2.0': openapiSchemas.schemas['2.0'],
|
|
25
|
-
'3.0': openapiSchemas.schemas['3.0'],
|
|
26
|
-
'3.1': openapiSchemas.schemas['3.1'],
|
|
27
|
-
'3.2': openapiSchemas.schemas['3.2'],
|
|
28
|
-
};
|
|
22
|
+
static flower = flowerSchemas.schemas;
|
|
23
|
+
static openapi = openapiSchemas.schemas;
|
|
29
24
|
}
|
|
30
25
|
class UnsupportedFormat extends CLIError {
|
|
31
26
|
constructor(message = '') {
|
|
@@ -46,10 +41,10 @@ class API {
|
|
|
46
41
|
references;
|
|
47
42
|
specName;
|
|
48
43
|
version;
|
|
49
|
-
constructor(location,
|
|
44
|
+
constructor(location, data) {
|
|
50
45
|
this.location = location;
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
const [raw, parsed, references] = this._resolveContentFrom(data);
|
|
47
|
+
this.references = references || [];
|
|
53
48
|
this.rawDefinition = raw;
|
|
54
49
|
this.definition = parsed;
|
|
55
50
|
this.specName = this.getSpecName(parsed);
|
|
@@ -58,6 +53,9 @@ class API {
|
|
|
58
53
|
throw new UnsupportedFormat(`${this.specName} ${this.version}`);
|
|
59
54
|
}
|
|
60
55
|
}
|
|
56
|
+
static isArazzo(definition) {
|
|
57
|
+
return 'arazzo' in definition;
|
|
58
|
+
}
|
|
61
59
|
static isAsyncAPI(definition) {
|
|
62
60
|
return 'asyncapi' in definition;
|
|
63
61
|
}
|
|
@@ -70,6 +68,13 @@ class API {
|
|
|
70
68
|
static isOpenAPIOverlay(definition) {
|
|
71
69
|
return 'overlay' in definition;
|
|
72
70
|
}
|
|
71
|
+
static isSupportedFormat(definition) {
|
|
72
|
+
return (API.isArazzo(definition) ||
|
|
73
|
+
API.isAsyncAPI(definition) ||
|
|
74
|
+
API.isFlower(definition) ||
|
|
75
|
+
API.isOpenAPI(definition) ||
|
|
76
|
+
API.isOpenAPIOverlay(definition));
|
|
77
|
+
}
|
|
73
78
|
static async load(path) {
|
|
74
79
|
const { json, text, yaml } = getJsonSchemaRefParserDefaultOptions().parse;
|
|
75
80
|
// Not sure why the lib types the parser as potentially
|
|
@@ -114,8 +119,17 @@ class API {
|
|
|
114
119
|
},
|
|
115
120
|
})
|
|
116
121
|
.then(($refs) => {
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
// JSON schema refs parser lib doesn't type the output of this
|
|
123
|
+
// method well (it types it as a generic JSON schema) where as
|
|
124
|
+
// it builds a Map of string (the path/URLs of each reference)
|
|
125
|
+
// to JSONSchema (the reference value)
|
|
126
|
+
//
|
|
127
|
+
// We also change the reference values in our custom parsers
|
|
128
|
+
// defined above to include the raw values which gets “widen”
|
|
129
|
+
// by the lib. We thus need to force the type output to a more
|
|
130
|
+
// precise type.
|
|
131
|
+
const data = $refs.values();
|
|
132
|
+
return new API(path, data);
|
|
119
133
|
})
|
|
120
134
|
.catch((error) => {
|
|
121
135
|
throw new CLIError(error);
|
|
@@ -147,59 +161,68 @@ class API {
|
|
|
147
161
|
}
|
|
148
162
|
/* eslint-enable no-await-in-loop */
|
|
149
163
|
}
|
|
164
|
+
if (API.isArazzo(this.definition)) {
|
|
165
|
+
await this._resolveArazzoSourceDescriptions();
|
|
166
|
+
}
|
|
150
167
|
const references = [];
|
|
151
168
|
for (let i = 0; i < this.references.length; i++) {
|
|
152
|
-
const
|
|
153
|
-
references.push({
|
|
154
|
-
content: reference.content,
|
|
155
|
-
location: reference.location,
|
|
156
|
-
});
|
|
169
|
+
const { content, location, name } = this.references[i];
|
|
170
|
+
references.push({ content, location, name });
|
|
157
171
|
}
|
|
158
172
|
return [this.serializeDefinition(outputPath), references];
|
|
159
173
|
}
|
|
160
174
|
getSpec(definition) {
|
|
175
|
+
if (API.isArazzo(definition)) {
|
|
176
|
+
return SupportedFormat.arazzo[this.versionWithoutPatch()];
|
|
177
|
+
}
|
|
161
178
|
if (API.isAsyncAPI(definition)) {
|
|
162
179
|
return SupportedFormat.asyncapi[this.versionWithoutPatch()];
|
|
163
180
|
}
|
|
164
|
-
if (API.isOpenAPIOverlay(definition)) {
|
|
165
|
-
return { overlay: { type: 'string' } };
|
|
166
|
-
}
|
|
167
181
|
if (API.isFlower(definition)) {
|
|
168
182
|
return SupportedFormat.flower[this.versionWithoutPatch()];
|
|
169
183
|
}
|
|
170
184
|
if (API.isOpenAPI(definition)) {
|
|
171
185
|
return SupportedFormat.openapi[this.versionWithoutPatch()];
|
|
172
186
|
}
|
|
187
|
+
if (API.isOpenAPIOverlay(definition)) {
|
|
188
|
+
return { overlay: { type: 'string' } };
|
|
189
|
+
}
|
|
173
190
|
return undefined;
|
|
174
191
|
}
|
|
175
192
|
getSpecName(definition) {
|
|
193
|
+
if (API.isArazzo(definition)) {
|
|
194
|
+
return 'Arazzo';
|
|
195
|
+
}
|
|
176
196
|
if (API.isAsyncAPI(definition)) {
|
|
177
197
|
return 'AsyncAPI';
|
|
178
198
|
}
|
|
179
199
|
if (API.isFlower(definition)) {
|
|
180
200
|
return 'Flower';
|
|
181
201
|
}
|
|
182
|
-
if (API.isOpenAPIOverlay(definition)) {
|
|
183
|
-
return 'OpenAPIOverlay';
|
|
184
|
-
}
|
|
185
202
|
if (API.isOpenAPI(definition)) {
|
|
186
203
|
return 'OpenAPI';
|
|
187
204
|
}
|
|
205
|
+
if (API.isOpenAPIOverlay(definition)) {
|
|
206
|
+
return 'OpenAPIOverlay';
|
|
207
|
+
}
|
|
188
208
|
return undefined;
|
|
189
209
|
}
|
|
190
210
|
getVersion(definition) {
|
|
211
|
+
if (API.isArazzo(definition)) {
|
|
212
|
+
return definition.arazzo;
|
|
213
|
+
}
|
|
191
214
|
if (API.isAsyncAPI(definition)) {
|
|
192
215
|
return definition.asyncapi;
|
|
193
216
|
}
|
|
194
217
|
if (API.isFlower(definition)) {
|
|
195
218
|
return definition.flower;
|
|
196
219
|
}
|
|
197
|
-
if (API.isOpenAPIOverlay(definition)) {
|
|
198
|
-
return definition.overlay;
|
|
199
|
-
}
|
|
200
220
|
if (API.isOpenAPI(definition)) {
|
|
201
221
|
return (definition.openapi || definition.swagger);
|
|
202
222
|
}
|
|
223
|
+
if (API.isOpenAPIOverlay(definition)) {
|
|
224
|
+
return definition.overlay;
|
|
225
|
+
}
|
|
203
226
|
return undefined;
|
|
204
227
|
}
|
|
205
228
|
guessFormat(output) {
|
|
@@ -215,52 +238,6 @@ class API {
|
|
|
215
238
|
.join(nodePath?.posix?.sep ?? '/');
|
|
216
239
|
return path === this.location || path === resolvedAbsLocation;
|
|
217
240
|
}
|
|
218
|
-
resolveContent(values) {
|
|
219
|
-
let mainReference = { parsed: {}, raw: '' };
|
|
220
|
-
for (const [absPath, reference] of Object.entries(values)) {
|
|
221
|
-
if (this.isMainRefPath(absPath)) {
|
|
222
|
-
// $refs.values is not properly typed so we need to force it
|
|
223
|
-
// with the resulting type of our custom defined parser
|
|
224
|
-
mainReference = reference;
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
// $refs.values is not properly typed so we need to force it
|
|
228
|
-
// with the resulting type of our custom defined parser
|
|
229
|
-
const { raw } = reference;
|
|
230
|
-
if (!raw) {
|
|
231
|
-
throw new UnsupportedFormat(`Reference ${absPath} is empty`);
|
|
232
|
-
}
|
|
233
|
-
this.references.push({
|
|
234
|
-
content: raw,
|
|
235
|
-
location: this.resolveRelativeLocation(absPath),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
const { parsed, raw } = mainReference;
|
|
240
|
-
if (!parsed || !raw || !(parsed instanceof Object) || !('info' in parsed || 'flower' in parsed)) {
|
|
241
|
-
debug('bump-cli:definition')(`Main location (${this.location}) not found or empty (within ${JSON.stringify(Object.keys(values))})`);
|
|
242
|
-
throw new UnsupportedFormat('Definition needs to be a valid Object');
|
|
243
|
-
}
|
|
244
|
-
if (!API.isOpenAPI(parsed) && !API.isAsyncAPI(parsed) && !API.isOpenAPIOverlay(parsed) && !API.isFlower(parsed)) {
|
|
245
|
-
throw new UnsupportedFormat();
|
|
246
|
-
}
|
|
247
|
-
return [raw, parsed];
|
|
248
|
-
}
|
|
249
|
-
/* Resolve reference absolute paths to the main api location when possible */
|
|
250
|
-
resolveRelativeLocation(absPath) {
|
|
251
|
-
const definitionUrl = this.url();
|
|
252
|
-
const refUrl = this.url(absPath);
|
|
253
|
-
if ((refUrl.hostname === '' && // filesystem path
|
|
254
|
-
(/^\//.test(absPath) || // Unix style
|
|
255
|
-
/^[A-Za-z]+:[/\\]/.test(absPath))) || // Windows style
|
|
256
|
-
(/^https?:\/\//.test(absPath) && definitionUrl.hostname === refUrl.hostname) // Same domain URLs
|
|
257
|
-
) {
|
|
258
|
-
const relativeLocation = nodePath.relative(nodePath.dirname(this.location), absPath);
|
|
259
|
-
debug('bump-cli:definition')(`Resolved relative $ref location: ${relativeLocation}`);
|
|
260
|
-
return relativeLocation;
|
|
261
|
-
}
|
|
262
|
-
return absPath;
|
|
263
|
-
}
|
|
264
241
|
serializeDefinition(outputPath) {
|
|
265
242
|
if (this.overlayedDefinition) {
|
|
266
243
|
const { comments } = parseWithPointers(this.rawDefinition, { attachComments: true });
|
|
@@ -278,6 +255,84 @@ class API {
|
|
|
278
255
|
const [major, minor] = this.version.split('.', 3);
|
|
279
256
|
return `${major}.${minor}`;
|
|
280
257
|
}
|
|
258
|
+
async _resolveArazzoSourceDescriptions() {
|
|
259
|
+
if (!API.isArazzo(this.definition)) {
|
|
260
|
+
debug('bump-cli:definition')('This is not an Arazzo definition, no source descriptions to resolve');
|
|
261
|
+
}
|
|
262
|
+
else if (this.definition.sourceDescriptions) {
|
|
263
|
+
const sources = this.definition.sourceDescriptions;
|
|
264
|
+
for (const { name, type: sourceType, url: location } of sources) {
|
|
265
|
+
if (sourceType === 'openapi') {
|
|
266
|
+
const relativeLocation = this._resolveRelativeLocation(location);
|
|
267
|
+
/* eslint-disable no-await-in-loop */
|
|
268
|
+
const api = await API.load(relativeLocation);
|
|
269
|
+
const [content] = await api.extractDefinition();
|
|
270
|
+
/* eslint-enable no-await-in-loop */
|
|
271
|
+
this.references.push({ content, location: relativeLocation, name });
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
debug('bump-cli:definition')(`Arazzo source description of type ${sourceType} is not yet supported.`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
debug('bump-cli:definition')("Arazzo definition doesn't have any sourceDescriptions");
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
_resolveContentFrom(data) {
|
|
283
|
+
let definition;
|
|
284
|
+
let rawDefinition;
|
|
285
|
+
const references = [];
|
|
286
|
+
// data contains all refs as a map of paths/URLs and their
|
|
287
|
+
// correspond values
|
|
288
|
+
for (const [absPath, reference] of Object.entries(data)) {
|
|
289
|
+
if (this.isMainRefPath(absPath)) {
|
|
290
|
+
;
|
|
291
|
+
({ parsed: definition, raw: rawDefinition } = reference);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
if (!reference.raw) {
|
|
295
|
+
throw new UnsupportedFormat(`Reference ${absPath} is empty`);
|
|
296
|
+
}
|
|
297
|
+
references.push({
|
|
298
|
+
content: reference.raw,
|
|
299
|
+
location: this._resolveRelativeLocation(absPath),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (!definition ||
|
|
304
|
+
!rawDefinition ||
|
|
305
|
+
!(definition instanceof Object) ||
|
|
306
|
+
!('info' in definition || 'flower' in definition)) {
|
|
307
|
+
debug('bump-cli:definition')(`Main location (${this.location}) not found or empty (within ${JSON.stringify(Object.keys(data))})`);
|
|
308
|
+
throw new UnsupportedFormat('Definition needs to be a valid Object');
|
|
309
|
+
}
|
|
310
|
+
if (!API.isSupportedFormat(definition)) {
|
|
311
|
+
throw new UnsupportedFormat();
|
|
312
|
+
}
|
|
313
|
+
return [rawDefinition, definition, references];
|
|
314
|
+
}
|
|
315
|
+
/* Resolve reference paths to the main api location when possible */
|
|
316
|
+
_resolveRelativeLocation(path) {
|
|
317
|
+
const definitionUrl = this.url();
|
|
318
|
+
const refUrl = this.url(path);
|
|
319
|
+
const unixStyle = /^\//.test(path);
|
|
320
|
+
const windowsStyle = /^[A-Za-z]+:[/\\]/.test(path);
|
|
321
|
+
const isUrl = /^https?:\/\//.test(path);
|
|
322
|
+
// Guard: Absolute URL on different domain we return an untouched
|
|
323
|
+
// path
|
|
324
|
+
if (isUrl && definitionUrl.hostname !== refUrl.hostname) {
|
|
325
|
+
return path;
|
|
326
|
+
}
|
|
327
|
+
const isAbsolutePath = refUrl.hostname === '' && (unixStyle || windowsStyle);
|
|
328
|
+
// Absolute path or URL on **same domain**
|
|
329
|
+
const isAbsolute = isAbsolutePath || isUrl;
|
|
330
|
+
const relativeLocation = isAbsolute
|
|
331
|
+
? nodePath.relative(nodePath.dirname(this.location), path)
|
|
332
|
+
: nodePath.join(nodePath.dirname(this.location), path);
|
|
333
|
+
debug('bump-cli:definition')(`Resolved relative $ref location: ${relativeLocation}`);
|
|
334
|
+
return relativeLocation;
|
|
335
|
+
}
|
|
281
336
|
url(location = this.location) {
|
|
282
337
|
try {
|
|
283
338
|
return new URL(location);
|
package/oclif.manifest.json
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
},
|
|
12
12
|
"description": "Create a new version of your documentation from the given file or URL.",
|
|
13
13
|
"examples": [
|
|
14
|
-
"Deploy a new version of
|
|
15
|
-
"Deploy a new version of
|
|
16
|
-
"Deploy a whole directory of
|
|
17
|
-
"
|
|
18
|
-
"Deploy a new workflow document of
|
|
14
|
+
"Deploy a new version of an existing documentation\n\n$ bump deploy FILE --doc <your_doc_id_or_slug> --token <your_doc_token>\n* Let's deploy on Bump.sh... done\n* Your new documentation version will soon be ready\n",
|
|
15
|
+
"Deploy a new version of an existing documentation attached to a hub\n\n$ bump deploy FILE --doc <doc_slug> --hub <your_hub_id_or_slug> --token <your_doc_token>\n* Let's deploy on Bump.sh... done\n* Your new documentation version will soon be ready\n",
|
|
16
|
+
"Deploy a whole directory of API definitions files to a hub\n\n$ bump deploy DIR --filename-pattern *-{slug}-api --hub <hub_slug> --token <hub_token>\nWe've found 2 valid API definitions to deploy\n└─ DIR\n └─ source-my-service-api.yml (OpenAPI spec version 3.1.0)\n └─ source-my-jobs-service-api.yml (AsyncAPI spec version 2.6.0)\n\nLet's deploy those documentations to your <hub_slug> hub on Bump.sh\n\n* Your new documentation version will soon be ready\nLet's deploy a new version to your my-service documentation on Bump.sh... done\n\n* Your new documentation version will soon be ready\nLet's deploy a new version to your my-jobs-service documentation on Bump.sh... done\n",
|
|
17
|
+
"Validate a new documentation version before deploying it\n\n$ bump deploy FILE --dry-run --doc <doc_slug> --token <your_doc_token>\n* Let's validate on Bump.sh... done\n* Definition is valid\n",
|
|
18
|
+
"Deploy a new workflow document of an existing MCP server\n\n$ bump deploy FILE --mcp-server <your_mcp_server_id_or_slug> --token <your_organization_token>\n* Let's deploy on Bump.sh... done\n* Your <your_mcp_server_id_or_slug> MCP server... has received a new workflow definition which will soon be ready.\n"
|
|
19
19
|
],
|
|
20
20
|
"flags": {
|
|
21
21
|
"auto-create": {
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"description": "Documentation, Hub or Organization token. Can be provided via BUMP_TOKEN environment variable",
|
|
114
114
|
"name": "token",
|
|
115
115
|
"required": true,
|
|
116
|
+
"default": "99f52837852249b328c0a00249f846a3",
|
|
116
117
|
"hasDynamicHelp": false,
|
|
117
118
|
"multiple": false,
|
|
118
119
|
"type": "option"
|
|
@@ -214,6 +215,7 @@
|
|
|
214
215
|
"description": "Documentation, Hub or Organization token. Can be provided via BUMP_TOKEN environment variable",
|
|
215
216
|
"name": "token",
|
|
216
217
|
"required": false,
|
|
218
|
+
"default": "99f52837852249b328c0a00249f846a3",
|
|
217
219
|
"hasDynamicHelp": false,
|
|
218
220
|
"multiple": false,
|
|
219
221
|
"type": "option"
|
|
@@ -243,7 +245,7 @@
|
|
|
243
245
|
},
|
|
244
246
|
"description": "Apply an OpenAPI specified overlay to your API definition.",
|
|
245
247
|
"examples": [
|
|
246
|
-
"Apply the OVERLAY_FILE to the existing DEFINITION_FILE. The resulting\ndefinition is output on stdout meaning you can redirect it to a new\nfile.\n\n
|
|
248
|
+
"Apply the OVERLAY_FILE to the existing DEFINITION_FILE. The resulting\ndefinition is output on stdout meaning you can redirect it to a new\nfile.\n\n$ bump overlay DEFINITION_FILE OVERLAY_FILE > destination/file.json\n* Let's apply the overlay to the main definition... done\n"
|
|
247
249
|
],
|
|
248
250
|
"flags": {
|
|
249
251
|
"out": {
|
|
@@ -301,5 +303,5 @@
|
|
|
301
303
|
"strict": true
|
|
302
304
|
}
|
|
303
305
|
},
|
|
304
|
-
"version": "2.
|
|
306
|
+
"version": "2.10.0"
|
|
305
307
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bump-cli",
|
|
3
3
|
"description": "The Bump CLI is used to interact with your API documentation hosted on Bump.sh by using the API of developers.bump.sh",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.10.0",
|
|
5
5
|
"author": "Paul Bonaud <paulr@bump.sh>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bump": "./bin/run.js"
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"@types/debug": "^4.1.12",
|
|
15
15
|
"@types/jsonpath": "^0.2.4",
|
|
16
16
|
"@types/mocha": "^10",
|
|
17
|
-
"@types/node": "^
|
|
18
|
-
"@types/sinon": "^
|
|
17
|
+
"@types/node": "^25",
|
|
18
|
+
"@types/sinon": "^21.0.0",
|
|
19
19
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
|
20
20
|
"chai": "^6.2.2",
|
|
21
21
|
"eslint": "^8",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@apidevtools/json-schema-ref-parser": "^11.7.2",
|
|
94
94
|
"@asyncapi/specs": "^6.8.0",
|
|
95
|
-
"@clack/prompts": "^0.
|
|
95
|
+
"@clack/prompts": "^1.0.0",
|
|
96
96
|
"@oclif/core": "^4",
|
|
97
97
|
"@oclif/plugin-help": "^6",
|
|
98
98
|
"@oclif/plugin-warn-if-update-available": "^3.1.20",
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
"debug": "^4.3.7",
|
|
104
104
|
"jsonpathly": "^3.0.0",
|
|
105
105
|
"mergician": "^2.0.2",
|
|
106
|
-
"open": "^
|
|
106
|
+
"open": "^11.0.0"
|
|
107
107
|
}
|
|
108
108
|
}
|