@epilot/document-client 0.9.0 → 0.11.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.
@@ -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":{"$ref":"#/components/schemas/DocumentGenerationV2Request"}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"$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
@@ -70,6 +178,12 @@ declare namespace Components {
70
178
  */
71
179
  right?: number;
72
180
  };
181
+ /**
182
+ * Display margin guidelines
183
+ * example:
184
+ * true
185
+ */
186
+ display_margin_guidelines?: boolean;
73
187
  }
74
188
  }
75
189
  }
@@ -145,115 +259,6 @@ declare namespace Paths {
145
259
  job_id?: Parameters.JobId;
146
260
  mode?: Parameters.Mode;
147
261
  }
148
- export interface RequestBody {
149
- /**
150
- * Language to use for variables
151
- */
152
- language?: string;
153
- /**
154
- * Input template document
155
- */
156
- template_document: {
157
- /**
158
- * Document original filename
159
- * example:
160
- * my-template-{{order.order_number}}.docx
161
- */
162
- filename?: string;
163
- s3ref?: Components.Schemas.S3Reference;
164
- };
165
- /**
166
- * Entity to use for variable context
167
- * example:
168
- * bcd0aab9-b544-42b0-8bfb-6d449d02eacc
169
- */
170
- context_entity_id?: string;
171
- /**
172
- * User Id for variable context
173
- * example:
174
- * 100321
175
- */
176
- user_id?: string;
177
- /**
178
- * Custom values for variables in the template. Takes the higher precedence than others.
179
- */
180
- variable_payload?: {
181
- additionalProperties?: string;
182
- };
183
- template_settings?: /* Template Settings for document generation */ Components.Schemas.TemplateSettings;
184
- }
185
- namespace Responses {
186
- export interface $200 {
187
- job_id?: string; // uuid
188
- /**
189
- * Status of the job
190
- */
191
- job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
192
- /**
193
- * A message explaining the progress
194
- */
195
- message?: string;
196
- pdf_output?: {
197
- /**
198
- * Pre-signed S3 GET URL for PDF preview
199
- * example:
200
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
201
- */
202
- preview_url?: string;
203
- /**
204
- * example:
205
- * {
206
- * "s3ref": {
207
- * "bucket": "document-api-preview-prod",
208
- * "key": "preview/my-template.pdf"
209
- * }
210
- * }
211
- */
212
- output_document?: {
213
- /**
214
- * Generated document filename for PDF
215
- * example:
216
- * my-template-OR-001.pdf
217
- */
218
- filename?: string;
219
- s3ref?: Components.Schemas.S3Reference;
220
- };
221
- };
222
- docx_output?: {
223
- /**
224
- * Pre-signed S3 GET URL for DOCX preview
225
- * example:
226
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
227
- */
228
- preview_url?: string;
229
- /**
230
- * example:
231
- * {
232
- * "s3ref": {
233
- * "bucket": "document-api-preview-prod",
234
- * "key": "preview/my-template.docx"
235
- * }
236
- * }
237
- */
238
- output_document?: {
239
- /**
240
- * Generated document filename for DOCX
241
- * example:
242
- * my-template-OR-001.docx
243
- */
244
- filename?: string;
245
- s3ref?: Components.Schemas.S3Reference;
246
- };
247
- };
248
- error_output?: Components.Schemas.ErrorOutput;
249
- /**
250
- * List of variables and its corresponding replaced values from the document template
251
- */
252
- variable_payload?: {
253
- additionalProperties?: string;
254
- };
255
- }
256
- }
257
262
  }
258
263
  }
259
264
 
@@ -294,9 +299,9 @@ export interface OperationMethods {
294
299
  */
295
300
  'generateDocumentV2'(
296
301
  parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
297
- data?: Paths.GenerateDocumentV2.RequestBody,
302
+ data?: any,
298
303
  config?: AxiosRequestConfig
299
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
304
+ ): OperationResponse<any>
300
305
  }
301
306
 
302
307
  export interface PathsDictionary {
@@ -339,9 +344,9 @@ export interface PathsDictionary {
339
344
  */
340
345
  'post'(
341
346
  parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
342
- data?: Paths.GenerateDocumentV2.RequestBody,
347
+ data?: any,
343
348
  config?: AxiosRequestConfig
344
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
349
+ ): OperationResponse<any>
345
350
  }
346
351
  }
347
352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/document-client",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "API Client for epilot document API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",