@opensea/seadn
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -9,6 +9,6 @@ type MediaFormat = "webp" | "avif" | "jpeg" | "png"; | ||
fit?: MediaFit; | ||
t?: number; | ||
frameTime?: number; | ||
}; | ||
declare function optimize(image: string | URL, { width, height, format, quality, fit, t }: MediaParams): string; | ||
declare function optimize(image: string | URL, { width, height, format, quality, fit, frameTime }: MediaParams): string; | ||
export { type MediaFit, type MediaFormat, type MediaParams, optimize }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var r in n)s(e,r,{get:n[r],enumerable:!0})},x=(e,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of m(n))!l.call(e,t)&&t!==r&&s(e,t,{get:()=>n[t],enumerable:!(o=b(n,t))||o.enumerable});return e};var R=e=>x(s({},"__esModule",{value:!0}),e);var g={};h(g,{optimize:()=>d});module.exports=R(g);function d(e,{width:n,height:r,format:o,quality:t,fit:a,t:f}){try{typeof e=="string"&&(e=new URL(e))}catch(w){return e.toString()}if(!(e instanceof URL))return e;let u=S(e);if(!L(e)&&!u)return e.toString();let i=new URLSearchParams;if(r!==void 0&&i.set("h",String(r)),n!==void 0&&i.set("w",String(n)),o!==void 0&&i.set("format",o),t){if(Number(t)<=0||Number(t)>100)throw new Error("Quality has to be a positive number between 1 and 100");i.set("q",String(t))}if(a!==void 0&&i.set("fit",a),f!==void 0)u&&i.set("t",String(f));else if(c(e))return e.toString();return e.search=i.toString(),e.toString()}function c(e){let n=p(e);return n==="mp4"||n==="mov"}function S(e){return c(e)}function L(e){if(!U(e))return!1;switch(p(e)){case"png":case"jpeg":case"webp":case"avif":case"ico":case"gif":case void 0:return!0;default:return!1}}function p(e){let n=e.pathname.split(".");if(!(n.length<=1))return n[n.length-1]}function U(e){return e.hostname.endsWith("seadn.io")}0&&(module.exports={optimize}); | ||
"use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var r in n)s(e,r,{get:n[r],enumerable:!0})},x=(e,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of m(n))!l.call(e,t)&&t!==r&&s(e,t,{get:()=>n[t],enumerable:!(o=b(n,t))||o.enumerable});return e};var R=e=>x(s({},"__esModule",{value:!0}),e);var g={};h(g,{optimize:()=>d});module.exports=R(g);function d(e,{width:n,height:r,format:o,quality:t,fit:a,frameTime:f}){try{typeof e=="string"&&(e=new URL(e))}catch(w){return e.toString()}if(!(e instanceof URL))return e;let u=S(e);if(!L(e)&&!u)return e.toString();let i=new URLSearchParams;if(r!==void 0&&i.set("h",String(r)),n!==void 0&&i.set("w",String(n)),o!==void 0&&i.set("format",o),t){if(Number(t)<=0||Number(t)>100)throw new Error("Quality has to be a positive number between 1 and 100");i.set("q",String(t))}if(a!==void 0&&i.set("fit",a),f!==void 0)u&&i.set("frame-time",String(f));else if(c(e))return e.toString();return e.search=i.toString(),e.toString()}function c(e){let n=p(e);return n==="mp4"||n==="mov"}function S(e){return c(e)}function L(e){if(!U(e))return!1;switch(p(e)){case"png":case"jpeg":case"webp":case"avif":case"ico":case"gif":case void 0:return!0;default:return!1}}function p(e){let n=e.pathname.split(".");if(!(n.length<=1))return n[n.length-1]}function U(e){return e.hostname.endsWith("seadn.io")}0&&(module.exports={optimize}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@opensea/seadn", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Javascript SDK to work with SeaDN", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -93,3 +93,3 @@ import { test, expect } from "vitest"; | ||
"https://i2.seadn.io/bored-ape", | ||
{ t: 0.1 } satisfies MediaParams, | ||
{ frameTime: 0.1 } satisfies MediaParams, | ||
"https://i2.seadn.io/bored-ape", | ||
@@ -99,8 +99,8 @@ ], | ||
"https://i2.seadn.io/bored-ape.mp4", | ||
{ t: 0.1, height: 50 } satisfies MediaParams, | ||
"https://i2.seadn.io/bored-ape.mp4?h=50&t=0.1", | ||
{ frameTime: 0.1, height: 50 } satisfies MediaParams, | ||
"https://i2.seadn.io/bored-ape.mp4?h=50&frame-time=0.1", | ||
], | ||
[ | ||
"https://i2.seadn.io/bored-ape.gif", | ||
{ t: 0.1 } satisfies MediaParams, | ||
{ frameTime: 0.1 } satisfies MediaParams, | ||
"https://i2.seadn.io/bored-ape.gif", | ||
@@ -107,0 +107,0 @@ ], |
@@ -10,4 +10,3 @@ export type MediaFormat = "webp" | "avif" | "jpeg" | "png"; | ||
fit?: MediaFit; | ||
// Frame extraction time in seconds. Only applicable for videos | ||
t?: number; | ||
frameTime?: number; | ||
}; | ||
@@ -17,3 +16,3 @@ | ||
image: string | URL, | ||
{ width, height, format, quality, fit, t }: MediaParams, | ||
{ width, height, format, quality, fit, frameTime }: MediaParams, | ||
): string { | ||
@@ -56,5 +55,5 @@ try { | ||
} | ||
if (t !== undefined) { | ||
if (frameTime !== undefined) { | ||
if (isFrameable) { | ||
params.set("t", String(t)); | ||
params.set("frame-time", String(frameTime)); | ||
} | ||
@@ -61,0 +60,0 @@ } else if (isVideo(image)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19006
237