@venizia/ignis 0.4.8-9 → 0.4.8
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/esm/base/applications/base.js.map +1 -1
- package/dist/esm/components/api-reference/common/types.d.ts +6 -3
- package/dist/esm/components/api-reference/common/types.js.map +1 -1
- package/dist/esm/components/api-reference/component.js +8 -3
- package/dist/esm/components/api-reference/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/component.js +3 -2
- package/dist/esm/components/auth/authenticate/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +5 -3
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +18 -1
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
- package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +1 -2
- package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
- package/dist/esm/components/mail/common/constants.d.ts +24 -14
- package/dist/esm/components/mail/common/constants.js +19 -32
- package/dist/esm/components/mail/common/constants.js.map +1 -1
- package/dist/esm/components/mail/common/errors.d.ts +10 -1
- package/dist/esm/components/mail/common/errors.js +7 -1
- package/dist/esm/components/mail/common/errors.js.map +1 -1
- package/dist/esm/components/mail/common/types/message.d.ts +4 -4
- package/dist/esm/components/mail/common/types/message.js.map +1 -1
- package/dist/esm/components/mail/common/types/options.d.ts +54 -10
- package/dist/esm/components/mail/common/types/options.js.map +1 -1
- package/dist/esm/components/mail/common/types/queue.d.ts +23 -12
- package/dist/esm/components/mail/common/types/queue.js.map +1 -1
- package/dist/esm/components/mail/common/types/template.d.ts +5 -4
- package/dist/esm/components/mail/common/types/template.js.map +1 -1
- package/dist/esm/components/mail/common/types/verification.d.ts +1 -0
- package/dist/esm/components/mail/common/types/verification.js.map +1 -1
- package/dist/esm/components/mail/component.js +11 -2
- package/dist/esm/components/mail/component.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +1 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +15 -28
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +2 -0
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +17 -10
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +11 -6
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +2 -3
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +15 -6
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +2 -3
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +2 -2
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -2
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +7 -9
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-transporter.provider.js +7 -7
- package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
- package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -6
- package/dist/esm/components/mail/services/generators/numeric-code.js +3 -31
- package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
- package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -1
- package/dist/esm/components/mail/services/generators/random-token.js +9 -6
- package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
- package/dist/esm/components/mail/services/mail.service.d.ts +1 -2
- package/dist/esm/components/mail/services/mail.service.js +21 -19
- package/dist/esm/components/mail/services/mail.service.js.map +1 -1
- package/dist/esm/components/mail/services/template.service.d.ts +7 -5
- package/dist/esm/components/mail/services/template.service.js +24 -16
- package/dist/esm/components/mail/services/template.service.js.map +1 -1
- package/dist/esm/components/mail/utilities/attachment.utility.js +8 -6
- package/dist/esm/components/mail/utilities/attachment.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/header.utility.d.ts +14 -0
- package/dist/esm/components/mail/utilities/header.utility.js +44 -0
- package/dist/esm/components/mail/utilities/header.utility.js.map +1 -0
- package/dist/esm/components/mail/utilities/index.d.ts +1 -0
- package/dist/esm/components/mail/utilities/index.js +1 -0
- package/dist/esm/components/mail/utilities/index.js.map +1 -1
- package/dist/esm/components/mail/utilities/mime.utility.d.ts +5 -1
- package/dist/esm/components/mail/utilities/mime.utility.js +12 -58
- package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/type.utility.d.ts +2 -3
- package/dist/esm/components/mail/utilities/type.utility.js +6 -7
- package/dist/esm/components/mail/utilities/type.utility.js.map +1 -1
- package/dist/esm/components/socket-io/handlers/bun.handler.d.ts +13 -3
- package/dist/esm/components/socket-io/handlers/bun.handler.js.map +1 -1
- package/dist/esm/components/static-asset/common/constants.d.ts +51 -24
- package/dist/esm/components/static-asset/common/constants.js +75 -47
- package/dist/esm/components/static-asset/common/constants.js.map +1 -1
- package/dist/esm/components/static-asset/common/errors.d.ts +30 -35
- package/dist/esm/components/static-asset/common/errors.js +31 -33
- package/dist/esm/components/static-asset/common/errors.js.map +1 -1
- package/dist/esm/components/static-asset/common/index.d.ts +1 -1
- package/dist/esm/components/static-asset/common/index.js +1 -1
- package/dist/esm/components/static-asset/common/index.js.map +1 -1
- package/dist/esm/components/static-asset/common/keys.d.ts +10 -2
- package/dist/esm/components/static-asset/common/keys.js +10 -2
- package/dist/esm/components/static-asset/common/keys.js.map +1 -1
- package/dist/esm/components/static-asset/common/types.d.ts +267 -147
- package/dist/esm/components/static-asset/common/types.js.map +1 -1
- package/dist/esm/components/static-asset/common/validation.d.ts +10 -0
- package/dist/esm/components/static-asset/common/validation.js +8 -0
- package/dist/esm/components/static-asset/common/validation.js.map +1 -0
- package/dist/esm/components/static-asset/component.d.ts +4 -2
- package/dist/esm/components/static-asset/component.js +26 -31
- package/dist/esm/components/static-asset/component.js.map +1 -1
- package/dist/esm/components/static-asset/controller/factory.d.ts +37 -79
- package/dist/esm/components/static-asset/controller/factory.js +26 -917
- package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
- package/dist/esm/components/static-asset/controller/index.d.ts +1 -0
- package/dist/esm/components/static-asset/controller/index.js +1 -0
- package/dist/esm/components/static-asset/controller/index.js.map +1 -1
- package/dist/esm/components/static-asset/controller/routes/context.d.ts +62 -0
- package/dist/esm/components/static-asset/controller/routes/context.js +45 -0
- package/dist/esm/components/static-asset/controller/routes/context.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/definition.d.ts +40 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js +83 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.d.ts +3 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js +153 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/labels.d.ts +16 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js +19 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/objects.d.ts +7 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js +193 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/serve.d.ts +29 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js +152 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/table.d.ts +12 -0
- package/dist/esm/components/static-asset/controller/routes/table.js +52 -0
- package/dist/esm/components/static-asset/controller/routes/table.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/upload.d.ts +10 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js +175 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js.map +1 -0
- package/dist/esm/components/static-asset/index.d.ts +2 -1
- package/dist/esm/components/static-asset/index.js +2 -1
- package/dist/esm/components/static-asset/index.js.map +1 -1
- package/dist/esm/components/static-asset/models/base.model.d.ts +4 -4
- package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
- package/dist/esm/components/static-asset/services/commitment.service.d.ts +103 -0
- package/dist/esm/components/static-asset/services/commitment.service.js +252 -0
- package/dist/esm/components/static-asset/services/commitment.service.js.map +1 -0
- package/dist/esm/components/static-asset/services/index.d.ts +3 -0
- package/dist/esm/components/static-asset/services/index.js +3 -0
- package/dist/esm/components/static-asset/services/index.js.map +1 -0
- package/dist/esm/components/static-asset/services/policy.service.d.ts +45 -0
- package/dist/esm/components/static-asset/services/policy.service.js +104 -0
- package/dist/esm/components/static-asset/services/policy.service.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.d.ts +28 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js +112 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.d.ts +69 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js +160 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/index.d.ts +6 -0
- package/dist/esm/components/static-asset/utilities/index.js +6 -0
- package/dist/esm/components/static-asset/utilities/index.js.map +1 -0
- package/dist/esm/components/static-asset/{ingest.d.ts → utilities/ingest.utility.d.ts} +5 -5
- package/dist/esm/components/static-asset/{ingest.js → utilities/ingest.utility.js} +12 -10
- package/dist/esm/components/static-asset/utilities/ingest.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/key-scope.d.ts → utilities/key-scope.utility.d.ts} +21 -2
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js +74 -0
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/meta-link.d.ts → utilities/meta-link.utility.d.ts} +9 -9
- package/dist/esm/components/static-asset/{controller/meta-link.js → utilities/meta-link.utility.js} +10 -10
- package/dist/esm/components/static-asset/utilities/meta-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.d.ts +16 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js +20 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.d.ts +39 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js +53 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.d.ts +43 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js +71 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.d.ts +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js.map +1 -0
- package/dist/esm/testing/assert-application-boots.d.ts +2 -2
- package/dist/esm/testing/assert-application-boots.js +6 -2
- package/dist/esm/testing/assert-application-boots.js.map +1 -1
- package/dist/presets/app/preset.json +4 -4
- package/dist/presets/lib/preset.json +3 -3
- package/dist/presets/shared/preset.json +1 -1
- package/package.json +8 -8
- package/dist/esm/components/static-asset/common/commit-token.d.ts +0 -28
- package/dist/esm/components/static-asset/common/commit-token.js +0 -48
- package/dist/esm/components/static-asset/common/commit-token.js.map +0 -1
- package/dist/esm/components/static-asset/controller/base.definition.d.ts +0 -30
- package/dist/esm/components/static-asset/controller/base.definition.js +0 -307
- package/dist/esm/components/static-asset/controller/base.definition.js.map +0 -1
- package/dist/esm/components/static-asset/controller/key-scope.js +0 -41
- package/dist/esm/components/static-asset/controller/key-scope.js.map +0 -1
- package/dist/esm/components/static-asset/controller/meta-link.js.map +0 -1
- package/dist/esm/components/static-asset/controller/route-options.d.ts +0 -29
- package/dist/esm/components/static-asset/controller/route-options.js +0 -47
- package/dist/esm/components/static-asset/controller/route-options.js.map +0 -1
- package/dist/esm/components/static-asset/ingest.js.map +0 -1
|
@@ -1,203 +1,323 @@
|
|
|
1
|
-
import type { BaseRestController, IAuthRouteConfig, TRouteContext } from '../../../base/index.js';
|
|
1
|
+
import type { BaseRestController, IAuthRouteConfig, TRouteAuthConfig, TRouteContext } from '../../../base/index.js';
|
|
2
|
+
import type { z } from '@hono/zod-openapi';
|
|
2
3
|
import type { IDuration } from '@venizia/ignis-helpers/common';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
4
|
+
import type { TTableInsert, TTableObject } from '@venizia/ignis-connectors/postgres';
|
|
5
|
+
import type { TWhere } from '@venizia/ignis-filter';
|
|
6
|
+
import type { TToggle } from '@venizia/ignis-kernel';
|
|
7
|
+
import type { DiskHelper, IBucketRef, IFileStat, IObjectLocation, IObjectRef, IStorageHelper, IUploadResult, StorageTypes, TUploadNaming } from '@venizia/ignis-helpers';
|
|
5
8
|
import type { BunS3Helper } from '@venizia/ignis-helpers/bun-s3';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
/**
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* The most file parts one upload request may carry; more is refused with 413 before anything is written. The upload-policy request is bounded by the same number (more is a 422).
|
|
17
|
-
*
|
|
18
|
-
* @default DEFAULT_MAX_UPLOAD_FILES (20)
|
|
19
|
-
*/
|
|
20
|
-
maxFiles?: number;
|
|
21
|
-
};
|
|
22
|
-
/** `folderPath` carries the upload query's target folder - dropping it flattens nested uploads. */
|
|
23
|
-
normalizeNameFn?: (opts: {
|
|
24
|
-
file: TUploadNaming;
|
|
25
|
-
}) => string;
|
|
26
|
-
normalizeLinkFn?: (opts: IObjectLocation) => string;
|
|
27
|
-
/**
|
|
28
|
-
* Maximum folder nesting depth allowed in object paths.
|
|
29
|
-
*
|
|
30
|
-
* @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH
|
|
31
|
-
*/
|
|
32
|
-
maxFolderDepth?: number;
|
|
33
|
-
/** Largest file the UPLOAD route accepts. Absent means no ceiling. Checked against `content-length` before spooling, then per file after parsing. */
|
|
34
|
-
maxBytes?: number;
|
|
35
|
-
[key: string]: AnyType;
|
|
36
|
-
};
|
|
37
|
-
/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written. */
|
|
38
|
-
export type TObjectNameResolver = (opts: {
|
|
9
|
+
import type { TConstValue, TValueOrAsyncResolver, ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
10
|
+
import type { TMetaLink, TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models/index.js';
|
|
11
|
+
import type { StaticAssetRouteKeys, TStaticAssetTokenStage } from './constants.js';
|
|
12
|
+
import type { StaticAssetPinnedFile } from '../utilities/pinned-file.utility.js';
|
|
13
|
+
/** The toggle type, shared with the controllers: defined in the kernel. */
|
|
14
|
+
export type { TToggle };
|
|
15
|
+
/** The storage backends a static asset entry can serve from: the helpers that declare one. */
|
|
16
|
+
export type TStaticAssetStorageType = typeof StorageTypes.DISK | typeof StorageTypes.BUN_S3;
|
|
17
|
+
/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written - the scope and the default naming - so the hook may keep it, extend it or ignore it. */
|
|
18
|
+
export type TStaticAssetObjectKeyResolver = (opts: {
|
|
39
19
|
bucket: IBucketRef;
|
|
40
20
|
file: TUploadNaming;
|
|
41
21
|
defaultKey: string;
|
|
42
22
|
}) => string;
|
|
43
|
-
/** Adds routes of the application's own to a generated asset controller. Runs after every built-in route, so a built-in route always wins a path collision. `basePath` is the mount path with exactly one leading slash. */
|
|
44
23
|
/** Adds routes of the application's own. Registration order decides a path collision, so the same shape serves both the before and the after hook. */
|
|
45
|
-
export type
|
|
24
|
+
export type TStaticAssetDefineExtraRoutes = (opts: {
|
|
46
25
|
controller: BaseRestController;
|
|
47
26
|
helper: IStorageHelper;
|
|
48
27
|
basePath: string;
|
|
49
28
|
}) => void;
|
|
50
|
-
/** Path parameters of the bucket routes. */
|
|
51
|
-
export type TBucketParams = {
|
|
52
|
-
bucketName: string;
|
|
53
|
-
};
|
|
54
29
|
/** Path parameters of the object routes. */
|
|
55
|
-
export type
|
|
56
|
-
bucketName: string;
|
|
30
|
+
export type TStaticAssetObjectParams = {
|
|
57
31
|
objectName: string;
|
|
58
32
|
};
|
|
59
33
|
/** Labels recorded on the MetaLink row of an uploaded object. */
|
|
60
|
-
export type
|
|
34
|
+
export type TStaticAssetUploadLabels = {
|
|
61
35
|
principalType?: string;
|
|
62
36
|
principalId?: string;
|
|
63
37
|
variant?: string;
|
|
64
38
|
/** Display order within the principal. Caller-supplied: deriving it would be a non-atomic read of `max(sequence)` then a write of `max + 1`. */
|
|
65
39
|
sequence?: number;
|
|
66
|
-
folderPath?: string;
|
|
67
40
|
};
|
|
68
|
-
/**
|
|
69
|
-
export type
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
41
|
+
/** Application-chosen strings the commit token signs for one file. The token is signed, not encrypted: no secrets. */
|
|
42
|
+
export type TStaticAssetTokenMetadata = Record<string, string>;
|
|
43
|
+
/** One file of an upload-policy request. `metadata` is the client's hint: `resolvers.metadata` reads it, and only what that returns is signed. */
|
|
44
|
+
export type TStaticAssetUploadPolicyFile = {
|
|
45
|
+
fileName: string;
|
|
46
|
+
contentType?: string;
|
|
47
|
+
size?: number;
|
|
48
|
+
metadata?: TStaticAssetTokenMetadata;
|
|
49
|
+
};
|
|
50
|
+
/** The decisions of a direct upload that belong to the application, each made on a different call. */
|
|
51
|
+
export type TStaticAssetDirectUploadResolvers = {
|
|
52
|
+
/**
|
|
53
|
+
* Who the upload belongs to. Called on every direct-upload route: the policy route signs the
|
|
54
|
+
* answer into the commit token, and the other routes refuse a token whose owner differs.
|
|
55
|
+
*/
|
|
56
|
+
owner: (opts: {
|
|
57
|
+
context: TRouteContext;
|
|
58
|
+
}) => ValueOrPromise<string>;
|
|
59
|
+
/** Per file, at policy time: what the token signs for it, readable again at validate and commit. Absent, a client that sends `metadata` is refused. */
|
|
60
|
+
metadata?: (opts: {
|
|
61
|
+
context: TRouteContext;
|
|
62
|
+
file: TStaticAssetUploadPolicyFile;
|
|
63
|
+
}) => ValueOrPromise<TStaticAssetTokenMetadata>;
|
|
64
|
+
commit?: {
|
|
65
|
+
/** At commit time: the final key, in the same bucket and inside the `keyPrefix`. Absent keeps `defaultKey`. */
|
|
66
|
+
destination?: (opts: {
|
|
67
|
+
owner: string;
|
|
68
|
+
metadata: TStaticAssetTokenMetadata;
|
|
69
|
+
file: {
|
|
70
|
+
fileName: string;
|
|
71
|
+
};
|
|
72
|
+
defaultKey: string;
|
|
73
|
+
}) => ValueOrPromise<{
|
|
74
|
+
key: string;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
73
77
|
};
|
|
74
78
|
/** Enables the signed-policy upload flow, where the client posts bytes straight to the storage and IGNIS only signs the permission and verifies the commit. */
|
|
75
|
-
export type
|
|
76
|
-
/**
|
|
77
|
-
|
|
79
|
+
export type TStaticAssetDirectUploadOptions = {
|
|
80
|
+
/**
|
|
81
|
+
* Who may use direct upload. Guards every direct-upload route. There is no safe default for a
|
|
82
|
+
* route that hands out a write credential, so leaving it out is allowed only when the entry's
|
|
83
|
+
* `auth` already authenticates or authorizes: then `auth` is the gate. With neither, the
|
|
84
|
+
* component refuses to start.
|
|
85
|
+
*/
|
|
86
|
+
authorize?: (opts: {
|
|
78
87
|
context: TRouteContext;
|
|
79
88
|
}) => ValueOrPromise<boolean>;
|
|
89
|
+
/** What the application decides about an upload; `owner` is required, the rest is optional. */
|
|
90
|
+
resolvers: TStaticAssetDirectUploadResolvers;
|
|
80
91
|
/** Signs the commit token. Keep it out of the repository and out of the client. */
|
|
81
92
|
secretKey: string;
|
|
82
93
|
/** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */
|
|
83
94
|
maxBytes: number;
|
|
84
95
|
/**
|
|
85
|
-
*
|
|
96
|
+
* The most files one upload-policy request may name; more is a 422.
|
|
97
|
+
*
|
|
98
|
+
* @default StaticAssetDefaults.MAX_UPLOAD_FILES (20)
|
|
99
|
+
*/
|
|
100
|
+
maxFiles?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Where a policy may write: not empty, ends with `/`, made of valid key segments, and neither
|
|
103
|
+
* inside the entry's `keyPrefix` nor containing it - a pending object must never be readable
|
|
104
|
+
* through the entry's own routes. The final key is NEVER in a policy, so content cannot be
|
|
105
|
+
* replaced after the commit. The lifecycle rule that collects abandoned uploads targets this prefix.
|
|
86
106
|
*
|
|
87
107
|
* @default 'pending/'
|
|
88
108
|
*/
|
|
89
109
|
pendingPrefix?: string;
|
|
110
|
+
expires?: {
|
|
111
|
+
/**
|
|
112
|
+
* How long the browser may post the bytes: the POST policy's lifetime.
|
|
113
|
+
*
|
|
114
|
+
* @default StoragePresignDefaults.POST_EXPIRES_IN
|
|
115
|
+
*/
|
|
116
|
+
upload?: IDuration;
|
|
117
|
+
/**
|
|
118
|
+
* How long the commit token stays good, for validating and committing after the upload. The
|
|
119
|
+
* pending object must outlive it, so the lifecycle rule on `pendingPrefix` has to be longer still.
|
|
120
|
+
*
|
|
121
|
+
* @default `upload`
|
|
122
|
+
*/
|
|
123
|
+
commit?: IDuration;
|
|
124
|
+
};
|
|
90
125
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
126
|
+
* Checks the pending file. On, the component registers `POST {base}/upload-validate`, which
|
|
127
|
+
* answers the token `commit` takes, and `commit` accepts no other.
|
|
128
|
+
* Build it with `StaticAssetValidation.define`.
|
|
94
129
|
*/
|
|
95
|
-
|
|
96
|
-
/** Runs BEFORE the copy to the final key, so a hook that throws leaves the object under the pending prefix for a lifecycle rule to collect, rather than stranding it at the final key. */
|
|
97
|
-
onCommit?: (opts: {
|
|
98
|
-
bucket: IBucketRef;
|
|
99
|
-
pendingObject: IObjectRef;
|
|
100
|
-
object: IObjectRef;
|
|
101
|
-
}) => ValueOrPromise<void>;
|
|
130
|
+
validation: TToggle<IStaticAssetValidation<z.ZodType>>;
|
|
102
131
|
};
|
|
132
|
+
/** What a validation answers: whether the file may be committed, and the problems the user should see. */
|
|
133
|
+
export interface IStaticAssetValidationResult<Issue> {
|
|
134
|
+
isValid: boolean;
|
|
135
|
+
issues: Issue[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The application's own check of an uploaded file, run on the PENDING object before anything is
|
|
139
|
+
* committed. The component owns the route and the refusal; the application owns only this logic.
|
|
140
|
+
* Build it with `StaticAssetValidation.define` so the handler is typed by `issueSchema`.
|
|
141
|
+
*/
|
|
142
|
+
export interface IStaticAssetValidation<IssueSchema extends z.ZodType> {
|
|
143
|
+
/** The shape of ONE issue. It types the handler's answer and documents the route's response. */
|
|
144
|
+
issueSchema: IssueSchema;
|
|
145
|
+
/** Runs once per `upload-validate`. Read the file through `file`: every read is pinned to the content `commit` will copy. */
|
|
146
|
+
handler: (opts: {
|
|
147
|
+
file: StaticAssetPinnedFile;
|
|
148
|
+
owner: string;
|
|
149
|
+
metadata: TStaticAssetTokenMetadata;
|
|
150
|
+
}) => ValueOrPromise<IStaticAssetValidationResult<z.infer<IssueSchema>>>;
|
|
151
|
+
}
|
|
152
|
+
/** What `validate` answers. `commitToken` is present only when the file is valid: it is the token `commit` takes. */
|
|
153
|
+
export interface IStaticAssetValidateResult<Issue> extends IStaticAssetValidationResult<Issue> {
|
|
154
|
+
commitToken?: string;
|
|
155
|
+
}
|
|
103
156
|
/** Body of the upload policy route: the files the client intends to upload. */
|
|
104
|
-
export type
|
|
105
|
-
files:
|
|
106
|
-
fileName: string;
|
|
107
|
-
contentType?: string;
|
|
108
|
-
size?: number;
|
|
109
|
-
}>;
|
|
157
|
+
export type TStaticAssetUploadPolicyRequest = {
|
|
158
|
+
files: TStaticAssetUploadPolicyFile[];
|
|
110
159
|
};
|
|
160
|
+
/** The repository verbs the component calls, on MetaLink rows. A `DefaultCRUDRepository` over any `TMetaLinkCompatibleSchema` table satisfies it, and so does a small fake in a test. The contract checks the select row only (see the static-asset usage page for what that leaves to the table). */
|
|
161
|
+
export interface IMetaLinkRepository {
|
|
162
|
+
create(opts: {
|
|
163
|
+
data: TTableInsert<TMetaLinkSchema>;
|
|
164
|
+
}): Promise<{
|
|
165
|
+
count: number;
|
|
166
|
+
data: TMetaLink;
|
|
167
|
+
}>;
|
|
168
|
+
updateBy(opts: {
|
|
169
|
+
data: Partial<TTableInsert<TMetaLinkSchema>>;
|
|
170
|
+
where: TWhere<TMetaLink>;
|
|
171
|
+
}): Promise<{
|
|
172
|
+
count: number;
|
|
173
|
+
data: TMetaLink[] | null;
|
|
174
|
+
}>;
|
|
175
|
+
updateById(opts: {
|
|
176
|
+
id: string;
|
|
177
|
+
data: Partial<TTableInsert<TMetaLinkSchema>>;
|
|
178
|
+
}): Promise<{
|
|
179
|
+
count: number;
|
|
180
|
+
data: TMetaLink;
|
|
181
|
+
}>;
|
|
182
|
+
deleteBy(opts: {
|
|
183
|
+
where: TWhere<TMetaLink>;
|
|
184
|
+
}): Promise<{
|
|
185
|
+
count: number;
|
|
186
|
+
}>;
|
|
187
|
+
}
|
|
111
188
|
/** The MetaLink table belongs to the application. `Schema` defaults to the table IGNIS ships, and widens to any table whose row carries the same fields. */
|
|
112
189
|
export type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {
|
|
113
|
-
|
|
114
|
-
repository: TValueOrAsyncResolver<DefaultCRUDRepository<Schema>>;
|
|
190
|
+
repository: TValueOrAsyncResolver<IMetaLinkRepository>;
|
|
115
191
|
createMetaLink?: (opts: {
|
|
116
192
|
uploadResult: IUploadResult;
|
|
117
193
|
fileStat: IFileStat;
|
|
118
|
-
/** The caller's labels
|
|
119
|
-
|
|
194
|
+
/** The caller's labels: form fields on an upload, beside the commit token on a direct one. */
|
|
195
|
+
labels: TStaticAssetUploadLabels;
|
|
120
196
|
}) => ValueOrPromise<{
|
|
121
197
|
count: number;
|
|
122
198
|
data: TTableObject<Schema>;
|
|
123
199
|
}>;
|
|
124
200
|
};
|
|
125
|
-
/** The part of a built-in route an application may change. */
|
|
126
|
-
export type TStaticAssetRouteConfig = Partial<Omit<IAuthRouteConfig, 'method' | 'request' | 'responses'>> &
|
|
201
|
+
/** The part of a built-in route an application may change. `authenticate` and `authorize` replace the entry's `auth` for this route, and `{ skip: true }` leaves it open. */
|
|
202
|
+
export type TStaticAssetRouteConfig = Partial<Omit<IAuthRouteConfig, 'method' | 'request' | 'responses' | 'authenticate' | 'authorize'>> & TRouteAuthConfig;
|
|
203
|
+
/** Authentication and authorization for every built-in route of an entry; a route's own `authenticate`/`authorize` replaces it for that route. */
|
|
204
|
+
export type TStaticAssetAuth = TRouteAuthConfig & {
|
|
127
205
|
/**
|
|
128
|
-
*
|
|
206
|
+
* `{ use: true }` leaves `getObjectByName` and `downloadObjectByName` unauthenticated, so a
|
|
207
|
+
* browser can show an image without a token. `listObjects` is NOT public: listing a bucket is not
|
|
208
|
+
* reading an object.
|
|
129
209
|
*
|
|
130
|
-
* @default
|
|
210
|
+
* @default { use: false }
|
|
131
211
|
*/
|
|
132
|
-
|
|
212
|
+
publicRead?: TToggle;
|
|
133
213
|
};
|
|
134
|
-
/**
|
|
135
|
-
export type
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
214
|
+
/** The name of a built-in route, the key of `routes`. */
|
|
215
|
+
export type TStaticAssetRouteKey = TConstValue<typeof StaticAssetRouteKeys>;
|
|
216
|
+
/**
|
|
217
|
+
* What each built-in route does: `{ use: false }` turns it off, `{ use: true, ... }` turns it on
|
|
218
|
+
* with those overrides. A route left out is on as built.
|
|
219
|
+
*/
|
|
220
|
+
export type TStaticAssetRoutes = Partial<Record<TStaticAssetRouteKey, TToggle<TStaticAssetRouteConfig>>>;
|
|
221
|
+
/** Uploading through the application: the browser sends the bytes to `POST /objects` and the application writes them to the storage. */
|
|
222
|
+
export type TStaticAssetServerUploadOptions = {
|
|
223
|
+
/** Largest file the route accepts. Absent means no ceiling. Checked against `content-length` before the body is read, then per file after parsing. */
|
|
224
|
+
maxBytes?: number;
|
|
225
|
+
/**
|
|
226
|
+
* The most file parts one request may carry; more is refused with 413 before anything is written.
|
|
227
|
+
*
|
|
228
|
+
* @default StaticAssetDefaults.MAX_UPLOAD_FILES (20)
|
|
229
|
+
*/
|
|
230
|
+
maxFiles?: number;
|
|
231
|
+
/** The one hook that decides the key an uploaded file is stored under. Absent keeps the default naming. Under a `keyPrefix` a key outside the scope is refused, never rewritten. */
|
|
232
|
+
objectKey?: TStaticAssetObjectKeyResolver;
|
|
233
|
+
};
|
|
234
|
+
/** Direct upload is a POST policy, which only S3 can sign, and its pending objects stay out of the served scope only when the entry has a `keyPrefix`. */
|
|
235
|
+
type TStaticAssetDirectUploadScope = {
|
|
236
|
+
keyPrefix?: string;
|
|
237
|
+
directUpload: {
|
|
238
|
+
use: false;
|
|
239
|
+
};
|
|
240
|
+
} | {
|
|
241
|
+
keyPrefix: string;
|
|
242
|
+
directUpload: {
|
|
243
|
+
use: true;
|
|
244
|
+
} & TStaticAssetDirectUploadOptions;
|
|
148
245
|
};
|
|
149
|
-
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* @default true
|
|
159
|
-
*/
|
|
160
|
-
isStrict?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.
|
|
163
|
-
*
|
|
164
|
-
* @default false
|
|
165
|
-
*/
|
|
166
|
-
rawObjectPath?: boolean;
|
|
167
|
-
/** The single bucket every object route uses. It leaves the URL (`/objects/{objectName}`) and the four bucket-management routes are not registered. The function form is read per request, so an environment variable can be read lazily. */
|
|
168
|
-
bucket?: TValueOrAsyncResolver<string>;
|
|
169
|
-
/**
|
|
170
|
-
* The key scope this controller owns, e.g. `inventory/`. Every route refuses a key outside it
|
|
171
|
-
* as a 404 without calling the storage, `listObjects` lists only inside it, and an upload key
|
|
172
|
-
* must land inside it: the default name is placed there, a `resolveObjectName` or
|
|
173
|
-
* `extra.normalizeNameFn` key outside it is refused. `maxFolderDepth` counts the folders below
|
|
174
|
-
* it.
|
|
175
|
-
*
|
|
176
|
-
* @default every key in the bucket
|
|
177
|
-
*/
|
|
178
|
-
keyPrefix?: string;
|
|
179
|
-
routes?: TStaticAssetRoutes;
|
|
180
|
-
/** Direct upload: the browser posts the bytes to the storage and IGNIS only signs the permission. Absent leaves both routes unregistered. Requires `bucket` - a policy names one bucket, and a bucket in the URL is a bucket the caller chooses. */
|
|
181
|
-
directUpload?: TDirectUploadOptions;
|
|
182
|
-
};
|
|
183
|
-
extra?: TStaticAssetExtraOptions;
|
|
184
|
-
/** Decides the stored object name of each uploaded file; absent keeps the storage helper's own naming. */
|
|
185
|
-
resolveObjectName?: TObjectNameResolver;
|
|
186
|
-
/** Registers the application's own routes BEFORE every built-in one, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */
|
|
187
|
-
defineRoutesBefore?: TDefineExtraRoutes;
|
|
188
|
-
/** Registers the application's own routes on the generated controller, after every built-in one. */
|
|
189
|
-
defineExtraRoutes?: TDefineExtraRoutes;
|
|
190
|
-
} & ({
|
|
191
|
-
storage: typeof StaticAssetStorageTypes.BUN_S3;
|
|
192
|
-
helper: BunS3Helper;
|
|
193
|
-
} | {
|
|
194
|
-
storage: typeof StaticAssetStorageTypes.DISK;
|
|
195
|
-
helper: DiskHelper;
|
|
196
|
-
}) & ({
|
|
197
|
-
useMetaLink?: false | undefined;
|
|
198
|
-
} | {
|
|
199
|
-
useMetaLink: true;
|
|
200
|
-
metaLink: TMetaLinkConfig<Schema>;
|
|
201
|
-
});
|
|
246
|
+
/** The storage helper decides which direct upload shapes are possible. */
|
|
247
|
+
type TStaticAssetStorage = ({
|
|
248
|
+
helper: BunS3Helper;
|
|
249
|
+
} & TStaticAssetDirectUploadScope) | {
|
|
250
|
+
helper: DiskHelper;
|
|
251
|
+
keyPrefix?: string;
|
|
252
|
+
directUpload: {
|
|
253
|
+
use: false;
|
|
254
|
+
};
|
|
202
255
|
};
|
|
256
|
+
/** One storage backend with its generated controller. Every switch is a toggle; a toggle left out is a type error, so nothing is on or off by accident. */
|
|
257
|
+
export type TStaticAssetEntry<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {
|
|
258
|
+
basePath: string;
|
|
259
|
+
/** The controller's name. Absent, it is derived from the entry's key. */
|
|
260
|
+
name?: string;
|
|
261
|
+
/** The single bucket every route uses. The function form is read per request, so an environment variable can be read lazily. */
|
|
262
|
+
bucket: TValueOrAsyncResolver<string>;
|
|
263
|
+
/**
|
|
264
|
+
* The key scope this entry owns, e.g. `inventory/`. Every route refuses a key outside it as a
|
|
265
|
+
* 404 without calling the storage, `listObjects` lists only inside it, and an upload key must
|
|
266
|
+
* land inside it. `maxFolderDepth` counts the folders below it. Required with
|
|
267
|
+
* `directUpload`: it keeps the pending prefix outside everything the routes serve.
|
|
268
|
+
*
|
|
269
|
+
* @default every key in the bucket
|
|
270
|
+
*/
|
|
271
|
+
keyPrefix?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Folders a key may nest below the `keyPrefix`, for every route of the entry: reads and deletes
|
|
274
|
+
* too, so it holds for keys that arrive by direct upload or ingest.
|
|
275
|
+
*
|
|
276
|
+
* @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH
|
|
277
|
+
*/
|
|
278
|
+
maxFolderDepth?: number;
|
|
279
|
+
/**
|
|
280
|
+
* `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.
|
|
281
|
+
*
|
|
282
|
+
* @default false
|
|
283
|
+
*/
|
|
284
|
+
rawObjectPath?: boolean;
|
|
285
|
+
/** The link stored and returned for an object. Absent builds the URL of this controller's own object route. */
|
|
286
|
+
link?: (opts: IObjectLocation) => string;
|
|
287
|
+
/** Authentication and authorization of every built-in route of this entry. Absent leaves every route open; `publicRead` is the only way a read route is public on purpose. */
|
|
288
|
+
auth?: TStaticAssetAuth;
|
|
289
|
+
serverUpload: TToggle<TStaticAssetServerUploadOptions>;
|
|
290
|
+
/** Every upload also writes a MetaLink row, and the object's deletion removes it. */
|
|
291
|
+
metaLink: TToggle<TMetaLinkConfig<Schema>>;
|
|
292
|
+
routes?: TStaticAssetRoutes;
|
|
293
|
+
extend?: {
|
|
294
|
+
/** Registered BEFORE every built-in route, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */
|
|
295
|
+
before?: TStaticAssetDefineExtraRoutes;
|
|
296
|
+
/** Registered after every built-in route. */
|
|
297
|
+
after?: TStaticAssetDefineExtraRoutes;
|
|
298
|
+
};
|
|
299
|
+
} & TStaticAssetStorage;
|
|
300
|
+
/** Static asset entries keyed by an application-chosen name; each key becomes one controller. */
|
|
301
|
+
export type TStaticAssetComponentOptions<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = Record<string, TStaticAssetEntry<Schema>>;
|
|
302
|
+
/** The content a validation read: the ETag, and the version id when the storage has real versions. */
|
|
303
|
+
export interface IStaticAssetPin {
|
|
304
|
+
etag: string;
|
|
305
|
+
versionId?: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* What a commit token binds: the pending object a policy was issued for, when the grant dies and,
|
|
309
|
+
* who it was issued to and the application's own metadata for the file.
|
|
310
|
+
*/
|
|
311
|
+
export interface IStaticAssetCommitTokenPayload {
|
|
312
|
+
bucket: IBucketRef;
|
|
313
|
+
object: IObjectRef;
|
|
314
|
+
expiresAt: number;
|
|
315
|
+
/** The token commits only for this owner. */
|
|
316
|
+
owner: string;
|
|
317
|
+
/** What `resolvers.metadata` returned for the file; `{}` without one. Signed, not encrypted. */
|
|
318
|
+
metadata: TStaticAssetTokenMetadata;
|
|
319
|
+
stage: TStaticAssetTokenStage;
|
|
320
|
+
/** Present from `VALIDATED` on: `commit` copies only content that still matches it. */
|
|
321
|
+
pin?: IStaticAssetPin;
|
|
322
|
+
}
|
|
203
323
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseRestController, IAuthRouteConfig, TRouteContext } from '@/base';\nimport type { IDuration } from '@venizia/ignis-helpers/common';\nimport type {\n BaseRelationalEntity,\n DefaultCRUDRepository,\n TTableObject,\n} from '@venizia/ignis-connectors/postgres';\nimport type {\n DiskHelper,\n IBucketRef,\n IFileStat,\n IObjectLocation,\n IObjectRef,\n IStorageHelper,\n IUploadResult,\n TUploadNaming,\n} from '@venizia/ignis-helpers';\nimport type { BunS3Helper } from '@venizia/ignis-helpers/bun-s3';\nimport type { AnyType, TValueOrAsyncResolver, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TMultipartStorage } from '@venizia/ignis-helpers';\nimport type { TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models';\nimport type { StaticAssetStorageTypes } from './constants';\n\n/** Per-controller upload tuning: multipart parsing, name and link normalization, folder depth and size ceiling. */\nexport type TStaticAssetExtraOptions = {\n parseMultipartBody?: {\n storage?: TMultipartStorage;\n uploadDir?: string;\n /**\n * The most file parts one upload request may carry; more is refused with 413 before anything is written. The upload-policy request is bounded by the same number (more is a 422).\n *\n * @default DEFAULT_MAX_UPLOAD_FILES (20)\n */\n maxFiles?: number;\n };\n\n /** `folderPath` carries the upload query's target folder - dropping it flattens nested uploads. */\n normalizeNameFn?: (opts: { file: TUploadNaming }) => string;\n normalizeLinkFn?: (opts: IObjectLocation) => string;\n\n /**\n * Maximum folder nesting depth allowed in object paths.\n *\n * @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH\n */\n maxFolderDepth?: number;\n\n /** Largest file the UPLOAD route accepts. Absent means no ceiling. Checked against `content-length` before spooling, then per file after parsing. */\n maxBytes?: number;\n [key: string]: AnyType;\n};\n\n/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written. */\nexport type TObjectNameResolver = (opts: {\n bucket: IBucketRef;\n file: TUploadNaming;\n defaultKey: string;\n}) => string;\n\n/** Adds routes of the application's own to a generated asset controller. Runs after every built-in route, so a built-in route always wins a path collision. `basePath` is the mount path with exactly one leading slash. */\n/** Adds routes of the application's own. Registration order decides a path collision, so the same shape serves both the before and the after hook. */\nexport type TDefineExtraRoutes = (opts: {\n controller: BaseRestController;\n helper: IStorageHelper;\n basePath: string;\n}) => void;\n\n// Declared by hand rather than inferred: RouteHandler inference here is heavy.\n/** Path parameters of the bucket routes. */\nexport type TBucketParams = { bucketName: string };\n/** Path parameters of the object routes. */\nexport type TObjectParams = { bucketName: string; objectName: string };\n/** Labels recorded on the MetaLink row of an uploaded object. */\nexport type TUploadQuery = {\n principalType?: string;\n principalId?: string;\n variant?: string;\n /** Display order within the principal. Caller-supplied: deriving it would be a non-atomic read of `max(sequence)` then a write of `max + 1`. */\n sequence?: number;\n folderPath?: string;\n};\n/** Query of the list objects route. Every value arrives as a string. */\nexport type TListQuery = { prefix?: string; recursive?: string; maxKeys?: string };\n\n/** Enables the signed-policy upload flow, where the client posts bytes straight to the storage and IGNIS only signs the permission and verifies the commit. */\nexport type TDirectUploadOptions = {\n /** Who may ask for a policy. REQUIRED, not defaulted: this route hands out a write credential, and there is no safe default for that. */\n authorize: (opts: { context: TRouteContext }) => ValueOrPromise<boolean>;\n\n /** Signs the commit token. Keep it out of the repository and out of the client. */\n secretKey: string;\n\n /** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */\n maxBytes: number;\n\n /**\n * Where a policy may write. The final key is NEVER in a policy, so content cannot be replaced after the commit.\n *\n * @default 'pending/'\n */\n pendingPrefix?: string;\n\n /**\n * How long a policy and its commit token stay good.\n *\n * @default StoragePresignDefaults.POST_EXPIRES_IN\n */\n expiresIn?: IDuration;\n\n /** Runs BEFORE the copy to the final key, so a hook that throws leaves the object under the pending prefix for a lifecycle rule to collect, rather than stranding it at the final key. */\n onCommit?: (opts: {\n bucket: IBucketRef;\n pendingObject: IObjectRef;\n object: IObjectRef;\n }) => ValueOrPromise<void>;\n};\n\n/** Body of the upload policy route: the files the client intends to upload. */\nexport type TUploadPolicyRequest = {\n files: Array<{ fileName: string; contentType?: string; size?: number }>;\n};\n\n/** The MetaLink table belongs to the application. `Schema` defaults to the table IGNIS ships, and widens to any table whose row carries the same fields. */\nexport type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {\n model: TValueOrAsyncResolver<typeof BaseRelationalEntity<Schema>>;\n repository: TValueOrAsyncResolver<DefaultCRUDRepository<Schema>>;\n createMetaLink?: (opts: {\n uploadResult: IUploadResult;\n fileStat: IFileStat;\n /** The caller's labels. Named for where they used to travel - they arrive in the request BODY now, as form fields on an upload and beside the commit token on a direct one. */\n query: TUploadQuery;\n }) => ValueOrPromise<{ count: number; data: TTableObject<Schema> }>;\n};\n\n/** The part of a built-in route an application may change. */\nexport type TStaticAssetRouteConfig = Partial<\n Omit<IAuthRouteConfig, 'method' | 'request' | 'responses'>\n> & {\n /**\n * Whether this route is registered.\n *\n * @default true\n */\n enabled?: boolean;\n};\n\n/** Per-route overrides for the built-in routes of a generated asset controller. A key left out keeps that route as built. */\nexport type TStaticAssetRoutes = {\n getBuckets?: TStaticAssetRouteConfig;\n getBucketByName?: TStaticAssetRouteConfig;\n createBucket?: TStaticAssetRouteConfig;\n deleteBucket?: TStaticAssetRouteConfig;\n\n upload?: TStaticAssetRouteConfig;\n listObjects?: TStaticAssetRouteConfig;\n deleteObject?: TStaticAssetRouteConfig;\n getObjectByName?: TStaticAssetRouteConfig;\n downloadObjectByName?: TStaticAssetRouteConfig;\n\n uploadPolicy?: TStaticAssetRouteConfig;\n uploadCommit?: TStaticAssetRouteConfig;\n\n recreateMetaLink?: TStaticAssetRouteConfig;\n};\n\n/** Static asset controllers keyed by an application-chosen name. Each entry pairs a storage type with its matching helper, and `useMetaLink: true` requires a `metaLink` config. */\nexport type TStaticAssetsComponentOptions<\n Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema,\n> = {\n [key: string]: {\n controller: {\n name: string;\n basePath: string;\n\n /**\n * Whether `/path` and `/path/` are different routes on this controller.\n *\n * @default true\n */\n isStrict?: boolean;\n\n /**\n * `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.\n *\n * @default false\n */\n rawObjectPath?: boolean;\n\n /** The single bucket every object route uses. It leaves the URL (`/objects/{objectName}`) and the four bucket-management routes are not registered. The function form is read per request, so an environment variable can be read lazily. */\n bucket?: TValueOrAsyncResolver<string>;\n\n /**\n * The key scope this controller owns, e.g. `inventory/`. Every route refuses a key outside it\n * as a 404 without calling the storage, `listObjects` lists only inside it, and an upload key\n * must land inside it: the default name is placed there, a `resolveObjectName` or\n * `extra.normalizeNameFn` key outside it is refused. `maxFolderDepth` counts the folders below\n * it.\n *\n * @default every key in the bucket\n */\n keyPrefix?: string;\n\n routes?: TStaticAssetRoutes;\n\n /** Direct upload: the browser posts the bytes to the storage and IGNIS only signs the permission. Absent leaves both routes unregistered. Requires `bucket` - a policy names one bucket, and a bucket in the URL is a bucket the caller chooses. */\n directUpload?: TDirectUploadOptions;\n };\n extra?: TStaticAssetExtraOptions;\n\n /** Decides the stored object name of each uploaded file; absent keeps the storage helper's own naming. */\n resolveObjectName?: TObjectNameResolver;\n\n /** Registers the application's own routes BEFORE every built-in one, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */\n defineRoutesBefore?: TDefineExtraRoutes;\n\n /** Registers the application's own routes on the generated controller, after every built-in one. */\n defineExtraRoutes?: TDefineExtraRoutes;\n } & (\n | { storage: typeof StaticAssetStorageTypes.BUN_S3; helper: BunS3Helper }\n | { storage: typeof StaticAssetStorageTypes.DISK; helper: DiskHelper }\n ) &\n (\n | { useMetaLink?: false | undefined }\n | { useMetaLink: true; metaLink: TMetaLinkConfig<Schema> }\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseRestController, IAuthRouteConfig, TRouteAuthConfig, TRouteContext } from '@/base';\nimport type { z } from '@hono/zod-openapi';\nimport type { IDuration } from '@venizia/ignis-helpers/common';\nimport type { TTableInsert, TTableObject } from '@venizia/ignis-connectors/postgres';\nimport type { TWhere } from '@venizia/ignis-filter';\nimport type { TToggle } from '@venizia/ignis-kernel';\nimport type {\n DiskHelper,\n IBucketRef,\n IFileStat,\n IObjectLocation,\n IObjectRef,\n IStorageHelper,\n IUploadResult,\n StorageTypes,\n TUploadNaming,\n} from '@venizia/ignis-helpers';\nimport type { BunS3Helper } from '@venizia/ignis-helpers/bun-s3';\nimport type {\n TConstValue,\n TValueOrAsyncResolver,\n ValueOrPromise,\n} from '@venizia/ignis-helpers/common';\nimport type { TMetaLink, TMetaLinkCompatibleSchema, TMetaLinkSchema } from '../models';\nimport type { StaticAssetRouteKeys, TStaticAssetTokenStage } from './constants';\nimport type { StaticAssetPinnedFile } from '../utilities/pinned-file.utility';\n\n/** The toggle type, shared with the controllers: defined in the kernel. */\nexport type { TToggle };\n\n/** The storage backends a static asset entry can serve from: the helpers that declare one. */\nexport type TStaticAssetStorageType = typeof StorageTypes.DISK | typeof StorageTypes.BUN_S3;\n\n/** Decides the key one uploaded file is stored under. `defaultKey` is what IGNIS would have written - the scope and the default naming - so the hook may keep it, extend it or ignore it. */\nexport type TStaticAssetObjectKeyResolver = (opts: {\n bucket: IBucketRef;\n file: TUploadNaming;\n defaultKey: string;\n}) => string;\n\n/** Adds routes of the application's own. Registration order decides a path collision, so the same shape serves both the before and the after hook. */\nexport type TStaticAssetDefineExtraRoutes = (opts: {\n controller: BaseRestController;\n helper: IStorageHelper;\n basePath: string;\n}) => void;\n\n/** Path parameters of the object routes. */\nexport type TStaticAssetObjectParams = { objectName: string };\n\n/** Labels recorded on the MetaLink row of an uploaded object. */\nexport type TStaticAssetUploadLabels = {\n principalType?: string;\n principalId?: string;\n variant?: string;\n /** Display order within the principal. Caller-supplied: deriving it would be a non-atomic read of `max(sequence)` then a write of `max + 1`. */\n sequence?: number;\n};\n\n/** Application-chosen strings the commit token signs for one file. The token is signed, not encrypted: no secrets. */\nexport type TStaticAssetTokenMetadata = Record<string, string>;\n\n/** One file of an upload-policy request. `metadata` is the client's hint: `resolvers.metadata` reads it, and only what that returns is signed. */\nexport type TStaticAssetUploadPolicyFile = {\n fileName: string;\n contentType?: string;\n size?: number;\n metadata?: TStaticAssetTokenMetadata;\n};\n\n/** The decisions of a direct upload that belong to the application, each made on a different call. */\nexport type TStaticAssetDirectUploadResolvers = {\n /**\n * Who the upload belongs to. Called on every direct-upload route: the policy route signs the\n * answer into the commit token, and the other routes refuse a token whose owner differs.\n */\n owner: (opts: { context: TRouteContext }) => ValueOrPromise<string>;\n\n /** Per file, at policy time: what the token signs for it, readable again at validate and commit. Absent, a client that sends `metadata` is refused. */\n metadata?: (opts: {\n context: TRouteContext;\n file: TStaticAssetUploadPolicyFile;\n }) => ValueOrPromise<TStaticAssetTokenMetadata>;\n\n commit?: {\n /** At commit time: the final key, in the same bucket and inside the `keyPrefix`. Absent keeps `defaultKey`. */\n destination?: (opts: {\n owner: string;\n metadata: TStaticAssetTokenMetadata;\n file: { fileName: string };\n defaultKey: string;\n }) => ValueOrPromise<{ key: string }>;\n };\n};\n\n/** Enables the signed-policy upload flow, where the client posts bytes straight to the storage and IGNIS only signs the permission and verifies the commit. */\nexport type TStaticAssetDirectUploadOptions = {\n /**\n * Who may use direct upload. Guards every direct-upload route. There is no safe default for a\n * route that hands out a write credential, so leaving it out is allowed only when the entry's\n * `auth` already authenticates or authorizes: then `auth` is the gate. With neither, the\n * component refuses to start.\n */\n authorize?: (opts: { context: TRouteContext }) => ValueOrPromise<boolean>;\n\n /** What the application decides about an upload; `owner` is required, the rest is optional. */\n resolvers: TStaticAssetDirectUploadResolvers;\n\n /** Signs the commit token. Keep it out of the repository and out of the client. */\n secretKey: string;\n\n /** The ceiling the policy carries as `content-length-range`. A signed PUT cannot express this at all, which is why this is a POST policy. */\n maxBytes: number;\n\n /**\n * The most files one upload-policy request may name; more is a 422.\n *\n * @default StaticAssetDefaults.MAX_UPLOAD_FILES (20)\n */\n maxFiles?: number;\n\n /**\n * Where a policy may write: not empty, ends with `/`, made of valid key segments, and neither\n * inside the entry's `keyPrefix` nor containing it - a pending object must never be readable\n * through the entry's own routes. The final key is NEVER in a policy, so content cannot be\n * replaced after the commit. The lifecycle rule that collects abandoned uploads targets this prefix.\n *\n * @default 'pending/'\n */\n pendingPrefix?: string;\n\n expires?: {\n /**\n * How long the browser may post the bytes: the POST policy's lifetime.\n *\n * @default StoragePresignDefaults.POST_EXPIRES_IN\n */\n upload?: IDuration;\n\n /**\n * How long the commit token stays good, for validating and committing after the upload. The\n * pending object must outlive it, so the lifecycle rule on `pendingPrefix` has to be longer still.\n *\n * @default `upload`\n */\n commit?: IDuration;\n };\n\n /**\n * Checks the pending file. On, the component registers `POST {base}/upload-validate`, which\n * answers the token `commit` takes, and `commit` accepts no other.\n * Build it with `StaticAssetValidation.define`.\n */\n validation: TToggle<IStaticAssetValidation<z.ZodType>>;\n};\n\n/** What a validation answers: whether the file may be committed, and the problems the user should see. */\nexport interface IStaticAssetValidationResult<Issue> {\n isValid: boolean;\n issues: Issue[];\n}\n\n/**\n * The application's own check of an uploaded file, run on the PENDING object before anything is\n * committed. The component owns the route and the refusal; the application owns only this logic.\n * Build it with `StaticAssetValidation.define` so the handler is typed by `issueSchema`.\n */\nexport interface IStaticAssetValidation<IssueSchema extends z.ZodType> {\n /** The shape of ONE issue. It types the handler's answer and documents the route's response. */\n issueSchema: IssueSchema;\n\n /** Runs once per `upload-validate`. Read the file through `file`: every read is pinned to the content `commit` will copy. */\n handler: (opts: {\n file: StaticAssetPinnedFile;\n owner: string;\n metadata: TStaticAssetTokenMetadata;\n }) => ValueOrPromise<IStaticAssetValidationResult<z.infer<IssueSchema>>>;\n}\n\n/** What `validate` answers. `commitToken` is present only when the file is valid: it is the token `commit` takes. */\nexport interface IStaticAssetValidateResult<Issue> extends IStaticAssetValidationResult<Issue> {\n commitToken?: string;\n}\n\n/** Body of the upload policy route: the files the client intends to upload. */\nexport type TStaticAssetUploadPolicyRequest = { files: TStaticAssetUploadPolicyFile[] };\n\n/** The repository verbs the component calls, on MetaLink rows. A `DefaultCRUDRepository` over any `TMetaLinkCompatibleSchema` table satisfies it, and so does a small fake in a test. The contract checks the select row only (see the static-asset usage page for what that leaves to the table). */\nexport interface IMetaLinkRepository {\n create(opts: {\n data: TTableInsert<TMetaLinkSchema>;\n }): Promise<{ count: number; data: TMetaLink }>;\n updateBy(opts: {\n data: Partial<TTableInsert<TMetaLinkSchema>>;\n where: TWhere<TMetaLink>;\n }): Promise<{ count: number; data: TMetaLink[] | null }>;\n updateById(opts: {\n id: string;\n data: Partial<TTableInsert<TMetaLinkSchema>>;\n }): Promise<{ count: number; data: TMetaLink }>;\n deleteBy(opts: { where: TWhere<TMetaLink> }): Promise<{ count: number }>;\n}\n\n/** The MetaLink table belongs to the application. `Schema` defaults to the table IGNIS ships, and widens to any table whose row carries the same fields. */\nexport type TMetaLinkConfig<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {\n repository: TValueOrAsyncResolver<IMetaLinkRepository>;\n createMetaLink?: (opts: {\n uploadResult: IUploadResult;\n fileStat: IFileStat;\n /** The caller's labels: form fields on an upload, beside the commit token on a direct one. */\n labels: TStaticAssetUploadLabels;\n }) => ValueOrPromise<{ count: number; data: TTableObject<Schema> }>;\n};\n\n/** The part of a built-in route an application may change. `authenticate` and `authorize` replace the entry's `auth` for this route, and `{ skip: true }` leaves it open. */\nexport type TStaticAssetRouteConfig = Partial<\n Omit<IAuthRouteConfig, 'method' | 'request' | 'responses' | 'authenticate' | 'authorize'>\n> &\n TRouteAuthConfig;\n\n/** Authentication and authorization for every built-in route of an entry; a route's own `authenticate`/`authorize` replaces it for that route. */\nexport type TStaticAssetAuth = TRouteAuthConfig & {\n /**\n * `{ use: true }` leaves `getObjectByName` and `downloadObjectByName` unauthenticated, so a\n * browser can show an image without a token. `listObjects` is NOT public: listing a bucket is not\n * reading an object.\n *\n * @default { use: false }\n */\n publicRead?: TToggle;\n};\n\n/** The name of a built-in route, the key of `routes`. */\nexport type TStaticAssetRouteKey = TConstValue<typeof StaticAssetRouteKeys>;\n\n/**\n * What each built-in route does: `{ use: false }` turns it off, `{ use: true, ... }` turns it on\n * with those overrides. A route left out is on as built.\n */\nexport type TStaticAssetRoutes = Partial<\n Record<TStaticAssetRouteKey, TToggle<TStaticAssetRouteConfig>>\n>;\n\n/** Uploading through the application: the browser sends the bytes to `POST /objects` and the application writes them to the storage. */\nexport type TStaticAssetServerUploadOptions = {\n /** Largest file the route accepts. Absent means no ceiling. Checked against `content-length` before the body is read, then per file after parsing. */\n maxBytes?: number;\n\n /**\n * The most file parts one request may carry; more is refused with 413 before anything is written.\n *\n * @default StaticAssetDefaults.MAX_UPLOAD_FILES (20)\n */\n maxFiles?: number;\n\n /** The one hook that decides the key an uploaded file is stored under. Absent keeps the default naming. Under a `keyPrefix` a key outside the scope is refused, never rewritten. */\n objectKey?: TStaticAssetObjectKeyResolver;\n};\n\n/** Direct upload is a POST policy, which only S3 can sign, and its pending objects stay out of the served scope only when the entry has a `keyPrefix`. */\ntype TStaticAssetDirectUploadScope =\n | { keyPrefix?: string; directUpload: { use: false } }\n | { keyPrefix: string; directUpload: { use: true } & TStaticAssetDirectUploadOptions };\n\n/** The storage helper decides which direct upload shapes are possible. */\ntype TStaticAssetStorage =\n | ({ helper: BunS3Helper } & TStaticAssetDirectUploadScope)\n | { helper: DiskHelper; keyPrefix?: string; directUpload: { use: false } };\n\n/** One storage backend with its generated controller. Every switch is a toggle; a toggle left out is a type error, so nothing is on or off by accident. */\nexport type TStaticAssetEntry<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> = {\n basePath: string;\n\n /** The controller's name. Absent, it is derived from the entry's key. */\n name?: string;\n\n /** The single bucket every route uses. The function form is read per request, so an environment variable can be read lazily. */\n bucket: TValueOrAsyncResolver<string>;\n\n /**\n * The key scope this entry owns, e.g. `inventory/`. Every route refuses a key outside it as a\n * 404 without calling the storage, `listObjects` lists only inside it, and an upload key must\n * land inside it. `maxFolderDepth` counts the folders below it. Required with\n * `directUpload`: it keeps the pending prefix outside everything the routes serve.\n *\n * @default every key in the bucket\n */\n keyPrefix?: string;\n\n /**\n * Folders a key may nest below the `keyPrefix`, for every route of the entry: reads and deletes\n * too, so it holds for keys that arrive by direct upload or ingest.\n *\n * @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH\n */\n maxFolderDepth?: number;\n\n /**\n * `true` serves a raw nested object path (`/objects/photos/2024/f.jpg`) - a URL shape change; a percent-encoded path keeps working either way.\n *\n * @default false\n */\n rawObjectPath?: boolean;\n\n /** The link stored and returned for an object. Absent builds the URL of this controller's own object route. */\n link?: (opts: IObjectLocation) => string;\n\n /** Authentication and authorization of every built-in route of this entry. Absent leaves every route open; `publicRead` is the only way a read route is public on purpose. */\n auth?: TStaticAssetAuth;\n\n serverUpload: TToggle<TStaticAssetServerUploadOptions>;\n\n /** Every upload also writes a MetaLink row, and the object's deletion removes it. */\n metaLink: TToggle<TMetaLinkConfig<Schema>>;\n\n routes?: TStaticAssetRoutes;\n\n extend?: {\n /** Registered BEFORE every built-in route, so a literal path wins over the catch-all `rawObjectPath` produces. Hono matches in registration order. */\n before?: TStaticAssetDefineExtraRoutes;\n /** Registered after every built-in route. */\n after?: TStaticAssetDefineExtraRoutes;\n };\n} & TStaticAssetStorage;\n\n/** Static asset entries keyed by an application-chosen name; each key becomes one controller. */\nexport type TStaticAssetComponentOptions<\n Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema,\n> = Record<string, TStaticAssetEntry<Schema>>;\n\n/** The content a validation read: the ETag, and the version id when the storage has real versions. */\nexport interface IStaticAssetPin {\n etag: string;\n versionId?: string;\n}\n\n/**\n * What a commit token binds: the pending object a policy was issued for, when the grant dies and,\n * who it was issued to and the application's own metadata for the file.\n */\nexport interface IStaticAssetCommitTokenPayload {\n bucket: IBucketRef;\n object: IObjectRef;\n expiresAt: number;\n /** The token commits only for this owner. */\n owner: string;\n /** What `resolvers.metadata` returned for the file; `{}` without one. Signed, not encrypted. */\n metadata: TStaticAssetTokenMetadata;\n stage: TStaticAssetTokenStage;\n /** Present from `VALIDATED` on: `commit` copies only content that still matches it. */\n pin?: IStaticAssetPin;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from '@hono/zod-openapi';
|
|
2
|
+
import type { IStaticAssetValidation } from './types.js';
|
|
3
|
+
/** Defines the application's check of an uploaded file; see `directUpload.validation`. */
|
|
4
|
+
export declare class StaticAssetValidation {
|
|
5
|
+
/** Returns `opts` switched on. It exists to infer `IssueSchema`, so a handler that answers another shape of issue fails type-checking. */
|
|
6
|
+
static define<IssueSchema extends z.ZodType>(opts: IStaticAssetValidation<IssueSchema>): IStaticAssetValidation<IssueSchema> & {
|
|
7
|
+
use: true;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Defines the application's check of an uploaded file; see `directUpload.validation`. */
|
|
2
|
+
export class StaticAssetValidation {
|
|
3
|
+
/** Returns `opts` switched on. It exists to infer `IssueSchema`, so a handler that answers another shape of issue fails type-checking. */
|
|
4
|
+
static define(opts) {
|
|
5
|
+
return { use: true, ...opts };
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/validation.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,OAAO,qBAAqB;IAChC,0IAA0I;IAC1I,MAAM,CAAC,MAAM,CACX,IAAyC;QAEzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["import type { z } from '@hono/zod-openapi';\nimport type { IStaticAssetValidation } from './types';\n\n/** Defines the application's check of an uploaded file; see `directUpload.validation`. */\nexport class StaticAssetValidation {\n /** Returns `opts` switched on. It exists to infer `IssueSchema`, so a handler that answers another shape of issue fails type-checking. */\n static define<IssueSchema extends z.ZodType>(\n opts: IStaticAssetValidation<IssueSchema>,\n ): IStaticAssetValidation<IssueSchema> & { use: true } {\n return { use: true, ...opts };\n }\n}\n"]}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type BaseApplication } from '../../base/applications/index.js';
|
|
2
2
|
import { BaseComponent } from '@venizia/ignis-kernel';
|
|
3
3
|
import { type ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
4
|
-
import { type
|
|
4
|
+
import { type TStaticAssetComponentOptions } from './common/index.js';
|
|
5
5
|
import type { TMetaLinkCompatibleSchema, TMetaLinkSchema } from './models/index.js';
|
|
6
6
|
/** `Schema` is the MetaLink table the application binds. It has to live on the CLASS, not only on the options: `component(Ctor, { options })` infers the options from the class, so a class pinned to the shipped table can only carry options for that table. */
|
|
7
|
-
export declare class StaticAssetComponent<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> extends BaseComponent<
|
|
7
|
+
export declare class StaticAssetComponent<Schema extends TMetaLinkCompatibleSchema = TMetaLinkSchema> extends BaseComponent<TStaticAssetComponentOptions<Schema>> {
|
|
8
8
|
private application;
|
|
9
9
|
constructor(application: BaseApplication);
|
|
10
10
|
binding(): ValueOrPromise<void>;
|
|
11
|
+
/** One pair of services per entry that turns direct upload on. The routes run the very objects an application's service resolves from the keys. */
|
|
12
|
+
private bindDirectUploadServices;
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=component.d.ts.map
|