@epilot/document-client 0.6.2 → 0.7.1-alpha

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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(o(534));t.default=r.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Document API","version":"1.0.0","description":"Generate documents with epilot data\\n\\n[Feature Documentation](https://docs.epilot.io/docs/files/document-generation)\\n"},"tags":[{"name":"Documents","description":"Document Generation"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/documents:generate":{"post":{"operationId":"generateDocument","summary":"generateDocument","description":"Builds document generated from input document with variables.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n\\nUses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.\\n","tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","default":"en","example":"de","description":"Language to use"},"template_document":{"description":"Input template document","type":"object","properties":{"filename":{"type":"string","description":"Document original filename","example":"my-template-{{order.order_number}}.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}},"context_entity_id":{"type":"string","description":"Entity to use for variable context","example":"bcd0aab9-b544-42b0-8bfb-6d449d02eacc"},"user_id":{"type":"string","description":"User Id for variable context","example":100321}},"required":["template_document"]}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename","type":"string","example":"my-template-OR-001.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.pdf"}}}}}}}}}}},"/v2/documents:generate":{"post":{"operationId":"generateDocumentV2","summary":"generateDocumentV2","description":"Builds document generated from input document with variables.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n- .docx but limited to only text based variables\\n\\nUses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.\\n","parameters":[{"in":"query","name":"job_id","description":"Job ID for tracking the status of document generation action","schema":{"type":"string"}},{"in":"query","name":"mode","description":"Type of mode used for document generation flow.\\nPartial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.\\nFull - Goes through all the steps for the full generation of final document\\n","schema":{"type":"string","enum":["partial_generation","full_generation"],"default":"automatic"}}],"tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","enum":["en","de"],"default":"en","example":"de","description":"Language to use"},"template_document":{"description":"Input template document","type":"object","properties":{"filename":{"type":"string","description":"Document original filename","example":"my-template-{{order.order_number}}.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}},"context_entity_id":{"type":"string","description":"Entity to use for variable context","example":"bcd0aab9-b544-42b0-8bfb-6d449d02eacc"},"user_id":{"type":"string","description":"User Id for variable context","example":100321},"variable_payload":{"description":"Custom values for variables in the template. Takes the higher precedence than others.","type":"object","properties":{"additionalProperties":{"type":"string"}}}},"required":["template_document"]}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"job_status":{"description":"Status of the job","type":"string","enum":["STARTED","PROCESSING","SUCCESS","FAILED"]},"message":{"description":"A message explaining the progress","type":"string"},"pdf_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for PDF preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for PDF","type":"string","example":"my-template-OR-001.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.pdf"}}}}},"docx_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for DOCX preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for DOCX","type":"string","example":"my-template-OR-001.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.docx"}}}}},"variable_payload":{"description":"List of variables and its corresponding replaced values from the document template","type":"object","properties":{"additionalProperties":{"type":"string"}}}}}}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with epilot OAuth2 bearer token","bearerFormat":"JWT"}},"schemas":{"S3Reference":{"type":"object","properties":{"bucket":{"type":"string","example":"document-api-prod"},"key":{"type":"string","example":"uploads/my-template.pdf"}},"required":["bucket","key"]}}}}')}},t={},o=function o(n){var r=t[n];if(void 0!==r)return r.exports;var p=t[n]={exports:{}};return e[n].call(p.exports,p,p.exports,o),p.exports}(914),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
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 n=r(o(534));t.default=n.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Document API","version":"1.0.0","description":"Generate documents with epilot data\\n\\n[Feature Documentation](https://docs.epilot.io/docs/files/document-generation)\\n"},"tags":[{"name":"Documents","description":"Document Generation"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/documents:generate":{"post":{"operationId":"generateDocument","summary":"generateDocument","description":"Builds document generated from input document with variables.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n\\nUses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.\\n","tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","default":"en","example":"de","description":"Language to use"},"template_document":{"description":"Input template document","type":"object","properties":{"filename":{"type":"string","description":"Document original filename","example":"my-template-{{order.order_number}}.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}},"context_entity_id":{"type":"string","description":"Entity to use for variable context","example":"bcd0aab9-b544-42b0-8bfb-6d449d02eacc"},"user_id":{"type":"string","description":"User Id for variable context","example":100321}},"required":["template_document"]}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename","type":"string","example":"my-template-OR-001.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.pdf"}}}}}}}}}}},"/v2/documents:generate":{"post":{"operationId":"generateDocumentV2","summary":"generateDocumentV2","description":"Builds document generated from input document with variables.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n- .docx but limited to only text based variables\\n\\nUses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.\\n","parameters":[{"in":"query","name":"job_id","description":"Job ID for tracking the status of document generation action","schema":{"type":"string"}},{"in":"query","name":"mode","description":"Type of mode used for document generation flow.\\nPartial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.\\nFull - Goes through all the steps for the full generation of final document\\n","schema":{"type":"string","enum":["partial_generation","full_generation"],"default":"automatic"}}],"tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","default":"de","description":"Language to use for variables"},"template_document":{"description":"Input template document","type":"object","properties":{"filename":{"type":"string","description":"Document original filename","example":"my-template-{{order.order_number}}.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}},"context_entity_id":{"type":"string","description":"Entity to use for variable context","example":"bcd0aab9-b544-42b0-8bfb-6d449d02eacc"},"user_id":{"type":"string","description":"User Id for variable context","example":100321},"variable_payload":{"description":"Custom values for variables in the template. Takes the higher precedence than others.","type":"object","properties":{"additionalProperties":{"type":"string"}}}},"required":["template_document"]}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"job_status":{"description":"Status of the job","type":"string","enum":["STARTED","PROCESSING","SUCCESS","FAILED"]},"message":{"description":"A message explaining the progress","type":"string"},"pdf_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for PDF preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for PDF","type":"string","example":"my-template-OR-001.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.pdf"}}}}},"docx_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for DOCX preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for DOCX","type":"string","example":"my-template-OR-001.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.docx"}}}}},"variable_payload":{"description":"List of variables and its corresponding replaced values from the document template","type":"object","properties":{"additionalProperties":{"type":"string"}}}}}}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with epilot OAuth2 bearer token","bearerFormat":"JWT"}},"schemas":{"S3Reference":{"type":"object","properties":{"bucket":{"type":"string","example":"document-api-prod"},"key":{"type":"string","example":"uploads/my-template.pdf"}},"required":["bucket","key"]}}},"servers":[{"url":"https://document.sls.epilot.io"},{"url":"https://document.sls.epilot.io"}]}')}},t={},o=function o(r){var n=t[r];if(void 0!==n)return n.exports;var p=t[r]={exports:{}};return e[r].call(p.exports,p,p.exports,o),p.exports}(914),r=exports;for(var n in o)r[n]=o[n];o.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -97,11 +97,9 @@ declare namespace Paths {
97
97
  }
98
98
  export interface RequestBody {
99
99
  /**
100
- * Language to use
101
- * example:
102
- * de
100
+ * Language to use for variables
103
101
  */
104
- language?: "en" | "de";
102
+ language?: string;
105
103
  /**
106
104
  * Input template document
107
105
  */
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@epilot/document-client",
3
- "version": "0.6.2",
3
+ "version": "0.7.1-alpha",
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 --passWithNoTests",
9
9
  "typescript": "tsc",
10
10
  "bundle-definition": "webpack",
11
- "openapi": "openapi read --json ../lambda/ApiHandlerFunction/openapi.yml > src/openapi.json",
12
- "typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ../lambda/ApiHandlerFunction/openapi.yml >> src/openapi.d.ts",
11
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
12
+ "typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ./src/openapi.json >> src/openapi.d.ts",
13
13
  "build": "npm run openapi && npm run typegen && npm run typescript && npm run bundle-definition",
14
- "eslint": "../node_modules/.bin/eslint -c ../.eslintrc.yml",
14
+ "lint": "../../node_modules/eslint/bin/eslint.js src",
15
15
  "prepublishOnly": "npm run build"
16
16
  },
17
17
  "files": [
@@ -41,11 +41,10 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jest": "^26.0.20",
44
- "axios": "^0.25.0",
45
44
  "copy-webpack-plugin": "^7.0.0",
46
45
  "jest": "^26.6.3",
47
46
  "json-loader": "^0.5.7",
48
- "openapi-client-axios-typegen": "^6.0.0",
47
+ "openapi-client-axios-typegen": "^7.4.1",
49
48
  "openapicmd": "^1.6.2",
50
49
  "ts-jest": "^26.5.0",
51
50
  "ts-loader": "^8.0.14",
package/src/openapi.d.ts DELETED
@@ -1,298 +0,0 @@
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
101
- * example:
102
- * de
103
- */
104
- language?: "en" | "de";
105
- /**
106
- * Input template document
107
- */
108
- template_document: {
109
- /**
110
- * Document original filename
111
- * example:
112
- * my-template-{{order.order_number}}.docx
113
- */
114
- filename?: string;
115
- s3ref?: Components.Schemas.S3Reference;
116
- };
117
- /**
118
- * Entity to use for variable context
119
- * example:
120
- * bcd0aab9-b544-42b0-8bfb-6d449d02eacc
121
- */
122
- context_entity_id?: string;
123
- /**
124
- * User Id for variable context
125
- * example:
126
- * 100321
127
- */
128
- user_id?: string;
129
- /**
130
- * Custom values for variables in the template. Takes the higher precedence than others.
131
- */
132
- variable_payload?: {
133
- additionalProperties?: string;
134
- };
135
- }
136
- namespace Responses {
137
- export interface $200 {
138
- job_id?: string; // uuid
139
- /**
140
- * Status of the job
141
- */
142
- job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
143
- /**
144
- * A message explaining the progress
145
- */
146
- message?: string;
147
- pdf_output?: {
148
- /**
149
- * Pre-signed S3 GET URL for PDF preview
150
- * example:
151
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
152
- */
153
- preview_url?: string;
154
- /**
155
- * example:
156
- * {
157
- * "s3ref": {
158
- * "bucket": "document-api-preview-prod",
159
- * "key": "preview/my-template.pdf"
160
- * }
161
- * }
162
- */
163
- output_document?: {
164
- /**
165
- * Generated document filename for PDF
166
- * example:
167
- * my-template-OR-001.pdf
168
- */
169
- filename?: string;
170
- s3ref?: Components.Schemas.S3Reference;
171
- };
172
- };
173
- docx_output?: {
174
- /**
175
- * Pre-signed S3 GET URL for DOCX preview
176
- * example:
177
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
178
- */
179
- preview_url?: string;
180
- /**
181
- * example:
182
- * {
183
- * "s3ref": {
184
- * "bucket": "document-api-preview-prod",
185
- * "key": "preview/my-template.docx"
186
- * }
187
- * }
188
- */
189
- output_document?: {
190
- /**
191
- * Generated document filename for DOCX
192
- * example:
193
- * my-template-OR-001.docx
194
- */
195
- filename?: string;
196
- s3ref?: Components.Schemas.S3Reference;
197
- };
198
- };
199
- /**
200
- * List of variables and its corresponding replaced values from the document template
201
- */
202
- variable_payload?: {
203
- additionalProperties?: string;
204
- };
205
- }
206
- }
207
- }
208
- }
209
-
210
- export interface OperationMethods {
211
- /**
212
- * generateDocument - generateDocument
213
- *
214
- * Builds document generated from input document with variables.
215
- *
216
- * Supported input document types:
217
- * - .docx
218
- *
219
- * Supported output document types:
220
- * - .pdf
221
- *
222
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
223
- *
224
- */
225
- 'generateDocument'(
226
- parameters?: Parameters<UnknownParamsObject> | null,
227
- data?: Paths.GenerateDocument.RequestBody,
228
- config?: AxiosRequestConfig
229
- ): OperationResponse<Paths.GenerateDocument.Responses.$200>
230
- /**
231
- * generateDocumentV2 - generateDocumentV2
232
- *
233
- * Builds document generated from input document with variables.
234
- *
235
- * Supported input document types:
236
- * - .docx
237
- *
238
- * Supported output document types:
239
- * - .pdf
240
- * - .docx but limited to only text based variables
241
- *
242
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
243
- *
244
- */
245
- 'generateDocumentV2'(
246
- parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
247
- data?: Paths.GenerateDocumentV2.RequestBody,
248
- config?: AxiosRequestConfig
249
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
250
- }
251
-
252
- export interface PathsDictionary {
253
- ['/v1/documents:generate']: {
254
- /**
255
- * generateDocument - generateDocument
256
- *
257
- * Builds document generated from input document with variables.
258
- *
259
- * Supported input document types:
260
- * - .docx
261
- *
262
- * Supported output document types:
263
- * - .pdf
264
- *
265
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
266
- *
267
- */
268
- 'post'(
269
- parameters?: Parameters<UnknownParamsObject> | null,
270
- data?: Paths.GenerateDocument.RequestBody,
271
- config?: AxiosRequestConfig
272
- ): OperationResponse<Paths.GenerateDocument.Responses.$200>
273
- }
274
- ['/v2/documents:generate']: {
275
- /**
276
- * generateDocumentV2 - generateDocumentV2
277
- *
278
- * Builds document generated from input document with variables.
279
- *
280
- * Supported input document types:
281
- * - .docx
282
- *
283
- * Supported output document types:
284
- * - .pdf
285
- * - .docx but limited to only text based variables
286
- *
287
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
288
- *
289
- */
290
- 'post'(
291
- parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
292
- data?: Paths.GenerateDocumentV2.RequestBody,
293
- config?: AxiosRequestConfig
294
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
295
- }
296
- }
297
-
298
- export type Client = OpenAPIClient<OperationMethods, PathsDictionary>