@ddd-ts-kit/kernel 0.110.1 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +81 -17
- package/README.md +76 -13
- package/dist/application/criteria/filter-operator.d.ts +1 -1
- package/dist/application/criteria/filter-operator.d.ts.map +1 -1
- package/dist/application/criteria/filter-violations.d.ts.map +1 -1
- package/dist/application/criteria/filter-violations.js +4 -3
- package/dist/application/criteria/filter-violations.js.map +1 -1
- package/dist/application/criteria/finds-text.d.ts +4 -0
- package/dist/application/criteria/finds-text.d.ts.map +1 -0
- package/dist/application/criteria/finds-text.js +12 -0
- package/dist/application/criteria/finds-text.js.map +1 -0
- package/dist/application/criteria/fold-case.d.ts +14 -0
- package/dist/application/criteria/fold-case.d.ts.map +1 -0
- package/dist/application/criteria/fold-case.js +16 -0
- package/dist/application/criteria/fold-case.js.map +1 -0
- package/dist/application/criteria/holds.d.ts.map +1 -1
- package/dist/application/criteria/holds.js +5 -4
- package/dist/application/criteria/holds.js.map +1 -1
- package/dist/application/criteria/index.d.ts +3 -0
- package/dist/application/criteria/index.d.ts.map +1 -1
- package/dist/application/criteria/index.js +3 -0
- package/dist/application/criteria/index.js.map +1 -1
- package/dist/application/criteria/is-text-search.d.ts +5 -0
- package/dist/application/criteria/is-text-search.d.ts.map +1 -0
- package/dist/application/criteria/is-text-search.js +11 -0
- package/dist/application/criteria/is-text-search.js.map +1 -0
- package/dist/application/criteria/operand-of.d.ts +2 -1
- package/dist/application/criteria/operand-of.d.ts.map +1 -1
- package/dist/application/criteria/operator-of.d.ts +2 -1
- package/dist/application/criteria/operator-of.d.ts.map +1 -1
- package/dist/application/criteria/operators-of-type.js +1 -1
- package/dist/application/criteria/operators-of-type.js.map +1 -1
- package/dist/application/criteria/text-search.d.ts +3 -0
- package/dist/application/criteria/text-search.d.ts.map +1 -0
- package/dist/application/criteria/text-search.js +2 -0
- package/dist/application/criteria/text-search.js.map +1 -0
- package/dist/application/files/content-expectation.d.ts +6 -0
- package/dist/application/files/content-expectation.d.ts.map +1 -1
- package/dist/application/files/content-matches.d.ts +12 -3
- package/dist/application/files/content-matches.d.ts.map +1 -1
- package/dist/application/files/content-matches.js +23 -28
- package/dist/application/files/content-matches.js.map +1 -1
- package/dist/application/files/content-rule-defects.d.ts +9 -0
- package/dist/application/files/content-rule-defects.d.ts.map +1 -0
- package/dist/application/files/content-rule-defects.js +57 -0
- package/dist/application/files/content-rule-defects.js.map +1 -0
- package/dist/application/files/content-rule-of.d.ts +11 -0
- package/dist/application/files/content-rule-of.d.ts.map +1 -0
- package/dist/application/files/content-rule-of.js +28 -0
- package/dist/application/files/content-rule-of.js.map +1 -0
- package/dist/application/files/content-rule.d.ts +4 -0
- package/dist/application/files/content-rule.d.ts.map +1 -0
- package/dist/application/files/content-rule.js +2 -0
- package/dist/application/files/content-rule.js.map +1 -0
- package/dist/application/files/content-rules.d.ts +4 -0
- package/dist/application/files/content-rules.d.ts.map +1 -0
- package/dist/application/files/content-rules.js +2 -0
- package/dist/application/files/content-rules.js.map +1 -0
- package/dist/application/files/index.d.ts +10 -0
- package/dist/application/files/index.d.ts.map +1 -1
- package/dist/application/files/index.js +10 -0
- package/dist/application/files/index.js.map +1 -1
- package/dist/application/files/is-utf8.d.ts +8 -0
- package/dist/application/files/is-utf8.d.ts.map +1 -0
- package/dist/application/files/is-utf8.js +16 -0
- package/dist/application/files/is-utf8.js.map +1 -0
- package/dist/application/files/looks-like-text.d.ts +8 -0
- package/dist/application/files/looks-like-text.d.ts.map +1 -0
- package/dist/application/files/looks-like-text.js +28 -0
- package/dist/application/files/looks-like-text.js.map +1 -0
- package/dist/application/files/named-only-media-types.d.ts +6 -0
- package/dist/application/files/named-only-media-types.d.ts.map +1 -0
- package/dist/application/files/named-only-media-types.js +12 -0
- package/dist/application/files/named-only-media-types.js.map +1 -0
- package/dist/application/files/signed-media-types.d.ts +3 -0
- package/dist/application/files/signed-media-types.d.ts.map +1 -0
- package/dist/application/files/signed-media-types.js +13 -0
- package/dist/application/files/signed-media-types.js.map +1 -0
- package/dist/application/files/stated-content-rule.d.ts +7 -0
- package/dist/application/files/stated-content-rule.d.ts.map +1 -0
- package/dist/application/files/stated-content-rule.js +2 -0
- package/dist/application/files/stated-content-rule.js.map +1 -0
- package/dist/application/files/text-media-types.d.ts +3 -0
- package/dist/application/files/text-media-types.d.ts.map +1 -0
- package/dist/application/files/text-media-types.js +10 -0
- package/dist/application/files/text-media-types.js.map +1 -0
- package/dist/application/files/text-rule.d.ts +17 -0
- package/dist/application/files/text-rule.d.ts.map +1 -0
- package/dist/application/files/text-rule.js +2 -0
- package/dist/application/files/text-rule.js.map +1 -0
- package/dist/application/files/zip-containers.d.ts +3 -0
- package/dist/application/files/zip-containers.d.ts.map +1 -0
- package/dist/application/files/zip-containers.js +10 -0
- package/dist/application/files/zip-containers.js.map +1 -0
- package/dist/application/persistence/advisory-lock-options.d.ts +10 -0
- package/dist/application/persistence/advisory-lock-options.d.ts.map +1 -0
- package/dist/application/persistence/advisory-lock-options.js +2 -0
- package/dist/application/persistence/advisory-lock-options.js.map +1 -0
- package/dist/application/ports/read-model-rows.d.ts +8 -2
- package/dist/application/ports/read-model-rows.d.ts.map +1 -1
- package/dist/application/ports/read-model-rows.js.map +1 -1
- package/dist/application/ports/read-model-store.d.ts +29 -3
- package/dist/application/ports/read-model-store.d.ts.map +1 -1
- package/dist/application/ports/read-model-store.js +8 -1
- package/dist/application/ports/read-model-store.js.map +1 -1
- package/dist/application/ports/read-model-table.d.ts +7 -0
- package/dist/application/ports/read-model-table.d.ts.map +1 -1
- package/dist/application/ports/read-model-table.js.map +1 -1
- package/dist/application/read-model/event-stamp.d.ts +4 -2
- package/dist/application/read-model/event-stamp.d.ts.map +1 -1
- package/dist/application/read-model/is-newer.d.ts +8 -1
- package/dist/application/read-model/is-newer.d.ts.map +1 -1
- package/dist/application/read-model/is-newer.js +8 -1
- package/dist/application/read-model/is-newer.js.map +1 -1
- package/dist/application/read-model/read-model-table-state.d.ts +53 -0
- package/dist/application/read-model/read-model-table-state.d.ts.map +1 -0
- package/dist/application/read-model/read-model-table-state.js +2 -0
- package/dist/application/read-model/read-model-table-state.js.map +1 -0
- package/dist/application/read-model/read-model-write.d.ts +9 -4
- package/dist/application/read-model/read-model-write.d.ts.map +1 -1
- package/dist/application/read-model/same-stamp.d.ts +8 -0
- package/dist/application/read-model/same-stamp.d.ts.map +1 -0
- package/dist/application/read-model/same-stamp.js +11 -0
- package/dist/application/read-model/same-stamp.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +2 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +1 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js +2 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +1 -1
- package/dist/infrastructure/files/file-inspection.js +1 -1
- package/dist/infrastructure/files/file-inspection.js.map +1 -1
- package/dist/infrastructure/files/file-staging.d.ts +4 -2
- package/dist/infrastructure/files/file-staging.d.ts.map +1 -1
- package/dist/infrastructure/files/file-staging.js +14 -6
- package/dist/infrastructure/files/file-staging.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js +2 -6
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js.map +1 -1
- package/dist/infrastructure/persistence/advisory-lock-key.d.ts +16 -0
- package/dist/infrastructure/persistence/advisory-lock-key.d.ts.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-key.js +18 -0
- package/dist/infrastructure/persistence/advisory-lock-key.js.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts +9 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js +12 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js.map +1 -0
- package/dist/infrastructure/read-model/database-failure.d.ts +19 -0
- package/dist/infrastructure/read-model/database-failure.d.ts.map +1 -0
- package/dist/infrastructure/read-model/database-failure.js +71 -0
- package/dist/infrastructure/read-model/database-failure.js.map +1 -0
- package/dist/infrastructure/read-model/live-rows-columns-of.d.ts +7 -0
- package/dist/infrastructure/read-model/live-rows-columns-of.d.ts.map +1 -0
- package/dist/infrastructure/read-model/live-rows-columns-of.js +20 -0
- package/dist/infrastructure/read-model/live-rows-columns-of.js.map +1 -0
- package/dist/infrastructure/read-model/live-rows-constraint-form.d.ts +11 -0
- package/dist/infrastructure/read-model/live-rows-constraint-form.d.ts.map +1 -0
- package/dist/infrastructure/read-model/live-rows-constraint-form.js +13 -0
- package/dist/infrastructure/read-model/live-rows-constraint-form.js.map +1 -0
- package/dist/infrastructure/read-model/live-rows-constraint-of.d.ts +6 -0
- package/dist/infrastructure/read-model/live-rows-constraint-of.d.ts.map +1 -0
- package/dist/infrastructure/read-model/live-rows-constraint-of.js +18 -0
- package/dist/infrastructure/read-model/live-rows-constraint-of.js.map +1 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.d.ts +34 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.d.ts.map +1 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.js +124 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.js.map +1 -0
- package/dist/infrastructure/read-model/projection-rebuild.d.ts +4 -1
- package/dist/infrastructure/read-model/projection-rebuild.d.ts.map +1 -1
- package/dist/infrastructure/read-model/projection-rebuild.js +4 -1
- package/dist/infrastructure/read-model/projection-rebuild.js.map +1 -1
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts +12 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js +16 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-migration.d.ts +31 -0
- package/dist/infrastructure/read-model/read-model-table-migration.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-migration.js +82 -0
- package/dist/infrastructure/read-model/read-model-table-migration.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts +28 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.js +132 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-notes.d.ts +9 -0
- package/dist/infrastructure/read-model/read-model-table-notes.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-notes.js +36 -0
- package/dist/infrastructure/read-model/read-model-table-notes.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-ready.d.ts +4 -0
- package/dist/infrastructure/read-model/read-model-table-ready.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-ready.js +5 -0
- package/dist/infrastructure/read-model/read-model-table-ready.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-tables-not-ready-error.d.ts +24 -0
- package/dist/infrastructure/read-model/read-model-tables-not-ready-error.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-tables-not-ready-error.js +40 -0
- package/dist/infrastructure/read-model/read-model-tables-not-ready-error.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-tables.d.ts +82 -0
- package/dist/infrastructure/read-model/read-model-tables.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-tables.js +161 -0
- package/dist/infrastructure/read-model/read-model-tables.js.map +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts.map +1 -1
- package/dist/infrastructure/read-model/shadow-read-model-store.js +3 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.js.map +1 -1
- package/dist/infrastructure/read-model/table-read-model-store.d.ts +8 -0
- package/dist/infrastructure/read-model/table-read-model-store.d.ts.map +1 -1
- package/dist/infrastructure/read-model/table-read-model-store.js +11 -0
- package/dist/infrastructure/read-model/table-read-model-store.js.map +1 -1
- package/dist/infrastructure/read-model/write-if-newer.d.ts +14 -2
- package/dist/infrastructure/read-model/write-if-newer.d.ts.map +1 -1
- package/dist/infrastructure/read-model/write-if-newer.js +35 -5
- package/dist/infrastructure/read-model/write-if-newer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { TextSearch } from './text-search.js';
|
|
1
2
|
/**
|
|
2
3
|
* The operators the compiler accepts on a field holding `Value`: no order on a boolean, no
|
|
3
4
|
* text search off a string, no `isNull` on a field that is never null.
|
|
4
5
|
*/
|
|
5
|
-
export type OperatorOf<Value> = 'eq' | 'ne' | 'in' | ([Extract<Value, null | undefined>] extends [never] ? never : 'isNull') | ([NonNullable<Value>] extends [boolean] ? never : 'gt' | 'gte' | 'lt' | 'lte' | 'between') | ([NonNullable<Value>] extends [string] ?
|
|
6
|
+
export type OperatorOf<Value> = 'eq' | 'ne' | 'in' | ([Extract<Value, null | undefined>] extends [never] ? never : 'isNull') | ([NonNullable<Value>] extends [boolean] ? never : 'gt' | 'gte' | 'lt' | 'lte' | 'between') | ([NonNullable<Value>] extends [string] ? TextSearch : never);
|
|
6
7
|
//# sourceMappingURL=operator-of.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operator-of.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,IACxB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,QAAQ,CAAC,GACvE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GAC1F,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"operator-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operator-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,IACxB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,QAAQ,CAAC,GACvE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GAC1F,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ANY = ['eq', 'ne', 'in', 'isNull'];
|
|
2
2
|
const ORDERED = [...ANY, 'gt', 'gte', 'lt', 'lte', 'between'];
|
|
3
3
|
const BY_TYPE = {
|
|
4
|
-
string: [...ORDERED, 'contains', 'startsWith'],
|
|
4
|
+
string: [...ORDERED, 'contains', 'startsWith', 'containsIgnoringCase', 'startsWithIgnoringCase'],
|
|
5
5
|
number: ORDERED,
|
|
6
6
|
instant: ORDERED,
|
|
7
7
|
decimal: ORDERED,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators-of-type.js","sourceRoot":"","sources":["../../../src/application/criteria/operators-of-type.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,OAAO,GAA8B,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzF,MAAM,OAAO,GAA2D;IACtE,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"operators-of-type.js","sourceRoot":"","sources":["../../../src/application/criteria/operators-of-type.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,OAAO,GAA8B,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzF,MAAM,OAAO,GAA2D;IACtE,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,CAAC;IAChG,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,8DAA8D;AAC9D,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-search.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/text-search.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,sBAAsB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-search.js","sourceRoot":"","sources":["../../../src/application/criteria/text-search.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { ContentRules } from './content-rules.js';
|
|
2
|
+
import type { TextRule } from './text-rule.js';
|
|
1
3
|
/** What an incoming content must be: one of the accepted media types, the one it declares, verified on its bytes. */
|
|
2
4
|
export interface ContentExpectation {
|
|
3
5
|
readonly mediaType: string;
|
|
4
6
|
readonly accepted: readonly string[];
|
|
7
|
+
/** The text a text type may be. Default `utf-8`. */
|
|
8
|
+
readonly text?: TextRule;
|
|
9
|
+
/** The rule of each accepted media type the kit has none for: without one, such a type never passes. */
|
|
10
|
+
readonly contentRules?: ContentRules;
|
|
5
11
|
}
|
|
6
12
|
//# sourceMappingURL=content-expectation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-expectation.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-expectation.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC"}
|
|
1
|
+
{"version":3,"file":"content-expectation.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-expectation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,qHAAqH;AACrH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACzB,wGAAwG;IACxG,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { ContentExpectation } from './content-expectation.js';
|
|
1
2
|
/**
|
|
2
3
|
* Whether the first bytes of a content are what its declared media type says, read on the bytes
|
|
3
|
-
* and never on a file name
|
|
4
|
-
*
|
|
4
|
+
* and never on a file name, by the content rule of that type (`contentRuleOf`):
|
|
5
|
+
*
|
|
6
|
+
* - a signature: a PDF starts with `%PDF-`, a PNG with its eight bytes, an office document is a zip;
|
|
7
|
+
* - text, for the text types of the kit and those the route states as `text`: no control
|
|
8
|
+
* character, valid UTF-8 unless the route takes `single-byte` text (`TextRule`), and never the
|
|
9
|
+
* signature of a binary format;
|
|
10
|
+
* - `unchecked`, stated by the route: the bytes are taken as they are.
|
|
11
|
+
*
|
|
12
|
+
* A type with no rule never matches, and the rule of a family is not one for SVG, HTML or
|
|
13
|
+
* JavaScript: those pass only when the route states them by name.
|
|
5
14
|
*/
|
|
6
|
-
export declare function contentMatches(head: Uint8Array, declared: string): boolean;
|
|
15
|
+
export declare function contentMatches(head: Uint8Array, declared: string, expectation?: Pick<ContentExpectation, 'text' | 'contentRules'>): boolean;
|
|
7
16
|
//# sourceMappingURL=content-matches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-matches.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-matches.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-matches.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-matches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,cAAc,CAAM,GAClE,OAAO,CAeT"}
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { contentRuleOf } from './content-rule-of.js';
|
|
2
|
+
import { looksLikeText } from './looks-like-text.js';
|
|
2
3
|
import { mediaTypeOf } from './media-type-of.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
'application/zip',
|
|
6
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
7
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
8
|
-
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
9
|
-
'application/vnd.oasis.opendocument.text',
|
|
10
|
-
'application/vnd.oasis.opendocument.spreadsheet',
|
|
11
|
-
'application/epub+zip',
|
|
12
|
-
]);
|
|
13
|
-
/** Text has no signature: it is accepted when its first bytes are UTF-8 without control characters. */
|
|
14
|
-
const TEXT_TYPES = new Set(['text/plain', 'text/csv', 'text/markdown', 'application/json']);
|
|
15
|
-
/** Tab, line feed, form feed and carriage return are text; every other C0 control character is not. */
|
|
16
|
-
const TEXT_CONTROLS = new Set([9, 10, 12, 13]);
|
|
4
|
+
import { signatureOf } from './signature-of.js';
|
|
5
|
+
import { ZIP_CONTAINERS } from './zip-containers.js';
|
|
17
6
|
/**
|
|
18
7
|
* Whether the first bytes of a content are what its declared media type says, read on the bytes
|
|
19
|
-
* and never on a file name
|
|
20
|
-
*
|
|
8
|
+
* and never on a file name, by the content rule of that type (`contentRuleOf`):
|
|
9
|
+
*
|
|
10
|
+
* - a signature: a PDF starts with `%PDF-`, a PNG with its eight bytes, an office document is a zip;
|
|
11
|
+
* - text, for the text types of the kit and those the route states as `text`: no control
|
|
12
|
+
* character, valid UTF-8 unless the route takes `single-byte` text (`TextRule`), and never the
|
|
13
|
+
* signature of a binary format;
|
|
14
|
+
* - `unchecked`, stated by the route: the bytes are taken as they are.
|
|
15
|
+
*
|
|
16
|
+
* A type with no rule never matches, and the rule of a family is not one for SVG, HTML or
|
|
17
|
+
* JavaScript: those pass only when the route states them by name.
|
|
21
18
|
*/
|
|
22
|
-
export function contentMatches(head, declared) {
|
|
19
|
+
export function contentMatches(head, declared, expectation = {}) {
|
|
23
20
|
const essence = mediaTypeOf(declared);
|
|
21
|
+
const rule = contentRuleOf(essence, expectation.contentRules);
|
|
22
|
+
if (rule === 'unchecked') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
24
25
|
const signature = signatureOf(head);
|
|
25
26
|
if (signature !== undefined) {
|
|
26
|
-
return
|
|
27
|
+
return rule === 'signature' && proves(signature, essence);
|
|
27
28
|
}
|
|
28
|
-
return
|
|
29
|
+
return rule === 'text' && looksLikeText(head, expectation.text ?? 'utf-8');
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
new TextDecoder('utf-8', { fatal: true }).decode(head, { stream: true });
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
return head.every((byte) => byte >= 32 || TEXT_CONTROLS.has(byte));
|
|
31
|
+
function proves(signature, essence) {
|
|
32
|
+
return signature === essence || (signature === 'application/zip' && ZIP_CONTAINERS.includes(essence));
|
|
38
33
|
}
|
|
39
34
|
//# sourceMappingURL=content-matches.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-matches.js","sourceRoot":"","sources":["../../../src/application/files/content-matches.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-matches.js","sourceRoot":"","sources":["../../../src/application/files/content-matches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAgB,EAChB,QAAgB,EAChB,WAAW,GAAsD,EAAE;IAEnE,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IAE9D,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,IAAI,KAAK,MAAM,IAAI,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,MAAM,CAAC,SAAiB,EAAE,OAAe;IAChD,OAAO,SAAS,KAAK,OAAO,IAAI,CAAC,SAAS,KAAK,iBAAiB,IAAI,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContentExpectation } from './content-expectation.js';
|
|
2
|
+
/**
|
|
3
|
+
* What is wrong with the media types an upload accepts, one sentence each, before any request: an
|
|
4
|
+
* accepted type no content could ever prove (no signature, no text rule, none stated), and a stated
|
|
5
|
+
* rule that does nothing (for a type the kit already verifies, or one not accepted). Empty when
|
|
6
|
+
* every accepted type has a content rule: whoever declares the upload refuses to start otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function contentRuleDefects(expectation: Pick<ContentExpectation, 'accepted' | 'contentRules'>): string[];
|
|
9
|
+
//# sourceMappingURL=content-rule-defects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule-defects.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-rule-defects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAahE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,cAAc,CAAC,GAAG,MAAM,EAAE,CAO/G"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { acceptsMediaType } from './accepts-media-type.js';
|
|
2
|
+
import { contentRuleOf } from './content-rule-of.js';
|
|
3
|
+
import { mediaTypeOf } from './media-type-of.js';
|
|
4
|
+
import { SIGNED_MEDIA_TYPES } from './signed-media-types.js';
|
|
5
|
+
import { TEXT_MEDIA_TYPES } from './text-media-types.js';
|
|
6
|
+
/** `type/subtype`, or a family `type/*`. */
|
|
7
|
+
const MEDIA_TYPE = /^[^/*\s]+\/(?:[^/*\s]+|\*)$/;
|
|
8
|
+
const STATE_ONE = "State one in `contentRules`: 'text' (held to the text rule) or 'unchecked' (the bytes are taken as they are).";
|
|
9
|
+
/**
|
|
10
|
+
* What is wrong with the media types an upload accepts, one sentence each, before any request: an
|
|
11
|
+
* accepted type no content could ever prove (no signature, no text rule, none stated), and a stated
|
|
12
|
+
* rule that does nothing (for a type the kit already verifies, or one not accepted). Empty when
|
|
13
|
+
* every accepted type has a content rule: whoever declares the upload refuses to start otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export function contentRuleDefects(expectation) {
|
|
16
|
+
const { accepted, contentRules = {} } = expectation;
|
|
17
|
+
return [
|
|
18
|
+
...accepted.flatMap((entry) => unprovable(entry, contentRules)),
|
|
19
|
+
...Object.keys(contentRules).flatMap((written) => misstated(written, accepted)),
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
function unprovable(entry, stated) {
|
|
23
|
+
const essence = mediaTypeOf(entry);
|
|
24
|
+
if (!MEDIA_TYPE.test(essence)) {
|
|
25
|
+
return [`"${entry}" is neither a media type nor a family of them (\`image/*\`): no file is ever of it.`];
|
|
26
|
+
}
|
|
27
|
+
const proven = essence.endsWith('/*') ? familyHasRule(essence, stated) : contentRuleOf(essence, stated) !== undefined;
|
|
28
|
+
return proven
|
|
29
|
+
? []
|
|
30
|
+
: [
|
|
31
|
+
`"${entry}" has no content rule: the kit knows neither a signature nor a text rule for it, so no file of that type ever passes. ${STATE_ONE}`,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/** A family is provable when one type of it is: one the kit knows, or one a stated rule names, the family itself included. */
|
|
35
|
+
function familyHasRule(family, stated) {
|
|
36
|
+
const prefix = family.slice(0, -1);
|
|
37
|
+
const known = [...SIGNED_MEDIA_TYPES, ...TEXT_MEDIA_TYPES, ...Object.keys(stated).map(mediaTypeOf)];
|
|
38
|
+
return known.some((type) => type.startsWith(prefix));
|
|
39
|
+
}
|
|
40
|
+
function misstated(written, accepted) {
|
|
41
|
+
const essence = mediaTypeOf(written);
|
|
42
|
+
const ofTheKit = contentRuleOf(essence);
|
|
43
|
+
if (ofTheKit !== undefined) {
|
|
44
|
+
return [
|
|
45
|
+
`\`contentRules\` states "${written}", which the kit already verifies (${ofTheKit}): a stated rule does not replace it. Remove it.`,
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
const taken = essence.endsWith('/*')
|
|
49
|
+
? accepted.map(mediaTypeOf).includes(essence)
|
|
50
|
+
: acceptsMediaType(accepted, essence);
|
|
51
|
+
return taken
|
|
52
|
+
? []
|
|
53
|
+
: [
|
|
54
|
+
`\`contentRules\` states "${written}", which is not one of the accepted media types: add it there, or remove it.`,
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=content-rule-defects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule-defects.js","sourceRoot":"","sources":["../../../src/application/files/content-rule-defects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,4CAA4C;AAC5C,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,MAAM,SAAS,GACb,+GAA+G,CAAC;AAElH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAkE;IACnG,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,WAAW,CAAC;IAEpD,OAAO;QACL,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/D,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,MAAoB;IACrD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAEnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,KAAK,sFAAsF,CAAC,CAAC;IAC3G,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,SAAS,CAAC;IAEtH,OAAO,MAAM;QACX,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACE,IAAI,KAAK,yHAAyH,SAAS,EAAE;SAC9I,CAAC;AACR,CAAC;AAED,8HAA8H;AAC9H,SAAS,aAAa,CAAC,MAAc,EAAE,MAAoB;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,CAAC,GAAG,kBAAkB,EAAE,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;IAEpG,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,SAAS,CAAC,OAAe,EAAE,QAA2B;IAC7D,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAExC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;YACL,4BAA4B,OAAO,sCAAsC,QAAQ,kDAAkD;SACpI,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAExC,OAAO,KAAK;QACV,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACE,4BAA4B,OAAO,8EAA8E;SAClH,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentRule } from './content-rule.js';
|
|
2
|
+
import type { ContentRules } from './content-rules.js';
|
|
3
|
+
/**
|
|
4
|
+
* The content rule of a media type: the one of the kit when it knows the type (a signature, or
|
|
5
|
+
* text), else the one the route states for it, else for its family. `undefined` when neither says:
|
|
6
|
+
* a content of that type never passes, which `contentRuleDefects` reports before any request.
|
|
7
|
+
* The rule of a family never reaches a type a browser runs (`NAMED_ONLY_MEDIA_TYPES`: SVG, HTML,
|
|
8
|
+
* JavaScript): the route states that one by its name, or does not take it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function contentRuleOf(mediaType: string, stated?: ContentRules): ContentRule | undefined;
|
|
11
|
+
//# sourceMappingURL=content-rule-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule-of.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-rule-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOpD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,YAAiB,GAAG,WAAW,GAAG,SAAS,CAInG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { mediaTypeOf } from './media-type-of.js';
|
|
2
|
+
import { NAMED_ONLY_MEDIA_TYPES } from './named-only-media-types.js';
|
|
3
|
+
import { SIGNED_MEDIA_TYPES } from './signed-media-types.js';
|
|
4
|
+
import { TEXT_MEDIA_TYPES } from './text-media-types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The content rule of a media type: the one of the kit when it knows the type (a signature, or
|
|
7
|
+
* text), else the one the route states for it, else for its family. `undefined` when neither says:
|
|
8
|
+
* a content of that type never passes, which `contentRuleDefects` reports before any request.
|
|
9
|
+
* The rule of a family never reaches a type a browser runs (`NAMED_ONLY_MEDIA_TYPES`: SVG, HTML,
|
|
10
|
+
* JavaScript): the route states that one by its name, or does not take it.
|
|
11
|
+
*/
|
|
12
|
+
export function contentRuleOf(mediaType, stated = {}) {
|
|
13
|
+
const essence = mediaTypeOf(mediaType);
|
|
14
|
+
return kitRuleOf(essence) ?? statedFor(essence, stated) ?? statedForFamilyOf(essence, stated);
|
|
15
|
+
}
|
|
16
|
+
function kitRuleOf(essence) {
|
|
17
|
+
if (SIGNED_MEDIA_TYPES.includes(essence)) {
|
|
18
|
+
return 'signature';
|
|
19
|
+
}
|
|
20
|
+
return TEXT_MEDIA_TYPES.includes(essence) ? 'text' : undefined;
|
|
21
|
+
}
|
|
22
|
+
function statedForFamilyOf(essence, stated) {
|
|
23
|
+
return NAMED_ONLY_MEDIA_TYPES.includes(essence) ? undefined : statedFor(`${essence.split('/')[0] ?? ''}/*`, stated);
|
|
24
|
+
}
|
|
25
|
+
function statedFor(essence, stated) {
|
|
26
|
+
return Object.entries(stated).find(([written]) => mediaTypeOf(written) === essence)?.[1];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=content-rule-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule-of.js","sourceRoot":"","sources":["../../../src/application/files/content-rule-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,MAAM,GAAiB,EAAE;IACxE,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAe,EAAE,MAAoB;IAC9D,OAAO,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACtH,CAAC;AAED,SAAS,SAAS,CAAC,OAAe,EAAE,MAAoB;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StatedContentRule } from './stated-content-rule.js';
|
|
2
|
+
/** How the content of a media type is verified: by the signature of its format, or as its route states. */
|
|
3
|
+
export type ContentRule = 'signature' | StatedContentRule;
|
|
4
|
+
//# sourceMappingURL=content-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,2GAA2G;AAC3G,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rule.js","sourceRoot":"","sources":["../../../src/application/files/content-rule.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StatedContentRule } from './stated-content-rule.js';
|
|
2
|
+
/** The content rules a route states, by exact media type or by family (`video/*`): the exact one wins. */
|
|
3
|
+
export type ContentRules = Readonly<Record<string, StatedContentRule>>;
|
|
4
|
+
//# sourceMappingURL=content-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rules.d.ts","sourceRoot":"","sources":["../../../src/application/files/content-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,0GAA0G;AAC1G,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rules.js","sourceRoot":"","sources":["../../../src/application/files/content-rules.ts"],"names":[],"mappings":""}
|
|
@@ -3,6 +3,10 @@ export * from './assert-expiry.js';
|
|
|
3
3
|
export * from './content-disposition.js';
|
|
4
4
|
export * from './content-expectation.js';
|
|
5
5
|
export * from './content-matches.js';
|
|
6
|
+
export * from './content-rule.js';
|
|
7
|
+
export * from './content-rule-defects.js';
|
|
8
|
+
export * from './content-rule-of.js';
|
|
9
|
+
export * from './content-rules.js';
|
|
6
10
|
export * from './download-url-options.js';
|
|
7
11
|
export * from './file-content.js';
|
|
8
12
|
export * from './file-error.js';
|
|
@@ -13,19 +17,25 @@ export * from './file-metadata.js';
|
|
|
13
17
|
export * from './file-source.js';
|
|
14
18
|
export * from './file-upload.js';
|
|
15
19
|
export * from './inspection-limits.js';
|
|
20
|
+
export * from './is-utf8.js';
|
|
16
21
|
export * from './listed-file.js';
|
|
17
22
|
export * from './max-signed-url-seconds.js';
|
|
18
23
|
export * from './media-type-of.js';
|
|
24
|
+
export * from './named-only-media-types.js';
|
|
19
25
|
export * from './pending-upload.js';
|
|
20
26
|
export * from './pending-upload-link.js';
|
|
21
27
|
export * from './put-options.js';
|
|
22
28
|
export * from './received-file.js';
|
|
23
29
|
export * from './scan-verdict.js';
|
|
24
30
|
export * from './signature-of.js';
|
|
31
|
+
export * from './signed-media-types.js';
|
|
25
32
|
export * from './signed-download.js';
|
|
26
33
|
export * from './signed-upload.js';
|
|
27
34
|
export * from './signed-url.js';
|
|
28
35
|
export * from './staged-key-of.js';
|
|
36
|
+
export * from './stated-content-rule.js';
|
|
29
37
|
export * from './stored-file.js';
|
|
38
|
+
export * from './text-media-types.js';
|
|
39
|
+
export * from './text-rule.js';
|
|
30
40
|
export * from './upload-url-options.js';
|
|
31
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
|
@@ -3,6 +3,10 @@ export * from './assert-expiry.js';
|
|
|
3
3
|
export * from './content-disposition.js';
|
|
4
4
|
export * from './content-expectation.js';
|
|
5
5
|
export * from './content-matches.js';
|
|
6
|
+
export * from './content-rule.js';
|
|
7
|
+
export * from './content-rule-defects.js';
|
|
8
|
+
export * from './content-rule-of.js';
|
|
9
|
+
export * from './content-rules.js';
|
|
6
10
|
export * from './download-url-options.js';
|
|
7
11
|
export * from './file-content.js';
|
|
8
12
|
export * from './file-error.js';
|
|
@@ -13,19 +17,25 @@ export * from './file-metadata.js';
|
|
|
13
17
|
export * from './file-source.js';
|
|
14
18
|
export * from './file-upload.js';
|
|
15
19
|
export * from './inspection-limits.js';
|
|
20
|
+
export * from './is-utf8.js';
|
|
16
21
|
export * from './listed-file.js';
|
|
17
22
|
export * from './max-signed-url-seconds.js';
|
|
18
23
|
export * from './media-type-of.js';
|
|
24
|
+
export * from './named-only-media-types.js';
|
|
19
25
|
export * from './pending-upload.js';
|
|
20
26
|
export * from './pending-upload-link.js';
|
|
21
27
|
export * from './put-options.js';
|
|
22
28
|
export * from './received-file.js';
|
|
23
29
|
export * from './scan-verdict.js';
|
|
24
30
|
export * from './signature-of.js';
|
|
31
|
+
export * from './signed-media-types.js';
|
|
25
32
|
export * from './signed-download.js';
|
|
26
33
|
export * from './signed-upload.js';
|
|
27
34
|
export * from './signed-url.js';
|
|
28
35
|
export * from './staged-key-of.js';
|
|
36
|
+
export * from './stated-content-rule.js';
|
|
29
37
|
export * from './stored-file.js';
|
|
38
|
+
export * from './text-media-types.js';
|
|
39
|
+
export * from './text-rule.js';
|
|
30
40
|
export * from './upload-url-options.js';
|
|
31
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether bytes are valid UTF-8 as a whole: what a reader of a file received under the text rule
|
|
3
|
+
* `single-byte` asks before it decodes, `new TextDecoder(isUtf8(bytes) ? 'utf-8' : 'windows-1252')`.
|
|
4
|
+
* Text in a single-byte encoding with one accented letter is almost never valid UTF-8, and pure
|
|
5
|
+
* ASCII reads the same in both.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isUtf8(bytes: Uint8Array): boolean;
|
|
8
|
+
//# sourceMappingURL=is-utf8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-utf8.d.ts","sourceRoot":"","sources":["../../../src/application/files/is-utf8.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAQjD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether bytes are valid UTF-8 as a whole: what a reader of a file received under the text rule
|
|
3
|
+
* `single-byte` asks before it decodes, `new TextDecoder(isUtf8(bytes) ? 'utf-8' : 'windows-1252')`.
|
|
4
|
+
* Text in a single-byte encoding with one accented letter is almost never valid UTF-8, and pure
|
|
5
|
+
* ASCII reads the same in both.
|
|
6
|
+
*/
|
|
7
|
+
export function isUtf8(bytes) {
|
|
8
|
+
try {
|
|
9
|
+
new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=is-utf8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-utf8.js","sourceRoot":"","sources":["../../../src/application/files/is-utf8.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,KAAiB;IACtC,IAAI,CAAC;QACH,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextRule } from './text-rule.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the first bytes of a content are text under a rule. Under both rules a NUL or another
|
|
4
|
+
* control character refuses, which is what the head of a binary file holds; `utf-8` also demands
|
|
5
|
+
* valid UTF-8, cut anywhere, and `single-byte` refuses a UTF-16 or UTF-32 byte order mark.
|
|
6
|
+
*/
|
|
7
|
+
export declare function looksLikeText(head: Uint8Array, rule: TextRule): boolean;
|
|
8
|
+
//# sourceMappingURL=looks-like-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"looks-like-text.d.ts","sourceRoot":"","sources":["../../../src/application/files/looks-like-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAMvE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Tab, line feed, form feed and carriage return are text; every other C0 control character is not. */
|
|
2
|
+
const TEXT_CONTROLS = new Set([9, 10, 12, 13]);
|
|
3
|
+
/**
|
|
4
|
+
* Whether the first bytes of a content are text under a rule. Under both rules a NUL or another
|
|
5
|
+
* control character refuses, which is what the head of a binary file holds; `utf-8` also demands
|
|
6
|
+
* valid UTF-8, cut anywhere, and `single-byte` refuses a UTF-16 or UTF-32 byte order mark.
|
|
7
|
+
*/
|
|
8
|
+
export function looksLikeText(head, rule) {
|
|
9
|
+
if (!head.every((byte) => byte >= 32 || TEXT_CONTROLS.has(byte))) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return rule === 'utf-8' ? startsValidUtf8(head) : !startsWithWideMark(head);
|
|
13
|
+
}
|
|
14
|
+
function startsValidUtf8(head) {
|
|
15
|
+
try {
|
|
16
|
+
new TextDecoder('utf-8', { fatal: true }).decode(head, { stream: true });
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/** `FF FE` and `FE FF` open UTF-16, and UTF-32 in little endian: "ÿþ" opens no file of single-byte text. */
|
|
24
|
+
function startsWithWideMark(head) {
|
|
25
|
+
const [first, second] = head;
|
|
26
|
+
return (first === 0xff && second === 0xfe) || (first === 0xfe && second === 0xff);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=looks-like-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"looks-like-text.js","sourceRoot":"","sources":["../../../src/application/files/looks-like-text.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB,EAAE,IAAc;IAC5D,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,eAAe,CAAC,IAAgB;IACvC,IAAI,CAAC;QACH,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4GAA4G;AAC5G,SAAS,kBAAkB,CAAC,IAAgB;IAC1C,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE7B,OAAO,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The media types a browser runs when it opens them: a rule stated for a family (`image/*`,
|
|
3
|
+
* `text/*`) never reaches them, so that a route takes one only by naming it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NAMED_ONLY_MEDIA_TYPES: readonly string[];
|
|
6
|
+
//# sourceMappingURL=named-only-media-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-only-media-types.d.ts","sourceRoot":"","sources":["../../../src/application/files/named-only-media-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAMnD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The media types a browser runs when it opens them: a rule stated for a family (`image/*`,
|
|
3
|
+
* `text/*`) never reaches them, so that a route takes one only by naming it.
|
|
4
|
+
*/
|
|
5
|
+
export const NAMED_ONLY_MEDIA_TYPES = [
|
|
6
|
+
'image/svg+xml',
|
|
7
|
+
'text/html',
|
|
8
|
+
'application/xhtml+xml',
|
|
9
|
+
'text/javascript',
|
|
10
|
+
'application/javascript',
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=named-only-media-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-only-media-types.js","sourceRoot":"","sources":["../../../src/application/files/named-only-media-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,eAAe;IACf,WAAW;IACX,uBAAuB;IACvB,iBAAiB;IACjB,wBAAwB;CACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-media-types.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-media-types.ts"],"names":[],"mappings":"AAEA,gIAAgI;AAChI,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAS/C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ZIP_CONTAINERS } from './zip-containers.js';
|
|
2
|
+
/** The media types whose content is proven by its first bytes: the formats `signatureOf` recognises, and the zip containers. */
|
|
3
|
+
export const SIGNED_MEDIA_TYPES = [
|
|
4
|
+
'application/pdf',
|
|
5
|
+
'image/png',
|
|
6
|
+
'image/jpeg',
|
|
7
|
+
'image/gif',
|
|
8
|
+
'image/webp',
|
|
9
|
+
'application/zip',
|
|
10
|
+
'application/gzip',
|
|
11
|
+
...ZIP_CONTAINERS,
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=signed-media-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-media-types.js","sourceRoot":"","sources":["../../../src/application/files/signed-media-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,gIAAgI;AAChI,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,kBAAkB;IAClB,GAAG,cAAc;CAClB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a route states of a media type the kit knows no content rule for: `text`, held to the text
|
|
3
|
+
* rule of the route (what a browser on Windows calls a CSV, `application/vnd.ms-excel`), or
|
|
4
|
+
* `unchecked`, the bytes taken as they are, whatever they hold (`application/octet-stream`).
|
|
5
|
+
*/
|
|
6
|
+
export type StatedContentRule = 'text' | 'unchecked';
|
|
7
|
+
//# sourceMappingURL=stated-content-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stated-content-rule.d.ts","sourceRoot":"","sources":["../../../src/application/files/stated-content-rule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stated-content-rule.js","sourceRoot":"","sources":["../../../src/application/files/stated-content-rule.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-media-types.d.ts","sourceRoot":"","sources":["../../../src/application/files/text-media-types.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAO7C,CAAC"}
|