@ttt-productions/media-processing-core 0.8.16 → 0.8.18
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/audio/audio-processor.d.ts +2 -2
- package/dist/audio/audio-processor.d.ts.map +1 -1
- package/dist/audio/audio-processor.js +63 -50
- package/dist/audio/audio-processor.js.map +1 -1
- package/dist/audio/probe.d.ts +1 -1
- package/dist/audio/probe.d.ts.map +1 -1
- package/dist/audio/probe.js +6 -5
- package/dist/audio/probe.js.map +1 -1
- package/dist/duration/media-duration.d.ts +2 -13
- package/dist/duration/media-duration.d.ts.map +1 -1
- package/dist/duration/media-duration.js +24 -49
- package/dist/duration/media-duration.js.map +1 -1
- package/dist/image/formats.d.ts +2 -13
- package/dist/image/formats.d.ts.map +1 -1
- package/dist/image/formats.js +25 -35
- package/dist/image/formats.js.map +1 -1
- package/dist/image/image-processor.d.ts +2 -2
- package/dist/image/image-processor.d.ts.map +1 -1
- package/dist/image/image-processor.js +48 -57
- package/dist/image/image-processor.js.map +1 -1
- package/dist/image/resize.d.ts +2 -16
- package/dist/image/resize.d.ts.map +1 -1
- package/dist/image/resize.js +13 -28
- package/dist/image/resize.js.map +1 -1
- package/dist/index.d.ts +19 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/inspection/inspect-media.d.ts +13 -20
- package/dist/inspection/inspect-media.d.ts.map +1 -1
- package/dist/inspection/inspect-media.js +197 -201
- package/dist/inspection/inspect-media.js.map +1 -1
- package/dist/io/fs.d.ts +1 -1
- package/dist/io/fs.d.ts.map +1 -1
- package/dist/io/fs.js +4 -5
- package/dist/io/fs.js.map +1 -1
- package/dist/io/local-input.d.ts +1 -21
- package/dist/io/local-input.d.ts.map +1 -1
- package/dist/io/local-input.js +15 -35
- package/dist/io/local-input.js.map +1 -1
- package/dist/io/types.d.ts +0 -3
- package/dist/io/types.d.ts.map +1 -1
- package/dist/io/types.js.map +1 -1
- package/dist/moderation/merge.d.ts +1 -1
- package/dist/moderation/merge.d.ts.map +1 -1
- package/dist/moderation/merge.js +1 -2
- package/dist/moderation/merge.js.map +1 -1
- package/dist/moderation/types.d.ts +3 -5
- package/dist/moderation/types.d.ts.map +1 -1
- package/dist/moderation/types.js.map +1 -1
- package/dist/process-media.d.ts +2 -3
- package/dist/process-media.d.ts.map +1 -1
- package/dist/process-media.js +9 -9
- package/dist/process-media.js.map +1 -1
- package/dist/processing/errors.d.ts.map +1 -1
- package/dist/processing/errors.js +1 -1
- package/dist/processing/errors.js.map +1 -1
- package/dist/processing/result.d.ts +2 -2
- package/dist/processing/result.js +1 -1
- package/dist/processing/result.js.map +1 -1
- package/dist/run-pipeline.d.ts +5 -22
- package/dist/run-pipeline.d.ts.map +1 -1
- package/dist/run-pipeline.js +72 -81
- package/dist/run-pipeline.js.map +1 -1
- package/dist/server/download-token.d.ts +0 -6
- package/dist/server/download-token.d.ts.map +1 -1
- package/dist/server/download-token.js +3 -13
- package/dist/server/download-token.js.map +1 -1
- package/dist/server/firebase-media-io.d.ts +3 -13
- package/dist/server/firebase-media-io.d.ts.map +1 -1
- package/dist/server/firebase-media-io.js +1 -6
- package/dist/server/firebase-media-io.js.map +1 -1
- package/dist/server/gcs-errors.d.ts +0 -8
- package/dist/server/gcs-errors.d.ts.map +1 -1
- package/dist/server/gcs-errors.js +2 -10
- package/dist/server/gcs-errors.js.map +1 -1
- package/dist/server/index.d.ts +7 -6
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +7 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/pending-media.d.ts +3 -34
- package/dist/server/pending-media.d.ts.map +1 -1
- package/dist/server/pending-media.js +13 -30
- package/dist/server/pending-media.js.map +1 -1
- package/dist/server/r2-retry.d.ts +4 -52
- package/dist/server/r2-retry.d.ts.map +1 -1
- package/dist/server/r2-retry.js +49 -134
- package/dist/server/r2-retry.js.map +1 -1
- package/dist/server/staged-object.d.ts +2 -46
- package/dist/server/staged-object.d.ts.map +1 -1
- package/dist/server/staged-object.js +4 -48
- package/dist/server/staged-object.js.map +1 -1
- package/dist/server/storage-ops.d.ts +5 -67
- package/dist/server/storage-ops.d.ts.map +1 -1
- package/dist/server/storage-ops.js +110 -185
- package/dist/server/storage-ops.js.map +1 -1
- package/dist/types.d.ts +2 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/log.js +3 -3
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +1 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/safe-path.d.ts.map +1 -1
- package/dist/utils/safe-path.js +8 -9
- package/dist/utils/safe-path.js.map +1 -1
- package/dist/validation/validate-duration.d.ts.map +1 -1
- package/dist/validation/validate-duration.js.map +1 -1
- package/dist/validation/validate-mime.d.ts.map +1 -1
- package/dist/validation/validate-mime.js.map +1 -1
- package/dist/validation/validate-size.d.ts.map +1 -1
- package/dist/validation/validate-size.js.map +1 -1
- package/dist/video/ffmpeg.d.ts +1 -23
- package/dist/video/ffmpeg.d.ts.map +1 -1
- package/dist/video/ffmpeg.js +57 -64
- package/dist/video/ffmpeg.js.map +1 -1
- package/dist/video/probe.d.ts +1 -1
- package/dist/video/probe.d.ts.map +1 -1
- package/dist/video/probe.js +10 -8
- package/dist/video/probe.js.map +1 -1
- package/dist/video/video-processor.d.ts +2 -2
- package/dist/video/video-processor.d.ts.map +1 -1
- package/dist/video/video-processor.js +125 -96
- package/dist/video/video-processor.js.map +1 -1
- package/dist/workspace/temp.js +4 -4
- package/dist/workspace/temp.js.map +1 -1
- package/package.json +2 -2
- package/dist/audio/index.d.ts +0 -3
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -3
- package/dist/audio/index.js.map +0 -1
- package/dist/image/index.d.ts +0 -4
- package/dist/image/index.d.ts.map +0 -1
- package/dist/image/index.js +0 -4
- package/dist/image/index.js.map +0 -1
- package/dist/video/index.d.ts +0 -4
- package/dist/video/index.d.ts.map +0 -1
- package/dist/video/index.js +0 -4
- package/dist/video/index.js.map +0 -1
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type { getStorage } from
|
|
2
|
-
import { R2StorageError } from "./r2-retry.js";
|
|
3
|
-
export { R2StorageError };
|
|
4
|
-
/**
|
|
5
|
-
* A copy found an object at its destination key that is not this copy's result, and
|
|
6
|
-
* wrote nothing; that object is untouched. The key is a PROPERTY, never message text, so
|
|
7
|
-
* an escaping error never carries an object key to monitoring.
|
|
8
|
-
*/
|
|
1
|
+
import type { getStorage } from 'firebase-admin/storage';
|
|
9
2
|
export declare class ObjectAlreadyExistsError extends Error {
|
|
10
3
|
readonly key: string;
|
|
11
4
|
constructor(key: string);
|
|
12
5
|
}
|
|
13
|
-
/**
|
|
14
|
-
export type Bucket = ReturnType<ReturnType<typeof getStorage>[
|
|
6
|
+
/** Inferred from usage so the package takes no @google-cloud/storage dependency. */
|
|
7
|
+
export type Bucket = ReturnType<ReturnType<typeof getStorage>['bucket']>;
|
|
15
8
|
export interface ObjectWriteResult {
|
|
16
9
|
key: string;
|
|
17
10
|
sizeBytes: number;
|
|
@@ -23,71 +16,25 @@ export interface ObjectReadResult {
|
|
|
23
16
|
}
|
|
24
17
|
export interface ObjectCopyResult {
|
|
25
18
|
key: string;
|
|
26
|
-
/**
|
|
27
|
-
* `true` when the destination already held this copy's result — the same source version,
|
|
28
|
-
* committed by an earlier attempt whose answer was lost or by a concurrent identical
|
|
29
|
-
* copy; `false` when this call committed it.
|
|
30
|
-
*/
|
|
31
19
|
alreadyPresent: boolean;
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
* What `deleteCopy` found at the destination: `deleted` — a copy of the source, now removed;
|
|
35
|
-
* `absent` — no object; `notThisCopy` — an object this package did not copy from that
|
|
36
|
-
* source, left untouched.
|
|
37
|
-
*/
|
|
38
|
-
export type DeleteCopyResult = "deleted" | "absent" | "notThisCopy";
|
|
21
|
+
export type DeleteCopyResult = 'deleted' | 'absent' | 'notThisCopy';
|
|
39
22
|
export interface MediaObjectStore {
|
|
40
|
-
/**
|
|
41
|
-
* Upload a local file to the store at `key`. Objects are written with a
|
|
42
|
-
* one-year `immutable` cache-control, so keys are write-once: a replacement is
|
|
43
|
-
* written under a NEW key and the app repoints its reference to it. Overwriting
|
|
44
|
-
* an existing key would keep serving the old bytes from caches for up to a year.
|
|
45
|
-
*/
|
|
23
|
+
/** Objects carry a one-year `immutable` cache-control, so a key is write-once: an overwrite keeps serving the old bytes from caches. */
|
|
46
24
|
putFile(args: {
|
|
47
25
|
localPath: string;
|
|
48
26
|
key: string;
|
|
49
27
|
contentType?: string;
|
|
50
28
|
}): Promise<ObjectWriteResult>;
|
|
51
|
-
/**
|
|
52
|
-
* Server-side copy within the store. It never overwrites and is idempotent: it commits
|
|
53
|
-
* only when `toKey` holds no object, in one call that writes the destination fully
|
|
54
|
-
* formed (the source version's bytes and content headers, its provenance, and this
|
|
55
|
-
* store's token policy). When `toKey` already holds this copy's result — a retry of
|
|
56
|
-
* the same copy of the same source version — it resolves with `alreadyPresent: true`;
|
|
57
|
-
* when it holds anything else, it throws `ObjectAlreadyExistsError` and leaves that
|
|
58
|
-
* object untouched. It never deletes anything.
|
|
59
|
-
*/
|
|
60
29
|
copy(args: {
|
|
61
30
|
fromKey: string;
|
|
62
31
|
toKey: string;
|
|
63
32
|
}): Promise<ObjectCopyResult>;
|
|
64
|
-
/**
|
|
65
|
-
* Download an object's bytes from the store to a local file (streamed, so a
|
|
66
|
-
* large video never sits fully in memory). Used by safety evidence capture to
|
|
67
|
-
* pull final media — which may live in a different backend (R2) — before
|
|
68
|
-
* writing it into the separate (GCS) evidence vault: capture is inherently
|
|
69
|
-
* read-here-then-write, NOT a server-side copy, because source and vault can
|
|
70
|
-
* be different backends.
|
|
71
|
-
*/
|
|
72
33
|
readToFile(args: {
|
|
73
34
|
key: string;
|
|
74
35
|
localPath: string;
|
|
75
36
|
}): Promise<ObjectReadResult>;
|
|
76
|
-
/** Delete an object. Missing objects are a no-op, not an error. */
|
|
77
37
|
delete(key: string): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Delete `toKey` only when the object there is a copy of `fromKey` this package made: its
|
|
80
|
-
* own recorded provenance must name `fromKey` as its source. Only the destination is read,
|
|
81
|
-
* so this works after the source is gone. Any other object — a copy of another source, or
|
|
82
|
-
* one with no provenance — is left untouched and answers `notThisCopy`.
|
|
83
|
-
*
|
|
84
|
-
* Firebase Storage deletes only the generation it checked; an object replaced after the
|
|
85
|
-
* check is checked again, never deleted blind. R2's DeleteObject takes no precondition, so
|
|
86
|
-
* there the delete follows the check unconditioned. That gap is harmless only under the key
|
|
87
|
-
* contract: keys are write-once and a copy never replaces an object, so in the gap the
|
|
88
|
-
* checked object can only be removed; and a copy's key is derived from its source, so the
|
|
89
|
-
* only object that can land there afterwards is another copy of the same source.
|
|
90
|
-
*/
|
|
91
38
|
deleteCopy(args: {
|
|
92
39
|
fromKey: string;
|
|
93
40
|
toKey: string;
|
|
@@ -98,29 +45,20 @@ export interface CreateR2ObjectStoreArgs {
|
|
|
98
45
|
accessKeyId: string;
|
|
99
46
|
secretAccessKey: string;
|
|
100
47
|
bucket: string;
|
|
101
|
-
/** Override for tests; defaults to the real R2 S3 endpoint. */
|
|
102
48
|
endpoint?: string;
|
|
103
|
-
/** Override fetch for tests. */
|
|
104
49
|
fetchImpl?: typeof fetch;
|
|
105
|
-
/** Test seam: override the retry sleep (defaults to real `setTimeout`). */
|
|
106
50
|
sleepImpl?: (ms: number) => Promise<void>;
|
|
107
|
-
/** Test seam: override the backoff jitter source (defaults to `Math.random`). */
|
|
108
51
|
randomImpl?: () => number;
|
|
109
|
-
/** Test seam: override the clock used for HTTP-date `Retry-After` (defaults to `Date.now`). */
|
|
110
52
|
nowImpl?: () => number;
|
|
111
53
|
}
|
|
112
54
|
export declare function createR2ObjectStore(args: CreateR2ObjectStoreArgs): MediaObjectStore;
|
|
113
55
|
export interface CreateFirebaseStorageObjectStoreArgs {
|
|
114
56
|
bucket: Bucket;
|
|
115
57
|
}
|
|
116
|
-
/** Firebase Storage store for deployed environments. Token-free (see header). */
|
|
117
58
|
export declare function createFirebaseStorageObjectStore(args: CreateFirebaseStorageObjectStoreArgs): MediaObjectStore;
|
|
118
59
|
export interface CreateEmulatorObjectStoreArgs extends CreateFirebaseStorageObjectStoreArgs {
|
|
119
|
-
/** Fixed token attached to every object so deterministic emulator URLs work
|
|
120
|
-
* (token URLs bypass rules in the emulator). Pass the app's constant. */
|
|
121
60
|
downloadToken: string;
|
|
122
61
|
}
|
|
123
|
-
/** Local dev / tests only: the Firebase Storage store plus a fixed download token. */
|
|
124
62
|
export declare function createFirebaseEmulatorObjectStore(args: CreateEmulatorObjectStoreArgs): MediaObjectStore;
|
|
125
63
|
export declare function getMimeFromExt(ext: string): string;
|
|
126
64
|
//# sourceMappingURL=storage-ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-ops.d.ts","sourceRoot":"","sources":["../../src/server/storage-ops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-ops.d.ts","sourceRoot":"","sources":["../../src/server/storage-ops.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAczD,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM;CAIxC;AAED,oFAAoF;AACpF,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE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