@abyss-project/tools 3.0.0 → 3.1.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.
Files changed (161) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +1 -1
  3. package/dist/api/atlas-document.api.d.ts +2 -1
  4. package/dist/api/atlas-document.api.js +5 -1
  5. package/dist/api/atlas-document.api.js.map +1 -1
  6. package/dist/api/atlas-group.api.js.map +1 -1
  7. package/dist/api/atlas-page.api.js.map +1 -1
  8. package/dist/api/atlas.api.js +3 -3
  9. package/dist/api/atlas.api.js.map +1 -1
  10. package/dist/api/atlas.public.api.js.map +1 -1
  11. package/dist/api/board-card.api.js.map +1 -1
  12. package/dist/api/board-column.api.js.map +1 -1
  13. package/dist/api/board-label.api.js +1 -2
  14. package/dist/api/board-label.api.js.map +1 -1
  15. package/dist/api/board.api.js +7 -5
  16. package/dist/api/board.api.js.map +1 -1
  17. package/dist/api/draw.api.js +1 -2
  18. package/dist/api/draw.api.js.map +1 -1
  19. package/dist/api/draw.public.api.js.map +1 -1
  20. package/dist/api/extraction-plan-preset.api.js +19 -6
  21. package/dist/api/extraction-plan-preset.api.js.map +1 -1
  22. package/dist/api/extraction-settings.api.js.map +1 -1
  23. package/dist/api/extraction.api.d.ts +2 -1
  24. package/dist/api/extraction.api.js +43 -82
  25. package/dist/api/extraction.api.js.map +1 -1
  26. package/dist/api/extraction.application.api.d.ts +4 -0
  27. package/dist/api/extraction.application.api.js +23 -0
  28. package/dist/api/extraction.application.api.js.map +1 -0
  29. package/dist/api/extraction.application.api.test.d.ts +1 -0
  30. package/dist/api/extraction.application.api.test.js +59 -0
  31. package/dist/api/extraction.application.api.test.js.map +1 -0
  32. package/dist/api/index.d.ts +1 -0
  33. package/dist/api/index.js +1 -0
  34. package/dist/api/index.js.map +1 -1
  35. package/dist/api/probe-scan.api.d.ts +2 -9
  36. package/dist/api/probe-scan.api.js +16 -26
  37. package/dist/api/probe-scan.api.js.map +1 -1
  38. package/dist/api/probe-scan.api.test.js +10 -0
  39. package/dist/api/probe-scan.api.test.js.map +1 -1
  40. package/dist/api/probe-scan.application.api.js +2 -2
  41. package/dist/api/probe-scan.application.api.js.map +1 -1
  42. package/dist/api/probe-scan.application.api.test.js +4 -0
  43. package/dist/api/probe-scan.application.api.test.js.map +1 -1
  44. package/dist/api/retrospective.api.js +2 -1
  45. package/dist/api/retrospective.api.js.map +1 -1
  46. package/dist/api/short-link.admin.api.js.map +1 -1
  47. package/dist/api/short-link.api.js.map +1 -1
  48. package/dist/api/short-link.public.api.js.map +1 -1
  49. package/dist/api/tag.api.js.map +1 -1
  50. package/dist/constants/atlas.constants.js +1 -1
  51. package/dist/constants/atlas.constants.js.map +1 -1
  52. package/dist/constants/extract.constants.d.ts +4 -0
  53. package/dist/constants/extract.constants.js +91 -0
  54. package/dist/constants/extract.constants.js.map +1 -0
  55. package/dist/constants/index.d.ts +1 -0
  56. package/dist/constants/index.js +1 -0
  57. package/dist/constants/index.js.map +1 -1
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +5 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/server-sent-events/server-sent-events.manager.d.ts +1 -2
  62. package/dist/server-sent-events/server-sent-events.manager.js +1 -2
  63. package/dist/server-sent-events/server-sent-events.manager.js.map +1 -1
  64. package/dist/types/enum/document-type.enum.d.ts +1 -0
  65. package/dist/types/enum/document-type.enum.js +1 -0
  66. package/dist/types/enum/document-type.enum.js.map +1 -1
  67. package/dist/types/enum/extract-field-format.enum.d.ts +7 -0
  68. package/dist/types/enum/extract-field-format.enum.js +12 -0
  69. package/dist/types/enum/extract-field-format.enum.js.map +1 -0
  70. package/dist/types/enum/extract-field-key.enum.d.ts +59 -0
  71. package/dist/types/enum/extract-field-key.enum.js +64 -0
  72. package/dist/types/enum/extract-field-key.enum.js.map +1 -0
  73. package/dist/types/enum/extraction-warning.enum.d.ts +4 -1
  74. package/dist/types/enum/extraction-warning.enum.js +3 -0
  75. package/dist/types/enum/extraction-warning.enum.js.map +1 -1
  76. package/dist/types/enum/index.d.ts +2 -0
  77. package/dist/types/enum/index.js +2 -0
  78. package/dist/types/enum/index.js.map +1 -1
  79. package/dist/types/enum/rcb-bank.enum.js +252 -36
  80. package/dist/types/enum/rcb-bank.enum.js.map +1 -1
  81. package/dist/types/interface/api/requests/abyss.admin.request.d.ts +1 -1
  82. package/dist/types/interface/api/requests/atlas-document.request.d.ts +6 -0
  83. package/dist/types/interface/api/requests/board-card-document.request.d.ts +1 -0
  84. package/dist/types/interface/api/requests/extraction.request.d.ts +12 -0
  85. package/dist/types/interface/api/responses/atlas-document.response.d.ts +6 -4
  86. package/dist/types/interface/api/responses/board-card-document.response.d.ts +2 -4
  87. package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js +8 -2
  88. package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js.map +1 -1
  89. package/dist/types/interface/models/extraction-plan.dto.test.js +6 -1
  90. package/dist/types/interface/models/extraction-plan.dto.test.js.map +1 -1
  91. package/dist/types/interface/models/extraction-spatial-template.dto.test.js +20 -3
  92. package/dist/types/interface/models/extraction-spatial-template.dto.test.js.map +1 -1
  93. package/dist/types/interface/models/extraction.dto.d.ts +13 -0
  94. package/dist/types/interface/models/extraction.dto.js.map +1 -1
  95. package/dist/types/interface/models/index.d.ts +1 -0
  96. package/dist/types/interface/models/index.js +1 -0
  97. package/dist/types/interface/models/index.js.map +1 -1
  98. package/dist/types/interface/models/project.dto.d.ts +1 -1
  99. package/dist/types/interface/models/short-link.dto.d.ts +8 -0
  100. package/dist/types/interface/models/upload-session.dto.d.ts +8 -0
  101. package/dist/types/interface/models/upload-session.dto.js +3 -0
  102. package/dist/types/interface/models/upload-session.dto.js.map +1 -0
  103. package/dist/types/interface/models/user.dto.d.ts +1 -0
  104. package/package.json +12 -14
  105. package/src/api/atlas-document.api.ts +20 -3
  106. package/src/api/atlas-group.api.ts +4 -1
  107. package/src/api/atlas-page.api.ts +12 -6
  108. package/src/api/atlas.api.ts +12 -7
  109. package/src/api/atlas.public.api.ts +3 -1
  110. package/src/api/board-card.api.ts +6 -3
  111. package/src/api/board-column.api.ts +4 -1
  112. package/src/api/board-label.api.ts +7 -3
  113. package/src/api/board.api.ts +19 -10
  114. package/src/api/draw.api.ts +16 -12
  115. package/src/api/draw.public.api.ts +3 -1
  116. package/src/api/extraction-plan-preset.api.ts +64 -18
  117. package/src/api/extraction-settings.api.ts +2 -8
  118. package/src/api/extraction.api.ts +82 -84
  119. package/src/api/extraction.application.api.test.ts +55 -0
  120. package/src/api/extraction.application.api.ts +73 -0
  121. package/src/api/index.ts +1 -0
  122. package/src/api/probe-scan.api.test.ts +26 -0
  123. package/src/api/probe-scan.api.ts +66 -54
  124. package/src/api/probe-scan.application.api.test.ts +14 -0
  125. package/src/api/probe-scan.application.api.ts +5 -5
  126. package/src/api/retrospective.api.ts +8 -5
  127. package/src/api/short-link.admin.api.ts +14 -4
  128. package/src/api/short-link.api.ts +39 -17
  129. package/src/api/short-link.public.api.ts +25 -11
  130. package/src/api/tag.api.ts +3 -1
  131. package/src/constants/atlas.constants.ts +1 -1
  132. package/src/constants/extract.constants.ts +109 -0
  133. package/src/constants/index.ts +1 -0
  134. package/src/index.ts +19 -0
  135. package/src/server-sent-events/server-sent-events.manager.ts +5 -3
  136. package/src/types/enum/document-type.enum.ts +1 -0
  137. package/src/types/enum/extract-field-format.enum.ts +16 -0
  138. package/src/types/enum/extract-field-key.enum.ts +77 -0
  139. package/src/types/enum/extraction-warning.enum.ts +57 -0
  140. package/src/types/enum/index.ts +2 -0
  141. package/src/types/enum/rcb-bank.enum.ts +255 -41
  142. package/src/types/interface/api/requests/abyss.admin.request.ts +2 -1
  143. package/src/types/interface/api/requests/atlas-document.request.ts +14 -0
  144. package/src/types/interface/api/requests/board-card-document.request.ts +5 -0
  145. package/src/types/interface/api/requests/extraction.request.ts +22 -0
  146. package/src/types/interface/api/requests/probe-scan.request.ts +5 -1
  147. package/src/types/interface/api/responses/atlas-document.response.ts +11 -4
  148. package/src/types/interface/api/responses/board-card-document.response.ts +5 -4
  149. package/src/types/interface/api/responses/retrospective.response.ts +2 -1
  150. package/src/types/interface/models/content-share.dto.ts +5 -1
  151. package/src/types/interface/models/extraction-fetched-provenance.dto.test.ts +20 -9
  152. package/src/types/interface/models/extraction-plan.dto.test.ts +17 -4
  153. package/src/types/interface/models/extraction-spatial-template.dto.test.ts +26 -5
  154. package/src/types/interface/models/extraction.dto.ts +35 -0
  155. package/src/types/interface/models/index.ts +1 -0
  156. package/src/types/interface/models/probe-webhook.dto.ts +3 -4
  157. package/src/types/interface/models/project.dto.ts +2 -1
  158. package/src/types/interface/models/short-link.dto.ts +2 -0
  159. package/src/types/interface/models/upload-session.dto.ts +24 -0
  160. package/src/types/interface/models/user.dto.ts +3 -0
  161. package/tsconfig.check.json +15 -0
