extractia-sdk 1.0.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/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Extractia SDK
2
+
3
+ A JavaScript SDK for interacting with the Extractia API.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install extractia-sdk
9
+
10
+ Usage
11
+
12
+ import { setToken, getMyProfile, getTemplates, processImage } from 'extractia-sdk';
13
+
14
+ // Set your API token
15
+ setToken('YOUR_API_TOKEN');
16
+
17
+ // Get user profile
18
+ const profile = await getMyProfile();
19
+
20
+ // Get all templates
21
+ const templates = await getTemplates();
22
+
23
+ // Process an image with a template
24
+ const result = await processImage(templateId, base64Image);
25
+
26
+ API Reference
27
+
28
+ Authentication
29
+
30
+ setToken(token) – Set the API token for requests.
31
+ getMyProfile() – Get the authenticated user´s profile.
32
+ updateWebhook(url) – Update the webhook URL for the user.
33
+
34
+ Templates
35
+
36
+ getTemplates() – Retrieve all templates.
37
+ getTemplateById(id) – Get a template by its ID.
38
+ getTemplateByName(name) – Get a template by its name.
39
+ createTemplate(template) – Create a new template.
40
+ updateTemplate(id, template) – Update an existing template.
41
+ deleteTemplate(id) – Delete a template.
42
+ deleteAllTemplateDocuments(id) – Delete all documents for a template.
43
+
44
+ Documents
45
+
46
+ getDocumentsByTemplateId(templateId, options) – Get documents for a template.
47
+ deleteDocument(documentId) – Delete a document.
48
+ processImage(templateId, base64Image) – Process a single image.
49
+ processImagesMultipage(templateId, base64ImagesArray) – Process multiple images (multipage).
50
+
51
+ License
52
+
53
+ ISC
package/build.js ADDED
@@ -0,0 +1,29 @@
1
+ // build.js
2
+ import { build } from 'esbuild';
3
+
4
+ const sharedConfig = {
5
+ entryPoints: ['./src/index.js'],
6
+ bundle: true,
7
+ minify: false,
8
+ sourcemap: true,
9
+ target: ['es2017'],
10
+ };
11
+
12
+ Promise.all([
13
+ build({
14
+ ...sharedConfig,
15
+ outfile: './dist/extractia-sdk.esm.js',
16
+ format: 'esm',
17
+ }),
18
+ build({
19
+ ...sharedConfig,
20
+ outfile: './dist/extractia-sdk.cjs.js',
21
+ format: 'cjs',
22
+ }),
23
+ build({
24
+ ...sharedConfig,
25
+ outfile: './dist/extractia-sdk.browser.js',
26
+ format: 'iife',
27
+ globalName: 'ExtractiaSDK',
28
+ }),
29
+ ]).catch(() => process.exit(1));