main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
export declare const DEFAULT_HEADERS: {
'X-Client-Info': string;
};
//# sourceMappingURL=constants.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;CAA+C,CAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_HEADERS = void 0;
const version_1 = require("./version");
exports.DEFAULT_HEADERS = { 'X-Client-Info': `storage-js/${version_1.version}` };
//# sourceMappingURL=constants.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACtB,QAAA,eAAe,GAAG,EAAE,eAAe,EAAE,cAAc,iBAAO,EAAE,EAAE,CAAA"}

View File

@@ -0,0 +1,19 @@
export declare class StorageError extends Error {
protected __isStorageError: boolean;
constructor(message: string);
}
export declare function isStorageError(error: unknown): error is StorageError;
export declare class StorageApiError extends StorageError {
status: number;
constructor(message: string, status: number);
toJSON(): {
name: string;
message: string;
status: number;
};
}
export declare class StorageUnknownError extends StorageError {
originalError: unknown;
constructor(message: string, originalError: unknown);
}
//# sourceMappingURL=errors.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAS,CAAC,gBAAgB,UAAO;gBAErB,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,MAAM,EAAE,MAAM,CAAA;gBAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM3C,MAAM;;;;;CAOP;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IACnD,aAAa,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO;CAKpD"}

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageUnknownError = exports.StorageApiError = exports.isStorageError = exports.StorageError = void 0;
class StorageError extends Error {
constructor(message) {
super(message);
this.__isStorageError = true;
this.name = 'StorageError';
}
}
exports.StorageError = StorageError;
function isStorageError(error) {
return typeof error === 'object' && error !== null && '__isStorageError' in error;
}
exports.isStorageError = isStorageError;
class StorageApiError extends StorageError {
constructor(message, status) {
super(message);
this.name = 'StorageApiError';
this.status = status;
}
toJSON() {
return {
name: this.name,
message: this.message,
status: this.status,
};
}
}
exports.StorageApiError = StorageApiError;
class StorageUnknownError extends StorageError {
constructor(message, originalError) {
super(message);
this.name = 'StorageUnknownError';
this.originalError = originalError;
}
}
exports.StorageUnknownError = StorageUnknownError;
//# sourceMappingURL=errors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IAGrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHN,qBAAgB,GAAG,IAAI,CAAA;QAI/B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC5B,CAAC;CACF;AAPD,oCAOC;AAED,SAAgB,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,kBAAkB,IAAI,KAAK,CAAA;AACnF,CAAC;AAFD,wCAEC;AAED,MAAa,eAAgB,SAAQ,YAAY;IAG/C,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAA;IACH,CAAC;CACF;AAhBD,0CAgBC;AAED,MAAa,mBAAoB,SAAQ,YAAY;IAGnD,YAAY,OAAe,EAAE,aAAsB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;QACjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;CACF;AARD,kDAQC"}

View File