@@ -6,13 +6,20 @@
6
6
  // add no extra path segment (`@Controller({ prefixPath: '/scan' })`), so
7
7
  // these calls hit `scan`/`scan/:id` directly — no `probe/` prefix.
8
8
  //
9
- // File-upload dual environment handling (browser `FormData`/`Blob` vs Node
10
- // `Buffer`/stream + the `form-data` package) mirrors this package's own
11
- // extraction.api.ts (`detect`/`postExtract`): AbyssProbe is meant to be
12
- // called from the abyss-main UI (a browser) as well as from Node services
13
- // (abyss-storage, external integrators). `form-data` is lazy-`require`d
14
- // (never statically imported) so a browser bundle never tries to resolve
15
- // the Node-only package.
9
+ // Multipart bodies are built with the global `FormData` + `Blob` — the same
10
+ // code in a browser and on Node, mirroring this package's own
11
+ // extraction.api.ts. axios serializes a spec-compliant FormData on both and
12
+ // sets the multipart boundary itself, so no content-type header is ever set by
13
+ // hand. AbyssProbe is called from the abyss-main UI (a browser) as well as
14
+ // from Node services (abyss-storage, external integrators).
15
+ //
16
+ // A Node caller holding a file ON DISK passes `await fs.openAsBlob(path)`,
17
+ // which requires Node >= 19.8 — hence `engines.node` in package.json.
18
+ // `FormData` and `Blob` alone would only need Node 18, but openAsBlob is this
19
+ // client's documented way to send a file, and promising 18.x only to fail at
20
+ // runtime is worse than refusing the install. A caller that already holds its
21
+ // bytes passes a `Buffer`/`Uint8Array` and has no such constraint (see
22
+ // {@link ProbeScanFileInput}).
16
23
  //
