@ttt-productions/media-processing-core 0.0.3 → 0.0.5

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.
@@ -0,0 +1,2 @@
1
+ export declare function buildFirebaseDownloadUrl(bucketName: string, storagePath: string, downloadToken: string): string;
2
+ //# sourceMappingURL=build-download-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-download-url.d.ts","sourceRoot":"","sources":["../../src/server/build-download-url.ts"],"names":[],"mappings":"AAYA,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CAOR"}
@@ -0,0 +1,20 @@
1
+ // Single source of truth for Firebase Storage download URL construction.
2
+ //
3
+ // Emulator awareness: when `FIREBASE_STORAGE_EMULATOR_HOST` is set (the
4
+ // Firebase Admin SDK auto-sets this when the Storage emulator is running),
5
+ // constructed URLs target the local emulator. Otherwise they target the
6
+ // production Firebase Storage CDN. This is critical for E2E tests — without
7
+ // it, browsers running against the emulator fetch production URLs and 404.
8
+ //
9
+ // Every download URL produced anywhere in the system MUST come from this
10
+ // function. Inline construction (`https://firebasestorage.googleapis.com/...`)
11
+ // is forbidden — it bypasses the emulator branch and breaks E2E tests.
12
+ export function buildFirebaseDownloadUrl(bucketName, storagePath, downloadToken) {
13
+ const encodedPath = encodeURIComponent(storagePath);
14
+ const emulatorHost = process.env.FIREBASE_STORAGE_EMULATOR_HOST;
15
+ const baseUrl = emulatorHost
16
+ ? `http://${emulatorHost}`
17
+ : "https://firebasestorage.googleapis.com";
18
+ return `${baseUrl}/v0/b/${bucketName}/o/${encodedPath}?alt=media&token=${downloadToken}`;
19
+ }
20
+ //# sourceMappingURL=build-download-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-download-url.js","sourceRoot":"","sources":["../../src/server/build-download-url.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,uEAAuE;AAEvE,MAAM,UAAU,wBAAwB,CACtC,UAAkB,EAClB,WAAmB,EACnB,aAAqB;IAErB,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC;IAChE,MAAM,OAAO,GAAG,YAAY;QAC1B,CAAC,CAAC,UAAU,YAAY,EAAE;QAC1B,CAAC,CAAC,wCAAwC,CAAC;IAC7C,OAAO,GAAG,OAAO,SAAS,UAAU,MAAM,WAAW,oBAAoB,aAAa,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { MediaIO } from "../io/types.js";
2
+ export interface CreateFirebaseMediaIOArgs {
3
+ inputStoragePath: string;
4
+ outputStorageBasePath: string;
5
+ }
6
+ export declare function createFirebaseMediaIO(args: CreateFirebaseMediaIOArgs): MediaIO;
7
+ //# sourceMappingURL=firebase-media-io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-media-io.d.ts","sourceRoot":"","sources":["../../src/server/firebase-media-io.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAwB9E"}
@@ -0,0 +1,32 @@
1
+ // Firebase Storage MediaIO adapter for the media-processing pipeline.
2
+ // Public signature is unchanged from earlier ttt-prod implementations,
3
+ // so existing pipeline consumers don't need to update call shapes — only
4
+ // the import path moves to `@ttt-productions/media-processing-core/server`.
5
+ //
6
+ // Internals delegate to `uploadFileToStorage` so URL construction and
7
+ // token attachment have a single source of truth.
8
+ import { getStorage } from "firebase-admin/storage";
9
+ import { uploadFileToStorage } from "./storage-ops.js";
10
+ export function createFirebaseMediaIO(args) {
11
+ const bucket = getStorage().bucket();
12
+ return {
13
+ input: {
14
+ async readToFile(localPath) {
15
+ await bucket.file(args.inputStoragePath).download({ destination: localPath });
16
+ },
17
+ },
18
+ output: {
19
+ async writeFromFile(localPath, outputKey) {
20
+ const ext = localPath.split(".").pop() || "";
21
+ const destinationPath = `${args.outputStorageBasePath}/${outputKey}.${ext}`;
22
+ const result = await uploadFileToStorage({
23
+ bucket,
24
+ localPath,
25
+ destinationPath,
26
+ });
27
+ return { url: result.url, path: result.path };
28
+ },
29
+ },
30
+ };
31
+ }
32
+ //# sourceMappingURL=firebase-media-io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-media-io.js","sourceRoot":"","sources":["../../src/server/firebase-media-io.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uEAAuE;AACvE,yEAAyE;AACzE,4EAA4E;AAC5E,EAAE;AACF,sEAAsE;AACtE,kDAAkD;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOvD,MAAM,UAAU,qBAAqB,CAAC,IAA+B;IACnE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC,MAAM,EAAE,CAAC;IAErC,OAAO;QACL,KAAK,EAAE;YACL,KAAK,CAAC,UAAU,CAAC,SAAiB;gBAChC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;YAChF,CAAC;SACF;QACD,MAAM,EAAE;YACN,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,SAAiB;gBACtD,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;gBAC7C,MAAM,eAAe,GAAG,GAAG,IAAI,CAAC,qBAAqB,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;gBAE5E,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC;oBACvC,MAAM;oBACN,SAAS;oBACT,eAAe;iBAChB,CAAC,CAAC;gBAEH,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YAChD,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./build-download-url.js";
2
+ export * from "./storage-ops.js";
3
+ export * from "./firebase-media-io.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./build-download-url.js";
2
+ export * from "./storage-ops.js";
3
+ export * from "./firebase-media-io.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { getStorage } from "firebase-admin/storage";
2
+ /** Firebase Admin Storage Bucket — inferred to avoid @google-cloud/storage dep. */
3
+ export type Bucket = ReturnType<ReturnType<typeof getStorage>["bucket"]>;
4
+ export interface StorageWriteResult {
5
+ url: string;
6
+ path: string;
7
+ token: string;
8
+ }
9
+ /**
10
+ * Upload a local file to Storage. Generates a download token, attaches it
11
+ * to the file's metadata, and returns the emulator-aware download URL.
12
+ *
13
+ * Use this for: pipeline outputs (sharp, ffmpeg) and any other "local file
14
+ * → Storage" flow.
15
+ */
16
+ export declare function uploadFileToStorage(args: {
17
+ bucket: Bucket;
18
+ localPath: string;
19
+ destinationPath: string;
20
+ contentType?: string;
21
+ cacheControl?: string;
22
+ }): Promise<StorageWriteResult>;
23
+ /**
24
+ * Move or copy a file already in Storage to a new location. Generates a
25
+ * fresh download token at the destination, attaches it, and returns the
26
+ * emulator-aware download URL.
27
+ *
28
+ * Use this for: library publish (copies from project to library), streetz
29
+ * non-media file moves, job-posting / job-reply / chat-attachment
30
+ * relocations, and any other "Storage → Storage" flow.
31
+ */
32
+ export declare function relocateStorageFile(args: {
33
+ bucket: Bucket;
34
+ fromPath: string;
35
+ toPath: string;
36
+ mode: "move" | "copy";
37
+ }): Promise<StorageWriteResult>;
38
+ /**
39
+ * Attach a fresh download token to a file already at its final Storage
40
+ * location. Use when the file is already in place and only needs a token
41
+ * (e.g., content-moderation rejection where the file was renamed earlier).
42
+ */
43
+ export declare function attachDownloadToken(args: {
44
+ bucket: Bucket;
45
+ storagePath: string;
46
+ }): Promise<StorageWriteResult>;
47
+ //# sourceMappingURL=storage-ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-ops.d.ts","sourceRoot":"","sources":["../../src/server/storage-ops.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,mFAAmF;AACnF,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmB9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkB9B;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAY9B"}
@@ -0,0 +1,103 @@
1
+ // Storage write operations — chokepoint for every file-storage side-effect
2
+ // in the system. Inline `bucket.upload()`, `bucket.file().move()`,
3
+ // `bucket.file().copy()`, and `setMetadata({ firebaseStorageDownloadTokens })`
4
+ // calls are forbidden outside this module.
5
+ //
6
+ // Every operation generates a fresh download token, attaches it to the file's
7
+ // metadata, and returns a `StorageWriteResult` with the emulator-aware URL.
8
+ import { randomUUID } from "node:crypto";
9
+ import { buildFirebaseDownloadUrl } from "./build-download-url.js";
10
+ const DEFAULT_CACHE_CONTROL = "public, max-age=31536000";
11
+ /**
12
+ * Upload a local file to Storage. Generates a download token, attaches it
13
+ * to the file's metadata, and returns the emulator-aware download URL.
14
+ *
15
+ * Use this for: pipeline outputs (sharp, ffmpeg) and any other "local file
16
+ * → Storage" flow.
17
+ */
18
+ export async function uploadFileToStorage(args) {
19
+ const token = randomUUID();
20
+ const contentType = args.contentType ?? getMimeFromExt(extractExt(args.localPath));
21
+ await args.bucket.upload(args.localPath, {
22
+ destination: args.destinationPath,
23
+ metadata: {
24
+ contentType,
25
+ cacheControl: args.cacheControl ?? DEFAULT_CACHE_CONTROL,
26
+ metadata: { firebaseStorageDownloadTokens: token },
27
+ },
28
+ });
29
+ return {
30
+ url: buildFirebaseDownloadUrl(args.bucket.name, args.destinationPath, token),
31
+ path: args.destinationPath,
32
+ token,
33
+ };
34
+ }
35
+ /**
36
+ * Move or copy a file already in Storage to a new location. Generates a
37
+ * fresh download token at the destination, attaches it, and returns the
38
+ * emulator-aware download URL.
39
+ *
40
+ * Use this for: library publish (copies from project to library), streetz
41
+ * non-media file moves, job-posting / job-reply / chat-attachment
42
+ * relocations, and any other "Storage → Storage" flow.
43
+ */
44
+ export async function relocateStorageFile(args) {
45
+ const token = randomUUID();
46
+ if (args.mode === "move") {
47
+ await args.bucket.file(args.fromPath).move(args.toPath);
48
+ }
49
+ else {
50
+ await args.bucket.file(args.fromPath).copy(args.bucket.file(args.toPath));
51
+ }
52
+ await args.bucket.file(args.toPath).setMetadata({
53
+ metadata: { firebaseStorageDownloadTokens: token },
54
+ });
55
+ return {
56
+ url: buildFirebaseDownloadUrl(args.bucket.name, args.toPath, token),
57
+ path: args.toPath,
58
+ token,
59
+ };
60
+ }
61
+ /**
62
+ * Attach a fresh download token to a file already at its final Storage
63
+ * location. Use when the file is already in place and only needs a token
64
+ * (e.g., content-moderation rejection where the file was renamed earlier).
65
+ */
66
+ export async function attachDownloadToken(args) {
67
+ const token = randomUUID();
68
+ await args.bucket.file(args.storagePath).setMetadata({
69
+ metadata: { firebaseStorageDownloadTokens: token },
70
+ });
71
+ return {
72
+ url: buildFirebaseDownloadUrl(args.bucket.name, args.storagePath, token),
73
+ path: args.storagePath,
74
+ token,
75
+ };
76
+ }
77
+ function extractExt(localPath) {
78
+ return localPath.split(".").pop() || "";
79
+ }
80
+ function getMimeFromExt(ext) {
81
+ switch (ext.toLowerCase()) {
82
+ case "jpg":
83
+ case "jpeg":
84
+ return "image/jpeg";
85
+ case "png":
86
+ return "image/png";
87
+ case "webp":
88
+ return "image/webp";
89
+ case "mp4":
90
+ return "video/mp4";
91
+ case "webm":
92
+ return "video/webm";
93
+ case "m4a":
94
+ return "audio/mp4";
95
+ case "aac":
96
+ return "audio/aac";
97
+ case "mp3":
98
+ return "audio/mpeg";
99
+ default:
100
+ return "application/octet-stream";
101
+ }
102
+ }
103
+ //# sourceMappingURL=storage-ops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-ops.js","sourceRoot":"","sources":["../../src/server/storage-ops.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/media-processing-core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ttt-productions/ttt-packages.git",
@@ -18,6 +18,10 @@
18
18
  ".": {
19
19
  "types": "./dist/index.d.ts",
20
20
  "default": "./dist/index.js"
21
+ },
22
+ "./server": {
23
+ "types": "./dist/server/index.d.ts",
24
+ "default": "./dist/server/index.js"
21
25
  }