@@ -0,0 +1,15 @@
import { FetchParameters } from './types';
export declare type Fetch = typeof fetch;
export interface FetchOptions {
headers?: {
[key: string]: string;
};
noResolveJson?: boolean;
}
export declare type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD';
export declare function get(fetcher: Fetch, url: string, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
export declare function post(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
export declare function put(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
export declare function head(fetcher: Fetch, url: string, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
export declare function remove(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
//# sourceMappingURL=fetch.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,oBAAY,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,oBAAY,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAkE1E,wBAAsB,GAAG,CACvB,OAAO,EAAE,KAAK,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,eAAe,GAC3B,OAAO,CAAC,GAAG,CAAC,CAEd;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,KAAK,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,eAAe,GAC3B,OAAO,CAAC,GAAG,CAAC,CAEd;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,KAAK,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,eAAe,GAC3B,OAAO,CAAC,GAAG,CAAC,CAEd;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,KAAK,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,eAAe,GAC3B,OAAO,CAAC,GAAG,CAAC,CAWd;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,KAAK,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,eAAe,GAC3B,OAAO,CAAC,GAAG,CAAC,CAEd"}

View File

@@ -0,0 +1,89 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.remove = exports.head = exports.put = exports.post = exports.get = void 0;
const errors_1 = require("./errors");
const helpers_1 = require("./helpers");
const _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
const handleError = (error, reject, options) => __awaiter(void 0, void 0, void 0, function* () {
const Res = yield (0, helpers_1.resolveResponse)();
if (error instanceof Res && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
error
.json()
.then((err) => {
reject(new errors_1.StorageApiError(_getErrorMessage(err), error.status || 500));
})
.catch((err) => {
reject(new errors_1.StorageUnknownError(_getErrorMessage(err), err));
});
}
else {
reject(new errors_1.StorageUnknownError(_getErrorMessage(error), error));
}
});
const _getRequestParams = (method, options, parameters, body) => {
const params = { method, headers: (options === null || options === void 0 ? void 0 : options.headers) || {} };
if (method === 'GET') {
return params;
}
params.headers = Object.assign({ 'Content-Type': 'application/json' }, options === null || options === void 0 ? void 0 : options.headers);
if (body) {
params.body = JSON.stringify(body);
}
return Object.assign(Object.assign({}, params), parameters);
};
function _handleRequest(fetcher, method, url, options, parameters, body) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
fetcher(url, _getRequestParams(method, options, parameters, body))
.then((result) => {
if (!result.ok)
throw result;
if (options === null || options === void 0 ? void 0 : options.noResolveJson)
return result;
return result.json();
})
.then((data) => resolve(data))
.catch((error) => handleError(error, reject, options));
});
});
}
function get(fetcher, url, options, parameters) {
return __awaiter(this, void 0, void 0, function* () {
return _handleRequest(fetcher, 'GET', url, options, parameters);
});
}
exports.get = get;
function post(fetcher, url, body, options, parameters) {
return __awaiter(this, void 0, void 0, function* () {
return _handleRequest(fetcher, 'POST', url, options, parameters, body);
});
}
exports.post = post;
function put(fetcher, url, body, options, parameters) {
return __awaiter(this, void 0, void 0, function* () {
return _handleRequest(fetcher, 'PUT', url, options, parameters, body);
});
}
exports.put = put;
function head(fetcher, url, options, parameters) {
return __awaiter(this, void 0, void 0, function* () {
return _handleRequest(fetcher, 'HEAD', url, Object.assign(Object.assign({}, options), { noResolveJson: true }), parameters);
});
}
exports.head = head;
function remove(fetcher, url, body, options, parameters) {
return __awaiter(this, void 0, void 0, function* () {
return _handleRequest(fetcher, 'DELETE', url, options, parameters, body);
});
}
exports.remove = remove;
//# sourceMappingURL=fetch.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,uCAA2C;AAc3C,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAU,EAAE,CAC5C,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,iBAAiB,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAErF,MAAM,WAAW,GAAG,CAClB,KAAc,EACd,MAA8B,EAC9B,OAAsB,EACtB,EAAE;IACF,MAAM,GAAG,GAAG,MAAM,IAAA,yBAAe,GAAE,CAAA;IAEnC,IAAI,KAAK,YAAY,GAAG,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAA,EAAE;QACnD,KAAK;aACF,IAAI,EAAE;aACN,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,MAAM,CAAC,IAAI,wBAAe,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAA;QACzE,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,MAAM,CA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,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1E,CAAC;CAAA;AARD,wBAQC"}

View File

@@ -0,0 +1,6 @@
declare type Fetch = typeof fetch;
export declare const resolveFetch: (customFetch?: typeof fetch | undefined) => Fetch;
export declare const resolveResponse: () => Promise<typeof Response>;
export declare const recursiveToCamel: (item: Record<string, any>) => unknown;
export {};
//# sourceMappingURL=helpers.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK,GAAG,OAAO,KAAK,CAAA;AAEzB,eAAO,MAAM,YAAY,8CAA0B,KAWlD,CAAA;AAED,eAAO,MAAM,eAAe,QAAa,QAAQ,eAAe,CAO/D,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAU,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,OAc5D,CAAA"}

View File