17
24
  // `authHeader`/`serializeProbeQuery` are kept LOCAL and unexported (not a
18
25
  // shared utils file) — same convention as every other extract/*.api.ts file
@@ -61,60 +68,65 @@ function serializeProbeQuery<T extends object>(query: T): Record<string, unknown
61
68
  return out;
62
69
  }
63
70
 
64
- /** Anything `sdk.probe.scan` accepts as the file to submit. */
65
- export type ProbeScanFileInput = Buffer | Uint8Array | NodeJS.ReadableStream | Blob;
66
-
67
- function isBrowserEnv(): boolean {
68
- return typeof window !== 'undefined' && typeof FormData !== 'undefined';
69
- }
70
-
71
- async function loadNodeFormData(): Promise<any> {
72
- // Indirect eval so bundlers (esbuild/vite/webpack) do not try to resolve
73
- // the Node-only "form-data" package when this file is included in a
74
- // browser bundle. The require only ever runs at runtime on Node.
75
- // eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
76
- const nodeRequire: NodeRequire = new Function('return require')();
77
- return nodeRequire('form-data');
78
- }
71
+ /**
72
+ * Anything `sdk.probe.scan` accepts as the file to submit.
73
+ *
74
+ * `Blob` covers the browser's `File` (a `Blob` subclass) and, on Node, a
75
+ * FILE-BACKED blob from `await fs.openAsBlob(path)` (Node >= 19.8): its bytes
76
+ * are read from disk as the request body is written, so scanning a file at the
77
+ * 2 GiB ceiling never holds the file in memory. `Uint8Array` (and therefore
78
+ * `Buffer`) is for a caller that already holds the bytes.
79
+ *
80
+ * A Node `Readable` is NOT accepted. The body is a spec `FormData`, whose
81
+ * parts must have a known length, so a stream could only be honoured by
82
+ * buffering it whole — precisely what a 2 GiB scan must not do. A caller
83
+ * holding a path passes `await fs.openAsBlob(path)` instead.
84
+ */
85
+ export type ProbeScanFileInput = Blob | Uint8Array;
79
86
 
