@ttt-productions/media-processing-core 0.8.15 → 0.8.16

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,14 @@
1
+ /** The one method of a Storage object handle this module uses. */
2
+ export interface DownloadTokenWritable {
3
+ setMetadata(update: {
4
+ metadata: Record<string, string | null>;
5
+ }): Promise<unknown>;
6
+ }
7
+ /** True when the object's stored metadata still carries a download token. */
8
+ export declare function hasDownloadToken(objectMetadata: Readonly<Record<string, unknown>> | undefined): boolean;
9
+ /**
10
+ * Remove the object's download token and nothing else: a null custom-metadata value deletes that
11
+ * one key, leaving every other entry. A no-op write when the object has none.
12
+ */
13
+ export declare function removeDownloadToken(file: DownloadTokenWritable): Promise<void>;
14
+ //# sourceMappingURL=download-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-token.d.ts","sourceRoot":"","sources":["../../src/server/download-token.ts"],"names":[],"mappings":"AAKA,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AAKD,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAGvG;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF"}
@@ -0,0 +1,19 @@
1
+ // The one remover of a Storage object's Firebase download token. The Firebase Storage client gives
2
+ // every object it uploads a `firebaseStorageDownloadTokens` metadata entry: a never-expiring link
3
+ // that reads the object signed out, around the Storage rules. An app that serves no object through
4
+ // one removes it as soon as the server takes the object over.
5
+ /** The custom-metadata key the Firebase Storage client writes on upload. */
6
+ const DOWNLOAD_TOKENS_KEY = "firebaseStorageDownloadTokens";
7
+ /** True when the object's stored metadata still carries a download token. */
8
+ export function hasDownloadToken(objectMetadata) {
9
+ const custom = objectMetadata?.["metadata"];
10
+ return typeof custom === "object" && custom !== null && DOWNLOAD_TOKENS_KEY in custom;
11
+ }
12
+ /**
13
+ * Remove the object's download token and nothing else: a null custom-metadata value deletes that
14
+ * one key, leaving every other entry. A no-op write when the object has none.
15
+ */
16
+ export async function removeDownloadToken(file) {
17
+ await file.setMetadata({ metadata: { [DOWNLOAD_TOKENS_KEY]: null } });
18
+ }
19
+ //# sourceMappingURL=download-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-token.js","sourceRoot":"","sources":["../../src/server/download-token.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,kGAAkG;AAClG,mGAAmG;AACnG,8DAA8D;AAO9D,4EAA4E;AAC5E,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAE5D,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,cAA6D;IAC5F,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,mBAAmB,IAAI,MAAM,CAAC;AACxF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAA2B;IACnE,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC","sourcesContent":["// The one remover of a Storage object's Firebase download token. The Firebase Storage client gives\n// every object it uploads a `firebaseStorageDownloadTokens` metadata entry: a never-expiring link\n// that reads the object signed out, around the Storage rules. An app that serves no object through\n// one removes it as soon as the server takes the object over.\n\n/** The one method of a Storage object handle this module uses. */\nexport interface DownloadTokenWritable {\n setMetadata(update: { metadata: Record<string, string | null> }): Promise<unknown>;\n}\n\n/** The custom-metadata key the Firebase Storage client writes on upload. */\nconst DOWNLOAD_TOKENS_KEY = \"firebaseStorageDownloadTokens\";\n\n/** True when the object's stored metadata still carries a download token. */\nexport function hasDownloadToken(objectMetadata: Readonly<Record<string, unknown>> | undefined): boolean {\n const custom = objectMetadata?.[\"metadata\"];\n return typeof custom === \"object\" && custom !== null && DOWNLOAD_TOKENS_KEY in custom;\n}\n\n/**\n * Remove the object's download token and nothing else: a null custom-metadata value deletes that\n * one key, leaving every other entry. A no-op write when the object has none.\n */\nexport async function removeDownloadToken(file: DownloadTokenWritable): Promise<void> {\n await file.setMetadata({ metadata: { [DOWNLOAD_TOKENS_KEY]: null } });\n}\n"]}
@@ -3,4 +3,5 @@ export * from "./firebase-media-io.js";
3
3
  export * from "./pending-media.js";
4
4
  export * from "./staged-object.js";
5
5
  export * from "./gcs-errors.js";
6
+ export * from "./download-token.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -3,4 +3,5 @@ export * from "./firebase-media-io.js";
3
3
  export * from "./pending-media.js";
4
4
  export * from "./staged-object.js";
5
5
  export * from "./gcs-errors.js";
6
+ export * from "./download-token.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./storage-ops.js\";\nexport * from \"./firebase-media-io.js\";\nexport * from \"./pending-media.js\";\nexport * from \"./staged-object.js\";\nexport * from \"./gcs-errors.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from \"./storage-ops.js\";\nexport * from \"./firebase-media-io.js\";\nexport * from \"./pending-media.js\";\nexport * from \"./staged-object.js\";\nexport * from \"./gcs-errors.js\";\nexport * from \"./download-token.js\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/media-processing-core",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ttt-productions/ttt-packages.git",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "npm run clean && npm run build"
32
32
  },
33
33
  "dependencies": {
34
- "@ttt-productions/media-schemas": "^0.14.9",
34
+ "@ttt-productions/media-schemas": "^0.14.10",
35
35
  "aws4fetch": "^1.0.20",
36
36
  "sharp": "^0.35.3",
37
37
  "zod": "^4.4.3"