@balena/pinejs 17.2.0-build-add-large-file-uploads-interfaces-79c46b87ed3b7ae630ed6e3f9aad554c6647e8f7-1 → 17.2.0-build-joshbwlng-tasks-2f4d8f53b469a2eb62ffb71cb3f9e82258e9430c-1
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/.pinejs-cache.json +1 -1
- package/.versionbot/CHANGELOG.yml +72 -4
- package/CHANGELOG.md +33 -2
- package/out/bin/utils.js +2 -2
- package/out/config-loader/config-loader.js +1 -1
- package/out/config-loader/env.d.ts +4 -1
- package/out/config-loader/env.js +5 -1
- package/out/config-loader/env.js.map +1 -1
- package/out/data-server/sbvr-server.d.ts +1 -1
- package/out/data-server/sbvr-server.js.map +1 -1
- package/out/database-layer/db.d.ts +3 -1
- package/out/database-layer/db.js +19 -2
- package/out/database-layer/db.js.map +1 -1
- package/out/extended-sbvr-parser/extended-sbvr-parser.d.ts +2 -2
- package/out/http-transactions/transactions.d.ts +1 -1
- package/out/http-transactions/transactions.js.map +1 -1
- package/out/migrator/utils.js +4 -4
- package/out/migrator/utils.js.map +1 -1
- package/out/passport-pinejs/passport-pinejs.d.ts +0 -1
- package/out/pinejs-session-store/pinejs-session-store.d.ts +6 -8
- package/out/sbvr-api/abstract-sql.d.ts +2 -2
- package/out/sbvr-api/errors.d.ts +2 -2
- package/out/sbvr-api/hooks.d.ts +5 -43
- package/out/sbvr-api/odata-response.d.ts +1 -1
- package/out/sbvr-api/odata-response.js +2 -2
- package/out/sbvr-api/odata-response.js.map +1 -1
- package/out/sbvr-api/permissions.d.ts +2 -2
- package/out/sbvr-api/permissions.js +2 -2
- package/out/sbvr-api/permissions.js.map +1 -1
- package/out/sbvr-api/sbvr-utils.d.ts +10 -11
- package/out/sbvr-api/sbvr-utils.js +4 -2
- package/out/sbvr-api/sbvr-utils.js.map +1 -1
- package/out/sbvr-api/uri-parser.d.ts +3 -6
- package/out/sbvr-api/uri-parser.js +2 -2
- package/out/sbvr-api/uri-parser.js.map +1 -1
- package/out/server-glue/module.d.ts +1 -0
- package/out/server-glue/module.js +4 -1
- package/out/server-glue/module.js.map +1 -1
- package/out/tasks/common.d.ts +4 -0
- package/out/tasks/common.js +11 -0
- package/out/tasks/common.js.map +1 -0
- package/out/tasks/index.d.ts +7 -0
- package/out/tasks/index.js +160 -0
- package/out/tasks/index.js.map +1 -0
- package/out/tasks/out.d.ts +40 -0
- package/out/tasks/out.js +3 -0
- package/out/tasks/out.js.map +1 -0
- package/out/tasks/tasks.sbvr +55 -0
- package/out/tasks/types.d.ts +40 -0
- package/out/tasks/types.js +3 -0
- package/out/tasks/types.js.map +1 -0
- package/out/tasks/worker.d.ts +32 -0
- package/out/tasks/worker.js +204 -0
- package/out/tasks/worker.js.map +1 -0
- package/out/webresource-handler/index.d.ts +0 -26
- package/out/webresource-handler/index.js +2 -3
- package/out/webresource-handler/index.js.map +1 -1
- package/package.json +10 -7
- package/src/bin/utils.ts +2 -2
- package/src/config-loader/config-loader.ts +1 -1
- package/src/config-loader/env.ts +6 -1
- package/src/database-layer/db.ts +25 -0
- package/src/sbvr-api/sbvr-utils.ts +2 -1
- package/src/server-glue/module.ts +3 -0
- package/src/tasks/common.ts +9 -0
- package/src/tasks/index.ts +176 -0
- package/src/tasks/out.ts +46 -0
- package/src/tasks/tasks.sbvr +55 -0
- package/src/tasks/types.ts +44 -0
- package/src/tasks/worker.ts +282 -0
- package/src/webresource-handler/index.ts +2 -38
@@ -1,7 +1,6 @@
|
|
1
1
|
import type * as Express from 'express';
|
2
2
|
import busboy from 'busboy';
|
3
3
|
import type * as stream from 'node:stream';
|
4
|
-
import type { AnyObject } from '../sbvr-api/common-types';
|
5
4
|
import * as uriParser from '../sbvr-api/uri-parser';
|
6
5
|
import * as sbvrUtils from '../sbvr-api/sbvr-utils';
|
7
6
|
import type { HookArgs } from '../sbvr-api/hooks';
|
@@ -31,43 +30,10 @@ export interface UploadResponse {
|
|
31
30
|
filename: string;
|
32
31
|
}
|
33
32
|
|
34
|
-
export interface BeginMultipartUploadPayload {
|
35
|
-
filename: string;
|
36
|
-
content_type: string;
|
37
|
-
size: number;
|
38
|
-
chunk_size: number;
|
39
|
-
}
|
40
|
-
|
41
|
-
export interface UploadPart {
|
42
|
-
url: string;
|
43
|
-
chunkSize: number;
|
44
|
-
partNumber: number;
|
45
|
-
}
|
46
|
-
|
47
|
-
export interface BeginMultipartUploadHandlerResponse {
|
48
|
-
uploadParts: UploadPart[];
|
49
|
-
fileKey: string;
|
50
|
-
uploadId: string;
|
51
|
-
}
|
52
|
-
|
53
|
-
export interface CommitMultipartUploadPayload {
|
54
|
-
fileKey: string;
|
55
|
-
uploadId: string;
|
56
|
-
filename: string;
|
57
|
-
providerCommitData?: AnyObject;
|
58
|
-
}
|
59
|
-
|
60
33
|
export interface WebResourceHandler {
|
61
34
|
handleFile: (resource: IncomingFile) => Promise<UploadResponse>;
|
62
35
|
removeFile: (fileReference: string) => Promise<void>;
|
63
36
|
onPreRespond: (webResource: WebResource) => Promise<WebResource>;
|
64
|
-
beginMultipartUpload?: (
|
65
|
-
fieldName: string,
|
66
|
-
payload: BeginMultipartUploadPayload,
|
67
|
-
) => Promise<BeginMultipartUploadHandlerResponse>;
|
68
|
-
commitMultipartUpload?: (
|
69
|
-
commitInfo: CommitMultipartUploadPayload,
|
70
|
-
) => Promise<WebResource>;
|
71
37
|
}
|
72
38
|
|
73
39
|
export class WebResourceError extends TypedError {}
|
@@ -308,14 +274,12 @@ const getCreateWebResourceHooks = (
|
|
308
274
|
};
|
309
275
|
};
|
310
276
|
|
311
|
-
const isDefined = <T>(x: T | undefined | null): x is T => x != null;
|
312
|
-
|
313
277
|
const getWebResourcesHrefs = (
|
314
278
|
webResources?: WebResourcesDbResponse[] | null,
|
315
279
|
): string[] => {
|
316
280
|
const hrefs = (webResources ?? []).flatMap((resource) =>
|
317
281
|
Object.values(resource ?? {})
|
318
|
-
.filter(
|
282
|
+
.filter((resourceKey) => resourceKey != null)
|
319
283
|
.map((resourceKey) => normalizeHref(resourceKey.href)),
|
320
284
|
);
|
321
285
|
return hrefs;
|
@@ -331,7 +295,7 @@ const getWebResourcesKeysFromRequest = (
|
|
331
295
|
): string[] => {
|
332
296
|
return webResourceFields
|
333
297
|
.map((field) => values[field]?.href)
|
334
|
-
.filter(
|
298
|
+
.filter((href) => href != null);
|
335
299
|
};
|
336
300
|
|
337
301
|
const getRemoveWebResourceHooks = (
|