80
- export interface BuiltScanForm {
81
- form: unknown;
82
- headers: Record<string, string>;
87
+ /**
88
+ * The file as one multipart part.
89
+ *
90
+ * A `Blob` is used as-is, keeping whatever streaming its implementation gives
91
+ * (a file-backed `openAsBlob` reads from disk lazily); raw bytes are wrapped
92
+ * in a `Blob` carrying `mimeType`. `Buffer` is never named here — this code
93
+ * also runs in a browser bundle, where the global does not exist — and
94
+ * `Buffer` is a `Uint8Array` subclass, so the check below already covers it.
95
+ *
96
+ * Anything else is refused with an actionable message. Until 2.12.0 the same
97
+ * call died on Node with `ReferenceError: require is not defined`, thrown by a
98
+ * `form-data` loader before any request was made (#519): it named neither the
99
+ * cause nor the fix.
100
+ */
101
+ function toScanFilePart(file: ProbeScanFileInput, mimeType?: string): Blob {
102
+ if (file instanceof Blob) return file;
103
+ if (file instanceof Uint8Array) return new Blob([file], { type: mimeType ?? '' });
104
+
105
+ const isStream = typeof (file as { pipe?: unknown } | null | undefined)?.pipe === 'function';
106
+ throw new TypeError(
107
+ `A probe scan file must be a Blob (a browser File, or fs.openAsBlob(path) on Node), ` +
108
+ `a Buffer or a Uint8Array — received ${isStream ? 'a stream' : typeof file}. ` +
109
+ `On Node, pass \`await fs.openAsBlob(path)\`: a file-backed Blob is streamed from ` +
110
+ `disk, so the file is never buffered in memory.`,
111
+ );
83
112
  }
84
113
 
85
114
  /**
86
115
  * Exported (not just this file's own `scan` internals) so
87
116
  * probe-scan.application.api.ts reuses this EXACT multipart-building logic
88
- * (browser `FormData`/`Blob` vs Node `Buffer`/stream + lazy-required
89
- * `form-data`) rather than duplicating it — the file-upload contract is
90
- * identical for a personal/org caller and an application caller; only the
91
- * URL/auth differ (see that file's header comment).
117
+ * rather than duplicating it — the file-upload contract is identical for a
118
+ * personal/org caller and an application caller; only the URL/auth differ
119
+ * (see that file's header comment).
120
+ *
121
+ * Returns the form alone: axios sets the multipart content type, boundary
122
+ * included, so there is no header for the caller to merge in.
92
123
  */
93
- export async function buildScanForm(
94
- file: ProbeScanFileInput,
95
- options: IScanOptions,
96
- ): Promise<BuiltScanForm> {
97
- const filename = options.filename ?? 'file';
98
-
99
- if (isBrowserEnv()) {
100
- const form = new FormData();
101
- const blob =
102
- file instanceof Blob ? file : new Blob([file as BlobPart], { type: options.mimeType });
103
- form.append('file', blob, filename);
104
- if (options.context) form.append('context', JSON.stringify(options.context));
105
- if (options.callbackUrl) form.append('callbackUrl', options.callbackUrl);
106
- return { form, headers: {} };
107
- }
108
-
109
- const FormDataCtor = await loadNodeFormData();
110
- const form = new FormDataCtor();
111
- const filePart =
112
- Buffer.isBuffer(file) || file instanceof Uint8Array ? Buffer.from(file as Uint8Array) : file;
113
- form.append('file', filePart, { filename, contentType: options.mimeType });
124
+ export function buildScanForm(file: ProbeScanFileInput, options: IScanOptions): FormData {
125
+ const form = new FormData();
126
+ form.append('file', toScanFilePart(file, options.mimeType), options.filename ?? 'file');
114
127
  if (options.context) form.append('context', JSON.stringify(options.context));
115
128
  if (options.callbackUrl) form.append('callbackUrl', options.callbackUrl);
116
- const headers = typeof form.getHeaders === 'function' ? form.getHeaders() : {};
117
- return { form, headers };
129
+ return form;
118
130
  }
119
131
 
120
132
  /**
@@ -134,11 +146,11 @@ export const scan = async (
134
146
  options: IScanOptions = {},
135
147
  apiKey?: string,
136
148
  ): Promise<IScanResponse> => {
137
- const { form, headers } = await buildScanForm(file, options);
149
+ const form = buildScanForm(file, options);
138
150
  return (
139
151
  await AbyssToolsCore.axios.post<IScanResponse>('scan', form, {
140
152
  params: serializeProbeQuery({ mode: options.mode, organizationId: options.organizationId }),
141
- headers: { ...headers, ...authHeader(apiKey) },
153
+ headers: authHeader(apiKey),
142
154
  maxBodyLength: Infinity,
143
155
  maxContentLength: Infinity,
144
156
  })
@@ -18,4 +18,18 @@ void _scanAsync;
18
18
  void _getScan;
19
19
  void _listScans;
20
20
 
21
+ // The application client takes the SAME file input as the personal one (it
22
+ // reuses buildScanForm verbatim) — abyss-storage, its main caller, hands over
23
+ // `await fs.openAsBlob(path)`. A stream is refused at compile time (#519); see
24
+ // probe-scan.api.test.ts for the full input matrix.
25
+ declare const blob: Blob;
26
+ declare const stream: NodeJS.ReadableStream;
27
+
28
+ const _fromBlob: Parameters<typeof api.scanSyncApplication>[1] = blob;
29
+ // @ts-expect-error a Readable stream is not an accepted scan input since 2.12.0
30
+ const _fromStream: Parameters<typeof api.scanSyncApplication>[1] = stream;
31
+
32
+ void _fromBlob;
33
+ void _fromStream;
34
+
21
35
  export {};
@@ -8,9 +8,9 @@
8
8
  // (abyss-storage, external integrations) authenticating with a project API
9
9
  // key instead of a personal/org session.
10
10
  //
11
- // Reuses probe-scan.api.ts's `buildScanForm` (same dual-environment
12
- // multipart handling — browser `FormData`/`Blob` vs Node `Buffer`/stream +
13
- // lazy-required `form-data`) and every request/response TYPE verbatim
11
+ // Reuses probe-scan.api.ts's `buildScanForm` (the global `FormData` + `Blob`,
12
+ // one code path for the browser and for Node — see that file's header for what
13
+ // a Node caller passes) and every request/response TYPE verbatim
14
14
  // (`IScanOptions`, `IListScansQuery`, `IScanResponse`, `IScanSyncResponse`,
15
15
  // `IScanAsyncResponse`, `IGetScanResponse`, `IPaginateScanResponse`) — never
16
16
  // redefined here. `organizationId` is `Omit`'d from every option/query type
@@ -79,11 +79,11 @@ export const scanApplication = async (
79
79
  options: Omit<IScanOptions, 'organizationId'> = {},
80
80
  applicationApiKey?: string,
81
81
  ): Promise<IScanResponse> => {
82
- const { form, headers } = await buildScanForm(file, options);
82
+ const form = buildScanForm(file, options);
83
83
  return (
84
84
  await AbyssToolsCore.axios.post<IScanResponse>(`application/${applicationId}/scan`, form, {
85
85
  params: serializeProbeQuery({ mode: options.mode }),
86
- headers: { ...headers, ...authHeaderApplication(applicationApiKey) },
86
+ headers: authHeaderApplication(applicationApiKey),
87
87
  maxBodyLength: Infinity,
88
88
  maxContentLength: Infinity,
89
89
  })
@@ -23,7 +23,9 @@ export const getRetrospective = async (
23
23
  params: IGetRetrospectiveParams,
24
24
  ): Promise<IGetRetrospectiveResponse> => {
25
25
  return (
26
- await AbyssToolsCore.axios.get<IGetRetrospectiveResponse>(`retrospective/${params.retrospectiveId}`)
26
+ await AbyssToolsCore.axios.get<IGetRetrospectiveResponse>(
27
+ `retrospective/${params.retrospectiveId}`,
28
+ )
27
29
  ).data;
28
30
  };
29
31
 
@@ -52,7 +54,8 @@ export const paginateRetrospective = async (
52
54
  export const createRetrospective = async (
53
55
  body: ICreateRetrospectiveBody,
54
56
  ): Promise<ICreateRetrospectiveResponse> => {
55
- return (await AbyssToolsCore.axios.post<ICreateRetrospectiveResponse>(`retrospective`, body)).data;
57
+ return (await AbyssToolsCore.axios.post<ICreateRetrospectiveResponse>(`retrospective`, body))
58
+ .data;
56
59
  };
57
60
 
58
61
  export const createForOrganizationRetrospective = async (
@@ -113,9 +116,9 @@ export const transferRetrospective = async (
113
116
  ).data;
114
117
  };
115
118
 
116
- export const countOrganizationRetrospective = async (
117
- params: { organizationId: string },
118
- ): Promise<ICountOrganizationResponse> => {
119
+ export const countOrganizationRetrospective = async (params: {
120
+ organizationId: string;
121
+ }): Promise<ICountOrganizationResponse> => {
119
122
  return (
120
123
  await AbyssToolsCore.axios.get<ICountOrganizationResponse>(
121
124
  `retrospective/organization/${params.organizationId}/count`,
@@ -15,12 +15,17 @@ export const shortLinkAdminApi = {
15
15
  paginate: async (
16
16
  query: IPaginateShortLinkAdminQuery,
17
17
  ): Promise<IPaginateShortLinkAdminResponse> => {
18
- const response = await AbyssToolsCore.axios.get<IPaginateShortLinkAdminResponse>('/admin/short-link/paginate', { params: query });
18
+ const response = await AbyssToolsCore.axios.get<IPaginateShortLinkAdminResponse>(
19
+ '/admin/short-link/paginate',
20
+ { params: query },
21
+ );
19
22
  return response.data;
20
23
  },
21
24
 
22
25
  get: async (params: IGetShortLinkAdminParams): Promise<IGetShortLinkAdminResponse> => {
23
- const response = await AbyssToolsCore.axios.get<IGetShortLinkAdminResponse>(`/admin/short-link/${params.shortLinkId}`);
26
+ const response = await AbyssToolsCore.axios.get<IGetShortLinkAdminResponse>(
27
+ `/admin/short-link/${params.shortLinkId}`,
28
+ );
24
29
  return response.data;
25
30
  },
26
31
 
@@ -28,12 +33,17 @@ export const shortLinkAdminApi = {
28
33
  params: IUpdateShortLinkAdminParams,
29
34
  body: IUpdateShortLinkAdminBody,
30
35
  ): Promise<IUpdateShortLinkAdminResponse> => {
31
- const response = await AbyssToolsCore.axios.put<IUpdateShortLinkAdminResponse>(`/admin/short-link/${params.shortLinkId}`, body);
36
+ const response = await AbyssToolsCore.axios.put<IUpdateShortLinkAdminResponse>(
37
+ `/admin/short-link/${params.shortLinkId}`,
38
+ body,
39
+ );
32
40
  return response.data;
33
41
  },
34
42
 
35
43
  delete: async (params: IDeleteShortLinkAdminParams): Promise<IDeleteShortLinkAdminResponse> => {
36
- const response = await AbyssToolsCore.axios.delete<IDeleteShortLinkAdminResponse>(`/admin/short-link/${params.shortLinkId}`);
44
+ const response = await AbyssToolsCore.axios.delete<IDeleteShortLinkAdminResponse>(
45
+ `/admin/short-link/${params.shortLinkId}`,
46
+ );
37
47
  return response.data;
38
48
  },
39
49
  };
@@ -27,12 +27,17 @@ import type {
27
27
 
28
28
  export const shortLinkApi = {
29
29
  get: async (params: IGetShortLinkParams): Promise<IGetShortLinkResponse> => {
30
- const response = await AbyssToolsCore.axios.get<IGetShortLinkResponse>(`/short-link/${params.shortLinkId}`);
30
+ const response = await AbyssToolsCore.axios.get<IGetShortLinkResponse>(
31
+ `/short-link/${params.shortLinkId}`,
32
+ );
31
33
  return response.data;
32
34
  },
33
35
 
34
36
  paginate: async (query: IPaginateShortLinkQuery): Promise<IPaginateShortLinkResponse> => {
35
- const response = await AbyssToolsCore.axios.get<IPaginateShortLinkResponse>('/short-link/paginate', { params: query });
37
+ const response = await AbyssToolsCore.axios.get<IPaginateShortLinkResponse>(
38
+ '/short-link/paginate',
39
+ { params: query },
40
+ );
36
41
  return response.data;
37
42
  },
38
43
 
@@ -40,9 +45,12 @@ export const shortLinkApi = {
40
45
  params: IPaginateProjectShortLinkParams,
41
46
  query: IPaginateShortLinkQuery,
42
47
  ): Promise<IPaginateShortLinkResponse> => {
43
- const response = await AbyssToolsCore.axios.get<IPaginateShortLinkResponse>(`/short-link/project/${params.projectId}/paginate`, {
44
- params: query,
45
- });
48
+ const response = await AbyssToolsCore.axios.get<IPaginateShortLinkResponse>(
49
+ `/short-link/project/${params.projectId}/paginate`,
50
+ {
51
+ params: query,
52
+ },
53
+ );
46
54
  return response.data;
47
55
  },
48
56
 
@@ -55,7 +63,10 @@ export const shortLinkApi = {
55
63
  params: ICreateForOrganizationShortLinkParams,
56
64
  body: ICreateShortLinkBody,
57
65
  ): Promise<ICreateShortLinkResponse> => {
58
- const response = await AbyssToolsCore.axios.post<ICreateShortLinkResponse>(`/short-link/organization/${params.organizationId}`, body);
66
+ const response = await AbyssToolsCore.axios.post<ICreateShortLinkResponse>(
67
+ `/short-link/organization/${params.organizationId}`,
68
+ body,
69
+ );
59
70
  return response.data;
60
71
  },
61
72
 
@@ -63,12 +74,17 @@ export const shortLinkApi = {
63
74
  params: IUpdateShortLinkParams,
64
75
  body: IUpdateShortLinkBody,
65
76
  ): Promise<IUpdateShortLinkResponse> => {
66
- const response = await AbyssToolsCore.axios.put<IUpdateShortLinkResponse>(`/short-link/${params.shortLinkId}`, body);
77
+ const response = await AbyssToolsCore.axios.put<IUpdateShortLinkResponse>(
78
+ `/short-link/${params.shortLinkId}`,
79
+ body,
80
+ );
67
81
  return response.data;
68
82
  },
69
83
 
70
84
  delete: async (params: IDeleteShortLinkParams): Promise<IDeleteShortLinkResponse> => {
71
- const response = await AbyssToolsCore.axios.delete<IDeleteShortLinkResponse>(`/short-link/${params.shortLinkId}`);
85
+ const response = await AbyssToolsCore.axios.delete<IDeleteShortLinkResponse>(
86
+ `/short-link/${params.shortLinkId}`,
87
+ );
72
88
  return response.data;
73
89
  },
74
90
 
@@ -76,9 +92,12 @@ export const shortLinkApi = {
76
92
  params: IGetStatsShortLinkParams,
77
93
  query?: IGetStatsShortLinkQuery,
78
94
  ): Promise<IGetStatsShortLinkResponse> => {
79
- const response = await AbyssToolsCore.axios.get<IGetStatsShortLinkResponse>(`/short-link/${params.shortLinkId}/stats`, {
80
- params: query,
81
- });
95
+ const response = await AbyssToolsCore.axios.get<IGetStatsShortLinkResponse>(
96
+ `/short-link/${params.shortLinkId}/stats`,
97
+ {
98
+ params: query,
99
+ },
100
+ );
82
101
  return response.data;
83
102
  },
84
103
 
@@ -86,9 +105,12 @@ export const shortLinkApi = {
86
105
  params: IGetClicksShortLinkParams,
87
106
  query?: IGetClicksShortLinkQuery,
88
107
  ): Promise<IGetClicksShortLinkResponse> => {
89
- const response = await AbyssToolsCore.axios.get<IGetClicksShortLinkResponse>(`/short-link/${params.shortLinkId}/clicks`, {
90
- params: query,
91
- });
108
+ const response = await AbyssToolsCore.axios.get<IGetClicksShortLinkResponse>(
109
+ `/short-link/${params.shortLinkId}/clicks`,
110
+ {
111
+ params: query,
112
+ },
113
+ );
92
114
  return response.data;
93
115
  },
94
116
 
@@ -114,9 +136,9 @@ export const shortLinkApi = {
114
136
  return response.data;
115
137
  },
116
138
 
117
- countOrganization: async (
118
- params: { organizationId: string },
119
- ): Promise<ICountOrganizationResponse> => {
139
+ countOrganization: async (params: {
140
+ organizationId: string;
141
+ }): Promise<ICountOrganizationResponse> => {
120
142
  const response = await AbyssToolsCore.axios.get<ICountOrganizationResponse>(
121
143
  `/short-link/organization/${params.organizationId}/count`,
122
144
  );
@@ -19,7 +19,10 @@ export const shortLinkPublicApi = {
19
19
  createAnonymous: async (
20
20
  body: ICreateAnonymousShortLinkPublicBody,
21
21
  ): Promise<ICreateShortLinkPublicResponse> => {
22
- const response = await AbyssToolsCore.axios.post<ICreateShortLinkPublicResponse>('/short-link/public', body);
22
+ const response = await AbyssToolsCore.axios.post<ICreateShortLinkPublicResponse>(
23
+ '/short-link/public',
24
+ body,
25
+ );
23
26
  return response.data;
24
27
  },
25
28
 
@@ -27,9 +30,12 @@ export const shortLinkPublicApi = {
27
30
  params: IRedirectShortLinkPublicParams,
28
31
  query?: IRedirectShortLinkPublicQuery,
29
32
  ): Promise<IRedirectShortLinkPublicResponse> => {
30
- const response = await AbyssToolsCore.axios.get<IRedirectShortLinkPublicResponse>(`/short-link/public/redirect/${params.slug}`, {
31
- params: query,
32
- });
33
+ const response = await AbyssToolsCore.axios.get<IRedirectShortLinkPublicResponse>(
34
+ `/short-link/public/redirect/${params.slug}`,
35
+ {
36
+ params: query,
37
+ },
38
+ );
33
39
  return response.data;
34
40
  },
35
41
 
@@ -37,9 +43,12 @@ export const shortLinkPublicApi = {
37
43
  params: IGetStatsShortLinkPublicParams,
38
44
  query?: IGetStatsShortLinkPublicQuery,
39
45
  ): Promise<IGetStatsShortLinkPublicResponse> => {
40
- const response = await AbyssToolsCore.axios.get<IGetStatsShortLinkPublicResponse>(`/short-link/public/${params.shortLinkId}/stats`, {
41
- params: query,
42
- });
46
+ const response = await AbyssToolsCore.axios.get<IGetStatsShortLinkPublicResponse>(
47
+ `/short-link/public/${params.shortLinkId}/stats`,
48
+ {
49
+ params: query,
50
+ },
51
+ );
43
52
  return response.data;
44
53
  },
45
54
 
@@ -47,14 +56,19 @@ export const shortLinkPublicApi = {
47
56
  params: IGetClicksShortLinkPublicParams,
48
57
  query?: IGetClicksShortLinkPublicQuery,
49
58
  ): Promise<IGetClicksShortLinkPublicResponse> => {
50
- const response = await AbyssToolsCore.axios.get<IGetClicksShortLinkPublicResponse>(`/short-link/public/${params.shortLinkId}/clicks`, {
51
- params: query,
52
- });
59
+ const response = await AbyssToolsCore.axios.get<IGetClicksShortLinkPublicResponse>(
60
+ `/short-link/public/${params.shortLinkId}/clicks`,
61
+ {
62
+ params: query,
63
+ },
64
+ );
53
65
  return response.data;
54
66
  },
55
67
 
56
68
  renew: async (params: IRenewShortLinkPublicParams): Promise<IRenewShortLinkPublicResponse> => {
57
- const response = await AbyssToolsCore.axios.post<IRenewShortLinkPublicResponse>(`/short-link/public/${params.shortLinkId}/renew`);
69
+ const response = await AbyssToolsCore.axios.post<IRenewShortLinkPublicResponse>(
70
+ `/short-link/public/${params.shortLinkId}/renew`,
71
+ );
58
72
  return response.data;
59
73
  },
60
74
  };
@@ -63,7 +63,9 @@ export const getTagStats = async (query?: ITagStatsQuery): Promise<ITagStatsResp
63
63
  return (await AbyssToolsCore.axios.get<ITagStatsResponse>('tag/stats', { params: query })).data;
64
64
  };
65
65
 
66
- export const getEntityTags = async (params: IGetEntityTagsParams): Promise<IGetEntityTagsResponse> => {
66
+ export const getEntityTags = async (
67
+ params: IGetEntityTagsParams,
68
+ ): Promise<IGetEntityTagsResponse> => {
67
69
  return (
68
70
  await AbyssToolsCore.axios.get<IGetEntityTagsResponse>(
69
71
  `${params.entityType}/${params.entityId}/tags`,
@@ -1,2 +1,2 @@
1
1
  export const MAX_DOCUMENTS_PER_ATLAS_PAGE = 20;
2
- export const MAX_ATLAS_DOCUMENT_SIZE_OCTET = 20 * 1024 * 1024; // 20 MB
2
+ export const MAX_ATLAS_DOCUMENT_SIZE_OCTET = 100 * 1024 * 1024; // 100 MB
@@ -0,0 +1,109 @@
1
+ import { DocumentType } from '../types/enum/document-type.enum';
2
+ import { ExtractFieldFormat } from '../types/enum/extract-field-format.enum';
3
+ import { ExtractFieldKey } from '../types/enum/extract-field-key.enum';
4
+
5
+ const { AMOUNT, DATE, PERCENT, BOOLEAN, TEXT } = ExtractFieldFormat;
6
+
7
+ // ──────────────────────────────────────────────
8
+ // EXTRACT_PUBLISHABLE_FIELDS — the fields the built-in algorithmic
9
+ // interpreter of AbyssExtract can publish, per document type, with the format
10
+ // of their value. A field listed here may be absent from a given result (not
11
+ // found, or below its publish floor); a field not listed here is never
12
+ // published for that type by that interpreter. A learned template
13
+ // (spatial-template interpreter) publishes the keys its client defined, on any
14
+ // type.
15
+ //
16
+ // One exception: a valid machine-readable zone publishes its fields and
17
+ // `mrzValid` whatever the document type (listed here under `id_card` only).
18
+ //
19
+ // `generic` is absent: its fields are defined by the client. The extraction API
20
+ // tests that this list equals what its engine serves, type by type.
21
+ // ──────────────────────────────────────────────
22
+ export const EXTRACT_PUBLISHABLE_FIELDS: Readonly<
23
+ Record<
24
+ Exclude<DocumentType, DocumentType.GENERIC>,
25
+ Readonly<Partial<Record<ExtractFieldKey, ExtractFieldFormat>>>
26
+ >
27
+ > = Object.freeze({
28
+ [DocumentType.BANK_STATEMENT]: Object.freeze({
29
+ [ExtractFieldKey.IBAN]: TEXT,
30
+ [ExtractFieldKey.BIC]: TEXT,
31
+ [ExtractFieldKey.BANK_NAME]: TEXT,
32
+ [ExtractFieldKey.OPENING_BALANCE]: AMOUNT,
33
+ [ExtractFieldKey.CLOSING_BALANCE]: AMOUNT,
34
+ [ExtractFieldKey.PERIOD_START]: DATE,
35
+ [ExtractFieldKey.PERIOD_END]: DATE,
36
+ [ExtractFieldKey.CURRENCY]: TEXT,
37
+ }),
38
+ [DocumentType.INVOICE]: Object.freeze({
39
+ [ExtractFieldKey.TOTAL_TTC]: AMOUNT,
40
+ [ExtractFieldKey.TOTAL_HT]: AMOUNT,
41
+ [ExtractFieldKey.TOTAL_VAT]: AMOUNT,
42
+ [ExtractFieldKey.INVOICE_DATE]: DATE,
43
+ [ExtractFieldKey.DUE_DATE]: DATE,
44
+ [ExtractFieldKey.INVOICE_NUMBER]: TEXT,
45
+ [ExtractFieldKey.SUPPLIER]: TEXT,
46
+ [ExtractFieldKey.SUPPLIER_LEGAL_NAME]: TEXT,
47
+ [ExtractFieldKey.MARKETPLACE]: TEXT,
48
+ [ExtractFieldKey.SIRET]: TEXT,
49
+ [ExtractFieldKey.SIREN]: TEXT,
50
+ [ExtractFieldKey.VAT_NUMBER]: TEXT,
51
+ [ExtractFieldKey.IBAN]: TEXT,
52
+ [ExtractFieldKey.BIC]: TEXT,
53
+ [ExtractFieldKey.CURRENCY]: TEXT,
54
+ }),
55
+ [DocumentType.RECEIPT]: Object.freeze({
56
+ [ExtractFieldKey.TOTAL]: AMOUNT,
57
+ [ExtractFieldKey.VAT]: AMOUNT,
58
+ [ExtractFieldKey.DATE]: DATE,
59
+ [ExtractFieldKey.MERCHANT]: TEXT,
60
+ [ExtractFieldKey.CURRENCY]: TEXT,
61
+ }),
62
+ [DocumentType.ID_CARD]: Object.freeze({
63
+ [ExtractFieldKey.LAST_NAME]: TEXT,
64
+ [ExtractFieldKey.FIRST_NAMES]: TEXT,
65
+ [ExtractFieldKey.BIRTH_DATE]: DATE,
66
+ [ExtractFieldKey.EXPIRY_DATE]: DATE,
67
+ [ExtractFieldKey.ISSUE_DATE]: DATE,
68
+ [ExtractFieldKey.DOCUMENT_NUMBER]: TEXT,
69
+ [ExtractFieldKey.SEX]: TEXT,
70
+ [ExtractFieldKey.NATIONALITY]: TEXT,
71
+ [ExtractFieldKey.ISSUING_COUNTRY]: TEXT,
72
+ [ExtractFieldKey.DOCUMENT_KIND]: TEXT,
73
+ [ExtractFieldKey.MRZ_VALID]: BOOLEAN,
74
+ }),
75
+ [DocumentType.RIB]: Object.freeze({
76
+ [ExtractFieldKey.IBAN]: TEXT,
77
+ [ExtractFieldKey.BIC]: TEXT,
78
+ [ExtractFieldKey.HOLDER_NAME]: TEXT,
79
+ [ExtractFieldKey.BANK_NAME]: TEXT,
80
+ }),
81
+ [DocumentType.FINANCIAL_STATEMENT]: Object.freeze({
82
+ [ExtractFieldKey.COMPANY]: TEXT,
83
+ [ExtractFieldKey.SIREN]: TEXT,
84
+ [ExtractFieldKey.REGISTRATION_NUMBER]: TEXT,
85
+ [ExtractFieldKey.FISCAL_YEAR_END]: DATE,
86
+ [ExtractFieldKey.TOTAL_ACTIF]: AMOUNT,
87
+ [ExtractFieldKey.TOTAL_PASSIF]: AMOUNT,
88
+ [ExtractFieldKey.FIXED_ASSETS]: AMOUNT,
89
+ [ExtractFieldKey.CURRENT_ASSETS]: AMOUNT,
90
+ [ExtractFieldKey.CREDITORS_WITHIN_ONE_YEAR]: AMOUNT,
91
+ [ExtractFieldKey.NET_CURRENT_LIABILITIES]: AMOUNT,
92
+ [ExtractFieldKey.TOTAL_ASSETS_LESS_CURRENT_LIABILITIES]: AMOUNT,
93
+ [ExtractFieldKey.NET_ASSETS]: AMOUNT,
94
+ [ExtractFieldKey.CALLED_UP_SHARE_CAPITAL]: AMOUNT,
95
+ [ExtractFieldKey.PROFIT_AND_LOSS_ACCOUNT]: AMOUNT,
96
+ [ExtractFieldKey.TOTAL_SHAREHOLDERS_FUNDS]: AMOUNT,
97
+ [ExtractFieldKey.CURRENCY]: TEXT,
98
+ }),
99
+ [DocumentType.PAYSLIP]: Object.freeze({
100
+ [ExtractFieldKey.EMPLOYER]: TEXT,
101
+ [ExtractFieldKey.PERIOD]: TEXT,
102
+ [ExtractFieldKey.GROSS_CENTS]: AMOUNT,
103
+ [ExtractFieldKey.NET_CENTS]: AMOUNT,
104
+ [ExtractFieldKey.NET_TAXABLE_CENTS]: AMOUNT,
105
+ [ExtractFieldKey.PAS_AMOUNT_CENTS]: AMOUNT,
106
+ [ExtractFieldKey.PAS_RATE_PCT]: PERCENT,
107
+ [ExtractFieldKey.CURRENCY]: TEXT,
108
+ }),
109
+ });
@@ -3,3 +3,4 @@ export * from './board.constants';
3
3
  export * from './short-link.constants';
4
4
  export * from './tag.constants';
5
5
  export * from './beam.constants';
6
+ export * from './extract.constants';
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ import * as metricsApi from './api/metrics.api';
28
28
  import * as organizationApi from './api/organization.api';
29
29
  import * as tagApi from './api/tag.api';
30
30
  import * as extractionApi from './api/extraction.api';
31
+ import * as extractionApplicationApi from './api/extraction.application.api';
31
32
  import * as extractionSettingsApi from './api/extraction-settings.api';
32
33
  import * as extractionPlanPresetApi from './api/extraction-plan-preset.api';
33
34
  import * as monitorApi from './api/monitor.api';
@@ -254,6 +255,7 @@ type AbyssToolsCoreSDK = {
254
255
  getUploadPreSignedUrl: typeof atlasDocumentApi.getUploadPreSignedUrlAtlasDocument;
255
256
  paginate: typeof atlasDocumentApi.paginateAtlasDocument;
256
257
  list: typeof atlasDocumentApi.listAtlasDocument;
258
+ getPublicAccessId: typeof atlasDocumentApi.getPublicAccessIdAtlasDocument;
257
259
  };
258
260
  shortLink: {
259
261
  get: typeof shortLinkApiModule.shortLinkApi.get;
@@ -405,6 +407,19 @@ type AbyssToolsCoreSDK = {
405
407
  run: typeof extractionApi.extractSync;
406
408
  runQueue: typeof extractionApi.extractQueue;
407
409
  runBulk: typeof extractionApi.extractBulk;
410
+ /**
411
+ * Application/API-key-auth counterpart — for a backend satellite (e.g.
412
+ * AbyssBanking) triggering a SYNCHRONOUS extraction server-side with its
413
+ * APPLICATION api key: the run is OWNED by the application and BILLED to
414
+ * its resolved owning organization (never an end user). Hits
415
+ * `/extract/application/:applicationId/extract`, authenticated with the
416
+ * `abyss-api-key-application` header ({@link API_KEY_APPLICATION_HEADER})
417
+ * instead of the personal `abyss-api-key`. Does NOT change the personal `run`.
418
+ */
419
+ application: {
420
+ /** `POST /extract/application/:applicationId/extract` — synchronous; owned + billed to the app's org. */
421
+ run: typeof extractionApplicationApi.runExtractionApplication;
422
+ };
408
423
  files: {
409
424
  list: typeof extractionApi.listFiles;
410
425
  listShared: typeof extractionApi.listSharedFiles;
@@ -696,6 +711,7 @@ export class AbyssToolsCore {
696
711
  getUploadPreSignedUrl: atlasDocumentApi.getUploadPreSignedUrlAtlasDocument,
697
712
  paginate: atlasDocumentApi.paginateAtlasDocument,
698
713
  list: atlasDocumentApi.listAtlasDocument,
714
+ getPublicAccessId: atlasDocumentApi.getPublicAccessIdAtlasDocument,
699
715
  },
700
716
  shortLink: {
701
717
  get: shortLinkApiModule.shortLinkApi.get,
@@ -823,6 +839,9 @@ export class AbyssToolsCore {
823
839
  run: extractionApi.extractSync,
824
840
  runQueue: extractionApi.extractQueue,
825
841
  runBulk: extractionApi.extractBulk,
842
+ application: {
843
+ run: extractionApplicationApi.runExtractionApplication,
844
+ },
826
845
  files: {
827
846
  list: extractionApi.listFiles,
828
847
  listShared: extractionApi.listSharedFiles,