@epilot/blueprint-manifest-client 2.2.1

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 ADDED
@@ -0,0 +1,29 @@
1
+ # @epilot/blueprint-manifest-client
2
+
3
+ [![CI](https://github.com/epilot-dev/sdk-js/workflows/CI/badge.svg)](https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI)
4
+ [![npm version](https://img.shields.io/npm/v/@epilot/tf-blueprints-client.svg)](https://www.npmjs.com/package/@epilot/tf-blueprints-client)
5
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@epilot/tf-blueprints-client?label=gzip%20bundle)](https://bundlephobia.com/package/@epilot/tf-blueprints-client)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/epilot-dev/sdk-js/blob/main/LICENSE)
7
+
8
+ Client library for epilot [Blueprint Manifest API](https://docs.epilot.io/api/blueprint-manifest)
9
+
10
+ Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install --save @epilot/tf-blueprints-client
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { getClient } from "@epilot/blueprint-manifest";
22
+
23
+ const blueprintManifestClient = getClient();
24
+ const res = await blueprintManifestClient.getJob('my-job');
25
+ ```
26
+
27
+ ## Documentation:
28
+
29
+ https://docs.epilot.io/api/blueprints
@@ -0,0 +1,3 @@
1
+ import { Client } from './openapi';
2
+ export declare const getClient: () => Client;
3
+ export declare const createClient: () => Client;
package/dist/client.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createClient = exports.getClient = void 0;
18
+ var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids"));
19
+ var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
20
+ var definition_1 = __importDefault(require("./definition"));
21
+ var client;
22
+ var getClient = function () {
23
+ if (!client) {
24
+ client = (0, exports.createClient)();
25
+ }
26
+ return client;
27
+ };
28
+ exports.getClient = getClient;
29
+ var createClient = function () {
30
+ var _a;
31
+ var api = new openapi_client_axios_1.default({
32
+ definition: definition_1.default,
33
+ quick: true,
34
+ });
35
+ var apiClient = api.initSync();
36
+ apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {}));
37
+ return apiClient;
38
+ };
39
+ exports.createClient = createClient;
40
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,3 @@
1
+ import type { Document } from 'openapi-client-axios';
2
+ declare const _default: Document;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={914:function(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(o(240));t.default=s.default},240:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"servers":[{"url":"https://blueprint-manifest.sls.epilot.io"}],"paths":{"/v1/blueprint-manifest/jobs/{job_id}":{"get":{"operationId":"getJob","parameters":[{"$ref":"#/components/parameters/JobID"}],"responses":{}}},"/v1/blueprint-manifest/jobs:createExport":{"post":{"operationId":"createExport","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/blueprint-manifest/jobs/{job_id}:exportManifest":{"post":{"operationId":"exportManifest","parameters":[{"$ref":"#/components/parameters/JobID"}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/blueprint-manifest:uploadManifest":{"post":{"operationId":"uploadManifest","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/blueprint-manifest/jobs:createPlan":{"post":{"operationId":"createPlan","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/blueprint-manifest/jobs/{job_id}:applyPlan":{"post":{"operationId":"applyPlan","parameters":[{"$ref":"#/components/parameters/JobID"}],"requestBody":{"content":{"application/json":{}}},"responses":{}}}},"components":{"parameters":{"JobID":{"name":"job_id","in":"path","required":true}}}}')}},t={},o=function o(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return e[r].call(n.exports,n,n.exports,o),n.exports}(914),r=exports;for(var s in o)r[s]=o[s];o.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
@@ -0,0 +1,3 @@
1
+ export type { Document, OpenAPIClient, OpenAPIClientAxios } from 'openapi-client-axios';
2
+ export type { Client, Components, OperationMethods, Paths, PathsDictionary } from './openapi';
3
+ export * from './client';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,99 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": ""
6
+ },
7
+ "servers": [
8
+ {
9
+ "url": "https://blueprint-manifest.sls.epilot.io"
10
+ }
11
+ ],
12
+ "paths": {
13
+ "/v1/blueprint-manifest/jobs/{job_id}": {
14
+ "get": {
15
+ "operationId": "getJob",
16
+ "parameters": [
17
+ {
18
+ "$ref": "#/components/parameters/JobID"
19
+ }
20
+ ],
21
+ "responses": {}
22
+ }
23
+ },
24
+ "/v1/blueprint-manifest/jobs:createExport": {
25
+ "post": {
26
+ "operationId": "createExport",
27
+ "requestBody": {
28
+ "content": {
29
+ "application/json": {}
30
+ }
31
+ },
32
+ "responses": {}
33
+ }
34
+ },
35
+ "/v1/blueprint-manifest/jobs/{job_id}:exportManifest": {
36
+ "post": {
37
+ "operationId": "exportManifest",
38
+ "parameters": [
39
+ {
40
+ "$ref": "#/components/parameters/JobID"
41
+ }
42
+ ],
43
+ "requestBody": {
44
+ "content": {
45
+ "application/json": {}
46
+ }
47
+ },
48
+ "responses": {}
49
+ }
50
+ },
51
+ "/v1/blueprint-manifest:uploadManifest": {
52
+ "post": {
53
+ "operationId": "uploadManifest",
54
+ "requestBody": {
55
+ "content": {
56
+ "application/json": {}
57
+ }
58
+ },
59
+ "responses": {}
60
+ }
61
+ },
62
+ "/v1/blueprint-manifest/jobs:createPlan": {
63
+ "post": {
64
+ "operationId": "createPlan",
65
+ "requestBody": {
66
+ "content": {
67
+ "application/json": {}
68
+ }
69
+ },
70
+ "responses": {}
71
+ }
72
+ },
73
+ "/v1/blueprint-manifest/jobs/{job_id}:applyPlan": {
74
+ "post": {
75
+ "operationId": "applyPlan",
76
+ "parameters": [
77
+ {
78
+ "$ref": "#/components/parameters/JobID"
79
+ }
80
+ ],
81
+ "requestBody": {
82
+ "content": {
83
+ "application/json": {}
84
+ }
85
+ },
86
+ "responses": {}
87
+ }
88
+ }
89
+ },
90
+ "components": {
91
+ "parameters": {
92
+ "JobID": {
93
+ "name": "job_id",
94
+ "in": "path",
95
+ "required": true
96
+ }
97
+ }
98
+ }
99
+ }
@@ -0,0 +1,414 @@
1
+ /* eslint-disable */
2
+ import type {
3
+ OpenAPIClient,
4
+ Parameters,
5
+ UnknownParamsObject,
6
+ OperationResponse,
7
+ AxiosRequestConfig,
8
+ } from 'openapi-client-axios';
9
+
10
+ declare namespace Components {
11
+ namespace Parameters {
12
+ export type JobID = /**
13
+ * ID of an import or export job
14
+ * example:
15
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
16
+ */
17
+ Schemas.JobID;
18
+ }
19
+ export interface PathParameters {
20
+ JobID?: Parameters.JobID;
21
+ }
22
+ namespace Schemas {
23
+ export interface Job {
24
+ job_status?: JobStatus;
25
+ job_id?: /**
26
+ * ID of an import or export job
27
+ * example:
28
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
29
+ */
30
+ JobID;
31
+ message?: string;
32
+ timestamp?: string; // date-time
33
+ /**
34
+ * An URL to download the plan file
35
+ */
36
+ plan_file_content?: string;
37
+ /**
38
+ * An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import
39
+ */
40
+ resources_to_export?: /* An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import */ ResourceNode[] | ResourceNode;
41
+ /**
42
+ * An URL to download the resources to export when the resources are too large to be included in the response
43
+ */
44
+ large_resources_to_export_url?: string;
45
+ /**
46
+ * An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import
47
+ */
48
+ resources_to_import?: /* An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import */ ResourceNode[] | ResourceNode;
49
+ /**
50
+ * An URL to download the resources to import when the resources are too large to be included in the response
51
+ */
52
+ large_resources_to_import_url?: string;
53
+ /**
54
+ * An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import
55
+ */
56
+ imported_resources?: /* An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import */ ResourceNode[] | ResourceNode;
57
+ /**
58
+ * An URL to download the imported resources when the resources are too large to be included in the response
59
+ */
60
+ large_imported_resources_url?: string;
61
+ markdown?: {
62
+ /**
63
+ * Markdown content to be displayed when showing the plan to install blueprint
64
+ * example:
65
+ * This is the content of the preinstall.md file
66
+ *
67
+ */
68
+ preinstall?: string;
69
+ /**
70
+ * Markdown content to be displayed when showing the plan to install blueprint
71
+ * example:
72
+ * This is the content of the postinstall.md file
73
+ *
74
+ */
75
+ postinstall?: string;
76
+ };
77
+ }
78
+ /**
79
+ * ID of an import or export job
80
+ * example:
81
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
82
+ */
83
+ export type JobID = string;
84
+ export type JobStatus = "STARTED" | "WAITING_USER_ACTION" | "CANCELLED" | "IN_PROGRESS" | "SUCCESS" | "FAILED";
85
+ export interface ResourceNode {
86
+ id: string;
87
+ type: ResourceNodeType;
88
+ name?: string;
89
+ source_id?: string;
90
+ address?: string;
91
+ dependencies?: ResourceNode[];
92
+ changes?: ("create" | "update" | "no-op" | "delete")[];
93
+ }
94
+ export type ResourceNodeType = "designbuilder" | "journey" | "product" | "price" | "tax" | "automation_flow" | "entity_mapping" | "file" | "emailtemplate" | "schema" | "schema_attribute" | "schema_capability" | "schema_group" | "workflow_definition" | "closing_reason" | "taxonomy_classification";
95
+ export interface S3Reference {
96
+ /**
97
+ * example:
98
+ * epilot-dev-blueprints
99
+ */
100
+ bucket?: string;
101
+ /**
102
+ * example:
103
+ * templates/main.tf
104
+ */
105
+ key?: string;
106
+ }
107
+ export interface UploadFilePayload {
108
+ /**
109
+ * example:
110
+ * main.tf
111
+ */
112
+ filename: string;
113
+ /**
114
+ * MIME type of file
115
+ * example:
116
+ * application/pdf
117
+ */
118
+ mime_type?: string;
119
+ }
120
+ }
121
+ }
122
+ declare namespace Paths {
123
+ namespace ApplyPlan {
124
+ namespace Parameters {
125
+ export type JobId = /**
126
+ * ID of an import or export job
127
+ * example:
128
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
129
+ */
130
+ Components.Schemas.JobID;
131
+ }
132
+ export interface PathParameters {
133
+ job_id: Parameters.JobId;
134
+ }
135
+ export interface RequestBody {
136
+ /**
137
+ * example:
138
+ * example.tf
139
+ */
140
+ manifestFilePath?: string;
141
+ }
142
+ namespace Responses {
143
+ export type $200 = string;
144
+ }
145
+ }
146
+ namespace CreateExport {
147
+ export interface RequestBody {
148
+ resourceType?: "journey" | "product" | "price" | "tax" | "automation_flow" | "designbuilder" | "file" | "emailtemplate" | "entity" | "schema" | "schema_attribute" | "schema_capability" | "schema_group" | "workflow_definition" | "closing_reason" | "taxonomy_classification";
149
+ resourceIds?: [
150
+ string,
151
+ string?,
152
+ string?,
153
+ string?,
154
+ string?,
155
+ string?,
156
+ string?,
157
+ string?,
158
+ string?,
159
+ string?,
160
+ string?,
161
+ string?,
162
+ string?,
163
+ string?,
164
+ string?,
165
+ string?,
166
+ string?,
167
+ string?,
168
+ string?,
169
+ string?,
170
+ string?,
171
+ string?,
172
+ string?,
173
+ string?,
174
+ string?
175
+ ];
176
+ }
177
+ namespace Responses {
178
+ export interface $200 {
179
+ jobId?: /**
180
+ * ID of an import or export job
181
+ * example:
182
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
183
+ */
184
+ Components.Schemas.JobID;
185
+ }
186
+ }
187
+ }
188
+ namespace CreatePlan {
189
+ export interface RequestBody {
190
+ /**
191
+ * Path to the manifest file uploaded via `uploadManifest`
192
+ * example:
193
+ * example.tf
194
+ */
195
+ manifestFilePath?: string;
196
+ }
197
+ namespace Responses {
198
+ export interface $200 {
199
+ /**
200
+ * example:
201
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
202
+ */
203
+ jobId?: string;
204
+ }
205
+ }
206
+ }
207
+ namespace ExportManifest {
208
+ namespace Parameters {
209
+ export type JobId = /**
210
+ * ID of an import or export job
211
+ * example:
212
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
213
+ */
214
+ Components.Schemas.JobID;
215
+ }
216
+ export interface PathParameters {
217
+ job_id: Parameters.JobId;
218
+ }
219
+ export interface RequestBody {
220
+ /**
221
+ * An array of resource IDs to export
222
+ */
223
+ selectedResourceIds?: string[];
224
+ /**
225
+ * example:
226
+ * journey_HouseConnectionJourney
227
+ */
228
+ resourceName?: string;
229
+ }
230
+ namespace Responses {
231
+ export interface $200 {
232
+ jobId?: /**
233
+ * ID of an import or export job
234
+ * example:
235
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
236
+ */
237
+ Components.Schemas.JobID;
238
+ }
239
+ }
240
+ }
241
+ namespace GetJob {
242
+ namespace Parameters {
243
+ export type JobId = /**
244
+ * ID of an import or export job
245
+ * example:
246
+ * 4854bb2a-94f9-424d-a968-3fb17fb0bf89
247
+ */
248
+ Components.Schemas.JobID;
249
+ }
250
+ export interface PathParameters {
251
+ job_id: Parameters.JobId;
252
+ }
253
+ namespace Responses {
254
+ export type $200 = Components.Schemas.Job;
255
+ }
256
+ }
257
+ namespace UploadManifest {
258
+ export type RequestBody = Components.Schemas.UploadFilePayload;
259
+ namespace Responses {
260
+ export interface $201 {
261
+ s3ref?: Components.Schemas.S3Reference;
262
+ /**
263
+ * example:
264
+ * https://epilot-dev-blueprints.s3.eu-central-1.amazonaws.com/templates/document.pdf
265
+ */
266
+ upload_url?: string; // url
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ export interface OperationMethods {
273
+ /**
274
+ * getJob - getJob
275
+ *
276
+ * Get the current status of a blueprint (export or import)
277
+ */
278
+ 'getJob'(
279
+ parameters?: Parameters<Paths.GetJob.PathParameters> | null,
280
+ data?: any,
281
+ config?: AxiosRequestConfig
282
+ ): OperationResponse<Paths.GetJob.Responses.$200>
283
+ /**
284
+ * createExport - createExport
285
+ *
286
+ * Creates a new Export Job with a list of available resources to export from the passed root resource.
287
+ *
288
+ */
289
+ 'createExport'(
290
+ parameters?: Parameters<UnknownParamsObject> | null,
291
+ data?: Paths.CreateExport.RequestBody,
292
+ config?: AxiosRequestConfig
293
+ ): OperationResponse<Paths.CreateExport.Responses.$200>
294
+ /**
295
+ * exportManifest - exportManifest
296
+ *
297
+ * Triggers exporting a manifest file using selected resoruce ids for a job created with `createExportJob`
298
+ */
299
+ 'exportManifest'(
300
+ parameters?: Parameters<Paths.ExportManifest.PathParameters> | null,
301
+ data?: Paths.ExportManifest.RequestBody,
302
+ config?: AxiosRequestConfig
303
+ ): OperationResponse<Paths.ExportManifest.Responses.$200>
304
+ /**
305
+ * uploadManifest - uploadManifest
306
+ *
307
+ * Create pre-signed S3 URL to upload a manifest file.
308
+ *
309
+ */
310
+ 'uploadManifest'(
311
+ parameters?: Parameters<UnknownParamsObject> | null,
312
+ data?: Paths.UploadManifest.RequestBody,
313
+ config?: AxiosRequestConfig
314
+ ): OperationResponse<Paths.UploadManifest.Responses.$201>
315
+ /**
316
+ * createPlan - createPlan
317
+ *
318
+ * Creates a new import job from an uploaded manifest file and returns the plan
319
+ */
320
+ 'createPlan'(
321
+ parameters?: Parameters<UnknownParamsObject> | null,
322
+ data?: Paths.CreatePlan.RequestBody,
323
+ config?: AxiosRequestConfig
324
+ ): OperationResponse<Paths.CreatePlan.Responses.$200>
325
+ /**
326
+ * applyPlan - applyPlan
327
+ *
328
+ * Apply a plan returned by `createPlan`
329
+ */
330
+ 'applyPlan'(
331
+ parameters?: Parameters<Paths.ApplyPlan.PathParameters> | null,
332
+ data?: Paths.ApplyPlan.RequestBody,
333
+ config?: AxiosRequestConfig
334
+ ): OperationResponse<Paths.ApplyPlan.Responses.$200>
335
+ }
336
+
337
+ export interface PathsDictionary {
338
+ ['/v1/blueprint-manifest/jobs/{job_id}']: {
339
+ /**
340
+ * getJob - getJob
341
+ *
342
+ * Get the current status of a blueprint (export or import)
343
+ */
344
+ 'get'(
345
+ parameters?: Parameters<Paths.GetJob.PathParameters> | null,
346
+ data?: any,
347
+ config?: AxiosRequestConfig
348
+ ): OperationResponse<Paths.GetJob.Responses.$200>
349
+ }
350
+ ['/v1/blueprint-manifest/jobs:createExport']: {
351
+ /**
352
+ * createExport - createExport
353
+ *
354
+ * Creates a new Export Job with a list of available resources to export from the passed root resource.
355
+ *
356
+ */
357
+ 'post'(
358
+ parameters?: Parameters<UnknownParamsObject> | null,
359
+ data?: Paths.CreateExport.RequestBody,
360
+ config?: AxiosRequestConfig
361
+ ): OperationResponse<Paths.CreateExport.Responses.$200>
362
+ }
363
+ ['/v1/blueprint-manifest/jobs/{job_id}:exportManifest']: {
364
+ /**
365
+ * exportManifest - exportManifest
366
+ *
367
+ * Triggers exporting a manifest file using selected resoruce ids for a job created with `createExportJob`
368
+ */
369
+ 'post'(
370
+ parameters?: Parameters<Paths.ExportManifest.PathParameters> | null,
371
+ data?: Paths.ExportManifest.RequestBody,
372
+ config?: AxiosRequestConfig
373
+ ): OperationResponse<Paths.ExportManifest.Responses.$200>
374
+ }
375
+ ['/v1/blueprint-manifest:uploadManifest']: {
376
+ /**
377
+ * uploadManifest - uploadManifest
378
+ *
379
+ * Create pre-signed S3 URL to upload a manifest file.
380
+ *
381
+ */
382
+ 'post'(
383
+ parameters?: Parameters<UnknownParamsObject> | null,
384
+ data?: Paths.UploadManifest.RequestBody,
385
+ config?: AxiosRequestConfig
386
+ ): OperationResponse<Paths.UploadManifest.Responses.$201>
387
+ }
388
+ ['/v1/blueprint-manifest/jobs:createPlan']: {
389
+ /**
390
+ * createPlan - createPlan
391
+ *
392
+ * Creates a new import job from an uploaded manifest file and returns the plan
393
+ */
394
+ 'post'(
395
+ parameters?: Parameters<UnknownParamsObject> | null,
396
+ data?: Paths.CreatePlan.RequestBody,
397
+ config?: AxiosRequestConfig
398
+ ): OperationResponse<Paths.CreatePlan.Responses.$200>
399
+ }
400
+ ['/v1/blueprint-manifest/jobs/{job_id}:applyPlan']: {
401
+ /**
402
+ * applyPlan - applyPlan
403
+ *
404
+ * Apply a plan returned by `createPlan`
405
+ */
406
+ 'post'(
407
+ parameters?: Parameters<Paths.ApplyPlan.PathParameters> | null,
408
+ data?: Paths.ApplyPlan.RequestBody,
409
+ config?: AxiosRequestConfig
410
+ ): OperationResponse<Paths.ApplyPlan.Responses.$200>
411
+ }
412
+ }
413
+
414
+ export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
@@ -0,0 +1,533 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "Blueprint Manifest API",
5
+ "version": "0.1.0",
6
+ "description": "Service to create and install Blueprint Manifest files"
7
+ },
8
+ "tags": [
9
+ {
10
+ "name": "Jobs",
11
+ "description": "Manage Export and Import Jobs"
12
+ },
13
+ {
14
+ "name": "Export",
15
+ "description": "Export a Blueprint Manifest"
16
+ },
17
+ {
18
+ "name": "Import",
19
+ "description": "Import a Blueprint Manifest"
20
+ }
21
+ ],
22
+ "security": [
23
+ {
24
+ "EpilotAuth": []
25
+ }
26
+ ],
27
+ "servers": [
28
+ {
29
+ "url": "https://blueprint-manifest.sls.epilot.io"
30
+ }
31
+ ],
32
+ "paths": {
33
+ "/v1/blueprint-manifest/jobs/{job_id}": {
34
+ "get": {
35
+ "operationId": "getJob",
36
+ "summary": "getJob",
37
+ "description": "Get the current status of a blueprint (export or import)",
38
+ "tags": [
39
+ "Jobs"
40
+ ],
41
+ "parameters": [
42
+ {
43
+ "$ref": "#/components/parameters/JobID"
44
+ }
45
+ ],
46
+ "responses": {
47
+ "200": {
48
+ "description": "Current status of the blueprint",
49
+ "content": {
50
+ "application/json": {
51
+ "schema": {
52
+ "$ref": "#/components/schemas/Job"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ },
60
+ "/v1/blueprint-manifest/jobs:createExport": {
61
+ "post": {
62
+ "operationId": "createExport",
63
+ "summary": "createExport",
64
+ "description": "Creates a new Export Job with a list of available resources to export from the passed root resource.\n",
65
+ "tags": [
66
+ "Export"
67
+ ],
68
+ "requestBody": {
69
+ "content": {
70
+ "application/json": {
71
+ "schema": {
72
+ "type": "object",
73
+ "properties": {
74
+ "resourceType": {
75
+ "type": "string",
76
+ "enum": [
77
+ "journey",
78
+ "product",
79
+ "price",
80
+ "tax",
81
+ "automation_flow",
82
+ "designbuilder",
83
+ "file",
84
+ "emailtemplate",
85
+ "entity",
86
+ "schema",
87
+ "schema_attribute",
88
+ "schema_capability",
89
+ "schema_group",
90
+ "workflow_definition",
91
+ "closing_reason",
92
+ "taxonomy_classification"
93
+ ]
94
+ },
95
+ "resourceIds": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "string"
99
+ },
100
+ "minItems": 1,
101
+ "maxItems": 25
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "responses": {
109
+ "200": {
110
+ "description": "Created Export Job ID",
111
+ "content": {
112
+ "application/json": {
113
+ "schema": {
114
+ "type": "object",
115
+ "properties": {
116
+ "jobId": {
117
+ "$ref": "#/components/schemas/JobID"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ },
127
+ "/v1/blueprint-manifest/jobs/{job_id}:exportManifest": {
128
+ "post": {
129
+ "operationId": "exportManifest",
130
+ "summary": "exportManifest",
131
+ "description": "Triggers exporting a manifest file using selected resoruce ids for a job created with `createExportJob`",
132
+ "tags": [
133
+ "Export"
134
+ ],
135
+ "parameters": [
136
+ {
137
+ "$ref": "#/components/parameters/JobID"
138
+ }
139
+ ],
140
+ "requestBody": {
141
+ "content": {
142
+ "application/json": {
143
+ "schema": {
144
+ "type": "object",
145
+ "properties": {
146
+ "selectedResourceIds": {
147
+ "description": "An array of resource IDs to export",
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string"
151
+ }
152
+ },
153
+ "resourceName": {
154
+ "type": "string",
155
+ "example": "journey_HouseConnectionJourney"
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ },
162
+ "responses": {
163
+ "200": {
164
+ "description": "Export Job ID",
165
+ "content": {
166
+ "application/json": {
167
+ "schema": {
168
+ "type": "object",
169
+ "properties": {
170
+ "jobId": {
171
+ "$ref": "#/components/schemas/JobID"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "/v1/blueprint-manifest:uploadManifest": {
182
+ "post": {
183
+ "operationId": "uploadManifest",
184
+ "summary": "uploadManifest",
185
+ "description": "Create pre-signed S3 URL to upload a manifest file.\n",
186
+ "tags": [
187
+ "Import"
188
+ ],
189
+ "requestBody": {
190
+ "content": {
191
+ "application/json": {
192
+ "schema": {
193
+ "$ref": "#/components/schemas/UploadFilePayload"
194
+ }
195
+ }
196
+ }
197
+ },
198
+ "responses": {
199
+ "201": {
200
+ "description": "Pre-signed URL for POST / PUT upload",
201
+ "content": {
202
+ "application/json": {
203
+ "schema": {
204
+ "type": "object",
205
+ "properties": {
206
+ "s3ref": {
207
+ "$ref": "#/components/schemas/S3Reference"
208
+ },
209
+ "upload_url": {
210
+ "type": "string",
211
+ "format": "url",
212
+ "example": "https://epilot-dev-blueprints.s3.eu-central-1.amazonaws.com/templates/document.pdf"
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ },
222
+ "/v1/blueprint-manifest/jobs:createPlan": {
223
+ "post": {
224
+ "operationId": "createPlan",
225
+ "summary": "createPlan",
226
+ "description": "Creates a new import job from an uploaded manifest file and returns the plan",
227
+ "tags": [
228
+ "Import"
229
+ ],
230
+ "requestBody": {
231
+ "content": {
232
+ "application/json": {
233
+ "schema": {
234
+ "type": "object",
235
+ "properties": {
236
+ "manifestFilePath": {
237
+ "description": "Path to the manifest file uploaded via `uploadManifest`",
238
+ "type": "string",
239
+ "example": "example.tf"
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ },
246
+ "responses": {
247
+ "200": {
248
+ "description": "Created Import Job ID",
249
+ "content": {
250
+ "application/json": {
251
+ "schema": {
252
+ "type": "object",
253
+ "properties": {
254
+ "jobId": {
255
+ "type": "string",
256
+ "example": "4854bb2a-94f9-424d-a968-3fb17fb0bf89"
257
+ }
258
+ }
259
+ }
260
+ }
261
+ }
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "/v1/blueprint-manifest/jobs/{job_id}:applyPlan": {
267
+ "post": {
268
+ "operationId": "applyPlan",
269
+ "summary": "applyPlan",
270
+ "description": "Apply a plan returned by `createPlan`",
271
+ "tags": [
272
+ "Import"
273
+ ],
274
+ "parameters": [
275
+ {
276
+ "$ref": "#/components/parameters/JobID"
277
+ }
278
+ ],
279
+ "requestBody": {
280
+ "content": {
281
+ "application/json": {
282
+ "schema": {
283
+ "type": "object",
284
+ "properties": {
285
+ "manifestFilePath": {
286
+ "type": "string",
287
+ "example": "example.tf"
288
+ }
289
+ }
290
+ }
291
+ }
292
+ }
293
+ },
294
+ "responses": {
295
+ "200": {
296
+ "description": "Success",
297
+ "content": {
298
+ "application/json": {
299
+ "schema": {
300
+ "type": "string"
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ },
309
+ "components": {
310
+ "schemas": {
311
+ "JobStatus": {
312
+ "type": "string",
313
+ "enum": [
314
+ "STARTED",
315
+ "WAITING_USER_ACTION",
316
+ "CANCELLED",
317
+ "IN_PROGRESS",
318
+ "SUCCESS",
319
+ "FAILED"
320
+ ]
321
+ },
322
+ "ResourceNodeType": {
323
+ "type": "string",
324
+ "enum": [
325
+ "designbuilder",
326
+ "journey",
327
+ "product",
328
+ "price",
329
+ "tax",
330
+ "automation_flow",
331
+ "entity_mapping",
332
+ "file",
333
+ "emailtemplate",
334
+ "schema",
335
+ "schema_attribute",
336
+ "schema_capability",
337
+ "schema_group",
338
+ "workflow_definition",
339
+ "closing_reason",
340
+ "taxonomy_classification"
341
+ ]
342
+ },
343
+ "ResourceNode": {
344
+ "type": "object",
345
+ "properties": {
346
+ "id": {
347
+ "type": "string"
348
+ },
349
+ "type": {
350
+ "$ref": "#/components/schemas/ResourceNodeType"
351
+ },
352
+ "name": {
353
+ "type": "string"
354
+ },
355
+ "source_id": {
356
+ "type": "string"
357
+ },
358
+ "address": {
359
+ "type": "string"
360
+ },
361
+ "dependencies": {
362
+ "type": "array",
363
+ "items": {
364
+ "$ref": "#/components/schemas/ResourceNode"
365
+ }
366
+ },
367
+ "changes": {
368
+ "type": "array",
369
+ "items": {
370
+ "type": "string",
371
+ "enum": [
372
+ "create",
373
+ "update",
374
+ "no-op",
375
+ "delete"
376
+ ]
377
+ }
378
+ }
379
+ },
380
+ "required": [
381
+ "id",
382
+ "type"
383
+ ]
384
+ },
385
+ "JobID": {
386
+ "type": "string",
387
+ "description": "ID of an import or export job",
388
+ "example": "4854bb2a-94f9-424d-a968-3fb17fb0bf89"
389
+ },
390
+ "Job": {
391
+ "type": "object",
392
+ "properties": {
393
+ "job_status": {
394
+ "$ref": "#/components/schemas/JobStatus"
395
+ },
396
+ "job_id": {
397
+ "$ref": "#/components/schemas/JobID"
398
+ },
399
+ "message": {
400
+ "type": "string"
401
+ },
402
+ "timestamp": {
403
+ "type": "string",
404
+ "format": "date-time"
405
+ },
406
+ "plan_file_content": {
407
+ "type": "string",
408
+ "description": "An URL to download the plan file"
409
+ },
410
+ "resources_to_export": {
411
+ "description": "An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import",
412
+ "oneOf": [
413
+ {
414
+ "type": "array",
415
+ "items": {
416
+ "$ref": "#/components/schemas/ResourceNode"
417
+ }
418
+ },
419
+ {
420
+ "$ref": "#/components/schemas/ResourceNode"
421
+ }
422
+ ]
423
+ },
424
+ "large_resources_to_export_url": {
425
+ "type": "string",
426
+ "description": "An URL to download the resources to export when the resources are too large to be included in the response"
427
+ },
428
+ "resources_to_import": {
429
+ "description": "An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import",
430
+ "oneOf": [
431
+ {
432
+ "type": "array",
433
+ "items": {
434
+ "$ref": "#/components/schemas/ResourceNode"
435
+ }
436
+ },
437
+ {
438
+ "$ref": "#/components/schemas/ResourceNode"
439
+ }
440
+ ]
441
+ },
442
+ "large_resources_to_import_url": {
443
+ "type": "string",
444
+ "description": "An URL to download the resources to import when the resources are too large to be included in the response"
445
+ },
446
+ "imported_resources": {
447
+ "description": "An array of tree-like JSON objects or a singular tree-like JSON object representing the resources to import",
448
+ "oneOf": [
449
+ {
450
+ "type": "array",
451
+ "items": {
452
+ "$ref": "#/components/schemas/ResourceNode"
453
+ }
454
+ },
455
+ {
456
+ "$ref": "#/components/schemas/ResourceNode"
457
+ }
458
+ ]
459
+ },
460
+ "large_imported_resources_url": {
461
+ "type": "string",
462
+ "description": "An URL to download the imported resources when the resources are too large to be included in the response"
463
+ },
464
+ "markdown": {
465
+ "type": "object",
466
+ "properties": {
467
+ "preinstall": {
468
+ "type": "string",
469
+ "description": "Markdown content to be displayed when showing the plan to install blueprint",
470
+ "example": "This is the content of the preinstall.md file\n"
471
+ },
472
+ "postinstall": {
473
+ "type": "string",
474
+ "description": "Markdown content to be displayed when showing the plan to install blueprint",
475
+ "example": "This is the content of the postinstall.md file\n"
476
+ }
477
+ }
478
+ }
479
+ }
480
+ },
481
+ "UploadFilePayload": {
482
+ "type": "object",
483
+ "properties": {
484
+ "filename": {
485
+ "type": "string",
486
+ "example": "main.tf"
487
+ },
488
+ "mime_type": {
489
+ "description": "MIME type of file",
490
+ "type": "string",
491
+ "example": "application/pdf",
492
+ "default": "application/octet-stream"
493
+ }
494
+ },
495
+ "required": [
496
+ "filename"
497
+ ]
498
+ },
499
+ "S3Reference": {
500
+ "type": "object",
501
+ "properties": {
502
+ "bucket": {
503
+ "type": "string",
504
+ "example": "epilot-dev-blueprints"
505
+ },
506
+ "key": {
507
+ "type": "string",
508
+ "example": "templates/main.tf"
509
+ }
510
+ }
511
+ }
512
+ },
513
+ "parameters": {
514
+ "JobID": {
515
+ "name": "job_id",
516
+ "in": "path",
517
+ "required": true,
518
+ "description": "ID of an import or export job",
519
+ "schema": {
520
+ "$ref": "#/components/schemas/JobID"
521
+ }
522
+ }
523
+ },
524
+ "securitySchemes": {
525
+ "EpilotAuth": {
526
+ "type": "http",
527
+ "scheme": "bearer",
528
+ "description": "Authorization header with epilot OAuth2 bearer token",
529
+ "bearerFormat": "JWT"
530
+ }
531
+ }
532
+ }
533
+ }
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@epilot/blueprint-manifest-client",
3
+ "version": "2.2.1",
4
+ "description": "Client for epilot Terraform Blueprint Manifest API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "author": "epilot GmbH",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/epilot-dev/sdk-js.git",
12
+ "directory": "clients/blueprint-manifest-client"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/epilot-dev/sdk-js/issues"
16
+ },
17
+ "homepage": "https://github.com/epilot-dev/sdk-js/tree/main/clients/blueprint-manifest-client#readme",
18
+ "keywords": [
19
+ "blueprint",
20
+ "manifest",
21
+ "tf-blueprints",
22
+ "terraform"
23
+ ],
24
+ "scripts": {
25
+ "test": "jest",
26
+ "bundle-definition": "webpack",
27
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/blueprint-manifest.yaml",
28
+ "typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ./src/openapi.json >> src/openapi.d.ts",
29
+ "build": "tsc && npm run bundle-definition",
30
+ "build:watch": "npm run build && tsc -w",
31
+ "prepublishOnly": "npm run typegen && npm run build",
32
+ "lint": "../../node_modules/eslint/bin/eslint.js src"
33
+ },
34
+ "files": [
35
+ "*.js",
36
+ "*.d.ts",
37
+ "**/*.js",
38
+ "**/*.d.ts",
39
+ "**/*.json",
40
+ "!*.test.*",
41
+ "!**/*.test.*",
42
+ "!node_modules",
43
+ "!src",
44
+ "!src/**",
45
+ "!*.config.js"
46
+ ],
47
+ "peerDependencies": {
48
+ "axios": "^1.6.2"
49
+ },
50
+ "dependencies": {
51
+ "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
52
+ "buffer": "^6.0.3",
53
+ "https-browserify": "^1.0.0",
54
+ "openapi-client-axios": "^7.5.1",
55
+ "stream-http": "^3.1.1",
56
+ "url": "^0.11.0",
57
+ "util": "^0.12.3"
58
+ },
59
+ "devDependencies": {
60
+ "@types/jest": "^26.0.20",
61
+ "axios": "^1.6.2",
62
+ "copy-webpack-plugin": "^7.0.0",
63
+ "jest": "^26.6.3",
64
+ "json-loader": "^0.5.7",
65
+ "openapi-client-axios-typegen": "^7.4.1",
66
+ "openapicmd": "^2.1.0",
67
+ "ts-jest": "^26.5.0",
68
+ "ts-loader": "^8.0.14",
69
+ "ts-node": "^10.9.1",
70
+ "typescript": "^4.1.3",
71
+ "webpack": "^5.18.0",
72
+ "webpack-cli": "^4.4.0"
73
+ },
74
+ "gitHead": "39426e86cfb320fa3227dc03f60ee6a10848e7c7"
75
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "moduleResolution": "node",
7
+ "lib": ["esnext", "dom"],
8
+ "experimentalDecorators": true,
9
+ "emitDecoratorMetadata": true,
10
+ "esModuleInterop": true,
11
+ "noImplicitAny": true,
12
+ "strictPropertyInitialization": false,
13
+ "strictNullChecks": false,
14
+ "resolveJsonModule": true,
15
+ "baseUrl": ".",
16
+ "rootDir": "src",
17
+ "outDir": "dist",
18
+ "sourceMap": true,
19
+ "declaration": true
20
+ },
21
+ "include": ["src/**/*"],
22
+ "exclude": ["**/*.test.ts"]
23
+ }