@wecode-team/cms-supabase-api 0.1.33 → 0.1.35

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,13 @@
1
+ import type { NormalizedOssUploadConfig, OssUploadConfig, OssUploadInput, OssUploadResult } from "../types/upload";
2
+ export declare class OssUploadError extends Error {
3
+ status: number;
4
+ constructor(message: string, status?: number);
5
+ }
6
+ export declare class OssUploadService {
7
+ private readonly config;
8
+ constructor(config: OssUploadConfig);
9
+ getConfig(): Omit<NormalizedOssUploadConfig, "accessKeyId" | "accessKeySecret">;
10
+ upload(input: OssUploadInput): Promise<OssUploadResult>;
11
+ }
12
+ export declare function initializeOssUpload(config: OssUploadConfig): OssUploadService;
13
+ export declare function getOssUploadService(): OssUploadService;
@@ -125,3 +125,4 @@ export interface GetRelationOptionsParams {
125
125
  limit?: number;
126
126
  search?: string;
127
127
  }
128
+ export type { OssUploadProvider, OssUploadReturnMode, OssUploadConfig, NormalizedOssUploadConfig, OssUploadInput, OssUploadResult, UploadRouteResponse, } from "./upload";
@@ -0,0 +1,47 @@
1
+ export type OssUploadProvider = "aliyun-oss";
2
+ export type OssUploadReturnMode = "public-url" | "signed-url" | "both";
3
+ export interface OssUploadConfig {
4
+ provider?: OssUploadProvider;
5
+ bucket: string;
6
+ endpoint: string;
7
+ accessKeyId: string;
8
+ accessKeySecret: string;
9
+ publicBaseUrl?: string;
10
+ prefix?: string;
11
+ maxSize?: number;
12
+ returnMode?: OssUploadReturnMode;
13
+ signedUrlExpiresIn?: number;
14
+ }
15
+ export interface NormalizedOssUploadConfig {
16
+ provider: OssUploadProvider;
17
+ bucket: string;
18
+ endpoint: string;
19
+ accessKeyId: string;
20
+ accessKeySecret: string;
21
+ publicBaseUrl: string;
22
+ prefix: string;
23
+ maxSize: number;
24
+ returnMode: OssUploadReturnMode;
25
+ signedUrlExpiresIn: number;
26
+ }
27
+ export interface OssUploadInput {
28
+ buffer: ArrayBuffer;
29
+ contentType?: string;
30
+ directory?: string;
31
+ originalName?: string;
32
+ }
33
+ export interface OssUploadResult {
34
+ url: string;
35
+ objectKey: string;
36
+ signedUrl?: string;
37
+ }
38
+ export interface UploadRouteResponse {
39
+ success: boolean;
40
+ url?: string;
41
+ signedUrl?: string;
42
+ objectKey?: string;
43
+ fieldName?: string;
44
+ tableName?: string;
45
+ message?: string;
46
+ error?: string;
47
+ }
@@ -4,4 +4,5 @@ export declare function createDataRoute(app: Hono, tableName: string): Hono<impo
4
4
  export declare function createDynamicDataRoute(app: Hono): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
5
5
  export declare function createDynamicAuthRoute(app: Hono): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
6
6
  export declare function createAuthRoute(app: Hono, tableName: string): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
7
+ export declare function createOssUploadRoute(app: Hono): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
7
8
  export declare function createCmsRoutes(app: Hono): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wecode-team/cms-supabase-api",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "A CMS API package using Hono framework with Supabase and dynamic table management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",