@insureco/docman 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/dist/chunk-7DJVMOS3.js +15 -0
- package/dist/chunk-7DJVMOS3.js.map +1 -0
- package/dist/index.cjs +478 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +103 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +443 -0
- package/dist/index.js.map +1 -0
- package/dist/mock.cjs +339 -0
- package/dist/mock.cjs.map +1 -0
- package/dist/mock.d.cts +58 -0
- package/dist/mock.d.ts +58 -0
- package/dist/mock.js +305 -0
- package/dist/mock.js.map +1 -0
- package/dist/types-xbeSIrNB.d.cts +185 -0
- package/dist/types-xbeSIrNB.d.ts +185 -0
- package/package.json +44 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
interface DocmanClientConfig {
|
|
2
|
+
/** Base URL of the docman service (e.g. from DOCMAN_URL env var) */
|
|
3
|
+
readonly baseUrl: string;
|
|
4
|
+
/** Async function that returns a valid Bearer token (Bio-ID client_credentials) */
|
|
5
|
+
readonly accessTokenFn?: () => Promise<string>;
|
|
6
|
+
/** Internal service key for service-to-service auth */
|
|
7
|
+
readonly internalKey?: string;
|
|
8
|
+
/** Max retry attempts on network/5xx errors (default: 2) */
|
|
9
|
+
readonly retries?: number;
|
|
10
|
+
/** Request timeout in milliseconds (default: 15000) */
|
|
11
|
+
readonly timeoutMs?: number;
|
|
12
|
+
}
|
|
13
|
+
interface HtmlTemplate {
|
|
14
|
+
readonly _id: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly description?: string;
|
|
17
|
+
readonly org: string;
|
|
18
|
+
readonly html: string;
|
|
19
|
+
readonly landscape: boolean;
|
|
20
|
+
readonly variables: readonly string[];
|
|
21
|
+
readonly isSystem: boolean;
|
|
22
|
+
readonly archived: boolean;
|
|
23
|
+
readonly createdBy: string;
|
|
24
|
+
readonly updatedBy?: string;
|
|
25
|
+
readonly createdAt: string;
|
|
26
|
+
readonly updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
interface CreateHtmlTemplateOptions {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly description?: string;
|
|
31
|
+
readonly html: string;
|
|
32
|
+
readonly landscape?: boolean;
|
|
33
|
+
readonly isSystem?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface UpdateHtmlTemplateOptions {
|
|
36
|
+
readonly name?: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly html?: string;
|
|
39
|
+
readonly landscape?: boolean;
|
|
40
|
+
readonly isSystem?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface HtmlTemplateListQuery extends ListQuery {
|
|
43
|
+
readonly archived?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface PdfField {
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly type: string;
|
|
48
|
+
readonly required: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface TemplateCoordinates {
|
|
51
|
+
readonly customer?: string;
|
|
52
|
+
readonly agent?: string;
|
|
53
|
+
}
|
|
54
|
+
interface PdfTemplate {
|
|
55
|
+
readonly _id: string;
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly description?: string;
|
|
58
|
+
readonly org: string;
|
|
59
|
+
readonly storageKey: string;
|
|
60
|
+
readonly fields: readonly PdfField[];
|
|
61
|
+
readonly pages: number;
|
|
62
|
+
readonly coordinates?: TemplateCoordinates;
|
|
63
|
+
readonly isSystem: boolean;
|
|
64
|
+
readonly archived: boolean;
|
|
65
|
+
readonly createdBy: string;
|
|
66
|
+
readonly updatedBy?: string;
|
|
67
|
+
readonly createdAt: string;
|
|
68
|
+
readonly updatedAt: string;
|
|
69
|
+
}
|
|
70
|
+
interface CreatePdfTemplateOptions {
|
|
71
|
+
readonly name?: string;
|
|
72
|
+
readonly description?: string;
|
|
73
|
+
readonly coordinates?: TemplateCoordinates;
|
|
74
|
+
readonly isSystem?: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface UpdatePdfTemplateOptions {
|
|
77
|
+
readonly name?: string;
|
|
78
|
+
readonly description?: string;
|
|
79
|
+
readonly coordinates?: TemplateCoordinates;
|
|
80
|
+
readonly isSystem?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface PdfTemplateListQuery extends ListQuery {
|
|
83
|
+
readonly archived?: boolean;
|
|
84
|
+
}
|
|
85
|
+
interface TemplateGroupItem {
|
|
86
|
+
readonly templateId: string;
|
|
87
|
+
readonly templateType: 'pdf' | 'html';
|
|
88
|
+
}
|
|
89
|
+
interface TemplateGroup {
|
|
90
|
+
readonly _id: string;
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly org: string;
|
|
93
|
+
readonly templates: readonly TemplateGroupItem[];
|
|
94
|
+
readonly terms?: string;
|
|
95
|
+
readonly coordinates?: TemplateCoordinates;
|
|
96
|
+
readonly createdBy: string;
|
|
97
|
+
readonly updatedBy?: string;
|
|
98
|
+
readonly createdAt: string;
|
|
99
|
+
readonly updatedAt: string;
|
|
100
|
+
}
|
|
101
|
+
interface CreateTemplateGroupOptions {
|
|
102
|
+
readonly name: string;
|
|
103
|
+
readonly templates: readonly TemplateGroupItem[];
|
|
104
|
+
readonly terms?: string;
|
|
105
|
+
readonly coordinates?: TemplateCoordinates;
|
|
106
|
+
}
|
|
107
|
+
interface UpdateTemplateGroupOptions {
|
|
108
|
+
readonly name?: string;
|
|
109
|
+
readonly templates?: readonly TemplateGroupItem[];
|
|
110
|
+
readonly terms?: string;
|
|
111
|
+
readonly coordinates?: TemplateCoordinates;
|
|
112
|
+
}
|
|
113
|
+
interface SourceTemplate {
|
|
114
|
+
readonly templateId: string;
|
|
115
|
+
readonly templateType: 'pdf' | 'html';
|
|
116
|
+
}
|
|
117
|
+
interface DocmanDocument {
|
|
118
|
+
readonly _id: string;
|
|
119
|
+
readonly name: string;
|
|
120
|
+
readonly description?: string;
|
|
121
|
+
readonly org: string;
|
|
122
|
+
readonly storageKey: string;
|
|
123
|
+
readonly version: number;
|
|
124
|
+
readonly sourceTemplates: readonly SourceTemplate[];
|
|
125
|
+
readonly templateData?: Record<string, unknown>;
|
|
126
|
+
readonly pages: number;
|
|
127
|
+
readonly sizeBytes: number;
|
|
128
|
+
readonly deliveryMode: 'managed' | 'passthrough';
|
|
129
|
+
readonly shareToken: string;
|
|
130
|
+
readonly createdBy: string;
|
|
131
|
+
readonly createdAt: string;
|
|
132
|
+
readonly updatedAt: string;
|
|
133
|
+
}
|
|
134
|
+
interface DocumentVersion {
|
|
135
|
+
readonly _id: string;
|
|
136
|
+
readonly version: number;
|
|
137
|
+
readonly pages: number;
|
|
138
|
+
readonly sizeBytes: number;
|
|
139
|
+
readonly createdAt: string;
|
|
140
|
+
readonly createdBy: string;
|
|
141
|
+
}
|
|
142
|
+
interface GenerateOptions {
|
|
143
|
+
/** Template IDs to render and merge into the final document */
|
|
144
|
+
readonly templateIds: readonly string[];
|
|
145
|
+
/** Data passed to Handlebars templates and PDF form fields */
|
|
146
|
+
readonly data: Record<string, unknown>;
|
|
147
|
+
/** Human-readable document name (used for storage and display) */
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly description?: string;
|
|
150
|
+
}
|
|
151
|
+
interface GenerateResult {
|
|
152
|
+
readonly documentId: string;
|
|
153
|
+
readonly version: number;
|
|
154
|
+
/** Presigned S3 URL (1-hour TTL) */
|
|
155
|
+
readonly downloadUrl: string;
|
|
156
|
+
/** Public share URL: /d/:shareToken */
|
|
157
|
+
readonly publicUrl: string;
|
|
158
|
+
readonly pages: number;
|
|
159
|
+
readonly sizeBytes: number;
|
|
160
|
+
}
|
|
161
|
+
interface ListQuery {
|
|
162
|
+
readonly page?: number;
|
|
163
|
+
readonly limit?: number;
|
|
164
|
+
}
|
|
165
|
+
interface ListMeta {
|
|
166
|
+
readonly total: number;
|
|
167
|
+
readonly page: number;
|
|
168
|
+
readonly limit: number;
|
|
169
|
+
}
|
|
170
|
+
interface ListResult<T> {
|
|
171
|
+
readonly data: readonly T[];
|
|
172
|
+
readonly meta: ListMeta;
|
|
173
|
+
}
|
|
174
|
+
interface PageRange {
|
|
175
|
+
readonly start: number;
|
|
176
|
+
readonly end: number;
|
|
177
|
+
}
|
|
178
|
+
interface SplitPart {
|
|
179
|
+
readonly index: number;
|
|
180
|
+
readonly range: PageRange;
|
|
181
|
+
readonly buffer: Buffer;
|
|
182
|
+
readonly sizeBytes: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type { CreateHtmlTemplateOptions as C, DocmanClientConfig as D, GenerateOptions as G, HtmlTemplate as H, ListResult as L, PdfTemplate as P, SplitPart as S, TemplateGroup as T, UpdateHtmlTemplateOptions as U, HtmlTemplateListQuery as a, CreatePdfTemplateOptions as b, PdfTemplateListQuery as c, PdfField as d, UpdatePdfTemplateOptions as e, CreateTemplateGroupOptions as f, ListQuery as g, UpdateTemplateGroupOptions as h, GenerateResult as i, DocmanDocument as j, DocumentVersion as k, PageRange as l, ListMeta as m, SourceTemplate as n, TemplateCoordinates as o, TemplateGroupItem as p };
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@insureco/docman",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SDK for the iec-docman document generation service",
|
|
5
|
+
"license": "PRIVATE",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20.0.0"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./testing": {
|
|
20
|
+
"types": "./dist/mock.d.ts",
|
|
21
|
+
"import": "./dist/mock.mjs",
|
|
22
|
+
"require": "./dist/mock.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"dev": "tsup --watch",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:watch": "vitest",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"tsup": "^8.0.0",
|
|
38
|
+
"typescript": "^5.5.0",
|
|
39
|
+
"vitest": "^2.0.0"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "restricted"
|
|
43
|
+
}
|
|
44
|
+
}
|