@palbase/backend 14.3.0 → 15.0.0
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/db/index.d.cts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/{endpoint-BG-JVUPL.d.cts → endpoint-BW8bn1y-.d.cts} +2 -8
- package/dist/{endpoint-BG-JVUPL.d.ts → endpoint-BW8bn1y-.d.ts} +2 -8
- package/dist/{index-QQ2byWrv.d.ts → index-B398u5B0.d.ts} +1 -1
- package/dist/{index-j3ZZS_VS.d.cts → index-DmkBkvP6.d.cts} +1 -1
- package/dist/index.cjs +40 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/test/index.d.cts +1 -1
- package/dist/test/index.d.ts +1 -1
- package/docs/auth.md +37 -0
- package/docs/llms-full.txt +73 -3
- package/docs/services.md +36 -3
- package/package.json +1 -1
package/dist/db/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, h as PalbaseExtension, i as PolicyBuilder, j as PolicyCommand, k as PolicyDef, l as PolicyMode, R as RawConstraintDef, m as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TxPlan, q as TxTables, r as TypedDB, s as TypedTable, t as TypedTx, u as bigint, v as boolean, w as defineSchema, x as enumType, y as integer, z as isPalbaseExtension, A as jsonb, B as makeTypedDB, F as policy, G as raw, H as text, J as timestamp, K as uuid } from '../index-
|
|
2
|
-
export { M as Materialized,
|
|
1
|
+
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, h as PalbaseExtension, i as PolicyBuilder, j as PolicyCommand, k as PolicyDef, l as PolicyMode, R as RawConstraintDef, m as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TxPlan, q as TxTables, r as TypedDB, s as TypedTable, t as TypedTx, u as bigint, v as boolean, w as defineSchema, x as enumType, y as integer, z as isPalbaseExtension, A as jsonb, B as makeTypedDB, F as policy, G as raw, H as text, J as timestamp, K as uuid } from '../index-DmkBkvP6.cjs';
|
|
2
|
+
export { M as Materialized, b0 as Ref, b2 as TxColumnExpr, b3 as TxInsertShape, b5 as TxNow, b6 as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, bb as TxPlanResponse, bc as TxRefError, bd as TxRow, be as TxRows, bf as TxSelectOptions, bg as TxSetShape, bi as TxTable, bj as TxWhere, br as dec, bt as inc, bu as now } from '../endpoint-BW8bn1y-.cjs';
|
|
3
3
|
import './env.cjs';
|
|
4
4
|
import 'zod';
|
package/dist/db/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, h as PalbaseExtension, i as PolicyBuilder, j as PolicyCommand, k as PolicyDef, l as PolicyMode, R as RawConstraintDef, m as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TxPlan, q as TxTables, r as TypedDB, s as TypedTable, t as TypedTx, u as bigint, v as boolean, w as defineSchema, x as enumType, y as integer, z as isPalbaseExtension, A as jsonb, B as makeTypedDB, F as policy, G as raw, H as text, J as timestamp, K as uuid } from '../index-
|
|
2
|
-
export { M as Materialized,
|
|
1
|
+
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, h as PalbaseExtension, i as PolicyBuilder, j as PolicyCommand, k as PolicyDef, l as PolicyMode, R as RawConstraintDef, m as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TxPlan, q as TxTables, r as TypedDB, s as TypedTable, t as TypedTx, u as bigint, v as boolean, w as defineSchema, x as enumType, y as integer, z as isPalbaseExtension, A as jsonb, B as makeTypedDB, F as policy, G as raw, H as text, J as timestamp, K as uuid } from '../index-B398u5B0.js';
|
|
2
|
+
export { M as Materialized, b0 as Ref, b2 as TxColumnExpr, b3 as TxInsertShape, b5 as TxNow, b6 as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, bb as TxPlanResponse, bc as TxRefError, bd as TxRow, be as TxRows, bf as TxSelectOptions, bg as TxSetShape, bi as TxTable, bj as TxWhere, br as dec, bt as inc, bu as now } from '../endpoint-BW8bn1y-.js';
|
|
3
3
|
import './env.js';
|
|
4
4
|
import 'zod';
|
|
@@ -697,10 +697,6 @@ interface PalbaseFileObject {
|
|
|
697
697
|
interface PalbaseSignedUrlResponse {
|
|
698
698
|
signedUrl: string;
|
|
699
699
|
}
|
|
700
|
-
/** Storage public URL response. */
|
|
701
|
-
interface PalbasePublicUrlResponse {
|
|
702
|
-
publicUrl: string;
|
|
703
|
-
}
|
|
704
700
|
/** Storage upload options. */
|
|
705
701
|
interface PalbaseUploadOptions {
|
|
706
702
|
contentType?: string;
|
|
@@ -1371,9 +1367,7 @@ interface PalbaseBucketClient {
|
|
|
1371
1367
|
/** Download a file as a Blob. */
|
|
1372
1368
|
download(path: string): Promise<PalbaseResult<Blob>>;
|
|
1373
1369
|
/** Construct the public URL for a file (sync — no network call). */
|
|
1374
|
-
getPublicUrl(path: string, options?: PalbaseTransformOptions):
|
|
1375
|
-
data: PalbasePublicUrlResponse;
|
|
1376
|
-
};
|
|
1370
|
+
getPublicUrl(path: string, options?: PalbaseTransformOptions): string;
|
|
1377
1371
|
/** Create a time-limited signed URL. */
|
|
1378
1372
|
createSignedUrl(path: string, expiresIn: number): Promise<PalbaseResult<PalbaseSignedUrlResponse>>;
|
|
1379
1373
|
/** List objects in the bucket (optionally filtered by prefix). */
|
|
@@ -2007,4 +2001,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
|
|
|
2007
2001
|
*/
|
|
2008
2002
|
type AuthSpec = boolean | Partial<AuthConfig>;
|
|
2009
2003
|
|
|
2010
|
-
export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseAuthClient as G, HttpError as H, type PalbaseBatchOverrideOperation as I, type PalbaseBatchSetOverridesResult as J, type PalbaseBindDeviceParams as K, type Logger as L, type Materialized as M, NotFound as N, type PalbaseBucketClient as O, type PBRequest as P, type PalbaseClearAllOverridesResult as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type
|
|
2004
|
+
export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseAuthClient as G, HttpError as H, type PalbaseBatchOverrideOperation as I, type PalbaseBatchSetOverridesResult as J, type PalbaseBindDeviceParams as K, type Logger as L, type Materialized as M, NotFound as N, type PalbaseBucketClient as O, type PBRequest as P, type PalbaseClearAllOverridesResult as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseWhereOperator as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePushClient as aD, type PalbasePushSendParams as aE, type PalbasePushSendResponse as aF, type PalbaseQrCodeOptions as aG, type PalbaseQuerySnapshot as aH, type PalbaseRegisterDeviceParams as aI, type PalbaseResult as aJ, type PalbaseRetentionQueryInput as aK, type PalbaseRetentionResult as aL, type PalbaseSession as aM, type PalbaseSetOverrideResult as aN, type PalbaseSetOverridesResult as aO, type PalbaseSignedUrlResponse as aP, type PalbaseSmsClient as aQ, type PalbaseSmsSendParams as aR, type PalbaseSmsSendResponse as aS, type PalbaseTransformOptions as aT, type PalbaseUpdateLinkParams as aU, type PalbaseUploadOptions as aV, type PalbaseUser as aW, type PalbaseUserDetailResult as aX, type PalbaseUsersQueryInput as aY, type PalbaseUsersResult as aZ, type PalbaseVerifyRequestSignatureParams as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type Ref as b0, TooManyRequests as b1, type TxColumnExpr as b2, type TxInsertShape as b3, type TxInsertValue as b4, type TxNow as b5, type TxPlanBody as b6, TxPlanError as b7, type TxPlanHandle as b8, type TxPlanOpResult as b9, type TxPlanRejection as ba, type TxPlanResponse as bb, TxRefError as bc, type TxRow as bd, type TxRows as be, type TxSelectOptions as bf, type TxSetShape as bg, type TxSetValue as bh, type TxTable as bi, type TxWhere as bj, type TxWireExpr as bk, type TxWireGuard as bl, type TxWireOp as bm, type TxWireRef as bn, type TxWireValue as bo, Unauthorized as bp, type VerifiedDevice as bq, dec as br, defineMiddleware as bs, inc as bt, now as bu, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type Middleware as o, type MiddlewareContext as p, type MiddlewareHandler as q, PalError as r, type PalbaseAnalyticsClient as s, type PalbaseAnalyticsManagementNamespace as t, type PalbaseAnalyticsProperties as u, type PalbaseAnalyticsQueryNamespace as v, type PalbaseAttestAndroidParams as w, type PalbaseAttestAndroidResult as x, type PalbaseAttestiOSParams as y, type PalbaseAttestiOSResult as z };
|
|
@@ -697,10 +697,6 @@ interface PalbaseFileObject {
|
|
|
697
697
|
interface PalbaseSignedUrlResponse {
|
|
698
698
|
signedUrl: string;
|
|
699
699
|
}
|
|
700
|
-
/** Storage public URL response. */
|
|
701
|
-
interface PalbasePublicUrlResponse {
|
|
702
|
-
publicUrl: string;
|
|
703
|
-
}
|
|
704
700
|
/** Storage upload options. */
|
|
705
701
|
interface PalbaseUploadOptions {
|
|
706
702
|
contentType?: string;
|
|
@@ -1371,9 +1367,7 @@ interface PalbaseBucketClient {
|
|
|
1371
1367
|
/** Download a file as a Blob. */
|
|
1372
1368
|
download(path: string): Promise<PalbaseResult<Blob>>;
|
|
1373
1369
|
/** Construct the public URL for a file (sync — no network call). */
|
|
1374
|
-
getPublicUrl(path: string, options?: PalbaseTransformOptions):
|
|
1375
|
-
data: PalbasePublicUrlResponse;
|
|
1376
|
-
};
|
|
1370
|
+
getPublicUrl(path: string, options?: PalbaseTransformOptions): string;
|
|
1377
1371
|
/** Create a time-limited signed URL. */
|
|
1378
1372
|
createSignedUrl(path: string, expiresIn: number): Promise<PalbaseResult<PalbaseSignedUrlResponse>>;
|
|
1379
1373
|
/** List objects in the bucket (optionally filtered by prefix). */
|
|
@@ -2007,4 +2001,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
|
|
|
2007
2001
|
*/
|
|
2008
2002
|
type AuthSpec = boolean | Partial<AuthConfig>;
|
|
2009
2003
|
|
|
2010
|
-
export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseAuthClient as G, HttpError as H, type PalbaseBatchOverrideOperation as I, type PalbaseBatchSetOverridesResult as J, type PalbaseBindDeviceParams as K, type Logger as L, type Materialized as M, NotFound as N, type PalbaseBucketClient as O, type PBRequest as P, type PalbaseClearAllOverridesResult as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type
|
|
2004
|
+
export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseAuthClient as G, HttpError as H, type PalbaseBatchOverrideOperation as I, type PalbaseBatchSetOverridesResult as J, type PalbaseBindDeviceParams as K, type Logger as L, type Materialized as M, NotFound as N, type PalbaseBucketClient as O, type PBRequest as P, type PalbaseClearAllOverridesResult as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseWhereOperator as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePushClient as aD, type PalbasePushSendParams as aE, type PalbasePushSendResponse as aF, type PalbaseQrCodeOptions as aG, type PalbaseQuerySnapshot as aH, type PalbaseRegisterDeviceParams as aI, type PalbaseResult as aJ, type PalbaseRetentionQueryInput as aK, type PalbaseRetentionResult as aL, type PalbaseSession as aM, type PalbaseSetOverrideResult as aN, type PalbaseSetOverridesResult as aO, type PalbaseSignedUrlResponse as aP, type PalbaseSmsClient as aQ, type PalbaseSmsSendParams as aR, type PalbaseSmsSendResponse as aS, type PalbaseTransformOptions as aT, type PalbaseUpdateLinkParams as aU, type PalbaseUploadOptions as aV, type PalbaseUser as aW, type PalbaseUserDetailResult as aX, type PalbaseUsersQueryInput as aY, type PalbaseUsersResult as aZ, type PalbaseVerifyRequestSignatureParams as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type Ref as b0, TooManyRequests as b1, type TxColumnExpr as b2, type TxInsertShape as b3, type TxInsertValue as b4, type TxNow as b5, type TxPlanBody as b6, TxPlanError as b7, type TxPlanHandle as b8, type TxPlanOpResult as b9, type TxPlanRejection as ba, type TxPlanResponse as bb, TxRefError as bc, type TxRow as bd, type TxRows as be, type TxSelectOptions as bf, type TxSetShape as bg, type TxSetValue as bh, type TxTable as bi, type TxWhere as bj, type TxWireExpr as bk, type TxWireGuard as bl, type TxWireOp as bm, type TxWireRef as bn, type TxWireValue as bo, Unauthorized as bp, type VerifiedDevice as bq, dec as br, defineMiddleware as bs, inc as bt, now as bu, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type Middleware as o, type MiddlewareContext as p, type MiddlewareHandler as q, PalError as r, type PalbaseAnalyticsClient as s, type PalbaseAnalyticsManagementNamespace as t, type PalbaseAnalyticsProperties as u, type PalbaseAnalyticsQueryNamespace as v, type PalbaseAttestAndroidParams as w, type PalbaseAttestAndroidResult as x, type PalbaseAttestiOSParams as y, type PalbaseAttestiOSResult as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tables, TableTypes } from './db/env.js';
|
|
2
|
-
import { D as DBClient,
|
|
2
|
+
import { D as DBClient, b8 as TxPlanHandle, bi as TxTable, M as Materialized } from './endpoint-BW8bn1y-.js';
|
|
3
3
|
|
|
4
4
|
/** On delete action for foreign key references. */
|
|
5
5
|
type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tables, TableTypes } from './db/env.cjs';
|
|
2
|
-
import { D as DBClient,
|
|
2
|
+
import { D as DBClient, b8 as TxPlanHandle, bi as TxTable, M as Materialized } from './endpoint-BW8bn1y-.cjs';
|
|
3
3
|
|
|
4
4
|
/** On delete action for foreign key references. */
|
|
5
5
|
type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
package/dist/index.cjs
CHANGED
|
@@ -1371,6 +1371,44 @@ export {};
|
|
|
1371
1371
|
|
|
1372
1372
|
// src/config/storage.ts
|
|
1373
1373
|
var STORAGE_CONFIG_KIND = "storage";
|
|
1374
|
+
var VARIANT_FORMATS = ["webp", "avif", "jpeg", "png"];
|
|
1375
|
+
function normalizeVariants(input) {
|
|
1376
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) {
|
|
1377
|
+
throw new Error("bucket variants must be an object of { <name>: { width?, height?, format? } }");
|
|
1378
|
+
}
|
|
1379
|
+
const out = {};
|
|
1380
|
+
for (const [name, spec] of Object.entries(input)) {
|
|
1381
|
+
if (!/^[a-z0-9][a-z0-9_-]*$/i.test(name)) {
|
|
1382
|
+
throw new Error(
|
|
1383
|
+
`bucket variant name "${name}" must be alphanumeric with optional - or _ (e.g. "thumb", "card_2x")`
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
if (spec === null || typeof spec !== "object" || Array.isArray(spec)) {
|
|
1387
|
+
throw new Error(`bucket variant "${name}" must be an object like { width: 100, height: 100 }`);
|
|
1388
|
+
}
|
|
1389
|
+
for (const dim of ["width", "height"]) {
|
|
1390
|
+
const value = spec[dim];
|
|
1391
|
+
if (value === void 0) continue;
|
|
1392
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
1393
|
+
throw new Error(`bucket variant "${name}" ${dim} must be a positive integer, got ${String(value)}`);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
if (spec.width === void 0 && spec.height === void 0) {
|
|
1397
|
+
throw new Error(`bucket variant "${name}" must set width and/or height`);
|
|
1398
|
+
}
|
|
1399
|
+
if (spec.format !== void 0 && !VARIANT_FORMATS.includes(spec.format)) {
|
|
1400
|
+
throw new Error(
|
|
1401
|
+
`bucket variant "${name}" format must be one of ${VARIANT_FORMATS.join(", ")}, got "${String(spec.format)}"`
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
out[name] = {
|
|
1405
|
+
...spec.width !== void 0 ? { width: spec.width } : {},
|
|
1406
|
+
...spec.height !== void 0 ? { height: spec.height } : {},
|
|
1407
|
+
...spec.format !== void 0 ? { format: spec.format } : {}
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
return out;
|
|
1411
|
+
}
|
|
1374
1412
|
var UNIT_BYTES = {
|
|
1375
1413
|
b: 1,
|
|
1376
1414
|
kb: 1024,
|
|
@@ -1428,7 +1466,8 @@ function bucket(opts = {}) {
|
|
|
1428
1466
|
return {
|
|
1429
1467
|
public: opts.public ?? false,
|
|
1430
1468
|
fileSizeLimit,
|
|
1431
|
-
allowedMimeTypes
|
|
1469
|
+
allowedMimeTypes,
|
|
1470
|
+
variants: opts.variants === void 0 ? null : normalizeVariants(opts.variants)
|
|
1432
1471
|
};
|
|
1433
1472
|
}
|
|
1434
1473
|
function defineStorage(input) {
|