@epilot/document-client 0.10.0 → 0.11.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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(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"}}},"template_settings":{"$ref":"#/components/schemas/TemplateSettings"}},"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"}}}}},"error_output":{"$ref":"#/components/schemas/ErrorOutput"},"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"]},"ErrorOutput":{"type":"object","properties":{"error_message":{"description":"Error message","type":"string"},"error_code":{"description":"Error code","type":"string","enum":["PARSE_ERROR","DOC_TO_PDF_CONVERT_ERROR","INTERNAL_ERROR"]},"error_details":{"description":"Error details","type":"array","items":{"type":"object","additionalProperties":true}}}},"TemplateSettings":{"type":"object","description":"Template Settings for document generation","properties":{"custom_margins":{"description":"Custom margins for the document","type":"object","properties":{"top":{"description":"Top margin in cm","type":"number","example":2.54},"bottom":{"description":"Bottom margin in cm","type":"number","example":2.54},"left":{"description":"Left margin in cm","type":"number","example":1.27},"right":{"description":"Right margin in cm","type":"number","example":1.27}}},"display_margin_guidelines":{"description":"Display margin guidelines","type":"boolean","example":true}}}}},"servers":[{"url":"https://document.sls.epilot.io"}]}')}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var p=t[o]={exports:{}};return e[o].call(p.exports,p,p.exports,r),p.exports}(914),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(534));t.default=n.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.2","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":{"$ref":"#/components/schemas/DocumentGenerationV2Request"}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentGenerationV2Response"}}}}}}}},"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"]},"ErrorOutput":{"type":"object","properties":{"error_message":{"description":"Error message","type":"string"},"error_code":{"description":"Error code","type":"string","enum":["PARSE_ERROR","DOC_TO_PDF_CONVERT_ERROR","INTERNAL_ERROR"]},"error_details":{"description":"Error details","type":"array","items":{"type":"object","additionalProperties":true}}}},"TemplateSettings":{"type":"object","description":"Template Settings for document generation","properties":{"custom_margins":{"description":"Custom margins for the document","type":"object","properties":{"top":{"description":"Top margin in cm","type":"number","example":2.54},"bottom":{"description":"Bottom margin in cm","type":"number","example":2.54},"left":{"description":"Left margin in cm","type":"number","example":1.27},"right":{"description":"Right margin in cm","type":"number","example":1.27}}},"display_margin_guidelines":{"description":"Display margin guidelines","type":"boolean","example":true}}},"DocumentGenerationV2Request":{"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"}}},"template_settings":{"$ref":"#/components/schemas/TemplateSettings"}},"required":["template_document"]},"DocumentGenerationV2Response":{"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"}}}}},"error_output":{"$ref":"#/components/schemas/ErrorOutput"},"variable_payload":{"description":"List of variables and its corresponding replaced values from the document template","type":"object","properties":{"additionalProperties":{"type":"string"}}},"template_settings":{"$ref":"#/components/schemas/TemplateSettings"}}}}},"servers":[{"url":"https://document.sls.epilot.io"}]}')}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var p=t[o]={exports:{}};return e[o].call(p.exports,p,p.exports,r),p.exports}(914),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -9,6 +9,114 @@ import type {
9
9
 
10
10
  declare namespace Components {
11
11
  namespace Schemas {
12
+ export interface DocumentGenerationV2Request {
13
+ /**
14
+ * Language to use for variables
15
+ */
16
+ language?: string;
17
+ /**
18
+ * Input template document
19
+ */
20
+ template_document: {
21
+ /**
22
+ * Document original filename
23
+ * example:
24
+ * my-template-{{order.order_number}}.docx
25
+ */
26
+ filename?: string;
27
+ s3ref?: S3Reference;
28
+ };
29
+ /**
30
+ * Entity to use for variable context
31
+ * example:
32
+ * bcd0aab9-b544-42b0-8bfb-6d449d02eacc
33
+ */
34
+ context_entity_id?: string;
35
+ /**
36
+ * User Id for variable context
37
+ * example:
38
+ * 100321
39
+ */
40
+ user_id?: string;
41
+ /**
42
+ * Custom values for variables in the template. Takes the higher precedence than others.
43
+ */
44
+ variable_payload?: {
45
+ additionalProperties?: string;
46
+ };
47
+ template_settings?: /* Template Settings for document generation */ TemplateSettings;
48
+ }
49
+ export interface DocumentGenerationV2Response {
50
+ job_id?: string; // uuid
51
+ /**
52
+ * Status of the job
53
+ */
54
+ job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
55
+ /**
56
+ * A message explaining the progress
57
+ */
58
+ message?: string;
59
+ pdf_output?: {
60
+ /**
61
+ * Pre-signed S3 GET URL for PDF preview
62
+ * example:
63
+ * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
64
+ */
65
+ preview_url?: string;
66
+ /**
67
+ * example:
68
+ * {
69
+ * "s3ref": {
70
+ * "bucket": "document-api-preview-prod",
71
+ * "key": "preview/my-template.pdf"
72
+ * }
73
+ * }
74
+ */
75
+ output_document?: {
76
+ /**
77
+ * Generated document filename for PDF
78
+ * example:
79
+ * my-template-OR-001.pdf
80
+ */
81
+ filename?: string;
82
+ s3ref?: S3Reference;
83
+ };
84
+ };
85
+ docx_output?: {
86
+ /**
87
+ * Pre-signed S3 GET URL for DOCX preview
88
+ * example:
89
+ * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
90
+ */
91
+ preview_url?: string;
92
+ /**
93
+ * example:
94
+ * {
95
+ * "s3ref": {
96
+ * "bucket": "document-api-preview-prod",
97
+ * "key": "preview/my-template.docx"
98
+ * }
99
+ * }
100
+ */
101
+ output_document?: {
102
+ /**
103
+ * Generated document filename for DOCX
104
+ * example:
105
+ * my-template-OR-001.docx
106
+ */
107
+ filename?: string;
108
+ s3ref?: S3Reference;
109
+ };
110
+ };
111
+ error_output?: ErrorOutput;
112
+ /**
113
+ * List of variables and its corresponding replaced values from the document template
114
+ */
115
+ variable_payload?: {
116
+ additionalProperties?: string;
117
+ };
118
+ template_settings?: /* Template Settings for document generation */ TemplateSettings;
119
+ }
12
120
  export interface ErrorOutput {
13
121
  /**
14
122
  * Error message
@@ -151,114 +259,9 @@ declare namespace Paths {
151
259
  job_id?: Parameters.JobId;
152
260
  mode?: Parameters.Mode;
153
261
  }
154
- export interface RequestBody {
155
- /**
156
- * Language to use for variables
157
- */
158
- language?: string;
159
- /**
160
- * Input template document
161
- */
162
- template_document: {
163
- /**
164
- * Document original filename
165
- * example:
166
- * my-template-{{order.order_number}}.docx
167
- */
168
- filename?: string;
169
- s3ref?: Components.Schemas.S3Reference;
170
- };
171
- /**
172
- * Entity to use for variable context
173
- * example:
174
- * bcd0aab9-b544-42b0-8bfb-6d449d02eacc
175
- */
176
- context_entity_id?: string;
177
- /**
178
- * User Id for variable context
179
- * example:
180
- * 100321
181
- */
182
- user_id?: string;
183
- /**
184
- * Custom values for variables in the template. Takes the higher precedence than others.
185
- */
186
- variable_payload?: {
187
- additionalProperties?: string;
188
- };
189
- template_settings?: /* Template Settings for document generation */ Components.Schemas.TemplateSettings;
190
- }
262
+ export type RequestBody = Components.Schemas.DocumentGenerationV2Request;
191
263
  namespace Responses {
192
- export interface $200 {
193
- job_id?: string; // uuid
194
- /**
195
- * Status of the job
196
- */
197
- job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
198
- /**
199
- * A message explaining the progress
200
- */
201
- message?: string;
202
- pdf_output?: {
203
- /**
204
- * Pre-signed S3 GET URL for PDF preview
205
- * example:
206
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
207
- */
208
- preview_url?: string;
209
- /**
210
- * example:
211
- * {
212
- * "s3ref": {
213
- * "bucket": "document-api-preview-prod",
214
- * "key": "preview/my-template.pdf"
215
- * }
216
- * }
217
- */
218
- output_document?: {
219
- /**
220
- * Generated document filename for PDF
221
- * example:
222
- * my-template-OR-001.pdf
223
- */
224
- filename?: string;
225
- s3ref?: Components.Schemas.S3Reference;
226
- };
227
- };
228
- docx_output?: {
229
- /**
230
- * Pre-signed S3 GET URL for DOCX preview
231
- * example:
232
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
233
- */
234
- preview_url?: string;
235
- /**
236
- * example:
237
- * {
238
- * "s3ref": {
239
- * "bucket": "document-api-preview-prod",
240
- * "key": "preview/my-template.docx"
241
- * }
242
- * }
243
- */
244
- output_document?: {
245
- /**
246
- * Generated document filename for DOCX
247
- * example:
248
- * my-template-OR-001.docx
249
- */
250
- filename?: string;
251
- s3ref?: Components.Schemas.S3Reference;
252
- };
253
- };
254
- error_output?: Components.Schemas.ErrorOutput;
255
- /**
256
- * List of variables and its corresponding replaced values from the document template
257
- */
258
- variable_payload?: {
259
- additionalProperties?: string;
260
- };
261
- }
264
+ export type $200 = Components.Schemas.DocumentGenerationV2Response;
262
265
  }
263
266
  }
264
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/document-client",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "API Client for epilot document API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",