@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,34 +1,61 @@
|
|
|
1
1
|
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
2
|
-
/**
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
static
|
|
2
|
+
/** What a controller sends with every object. */
|
|
3
|
+
export declare class StaticAssetHeaders {
|
|
4
|
+
static readonly NOSNIFF = "nosniff";
|
|
5
|
+
static readonly CSP_SANDBOX = "sandbox";
|
|
6
|
+
static readonly RANGE_UNIT: "bytes";
|
|
7
|
+
}
|
|
8
|
+
/** Content types the controller serves. */
|
|
9
|
+
export declare class StaticAssetContentTypes {
|
|
10
|
+
/**
|
|
11
|
+
* Types the controller will let a browser render, keyed off the object name. Anything absent here is
|
|
12
|
+
* served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
|
|
13
|
+
* cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
|
|
14
|
+
*/
|
|
15
|
+
static readonly RENDERABLE: Set<string>;
|
|
16
|
+
}
|
|
17
|
+
/** The built-in routes of a generated controller, the keys of `routes`. */
|
|
18
|
+
export declare class StaticAssetRouteKeys {
|
|
19
|
+
static readonly UPLOAD = "upload";
|
|
20
|
+
static readonly LIST_OBJECTS = "listObjects";
|
|
21
|
+
static readonly DELETE_OBJECT = "deleteObject";
|
|
22
|
+
static readonly GET_OBJECT_BY_NAME = "getObjectByName";
|
|
23
|
+
static readonly DOWNLOAD_OBJECT_BY_NAME = "downloadObjectByName";
|
|
24
|
+
static readonly UPLOAD_POLICY = "uploadPolicy";
|
|
25
|
+
static readonly UPLOAD_COMMIT = "uploadCommit";
|
|
26
|
+
static readonly UPLOAD_VALIDATE = "uploadValidate";
|
|
27
|
+
static readonly RECREATE_META_LINK = "recreateMetaLink";
|
|
28
|
+
/** Every key, in registration order. */
|
|
29
|
+
static readonly ALL: readonly ["getObjectByName", "downloadObjectByName", "upload", "deleteObject", "listObjects", "uploadPolicy", "uploadCommit", "uploadValidate", "recreateMetaLink"];
|
|
16
30
|
}
|
|
17
|
-
/** One of the `StaticAssetStorageTypes` values. */
|
|
18
|
-
export type TStaticAssetStorageType = TConstValue<typeof StaticAssetStorageTypes>;
|
|
19
31
|
/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
|
|
20
32
|
export declare class MetaLinkRecreateActions {
|
|
21
33
|
static readonly CREATED = "created";
|
|
22
34
|
static readonly REFRESHED = "refreshed";
|
|
23
|
-
static readonly SCHEME_SET: Set<string>;
|
|
24
|
-
static isValid(value: string): boolean;
|
|
25
35
|
}
|
|
26
36
|
/** One of the `MetaLinkRecreateActions` values. */
|
|
27
37
|
export type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;
|
|
28
|
-
/** Where a
|
|
29
|
-
export declare
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
/** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */
|
|
39
|
+
export declare class StaticAssetTokenStages {
|
|
40
|
+
static readonly ISSUED = "issued";
|
|
41
|
+
static readonly VALIDATED = "validated";
|
|
42
|
+
}
|
|
43
|
+
/** One of the `StaticAssetTokenStages` values. */
|
|
44
|
+
export type TStaticAssetTokenStage = TConstValue<typeof StaticAssetTokenStages>;
|
|
45
|
+
/** Defaults of the static asset component. */
|
|
46
|
+
export declare class StaticAssetDefaults {
|
|
47
|
+
/** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
|
|
48
|
+
static readonly PENDING_PREFIX = "pending/";
|
|
49
|
+
/** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */
|
|
50
|
+
static readonly MAX_UPLOAD_FILES = 20;
|
|
51
|
+
/** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */
|
|
52
|
+
static readonly MAX_TOKEN_METADATA_BYTES = 1024;
|
|
53
|
+
/** The key of the application's token metadata inside a MetaLink row's `metadata` column. */
|
|
54
|
+
static readonly META_LINK_METADATA_KEY = "app";
|
|
55
|
+
}
|
|
56
|
+
/** Codes the component reports in a body instead of throwing. */
|
|
57
|
+
export declare class StaticAssetMetaLinkCodes {
|
|
58
|
+
/** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
|
|
59
|
+
static readonly CREATE_FAILED = "META_LINK_CREATE_FAILED";
|
|
60
|
+
}
|
|
34
61
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,55 +1,83 @@
|
|
|
1
1
|
import { HTTP } from '@venizia/ignis-helpers/common';
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
HTTP.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
static { this.
|
|
36
|
-
static
|
|
37
|
-
|
|
38
|
-
}
|
|
2
|
+
/** What a controller sends with every object. */
|
|
3
|
+
export class StaticAssetHeaders {
|
|
4
|
+
static { this.NOSNIFF = 'nosniff'; }
|
|
5
|
+
static { this.CSP_SANDBOX = 'sandbox'; }
|
|
6
|
+
static { this.RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES; }
|
|
7
|
+
}
|
|
8
|
+
/** Content types the controller serves. */
|
|
9
|
+
export class StaticAssetContentTypes {
|
|
10
|
+
/**
|
|
11
|
+
* Types the controller will let a browser render, keyed off the object name. Anything absent here is
|
|
12
|
+
* served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
|
|
13
|
+
* cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
|
|
14
|
+
*/
|
|
15
|
+
static { this.RENDERABLE = new Set([
|
|
16
|
+
HTTP.HeaderValues.IMAGE_PNG,
|
|
17
|
+
HTTP.HeaderValues.IMAGE_JPEG,
|
|
18
|
+
HTTP.HeaderValues.IMAGE_GIF,
|
|
19
|
+
HTTP.HeaderValues.IMAGE_WEBP,
|
|
20
|
+
'image/avif',
|
|
21
|
+
'image/bmp',
|
|
22
|
+
'image/x-icon',
|
|
23
|
+
'video/mp4',
|
|
24
|
+
'video/webm',
|
|
25
|
+
'audio/mpeg',
|
|
26
|
+
'audio/wav',
|
|
27
|
+
'audio/ogg',
|
|
28
|
+
HTTP.HeaderValues.APPLICATION_PDF,
|
|
29
|
+
HTTP.HeaderValues.TEXT_PLAIN,
|
|
30
|
+
HTTP.HeaderValues.TEXT_CSV,
|
|
31
|
+
]); }
|
|
32
|
+
}
|
|
33
|
+
/** The built-in routes of a generated controller, the keys of `routes`. */
|
|
34
|
+
export class StaticAssetRouteKeys {
|
|
35
|
+
static { this.UPLOAD = 'upload'; }
|
|
36
|
+
static { this.LIST_OBJECTS = 'listObjects'; }
|
|
37
|
+
static { this.DELETE_OBJECT = 'deleteObject'; }
|
|
38
|
+
static { this.GET_OBJECT_BY_NAME = 'getObjectByName'; }
|
|
39
|
+
static { this.DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName'; }
|
|
40
|
+
static { this.UPLOAD_POLICY = 'uploadPolicy'; }
|
|
41
|
+
static { this.UPLOAD_COMMIT = 'uploadCommit'; }
|
|
42
|
+
static { this.UPLOAD_VALIDATE = 'uploadValidate'; }
|
|
43
|
+
static { this.RECREATE_META_LINK = 'recreateMetaLink'; }
|
|
44
|
+
/** Every key, in registration order. */
|
|
45
|
+
static { this.ALL = [
|
|
46
|
+
StaticAssetRouteKeys.GET_OBJECT_BY_NAME,
|
|
47
|
+
StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,
|
|
48
|
+
StaticAssetRouteKeys.UPLOAD,
|
|
49
|
+
StaticAssetRouteKeys.DELETE_OBJECT,
|
|
50
|
+
StaticAssetRouteKeys.LIST_OBJECTS,
|
|
51
|
+
StaticAssetRouteKeys.UPLOAD_POLICY,
|
|
52
|
+
StaticAssetRouteKeys.UPLOAD_COMMIT,
|
|
53
|
+
StaticAssetRouteKeys.UPLOAD_VALIDATE,
|
|
54
|
+
StaticAssetRouteKeys.RECREATE_META_LINK,
|
|
55
|
+
]; }
|
|
39
56
|
}
|
|
40
57
|
/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
|
|
41
58
|
export class MetaLinkRecreateActions {
|
|
42
59
|
static { this.CREATED = 'created'; }
|
|
43
60
|
static { this.REFRESHED = 'refreshed'; }
|
|
44
|
-
static { this.SCHEME_SET = new Set([this.CREATED, this.REFRESHED]); }
|
|
45
|
-
static isValid(value) {
|
|
46
|
-
return this.SCHEME_SET.has(value);
|
|
47
|
-
}
|
|
48
61
|
}
|
|
49
|
-
/** Where a
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
/** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */
|
|
63
|
+
export class StaticAssetTokenStages {
|
|
64
|
+
static { this.ISSUED = 'issued'; }
|
|
65
|
+
static { this.VALIDATED = 'validated'; }
|
|
66
|
+
}
|
|
67
|
+
/** Defaults of the static asset component. */
|
|
68
|
+
export class StaticAssetDefaults {
|
|
69
|
+
/** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
|
|
70
|
+
static { this.PENDING_PREFIX = 'pending/'; }
|
|
71
|
+
/** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */
|
|
72
|
+
static { this.MAX_UPLOAD_FILES = 20; }
|
|
73
|
+
/** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */
|
|
74
|
+
static { this.MAX_TOKEN_METADATA_BYTES = 1024; }
|
|
75
|
+
/** The key of the application's token metadata inside a MetaLink row's `metadata` column. */
|
|
76
|
+
static { this.META_LINK_METADATA_KEY = 'app'; }
|
|
77
|
+
}
|
|
78
|
+
/** Codes the component reports in a body instead of throwing. */
|
|
79
|
+
export class StaticAssetMetaLinkCodes {
|
|
80
|
+
/** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
|
|
81
|
+
static { this.CREATE_FAILED = 'META_LINK_CREATE_FAILED'; }
|
|
82
|
+
}
|
|
55
83
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,iDAAiD;AACjD,MAAM,OAAO,kBAAkB;aACb,YAAO,GAAG,SAAS,CAAC;aACpB,gBAA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AO,GAAG,SAAS,CAAC;aACpB,cAAS,GAAG,WAAW,CAAC;;AAM1C,+GAA+G;AAC/G,MAAM,OAAO,sBAAsB;aACjB,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,WAAW,CAAC;;AAM1C,8CAA8C;AAC9C,MAAM,OAAO,mBAAmB;IAC9B,yHAAyH;aACzG,mBAAc,GAAG,UAAU,CAAC;IAE5C,sGAAsG;aACtF,qBAAgB,GAAG,EAAE,CAAC;IAEtC,wGAAwG;aACxF,6BAAwB,GAAG,IAAI,CAAC;IAEhD,6FAA6F;aAC7E,2BAAsB,GAAG,KAAK,CAAC;;AAGjD,iEAAiE;AACjE,MAAM,OAAO,wBAAwB;IACnC,2LAA2L;aAC3K,kBAAa,GAAG,yBAAyB,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** What a controller sends with every object. */\nexport class StaticAssetHeaders {\n static readonly NOSNIFF = 'nosniff';\n static readonly CSP_SANDBOX = 'sandbox';\n static readonly RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES;\n}\n\n/** Content types the controller serves. */\nexport class StaticAssetContentTypes {\n /**\n * Types the controller will let a browser render, keyed off the object name. Anything absent here is\n * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`\n * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.\n */\n static readonly RENDERABLE = new Set<string>([\n HTTP.HeaderValues.IMAGE_PNG,\n HTTP.HeaderValues.IMAGE_JPEG,\n HTTP.HeaderValues.IMAGE_GIF,\n HTTP.HeaderValues.IMAGE_WEBP,\n 'image/avif',\n 'image/bmp',\n 'image/x-icon',\n 'video/mp4',\n 'video/webm',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n HTTP.HeaderValues.APPLICATION_PDF,\n HTTP.HeaderValues.TEXT_PLAIN,\n HTTP.HeaderValues.TEXT_CSV,\n ]);\n}\n\n/** The built-in routes of a generated controller, the keys of `routes`. */\nexport class StaticAssetRouteKeys {\n static readonly UPLOAD = 'upload';\n static readonly LIST_OBJECTS = 'listObjects';\n static readonly DELETE_OBJECT = 'deleteObject';\n static readonly GET_OBJECT_BY_NAME = 'getObjectByName';\n static readonly DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName';\n\n static readonly UPLOAD_POLICY = 'uploadPolicy';\n static readonly UPLOAD_COMMIT = 'uploadCommit';\n static readonly UPLOAD_VALIDATE = 'uploadValidate';\n\n static readonly RECREATE_META_LINK = 'recreateMetaLink';\n\n /** Every key, in registration order. */\n static readonly ALL = [\n StaticAssetRouteKeys.GET_OBJECT_BY_NAME,\n StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,\n StaticAssetRouteKeys.UPLOAD,\n StaticAssetRouteKeys.DELETE_OBJECT,\n StaticAssetRouteKeys.LIST_OBJECTS,\n StaticAssetRouteKeys.UPLOAD_POLICY,\n StaticAssetRouteKeys.UPLOAD_COMMIT,\n StaticAssetRouteKeys.UPLOAD_VALIDATE,\n StaticAssetRouteKeys.RECREATE_META_LINK,\n ] as const;\n}\n\n/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */\nexport class MetaLinkRecreateActions {\n static readonly CREATED = 'created';\n static readonly REFRESHED = 'refreshed';\n}\n\n/** One of the `MetaLinkRecreateActions` values. */\nexport type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;\n\n/** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */\nexport class StaticAssetTokenStages {\n static readonly ISSUED = 'issued';\n static readonly VALIDATED = 'validated';\n}\n\n/** One of the `StaticAssetTokenStages` values. */\nexport type TStaticAssetTokenStage = TConstValue<typeof StaticAssetTokenStages>;\n\n/** Defaults of the static asset component. */\nexport class StaticAssetDefaults {\n /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */\n static readonly PENDING_PREFIX = 'pending/';\n\n /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */\n static readonly MAX_UPLOAD_FILES = 20;\n\n /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */\n static readonly MAX_TOKEN_METADATA_BYTES = 1024;\n\n /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */\n static readonly META_LINK_METADATA_KEY = 'app';\n}\n\n/** Codes the component reports in a body instead of throwing. */\nexport class StaticAssetMetaLinkCodes {\n /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */\n static readonly CREATE_FAILED = 'META_LINK_CREATE_FAILED';\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import type { TRegisterErrors } from '@venizia/ignis-helpers/core';
|
|
|
3
3
|
export declare const StaticAssetErrors: {
|
|
4
4
|
readonly UPLOAD_NOT_AUTHORIZED: {
|
|
5
5
|
readonly message: {
|
|
6
|
-
readonly text: "Not allowed to
|
|
6
|
+
readonly text: "Not allowed to upload";
|
|
7
7
|
readonly code: "core.static_asset.upload_not_authorized";
|
|
8
8
|
};
|
|
9
9
|
readonly statusCode: 403;
|
|
@@ -35,60 +35,63 @@ export declare const StaticAssetErrors: {
|
|
|
35
35
|
readonly statusCode: 400;
|
|
36
36
|
readonly category: "validation";
|
|
37
37
|
};
|
|
38
|
-
/**
|
|
39
|
-
readonly
|
|
38
|
+
/** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */
|
|
39
|
+
readonly UPLOAD_CHANGED: {
|
|
40
40
|
readonly message: {
|
|
41
|
-
readonly text: "
|
|
42
|
-
readonly code: "core.static_asset.
|
|
41
|
+
readonly text: "The uploaded file changed after it was validated";
|
|
42
|
+
readonly code: "core.static_asset.upload_changed";
|
|
43
43
|
};
|
|
44
|
-
readonly statusCode:
|
|
44
|
+
readonly statusCode: 409;
|
|
45
45
|
readonly category: "validation";
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
/** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */
|
|
48
|
+
readonly UPLOAD_ALREADY_COMMITTED: {
|
|
48
49
|
readonly message: {
|
|
49
|
-
readonly text: "
|
|
50
|
-
readonly code: "core.static_asset.
|
|
50
|
+
readonly text: "The upload was already committed";
|
|
51
|
+
readonly code: "core.static_asset.upload_already_committed";
|
|
51
52
|
};
|
|
52
|
-
readonly statusCode:
|
|
53
|
+
readonly statusCode: 409;
|
|
53
54
|
readonly category: "validation";
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
/** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */
|
|
57
|
+
readonly UPLOAD_METADATA_INVALID: {
|
|
56
58
|
readonly message: {
|
|
57
|
-
readonly text: "Invalid
|
|
58
|
-
readonly code: "core.static_asset.
|
|
59
|
+
readonly text: "Invalid upload metadata";
|
|
60
|
+
readonly code: "core.static_asset.upload_metadata_invalid";
|
|
59
61
|
};
|
|
60
62
|
readonly statusCode: 400;
|
|
61
63
|
readonly category: "validation";
|
|
62
64
|
};
|
|
63
|
-
/**
|
|
64
|
-
readonly
|
|
65
|
+
/** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */
|
|
66
|
+
readonly UPLOAD_NOT_VALIDATED: {
|
|
65
67
|
readonly message: {
|
|
66
|
-
readonly text: "
|
|
67
|
-
readonly code: "core.static_asset.
|
|
68
|
+
readonly text: "The upload has not been validated";
|
|
69
|
+
readonly code: "core.static_asset.upload_not_validated";
|
|
68
70
|
};
|
|
69
|
-
readonly statusCode:
|
|
71
|
+
readonly statusCode: 422;
|
|
70
72
|
readonly category: "validation";
|
|
71
73
|
};
|
|
72
|
-
readonly
|
|
74
|
+
readonly BUCKET_NAME_INVALID: {
|
|
73
75
|
readonly message: {
|
|
74
|
-
readonly text: "Invalid
|
|
75
|
-
readonly code: "core.static_asset.
|
|
76
|
+
readonly text: "Invalid bucket name";
|
|
77
|
+
readonly code: "core.static_asset.bucket_name_invalid";
|
|
76
78
|
};
|
|
77
79
|
readonly statusCode: 400;
|
|
78
80
|
readonly category: "validation";
|
|
79
81
|
};
|
|
80
|
-
readonly
|
|
82
|
+
readonly OBJECT_NAME_INVALID: {
|
|
81
83
|
readonly message: {
|
|
82
|
-
readonly text: "Invalid
|
|
83
|
-
readonly code: "core.static_asset.
|
|
84
|
+
readonly text: "Invalid object name or path";
|
|
85
|
+
readonly code: "core.static_asset.object_name_invalid";
|
|
84
86
|
};
|
|
85
87
|
readonly statusCode: 400;
|
|
86
88
|
readonly category: "validation";
|
|
87
89
|
};
|
|
88
|
-
|
|
90
|
+
/** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */
|
|
91
|
+
readonly OBJECT_KEY_OUT_OF_SCOPE: {
|
|
89
92
|
readonly message: {
|
|
90
|
-
readonly text: "
|
|
91
|
-
readonly code: "core.static_asset.
|
|
93
|
+
readonly text: "Object key is outside the key prefix of this controller";
|
|
94
|
+
readonly code: "core.static_asset.object_key_out_of_scope";
|
|
92
95
|
};
|
|
93
96
|
readonly statusCode: 400;
|
|
94
97
|
readonly category: "validation";
|
|
@@ -101,14 +104,6 @@ export declare const StaticAssetErrors: {
|
|
|
101
104
|
readonly statusCode: 400;
|
|
102
105
|
readonly category: "validation";
|
|
103
106
|
};
|
|
104
|
-
readonly MAX_KEYS_INVALID: {
|
|
105
|
-
readonly message: {
|
|
106
|
-
readonly text: "Invalid maxKeys - expected a positive integer";
|
|
107
|
-
readonly code: "core.static_asset.max_keys_invalid";
|
|
108
|
-
};
|
|
109
|
-
readonly statusCode: 400;
|
|
110
|
-
readonly category: "validation";
|
|
111
|
-
};
|
|
112
107
|
};
|
|
113
108
|
/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */
|
|
114
109
|
declare module '@venizia/ignis-helpers' {
|
|
@@ -4,7 +4,7 @@ import { HTTP } from '@venizia/ignis-helpers/common';
|
|
|
4
4
|
export const StaticAssetErrors = {
|
|
5
5
|
UPLOAD_NOT_AUTHORIZED: {
|
|
6
6
|
message: {
|
|
7
|
-
text: 'Not allowed to
|
|
7
|
+
text: 'Not allowed to upload',
|
|
8
8
|
code: 'core.static_asset.upload_not_authorized',
|
|
9
9
|
},
|
|
10
10
|
statusCode: HTTP.ResultCodes.RS_4.Forbidden,
|
|
@@ -30,54 +30,60 @@ export const StaticAssetErrors = {
|
|
|
30
30
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
31
31
|
category: ErrorScopes.VALIDATION,
|
|
32
32
|
},
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */
|
|
34
|
+
UPLOAD_CHANGED: {
|
|
35
35
|
message: {
|
|
36
|
-
text: '
|
|
37
|
-
code: 'core.static_asset.
|
|
36
|
+
text: 'The uploaded file changed after it was validated',
|
|
37
|
+
code: 'core.static_asset.upload_changed',
|
|
38
38
|
},
|
|
39
|
-
statusCode: HTTP.ResultCodes.RS_4.
|
|
39
|
+
statusCode: HTTP.ResultCodes.RS_4.Conflict,
|
|
40
40
|
category: ErrorScopes.VALIDATION,
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
/** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */
|
|
43
|
+
UPLOAD_ALREADY_COMMITTED: {
|
|
44
|
+
message: {
|
|
45
|
+
text: 'The upload was already committed',
|
|
46
|
+
code: 'core.static_asset.upload_already_committed',
|
|
47
|
+
},
|
|
48
|
+
statusCode: HTTP.ResultCodes.RS_4.Conflict,
|
|
45
49
|
category: ErrorScopes.VALIDATION,
|
|
46
50
|
},
|
|
47
|
-
|
|
51
|
+
/** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */
|
|
52
|
+
UPLOAD_METADATA_INVALID: {
|
|
48
53
|
message: {
|
|
49
|
-
text: 'Invalid
|
|
50
|
-
code: 'core.static_asset.
|
|
54
|
+
text: 'Invalid upload metadata',
|
|
55
|
+
code: 'core.static_asset.upload_metadata_invalid',
|
|
51
56
|
},
|
|
52
57
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
53
58
|
category: ErrorScopes.VALIDATION,
|
|
54
59
|
},
|
|
55
|
-
/**
|
|
56
|
-
|
|
60
|
+
/** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */
|
|
61
|
+
UPLOAD_NOT_VALIDATED: {
|
|
57
62
|
message: {
|
|
58
|
-
text: '
|
|
59
|
-
code: 'core.static_asset.
|
|
63
|
+
text: 'The upload has not been validated',
|
|
64
|
+
code: 'core.static_asset.upload_not_validated',
|
|
60
65
|
},
|
|
61
|
-
statusCode: HTTP.ResultCodes.RS_4.
|
|
66
|
+
statusCode: HTTP.ResultCodes.RS_4.UnprocessableEntity,
|
|
62
67
|
category: ErrorScopes.VALIDATION,
|
|
63
68
|
},
|
|
64
|
-
|
|
65
|
-
message: { text: 'Invalid
|
|
69
|
+
BUCKET_NAME_INVALID: {
|
|
70
|
+
message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },
|
|
66
71
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
67
72
|
category: ErrorScopes.VALIDATION,
|
|
68
73
|
},
|
|
69
|
-
|
|
74
|
+
OBJECT_NAME_INVALID: {
|
|
70
75
|
message: {
|
|
71
|
-
text: 'Invalid
|
|
72
|
-
code: 'core.static_asset.
|
|
76
|
+
text: 'Invalid object name or path',
|
|
77
|
+
code: 'core.static_asset.object_name_invalid',
|
|
73
78
|
},
|
|
74
79
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
75
80
|
category: ErrorScopes.VALIDATION,
|
|
76
81
|
},
|
|
77
|
-
|
|
82
|
+
/** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */
|
|
83
|
+
OBJECT_KEY_OUT_OF_SCOPE: {
|
|
78
84
|
message: {
|
|
79
|
-
text: '
|
|
80
|
-
code: 'core.static_asset.
|
|
85
|
+
text: 'Object key is outside the key prefix of this controller',
|
|
86
|
+
code: 'core.static_asset.object_key_out_of_scope',
|
|
81
87
|
},
|
|
82
88
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
83
89
|
category: ErrorScopes.VALIDATION,
|
|
@@ -87,13 +93,5 @@ export const StaticAssetErrors = {
|
|
|
87
93
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
88
94
|
category: ErrorScopes.VALIDATION,
|
|
89
95
|
},
|
|
90
|
-
MAX_KEYS_INVALID: {
|
|
91
|
-
message: {
|
|
92
|
-
text: 'Invalid maxKeys - expected a positive integer',
|
|
93
|
-
code: 'core.static_asset.max_keys_invalid',
|
|
94
|
-
},
|
|
95
|
-
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
96
|
-
category: ErrorScopes.VALIDATION,
|
|
97
|
-
},
|
|
98
96
|
};
|
|
99
97
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,uIAAuI;AACvI,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,qBAAqB,EAAE;QACrB,OAAO,EAAE;YACP,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,uIAAuI;AACvI,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,qBAAqB,EAAE;QACrB,OAAO,EAAE;YACP,IAAI,EAAE,uBAAuB;YAC7B,IAAI,EAAE,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terErrors } from '@venizia/ignis-helpers/core';\nimport { ErrorScopes } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** Codes a client branches on for a rejected static-asset request. A throw site may override `message` to name the offending value. */\nexport const StaticAssetErrors = {\n UPLOAD_NOT_AUTHORIZED: {\n message: {\n text: 'Not allowed to upload',\n code: 'core.static_asset.upload_not_authorized',\n },\n statusCode: HTTP.ResultCodes.RS_4.Forbidden,\n category: ErrorScopes.VALIDATION,\n },\n /** Both upload paths - one condition, one code to branch on. */\n UPLOAD_TOO_LARGE: {\n message: {\n text: 'File is larger than the maximum allowed',\n code: 'core.static_asset.upload_too_large',\n },\n statusCode: HTTP.ResultCodes.RS_4.ContentTooLarge,\n category: ErrorScopes.VALIDATION,\n },\n /** Deliberately not 404 and deliberately not \"expired\": a caller learns only that the token is no good, never whether the key it names exists. */\n INVALID_COMMIT_TOKEN: {\n message: { text: 'Invalid commit token', code: 'core.static_asset.invalid_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n EXPIRED_COMMIT_TOKEN: {\n message: { text: 'Commit token has expired', code: 'core.static_asset.expired_commit_token' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** The pending object is not the one that was read: it was overwritten or removed after the pin. Raised by a pinned read and by the commit copy. */\n UPLOAD_CHANGED: {\n message: {\n text: 'The uploaded file changed after it was validated',\n code: 'core.static_asset.upload_changed',\n },\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n category: ErrorScopes.VALIDATION,\n },\n /** The destination already holds an object: the token was committed once, and a second commit would overwrite it. */\n UPLOAD_ALREADY_COMMITTED: {\n message: {\n text: 'The upload was already committed',\n code: 'core.static_asset.upload_already_committed',\n },\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n category: ErrorScopes.VALIDATION,\n },\n /** The metadata a policy would sign is not allowed: oversized, or sent by a client with no `resolvers.metadata` to read it. */\n UPLOAD_METADATA_INVALID: {\n message: {\n text: 'Invalid upload metadata',\n code: 'core.static_asset.upload_metadata_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** With a `validation` on, `commit` takes the token `upload-validate` returned, not the one the policy issued. */\n UPLOAD_NOT_VALIDATED: {\n message: {\n text: 'The upload has not been validated',\n code: 'core.static_asset.upload_not_validated',\n },\n statusCode: HTTP.ResultCodes.RS_4.UnprocessableEntity,\n category: ErrorScopes.VALIDATION,\n },\n BUCKET_NAME_INVALID: {\n message: { text: 'Invalid bucket name', code: 'core.static_asset.bucket_name_invalid' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n OBJECT_NAME_INVALID: {\n message: {\n text: 'Invalid object name or path',\n code: 'core.static_asset.object_name_invalid',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** The application's naming hook produced a key outside the entry's `keyPrefix`; nothing is written. */\n OBJECT_KEY_OUT_OF_SCOPE: {\n message: {\n text: 'Object key is outside the key prefix of this controller',\n code: 'core.static_asset.object_key_out_of_scope',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n FILE_EMPTY: {\n message: { text: 'Empty file content', code: 'core.static_asset.file_empty' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n} as const satisfies Record<string, TErrorDefinition>;\n\n/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */\ndeclare module '@venizia/ignis-helpers' {\n interface IErrorKeyRegistry extends TRegisterErrors<typeof StaticAssetErrors> {}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC","sourcesContent":["export * from './errors';\nexport * from './constants';\nexport * from './keys';\nexport * from './types';\nexport * from './validation';\n"]}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/** Container keys of the static asset component. */
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class StaticAssetBindingKeys {
|
|
3
3
|
/** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */
|
|
4
|
-
static readonly
|
|
4
|
+
static readonly STATIC_ASSET_OPTIONS = "@app/static-asset/options";
|
|
5
|
+
/** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */
|
|
6
|
+
static policyService(opts: {
|
|
7
|
+
name: string;
|
|
8
|
+
}): string;
|
|
9
|
+
/** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */
|
|
10
|
+
static commitService(opts: {
|
|
11
|
+
name: string;
|
|
12
|
+
}): string;
|
|
5
13
|
}
|
|
6
14
|
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/** Container keys of the static asset component. */
|
|
2
|
-
export class
|
|
2
|
+
export class StaticAssetBindingKeys {
|
|
3
3
|
/** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */
|
|
4
|
-
static { this.
|
|
4
|
+
static { this.STATIC_ASSET_OPTIONS = '@app/static-asset/options'; }
|
|
5
|
+
/** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */
|
|
6
|
+
static policyService(opts) {
|
|
7
|
+
return `@app/static-asset/policy-service/${opts.name}`;
|
|
8
|
+
}
|
|
9
|
+
/** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */
|
|
10
|
+
static commitService(opts) {
|
|
11
|
+
return `@app/static-asset/commit-service/${opts.name}`;
|
|
12
|
+
}
|
|
5
13
|
}
|
|
6
14
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/keys.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/keys.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,OAAO,sBAAsB;IACjC,oPAAoP;aACpO,yBAAoB,GAAG,2BAA2B,CAAC;IAEnE,iMAAiM;IACjM,MAAM,CAAC,aAAa,CAAC,IAAsB;QACzC,OAAO,oCAAoC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;IAED,gGAAgG;IAChG,MAAM,CAAC,aAAa,CAAC,IAAsB;QACzC,OAAO,oCAAoC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC","sourcesContent":["/** Container keys of the static asset component. */\nexport class StaticAssetBindingKeys {\n /** The options an application registers through `configs.artifacts` land here, because an artifact index carries classes and no options. `application.component(StaticAssetComponent, { options })` passes them directly and wins over this key. */\n static readonly STATIC_ASSET_OPTIONS = '@app/static-asset/options';\n\n /** The `StaticAssetUploadPolicyService` of one options entry, bound only for an entry that turns `directUpload` on. `name` is the entry's KEY in the options object, not the controller name. */\n static policyService(opts: { name: string }): string {\n return `@app/static-asset/policy-service/${opts.name}`;\n }\n\n /** The `StaticAssetUploadCommitService` of one options entry, bound with its policy service. */\n static commitService(opts: { name: string }): string {\n return `@app/static-asset/commit-service/${opts.name}`;\n }\n}\n"]}
|