22
26
  },
23
27
  "scripts": {
@@ -27,12 +31,21 @@
27
31
  "prepublishOnly": "npm run clean && npm run build"
28
32
  },
29
33
  "dependencies": {
30
- "@ttt-productions/firebase-helpers": "^0.2.14",
31
- "@ttt-productions/media-contracts": "^0.2.4",
34
+ "@ttt-productions/firebase-helpers": "*",
35
+ "@ttt-productions/media-contracts": "*",
32
36
  "sharp": "^0.34.1"
33
37
  },
38
+ "peerDependencies": {
39
+ "firebase-admin": ">=10.0.0"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "firebase-admin": {
43
+ "optional": true
44
+ }
45
+ },
34
46
  "devDependencies": {
35
47
  "@types/node": "^22.10.0",
48
+ "firebase-admin": "^12.0.0",
36
49
  "typescript": "^5.8.3"
37
50
  },
38
51
  "author": "DJ (TTT Productions)",
@@ -1,53 +0,0 @@
1
- import type { MediaProcessingResult } from "@ttt-productions/media-contracts";
2
- export declare function mapResultForFirestore(result: MediaProcessingResult): {
3
- status: string;
4
- result: {
5
- ok: boolean;
6
- mediaType: "image" | "video" | "audio" | "other";
7
- error?: {
8
- code: "rejected" | "invalid_mime" | "too_large" | "too_long" | "upload_failed" | "upload_canceled" | "upload_timeout" | "network_error" | "quota_exceeded" | "invalid_spec" | "unsupported_format" | "processing_failed" | "processing_canceled" | "not_found" | "permission_denied" | "orientation_mismatch" | "aspect_ratio_mismatch" | "dimensions_mismatch" | "unknown";
9
- message: string;
10
- details?: Record<string, unknown> | undefined;
11
- } | undefined;
12
- meta?: {
13
- width?: number | undefined;
14
- height?: number | undefined;
15
- mime?: string | undefined;
16
- sizeBytes?: number | undefined;
17
- durationSec?: number | undefined;
18
- } | undefined;
19
- moderation?: {
20
- status: "rejected" | "passed" | "flagged" | "error";
21
- reasons?: string[] | undefined;
22
- provider?: string | undefined;
23
- findings?: {
24
- category?: string | undefined;
25
- label?: string | undefined;
26
- score?: number | undefined;
27
- severity?: string | undefined;
28
- reasons?: string[] | undefined;
29
- meta?: Record<string, unknown> | undefined;
30
- }[] | undefined;
31
- reviewedAt?: string | number | undefined;
32
- } | undefined;
33
- outputs?: {
34
- key: string;
35
- url: string;
36
- path?: string | undefined;
37
- width?: number | undefined;
38
- height?: number | undefined;
39
- mime?: string | undefined;
40
- sizeBytes?: number | undefined;
41
- durationSec?: number | undefined;
42
- extra?: Record<string, unknown> | undefined;
43
- }[] | undefined;
44
- warnings?: string[] | undefined;
45
- } | null;
46
- error: {
47
- code: "rejected" | "invalid_mime" | "too_large" | "too_long" | "upload_failed" | "upload_canceled" | "upload_timeout" | "network_error" | "quota_exceeded" | "invalid_spec" | "unsupported_format" | "processing_failed" | "processing_canceled" | "not_found" | "permission_denied" | "orientation_mismatch" | "aspect_ratio_mismatch" | "dimensions_mismatch" | "unknown";
48
- message: string;
49
- details?: Record<string, unknown> | undefined;
50
- } | null;
51
- updatedAt: number;
52
- };
53
- //# sourceMappingURL=firestore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firestore.d.ts","sourceRoot":"","sources":["../../src/firebase/firestore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE9E,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB;;;;;;;;mBAQok7B,CAAC;;;iBAAoF,CAAC;kBAAoC,CAAC;gBAAkC,CAAC;qBAAuC,CAAC;uBAAyC,CAAC;;;;mBAAwI,CAAC;oBAAwC,CAAC;oBAAsC,CAAC;wBAAwB,CAAC;qBAAuC,CAAC;qBAAuC,CAAC;wBAA0C,CAAC;uBAAyC,CAAC;oBAAwC,CAAC;;sBAAkF,CAAC;;;;;gBAAwH,CAAC;iBAAmC,CAAC;kBAAoC,CAAC;gBAAkC,CAAC;qBAAuC,CAAC;uBAAyC,CAAC;iBAAmC,CAAC;;;;;;;;;;EAAhs9B"}
@@ -1,10 +0,0 @@
1
- import { now } from "@ttt-productions/firebase-helpers";
2
- export function mapResultForFirestore(result) {
3
- return {
4
- status: result.ok ? "ready" : "failed",
5
- result: result.ok ? result : null,
6
- error: result.ok ? null : result.error ?? null,
7
- updatedAt: now()
8
- };
9
- }
10
- //# sourceMappingURL=firestore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../src/firebase/firestore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AAGxD,MAAM,UAAU,qBAAqB,CACnC,MAA6B;IAE7B,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;QACtC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;QACjC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI;QAC9C,SAAS,EAAE,GAAG,EAAE;KACjB,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function buildStoragePath(basePath: string, filename: string): string;
2
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/firebase/storage.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,MAAM,CAEV"}
@@ -1,7 +0,0 @@
1
- // functions-only helpers for firebase-admin storage
2
- // kept minimal so handlers stay thin
3
- import { joinPath } from "@ttt-productions/firebase-helpers";
4
- export function buildStoragePath(basePath, filename) {
5
- return joinPath(basePath, filename);
6
- }
7
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/firebase/storage.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,MAAM,UAAU,gBAAgB,CAC5B,QAAgB,EAChB,QAAgB;IAEhB,OAAO,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC"}