@evenicanpm/portal-dms-adapaters 1.6.0 → 1.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/package.json +3 -3
- package/src/paperless/client.ts +2 -2
- package/dist/index.d.ts +0 -2
- package/dist/paperless/client.d.ts +0 -108
- package/dist/paperless/config.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evenicanpm/portal-dms-adapaters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"typescript": "^5.6.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@evenicanpm/
|
|
26
|
+
"@evenicanpm/portal-types-schemas": "^1.8.0",
|
|
27
27
|
"zod": "^3.0.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "485f77c5cce7c36849fb9d416d1e503d0f9299a3"
|
|
30
30
|
}
|
package/src/paperless/client.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @category dms-provider
|
|
5
5
|
* Pure functions for extracting data from paperless-ngx
|
|
6
6
|
*/
|
|
7
|
-
import type { TableViewParams } from "@evenicanpm/
|
|
7
|
+
import type { TableViewParams } from "@evenicanpm/portal-types-schemas";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Paperless-Specific document config parameters.
|
|
@@ -149,7 +149,7 @@ export const buildCustomFieldsRequest = (input: {
|
|
|
149
149
|
*/
|
|
150
150
|
interface PaperlessMapperInput {
|
|
151
151
|
/**
|
|
152
|
-
* TableViewParams - The params that the portal-ui/feature/table generates
|
|
152
|
+
* TableViewParams - The params that the portal-table-ui/feature/table generates
|
|
153
153
|
* from the view.
|
|
154
154
|
*/
|
|
155
155
|
params: TableViewParams;
|
package/dist/index.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @module PaperlessProvider
|
|
4
|
-
* @category dms-provider
|
|
5
|
-
* Pure functions for extracting data from paperless-ngx
|
|
6
|
-
*/
|
|
7
|
-
import type { TableViewParams } from "@evenicanpm/storefront-portal-types-schemas";
|
|
8
|
-
/**
|
|
9
|
-
* Paperless-Specific document config parameters.
|
|
10
|
-
*/
|
|
11
|
-
export interface PaperlessDocConfig {
|
|
12
|
-
/** Paperless uses type for broad category of document */
|
|
13
|
-
type: string;
|
|
14
|
-
/** Paperless tags */
|
|
15
|
-
tags: string[];
|
|
16
|
-
/** Property names to map back from papaless to the UI */
|
|
17
|
-
paperlessToPortalMap: Record<string, string>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Configuration for Paperless Client
|
|
21
|
-
*/
|
|
22
|
-
export interface PaperlessClientConfig {
|
|
23
|
-
/** Credentials username */
|
|
24
|
-
username: string;
|
|
25
|
-
/** Credentials password */
|
|
26
|
-
password: string;
|
|
27
|
-
/** Base of paperless web-server */
|
|
28
|
-
baseUrl: string;
|
|
29
|
-
/** The endpoint prefix to fetch docs from paperless */
|
|
30
|
-
documentEndpoint: string;
|
|
31
|
-
tenantField: string;
|
|
32
|
-
customFieldsEndpoint: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Input for building a REST URL to fetch documents from Paperless
|
|
36
|
-
*/
|
|
37
|
-
interface PaperlessUrlInput {
|
|
38
|
-
config: PaperlessClientConfig;
|
|
39
|
-
params: TableViewParams;
|
|
40
|
-
paperlessParams: PaperlessDocConfig;
|
|
41
|
-
/** Property name to filter by for multi-tenancy so customer only sees their own docs */
|
|
42
|
-
customerId: string;
|
|
43
|
-
canViewAll: boolean;
|
|
44
|
-
docId?: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* Builds URL for fetching documents from Paperless.
|
|
49
|
-
* Takes credentials, parameters and document settings and Builds
|
|
50
|
-
* a fetch-ready URL.
|
|
51
|
-
*
|
|
52
|
-
* @param PaperlessAuth Credentials for paperless basic auth.
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
export declare const buildPaperlessRESTUrl: ({ config, params, paperlessParams, customerId, canViewAll, }: PaperlessUrlInput) => Request;
|
|
56
|
-
/**
|
|
57
|
-
* Builds a fetch-ready request for downloading a single document
|
|
58
|
-
* from Paperless.
|
|
59
|
-
*
|
|
60
|
-
* Uses Paperless basic authentication and the provided document ID
|
|
61
|
-
* to construct the download endpoint URL and required headers.
|
|
62
|
-
*
|
|
63
|
-
* @param input.config Paperless configuration containing base URL and credentials
|
|
64
|
-
* @param input.docId ID of the document to download
|
|
65
|
-
*/
|
|
66
|
-
export declare const buildPaperlessDownloadRequest: (input: {
|
|
67
|
-
config: PaperlessClientConfig;
|
|
68
|
-
docId: string;
|
|
69
|
-
}) => Request;
|
|
70
|
-
export declare const buildCustomFieldsRequest: (input: {
|
|
71
|
-
config: PaperlessClientConfig;
|
|
72
|
-
}) => Request;
|
|
73
|
-
interface PaperlessResponse {
|
|
74
|
-
/** an array with all id's of docs */
|
|
75
|
-
all?: number[];
|
|
76
|
-
/** Property name from paperless */
|
|
77
|
-
results: PaperlessDoc[];
|
|
78
|
-
}
|
|
79
|
-
export type PaperlessCustomFieldEntry = {
|
|
80
|
-
field: number;
|
|
81
|
-
value: unknown;
|
|
82
|
-
name?: string;
|
|
83
|
-
};
|
|
84
|
-
export interface PaperlessDoc {
|
|
85
|
-
id: string | number;
|
|
86
|
-
title: string;
|
|
87
|
-
created_date: string;
|
|
88
|
-
document_type: string;
|
|
89
|
-
customer_id: string;
|
|
90
|
-
custom_fields: PaperlessCustomFieldEntry[];
|
|
91
|
-
}
|
|
92
|
-
export type CustomFieldsMap = Record<number, string>;
|
|
93
|
-
interface TransformPaperlessResponseInput {
|
|
94
|
-
paperlessResponse: PaperlessResponse;
|
|
95
|
-
customFieldsMap: Record<number, string>;
|
|
96
|
-
transformDoc: (data: PaperlessDoc, cfMap: Record<number, string>) => unknown;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* TODO: CREATE ZOD SCHEMA FOR PAPERLESS RESPONSE
|
|
100
|
-
* TODO:
|
|
101
|
-
* @param
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
export declare const transformPaperlessResponse: ({ paperlessResponse: { results, all }, customFieldsMap, transformDoc, }: TransformPaperlessResponseInput) => {
|
|
105
|
-
data: unknown[];
|
|
106
|
-
items: number;
|
|
107
|
-
};
|
|
108
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PaperlessClientConfig } from "./client";
|
|
2
|
-
export declare const createPaperlessConfig: (input: {
|
|
3
|
-
username: string;
|
|
4
|
-
password: string;
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
documentEndpoint?: string;
|
|
7
|
-
tenantField?: string;
|
|
8
|
-
customFieldsEndpoint?: string;
|
|
9
|
-
}) => PaperlessClientConfig;
|
|
10
|
-
export declare const createPaperlessAssets: (input?: {
|
|
11
|
-
logoUrl?: string;
|
|
12
|
-
}) => {
|
|
13
|
-
logoUrl: string;
|
|
14
|
-
};
|