@epilot/document-client 0.7.1-alpha → 0.8.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/LICENSE +21 -0
- package/package.json +14 -11
- package/src/openapi.d.ts +296 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 epilot GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/document-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "API Client for epilot document API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "jest
|
|
8
|
+
"test": "jest",
|
|
9
9
|
"typescript": "tsc",
|
|
10
10
|
"bundle-definition": "webpack",
|
|
11
11
|
"openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
|
|
12
12
|
"typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ./src/openapi.json >> src/openapi.d.ts",
|
|
13
|
-
"build": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
13
|
+
"build": "tsc && npm run bundle-definition",
|
|
14
|
+
"build:watch": "npm run build && tsc -w",
|
|
15
|
+
"release-alpha": "npm version prerelease --preid alpha",
|
|
16
|
+
"lint": "../../node_modules/eslint/bin/eslint.js src"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"*.js",
|
|
@@ -29,28 +30,30 @@
|
|
|
29
30
|
"author": "epilot GmbH",
|
|
30
31
|
"license": "UNLICENSED",
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"axios": "^
|
|
33
|
+
"axios": "^1.6.2"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"buffer": "^6.0.3",
|
|
36
37
|
"https-browserify": "^1.0.0",
|
|
37
|
-
"openapi-client-axios": "^
|
|
38
|
+
"openapi-client-axios": "^7.5.1",
|
|
38
39
|
"stream-http": "^3.1.1",
|
|
39
40
|
"url": "^0.11.0",
|
|
40
41
|
"util": "^0.12.3"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@types/jest": "^26.0.20",
|
|
45
|
+
"axios": "^1.6.2",
|
|
44
46
|
"copy-webpack-plugin": "^7.0.0",
|
|
45
47
|
"jest": "^26.6.3",
|
|
46
48
|
"json-loader": "^0.5.7",
|
|
47
49
|
"openapi-client-axios-typegen": "^7.4.1",
|
|
48
|
-
"openapicmd": "^1.
|
|
50
|
+
"openapicmd": "^1.16.2",
|
|
49
51
|
"ts-jest": "^26.5.0",
|
|
50
52
|
"ts-loader": "^8.0.14",
|
|
51
|
-
"ts-node": "^10.
|
|
52
|
-
"typescript": "^4.
|
|
53
|
+
"ts-node": "^10.9.1",
|
|
54
|
+
"typescript": "^4.1.3",
|
|
53
55
|
"webpack": "^5.18.0",
|
|
54
56
|
"webpack-cli": "^4.4.0"
|
|
55
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "87e13b737363092db3b30c32df8e0507f7348697"
|
|
56
59
|
}
|
package/src/openapi.d.ts
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
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 Schemas {
|
|
12
|
+
export interface S3Reference {
|
|
13
|
+
/**
|
|
14
|
+
* example:
|
|
15
|
+
* document-api-prod
|
|
16
|
+
*/
|
|
17
|
+
bucket: string;
|
|
18
|
+
/**
|
|
19
|
+
* example:
|
|
20
|
+
* uploads/my-template.pdf
|
|
21
|
+
*/
|
|
22
|
+
key: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare namespace Paths {
|
|
27
|
+
namespace GenerateDocument {
|
|
28
|
+
export interface RequestBody {
|
|
29
|
+
/**
|
|
30
|
+
* Language to use
|
|
31
|
+
* example:
|
|
32
|
+
* de
|
|
33
|
+
*/
|
|
34
|
+
language?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Input template document
|
|
37
|
+
*/
|
|
38
|
+
template_document: {
|
|
39
|
+
/**
|
|
40
|
+
* Document original filename
|
|
41
|
+
* example:
|
|
42
|
+
* my-template-{{order.order_number}}.docx
|
|
43
|
+
*/
|
|
44
|
+
filename?: string;
|
|
45
|
+
s3ref?: Components.Schemas.S3Reference;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Entity to use for variable context
|
|
49
|
+
* example:
|
|
50
|
+
* bcd0aab9-b544-42b0-8bfb-6d449d02eacc
|
|
51
|
+
*/
|
|
52
|
+
context_entity_id?: string;
|
|
53
|
+
/**
|
|
54
|
+
* User Id for variable context
|
|
55
|
+
* example:
|
|
56
|
+
* 100321
|
|
57
|
+
*/
|
|
58
|
+
user_id?: string;
|
|
59
|
+
}
|
|
60
|
+
namespace Responses {
|
|
61
|
+
export interface $200 {
|
|
62
|
+
/**
|
|
63
|
+
* Pre-signed S3 GET URL for preview
|
|
64
|
+
* example:
|
|
65
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
|
|
66
|
+
*/
|
|
67
|
+
preview_url?: string;
|
|
68
|
+
/**
|
|
69
|
+
* example:
|
|
70
|
+
* {
|
|
71
|
+
* "s3ref": {
|
|
72
|
+
* "bucket": "document-api-preview-prod",
|
|
73
|
+
* "key": "preview/my-template.pdf"
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
*/
|
|
77
|
+
output_document?: {
|
|
78
|
+
/**
|
|
79
|
+
* Generated document filename
|
|
80
|
+
* example:
|
|
81
|
+
* my-template-OR-001.pdf
|
|
82
|
+
*/
|
|
83
|
+
filename?: string;
|
|
84
|
+
s3ref?: Components.Schemas.S3Reference;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
namespace GenerateDocumentV2 {
|
|
90
|
+
namespace Parameters {
|
|
91
|
+
export type JobId = string;
|
|
92
|
+
export type Mode = "partial_generation" | "full_generation";
|
|
93
|
+
}
|
|
94
|
+
export interface QueryParameters {
|
|
95
|
+
job_id?: Parameters.JobId;
|
|
96
|
+
mode?: Parameters.Mode;
|
|
97
|
+
}
|
|
98
|
+
export interface RequestBody {
|
|
99
|
+
/**
|
|
100
|
+
* Language to use for variables
|
|
101
|
+
*/
|
|
102
|
+
language?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Input template document
|
|
105
|
+
*/
|
|
106
|
+
template_document: {
|
|
107
|
+
/**
|
|
108
|
+
* Document original filename
|
|
109
|
+
* example:
|
|
110
|
+
* my-template-{{order.order_number}}.docx
|
|
111
|
+
*/
|
|
112
|
+
filename?: string;
|
|
113
|
+
s3ref?: Components.Schemas.S3Reference;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Entity to use for variable context
|
|
117
|
+
* example:
|
|
118
|
+
* bcd0aab9-b544-42b0-8bfb-6d449d02eacc
|
|
119
|
+
*/
|
|
120
|
+
context_entity_id?: string;
|
|
121
|
+
/**
|
|
122
|
+
* User Id for variable context
|
|
123
|
+
* example:
|
|
124
|
+
* 100321
|
|
125
|
+
*/
|
|
126
|
+
user_id?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Custom values for variables in the template. Takes the higher precedence than others.
|
|
129
|
+
*/
|
|
130
|
+
variable_payload?: {
|
|
131
|
+
additionalProperties?: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
namespace Responses {
|
|
135
|
+
export interface $200 {
|
|
136
|
+
job_id?: string; // uuid
|
|
137
|
+
/**
|
|
138
|
+
* Status of the job
|
|
139
|
+
*/
|
|
140
|
+
job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
|
|
141
|
+
/**
|
|
142
|
+
* A message explaining the progress
|
|
143
|
+
*/
|
|
144
|
+
message?: string;
|
|
145
|
+
pdf_output?: {
|
|
146
|
+
/**
|
|
147
|
+
* Pre-signed S3 GET URL for PDF preview
|
|
148
|
+
* example:
|
|
149
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
|
|
150
|
+
*/
|
|
151
|
+
preview_url?: string;
|
|
152
|
+
/**
|
|
153
|
+
* example:
|
|
154
|
+
* {
|
|
155
|
+
* "s3ref": {
|
|
156
|
+
* "bucket": "document-api-preview-prod",
|
|
157
|
+
* "key": "preview/my-template.pdf"
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
*/
|
|
161
|
+
output_document?: {
|
|
162
|
+
/**
|
|
163
|
+
* Generated document filename for PDF
|
|
164
|
+
* example:
|
|
165
|
+
* my-template-OR-001.pdf
|
|
166
|
+
*/
|
|
167
|
+
filename?: string;
|
|
168
|
+
s3ref?: Components.Schemas.S3Reference;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
docx_output?: {
|
|
172
|
+
/**
|
|
173
|
+
* Pre-signed S3 GET URL for DOCX preview
|
|
174
|
+
* example:
|
|
175
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
|
|
176
|
+
*/
|
|
177
|
+
preview_url?: string;
|
|
178
|
+
/**
|
|
179
|
+
* example:
|
|
180
|
+
* {
|
|
181
|
+
* "s3ref": {
|
|
182
|
+
* "bucket": "document-api-preview-prod",
|
|
183
|
+
* "key": "preview/my-template.docx"
|
|
184
|
+
* }
|
|
185
|
+
* }
|
|
186
|
+
*/
|
|
187
|
+
output_document?: {
|
|
188
|
+
/**
|
|
189
|
+
* Generated document filename for DOCX
|
|
190
|
+
* example:
|
|
191
|
+
* my-template-OR-001.docx
|
|
192
|
+
*/
|
|
193
|
+
filename?: string;
|
|
194
|
+
s3ref?: Components.Schemas.S3Reference;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* List of variables and its corresponding replaced values from the document template
|
|
199
|
+
*/
|
|
200
|
+
variable_payload?: {
|
|
201
|
+
additionalProperties?: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface OperationMethods {
|
|
209
|
+
/**
|
|
210
|
+
* generateDocument - generateDocument
|
|
211
|
+
*
|
|
212
|
+
* Builds document generated from input document with variables.
|
|
213
|
+
*
|
|
214
|
+
* Supported input document types:
|
|
215
|
+
* - .docx
|
|
216
|
+
*
|
|
217
|
+
* Supported output document types:
|
|
218
|
+
* - .pdf
|
|
219
|
+
*
|
|
220
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
'generateDocument'(
|
|
224
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
225
|
+
data?: Paths.GenerateDocument.RequestBody,
|
|
226
|
+
config?: AxiosRequestConfig
|
|
227
|
+
): OperationResponse<Paths.GenerateDocument.Responses.$200>
|
|
228
|
+
/**
|
|
229
|
+
* generateDocumentV2 - generateDocumentV2
|
|
230
|
+
*
|
|
231
|
+
* Builds document generated from input document with variables.
|
|
232
|
+
*
|
|
233
|
+
* Supported input document types:
|
|
234
|
+
* - .docx
|
|
235
|
+
*
|
|
236
|
+
* Supported output document types:
|
|
237
|
+
* - .pdf
|
|
238
|
+
* - .docx but limited to only text based variables
|
|
239
|
+
*
|
|
240
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
241
|
+
*
|
|
242
|
+
*/
|
|
243
|
+
'generateDocumentV2'(
|
|
244
|
+
parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
|
|
245
|
+
data?: Paths.GenerateDocumentV2.RequestBody,
|
|
246
|
+
config?: AxiosRequestConfig
|
|
247
|
+
): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface PathsDictionary {
|
|
251
|
+
['/v1/documents:generate']: {
|
|
252
|
+
/**
|
|
253
|
+
* generateDocument - generateDocument
|
|
254
|
+
*
|
|
255
|
+
* Builds document generated from input document with variables.
|
|
256
|
+
*
|
|
257
|
+
* Supported input document types:
|
|
258
|
+
* - .docx
|
|
259
|
+
*
|
|
260
|
+
* Supported output document types:
|
|
261
|
+
* - .pdf
|
|
262
|
+
*
|
|
263
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
264
|
+
*
|
|
265
|
+
*/
|
|
266
|
+
'post'(
|
|
267
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
268
|
+
data?: Paths.GenerateDocument.RequestBody,
|
|
269
|
+
config?: AxiosRequestConfig
|
|
270
|
+
): OperationResponse<Paths.GenerateDocument.Responses.$200>
|
|
271
|
+
}
|
|
272
|
+
['/v2/documents:generate']: {
|
|
273
|
+
/**
|
|
274
|
+
* generateDocumentV2 - generateDocumentV2
|
|
275
|
+
*
|
|
276
|
+
* Builds document generated from input document with variables.
|
|
277
|
+
*
|
|
278
|
+
* Supported input document types:
|
|
279
|
+
* - .docx
|
|
280
|
+
*
|
|
281
|
+
* Supported output document types:
|
|
282
|
+
* - .pdf
|
|
283
|
+
* - .docx but limited to only text based variables
|
|
284
|
+
*
|
|
285
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
286
|
+
*
|
|
287
|
+
*/
|
|
288
|
+
'post'(
|
|
289
|
+
parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
|
|
290
|
+
data?: Paths.GenerateDocumentV2.RequestBody,
|
|
291
|
+
config?: AxiosRequestConfig
|
|
292
|
+
): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
|