@@ -0,0 +1,73 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.recursiveToCamel = exports.resolveResponse = exports.resolveFetch = void 0;
const resolveFetch = (customFetch) => {
let _fetch;
if (customFetch) {
_fetch = customFetch;
}
else if (typeof fetch === 'undefined') {
_fetch = (...args) => Promise.resolve().then(() => __importStar(require('@supabase/node-fetch'))).then(({ default: fetch }) => fetch(...args));
}
else {
_fetch = fetch;
}
return (...args) => _fetch(...args);
};
exports.resolveFetch = resolveFetch;
const resolveResponse = () => __awaiter(void 0, void 0, void 0, function* () {
if (typeof Response === 'undefined') {
// @ts-ignore
return (yield Promise.resolve().then(() => __importStar(require('@supabase/node-fetch')))).Response;
}
return Response;
});
exports.resolveResponse = resolveResponse;
const recursiveToCamel = (item) => {
if (Array.isArray(item)) {
return item.map((el) => (0, exports.recursiveToCamel)(el));
}
else if (typeof item === 'function' || item !== Object(item)) {
return item;
}
const result = {};
Object.entries(item).forEach(([key, value]) => {
const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, ''));
result[newKey] = (0, exports.recursiveToCamel)(value);
});
return result;
};
exports.recursiveToCamel = recursiveToCamel;
//# sourceMappingURL=helpers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAA;KACrB;SAAM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CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;QACxF,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,wBAAgB,EAAC,KAAK,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAdY,QAAA,gBAAgB,oBAc5B"}

View File

@@ -0,0 +1,5 @@
export * from '../packages/StorageBucketApi';
export * from '../packages/StorageFileApi';
export * from './types';
export * from './constants';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}

View File

@@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("../packages/StorageBucketApi"), exports);
__exportStar(require("../packages/StorageFileApi"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./constants"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,6DAA0C;AAC1C,0CAAuB;AACvB,8CAA2B"}

View File

@@ -0,0 +1,132 @@
export interface Bucket {
id: string;
name: string;
owner: string;
file_size_limit?: number;
allowed_mime_types?: string[];
created_at: string;
updated_at: string;
public: boolean;
}
export interface FileObject {
name: string;
bucket_id: string;
owner: string;
id: string;
updated_at: string;
created_at: string;
last_accessed_at: string;
metadata: Record<string, any>;
buckets: Bucket;
}
export interface FileObjectV2 {
id: string;
version: string;
name: string;
bucket_id: string;
updated_at: string;
created_at: string;
last_accessed_at: string;
size?: number;
cache_control?: string;
content_type?: string;
etag?: string;
last_modified?: string;
metadata?: Record<string, any>;
}
export interface SortBy {
column?: string;
order?: string;
}
export interface FileOptions {
/**
* The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
*/
cacheControl?: string;
/**
* the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
*/
contentType?: string;
/**
* When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false.
*/
upsert?: boolean;
/**
* The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method.
*/
duplex?: string;
/**
* The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store.
*/
metadata?: Record<string, any>;
/**
* Optionally add extra headers
*/
headers?: Record<string, string>;
}
export interface DestinationOptions {
destinationBucket?: string;
}
export interface SearchOptions {
/**
* The number of files you want to be returned.
*/
limit?: number;
/**
* The starting position.
*/
offset?: number;
/**
* The column to sort by. Can be any column inside a FileObject.
*/
sortBy?: SortBy;
/**
* The search string to filter files by.
*/
search?: string;
}
export interface FetchParameters {
/**
* Pass in an AbortController's signal to cancel the request.
*/
signal?: AbortSignal;
}
export interface Metadata {
name: string;
}
export interface TransformOptions {
/**
* The width of the image in pixels.
*/
width?: number;
/**
* The height of the image in pixels.
*/
height?: number;
/**
* The resize mode can be cover, contain or fill. Defaults to cover.
* Cover resizes the image to maintain it's aspect ratio while filling the entire width and height.
* Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height.
* Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit.
*/
resize?: 'cover' | 'contain' | 'fill';
/**
* Set the quality of the returned image.
* A number from 20 to 100, with 100 being the highest quality.
* Defaults to 80
*/
quality?: number;
/**
* Specify the format of the image requested.
*
* When using 'origin' we force the format to be the same as the original image.
* When this option is not passed in, images are optimized to modern image formats like Webp.
*/
format?: 'origin';
}
declare type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : S;
export declare type Camelize<T> = {
[K in keyof T as CamelCase<Extract<K, string>>]: T[K];
};
export {};
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,OAAO,EAA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;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;IACrC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB;AAED,aAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,IAAI,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAC7E,GAAG,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE,GAClD,CAAC,CAAA;AAEL,oBAAY,QAAQ,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACtD,CAAA"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export declare const version = "2.7.1";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
// generated by genversion
exports.version = '2.7.1';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AACb,QAAA,OAAO,GAAG,OAAO,CAAA"}