@aurabase/aurabase-js 0.3.1 → 0.4.1
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/README.md +26 -795
- package/{packages/aurabase/dist/AuraClient-DAtDbfPB.d.ts → dist/AuraClient-BcFE8u1v.d.cts} +1 -1
- package/{packages/aurabase/dist/AuraClient-DAtDbfPB.d.cts → dist/AuraClient-BcFE8u1v.d.ts} +1 -1
- package/{packages/aurabase/dist → dist}/index.d.cts +1 -1
- package/{packages/aurabase/dist → dist}/index.d.ts +1 -1
- package/{packages/aurabase/dist → dist}/ssr.d.cts +1 -1
- package/{packages/aurabase/dist → dist}/ssr.d.ts +1 -1
- package/package.json +74 -82
- package/.changeset/config.json +0 -11
- package/CHANGELOG.md +0 -30
- package/packages/ai/LICENSE +0 -21
- package/packages/ai/README.md +0 -106
- package/packages/ai/dist/index.cjs +0 -229
- package/packages/ai/dist/index.d.cts +0 -139
- package/packages/ai/dist/index.d.ts +0 -139
- package/packages/ai/dist/index.js +0 -226
- package/packages/ai/package.json +0 -61
- package/packages/aurabase/LICENSE +0 -21
- package/packages/aurabase/README.md +0 -64
- package/packages/aurabase/package.json +0 -80
- package/packages/aurabase/vitest.e2e.config.ts +0 -9
- package/packages/auth/LICENSE +0 -21
- package/packages/auth/README.md +0 -215
- package/packages/auth/dist/index.cjs +0 -1175
- package/packages/auth/dist/index.d.cts +0 -397
- package/packages/auth/dist/index.d.ts +0 -397
- package/packages/auth/dist/index.js +0 -1170
- package/packages/auth/package.json +0 -61
- package/packages/core/LICENSE +0 -21
- package/packages/core/README.md +0 -132
- package/packages/core/dist/index.cjs +0 -695
- package/packages/core/dist/index.d.cts +0 -1137
- package/packages/core/dist/index.d.ts +0 -1137
- package/packages/core/dist/index.js +0 -673
- package/packages/core/package.json +0 -57
- package/packages/db/LICENSE +0 -21
- package/packages/db/README.md +0 -152
- package/packages/db/VENDORED.md +0 -93
- package/packages/db/dist/index.cjs +0 -544
- package/packages/db/dist/index.d.cts +0 -1111
- package/packages/db/dist/index.d.ts +0 -1111
- package/packages/db/dist/index.js +0 -541
- package/packages/db/package.json +0 -62
- package/packages/functions/LICENSE +0 -21
- package/packages/functions/README.md +0 -96
- package/packages/functions/dist/index.cjs +0 -173
- package/packages/functions/dist/index.d.cts +0 -81
- package/packages/functions/dist/index.d.ts +0 -81
- package/packages/functions/dist/index.js +0 -168
- package/packages/functions/package.json +0 -60
- package/packages/gen/LICENSE +0 -21
- package/packages/gen/README.md +0 -84
- package/packages/gen/dist/cli.cjs +0 -334
- package/packages/gen/dist/cli.d.cts +0 -1
- package/packages/gen/dist/cli.d.ts +0 -1
- package/packages/gen/dist/cli.js +0 -332
- package/packages/gen/dist/index.cjs +0 -257
- package/packages/gen/dist/index.d.cts +0 -12
- package/packages/gen/dist/index.d.ts +0 -12
- package/packages/gen/dist/index.js +0 -255
- package/packages/gen/package.json +0 -66
- package/packages/notifications/LICENSE +0 -21
- package/packages/notifications/README.md +0 -134
- package/packages/notifications/dist/index.cjs +0 -128
- package/packages/notifications/dist/index.d.cts +0 -81
- package/packages/notifications/dist/index.d.ts +0 -81
- package/packages/notifications/dist/index.js +0 -125
- package/packages/notifications/package.json +0 -60
- package/packages/realtime/LICENSE +0 -21
- package/packages/realtime/README.md +0 -183
- package/packages/realtime/dist/index.cjs +0 -977
- package/packages/realtime/dist/index.d.cts +0 -259
- package/packages/realtime/dist/index.d.ts +0 -259
- package/packages/realtime/dist/index.js +0 -973
- package/packages/realtime/package.json +0 -60
- package/packages/storage/LICENSE +0 -21
- package/packages/storage/README.md +0 -141
- package/packages/storage/dist/index.cjs +0 -333
- package/packages/storage/dist/index.d.cts +0 -185
- package/packages/storage/dist/index.d.ts +0 -185
- package/packages/storage/dist/index.js +0 -329
- package/packages/storage/package.json +0 -60
- /package/{packages/aurabase/dist → dist}/index.cjs +0 -0
- /package/{packages/aurabase/dist → dist}/index.js +0 -0
- /package/{packages/aurabase/dist → dist}/ssr.cjs +0 -0
- /package/{packages/aurabase/dist → dist}/ssr.js +0 -0
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { AuraResponse, BaseService, AuraClientLike, StorageBucket, UploadResult, ImageTransform, FileEntry, ObjectMeta, AuraError } from '@aurabase/core';
|
|
2
|
-
|
|
3
|
-
type DownloadFn = () => Promise<Response>;
|
|
4
|
-
/** Download paresseux (Blob par défaut). La requête ne part qu'à l'await ; résultat mémoïsé. */
|
|
5
|
-
declare class BlobDownloadBuilder implements PromiseLike<AuraResponse<Blob>> {
|
|
6
|
-
private readonly _fn;
|
|
7
|
-
private _promise;
|
|
8
|
-
constructor(_fn: DownloadFn);
|
|
9
|
-
asStream(): StreamDownloadBuilder;
|
|
10
|
-
private _run;
|
|
11
|
-
then<TR1 = AuraResponse<Blob>, TR2 = never>(onfulfilled?: ((v: AuraResponse<Blob>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2>;
|
|
12
|
-
}
|
|
13
|
-
/** Variante flux — `res.body` (ReadableStream). */
|
|
14
|
-
declare class StreamDownloadBuilder implements PromiseLike<AuraResponse<ReadableStream<Uint8Array>>> {
|
|
15
|
-
private readonly _fn;
|
|
16
|
-
private _promise;
|
|
17
|
-
constructor(_fn: DownloadFn);
|
|
18
|
-
private _run;
|
|
19
|
-
then<TR1 = AuraResponse<ReadableStream<Uint8Array>>, TR2 = never>(onfulfilled?: ((v: AuraResponse<ReadableStream<Uint8Array>>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare class StorageService extends BaseService {
|
|
23
|
-
constructor(client: AuraClientLike);
|
|
24
|
-
private get prefix();
|
|
25
|
-
listBuckets(): Promise<AuraResponse<StorageBucket[]>>;
|
|
26
|
-
getBucket(id: string): Promise<AuraResponse<StorageBucket>>;
|
|
27
|
-
createBucket(name: string, options?: {
|
|
28
|
-
public?: boolean;
|
|
29
|
-
fileSizeLimit?: number;
|
|
30
|
-
allowedMimeTypes?: string[];
|
|
31
|
-
}): Promise<AuraResponse<StorageBucket>>;
|
|
32
|
-
/**
|
|
33
|
-
* Met à jour un bucket existant (mise à jour PARTIELLE : seuls les champs
|
|
34
|
-
* fournis sont envoyés). Mapping identique à `createBucket`
|
|
35
|
-
* (`public`/`file_size_limit`/`allowed_mime_types`).
|
|
36
|
-
*
|
|
37
|
-
* Backend route: PATCH /v1/storage/{project_id}/buckets/{id}
|
|
38
|
-
*/
|
|
39
|
-
updateBucket(id: string, options?: {
|
|
40
|
-
public?: boolean;
|
|
41
|
-
fileSizeLimit?: number;
|
|
42
|
-
allowedMimeTypes?: string[];
|
|
43
|
-
}): Promise<AuraResponse<StorageBucket>>;
|
|
44
|
-
deleteBucket(id: string): Promise<AuraResponse<null>>;
|
|
45
|
-
/**
|
|
46
|
-
* Upload a file to a bucket.
|
|
47
|
-
*
|
|
48
|
-
* Le serveur génère une clé unique `<uuid>.<ext>` (relative au bucket).
|
|
49
|
-
* Réutilisez directement `data.key` pour download(), remove(), copy(), etc.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const { data } = await client.storage.upload('avatars', 'photo.png', file)
|
|
53
|
-
* await client.storage.download('avatars', data!.key) // fonctionne directement
|
|
54
|
-
*
|
|
55
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}
|
|
56
|
-
*/
|
|
57
|
-
upload(bucketId: string, path: string, file: Blob | File | ArrayBuffer, options?: {
|
|
58
|
-
contentType?: string;
|
|
59
|
-
upsert?: boolean;
|
|
60
|
-
metadata?: Record<string, string>;
|
|
61
|
-
}): Promise<AuraResponse<UploadResult>>;
|
|
62
|
-
/**
|
|
63
|
-
* Download paresseux d'un fichier. Renvoie un builder (Blob par défaut, `.asStream()` pour
|
|
64
|
-
* le flux) ; la requête part à l'`await`. Refresh proactif du token avant la requête.
|
|
65
|
-
* `options?.transform` (image) : appende `renderTransformParams(...)` à l'URL — figée à
|
|
66
|
-
* l'appel, le builder reste inchangé.
|
|
67
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/{*key}
|
|
68
|
-
*/
|
|
69
|
-
download(bucketId: string, path: string, options?: {
|
|
70
|
-
transform?: ImageTransform;
|
|
71
|
-
}): BlobDownloadBuilder;
|
|
72
|
-
/**
|
|
73
|
-
* List files in a bucket.
|
|
74
|
-
*
|
|
75
|
-
* ⚠️ `offset` n'est PAS supporté par le backend (`ListQuery` ne connaît que
|
|
76
|
-
* `prefix`+`limit`) : le paramètre est accepté pour compatibilité ascendante
|
|
77
|
-
* mais IGNORÉ (jamais envoyé au serveur). Pour restreindre les résultats,
|
|
78
|
-
* utilisez `prefix`. La vraie pagination (continuation token) relève du backend.
|
|
79
|
-
*
|
|
80
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}
|
|
81
|
-
*/
|
|
82
|
-
list(bucketId: string, options?: {
|
|
83
|
-
prefix?: string;
|
|
84
|
-
limit?: number;
|
|
85
|
-
offset?: number;
|
|
86
|
-
}): Promise<AuraResponse<FileEntry[]>>;
|
|
87
|
-
/**
|
|
88
|
-
* Delete one or more files from a bucket.
|
|
89
|
-
* Backend route: DELETE /v1/storage/{project_id}/{bucket}/{*key}
|
|
90
|
-
* Note: for single file deletion, paths[0] is used. Multi-delete is done in sequence.
|
|
91
|
-
*/
|
|
92
|
-
remove(bucketId: string, paths: string[]): Promise<AuraResponse<null>>;
|
|
93
|
-
/**
|
|
94
|
-
* Copy a file within a bucket.
|
|
95
|
-
*
|
|
96
|
-
* `fromPath`/`toPath` sont relatifs au bucket (cohérent avec `download`/
|
|
97
|
-
* `remove`/`upload`) — le SDK les préfixe par `bucketId` pour produire les
|
|
98
|
-
* clés MinIO complètes attendues par le backend.
|
|
99
|
-
*
|
|
100
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}/copy
|
|
101
|
-
*/
|
|
102
|
-
copy(bucketId: string, fromPath: string, toPath: string): Promise<AuraResponse<{
|
|
103
|
-
key: string;
|
|
104
|
-
}>>;
|
|
105
|
-
/**
|
|
106
|
-
* Move/rename a file within a bucket.
|
|
107
|
-
*
|
|
108
|
-
* `fromPath`/`toPath` sont relatifs au bucket (cohérent avec `download`/
|
|
109
|
-
* `remove`/`upload`) — le SDK les préfixe par `bucketId` pour produire les
|
|
110
|
-
* clés MinIO complètes attendues par le backend.
|
|
111
|
-
*
|
|
112
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}/move
|
|
113
|
-
*/
|
|
114
|
-
move(bucketId: string, fromPath: string, toPath: string): Promise<AuraResponse<{
|
|
115
|
-
key: string;
|
|
116
|
-
}>>;
|
|
117
|
-
/**
|
|
118
|
-
* Get file metadata.
|
|
119
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/meta/{*key}
|
|
120
|
-
*/
|
|
121
|
-
getMetadata(bucketId: string, path: string): Promise<AuraResponse<ObjectMeta>>;
|
|
122
|
-
/**
|
|
123
|
-
* Generate a signed (temporary) download URL.
|
|
124
|
-
*
|
|
125
|
-
* `options?.transform` (image) : dérisqué en réel (stack live) — les params transform
|
|
126
|
-
* sont HORS HMAC (le backend ne les couvre pas dans la signature), donc on les appende
|
|
127
|
-
* à l'URL signée APRÈS réception de `{ url, expires_in }`, sans toucher à la requête
|
|
128
|
-
* `signed-url` elle-même.
|
|
129
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/signed-url?key=...&ttl_secs=...
|
|
130
|
-
*/
|
|
131
|
-
createSignedUrl(bucketId: string, path: string, expiresInSeconds?: number, options?: {
|
|
132
|
-
transform?: ImageTransform;
|
|
133
|
-
}): Promise<AuraResponse<{
|
|
134
|
-
url: string;
|
|
135
|
-
expires_in: number;
|
|
136
|
-
}>>;
|
|
137
|
-
/**
|
|
138
|
-
* Génère plusieurs URLs signées en une passe (batch).
|
|
139
|
-
*
|
|
140
|
-
* Il n'existe pas d'endpoint batch côté backend : l'implémentation fait un
|
|
141
|
-
* fan-out `Promise.all` sur `createSignedUrl` (même patron que `remove()`),
|
|
142
|
-
* RÉSILIENT PAR-ITEM — chaque entrée est soit `{ path, url, expires_in }`
|
|
143
|
-
* (succès), soit `{ path, error }` (échec), sans faire échouer les autres.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* const { data } = await client.storage.createSignedUrls('avatars', ['a.png', 'b.png'])
|
|
147
|
-
* data?.forEach((r) => 'url' in r ? use(r.url) : console.warn(r.path, r.error))
|
|
148
|
-
*/
|
|
149
|
-
createSignedUrls(bucketId: string, paths: string[], expiresInSeconds?: number, options?: {
|
|
150
|
-
transform?: ImageTransform;
|
|
151
|
-
}): Promise<AuraResponse<Array<{
|
|
152
|
-
path: string;
|
|
153
|
-
url: string;
|
|
154
|
-
expires_in: number;
|
|
155
|
-
} | {
|
|
156
|
-
path: string;
|
|
157
|
-
error: AuraError;
|
|
158
|
-
}>>>;
|
|
159
|
-
/**
|
|
160
|
-
* Generate a signed upload URL (presigned POST/PUT).
|
|
161
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/upload-url?key=...&ttl_secs=...
|
|
162
|
-
*/
|
|
163
|
-
createSignedUploadUrl(bucketId: string, path: string, expiresInSeconds?: number): Promise<AuraResponse<{
|
|
164
|
-
url: string;
|
|
165
|
-
expires_in: number;
|
|
166
|
-
}>>;
|
|
167
|
-
/**
|
|
168
|
-
* Construit une URL vers un fichier d'un bucket.
|
|
169
|
-
*
|
|
170
|
-
* ⚠️ Cette URL N'EST PAS accessible sans authentification : le gateway exige
|
|
171
|
-
* une clé API (`apikey`/`x-api-key`) sur toutes les routes storage, y compris
|
|
172
|
-
* pour les buckets créés avec `public: true` (ce flag n'est actuellement pas
|
|
173
|
-
* vérifié côté gateway — une requête non authentifiée renvoie 401). Pour
|
|
174
|
-
* partager un fichier sans authentification, utilisez `createSignedUrl()`,
|
|
175
|
-
* qui génère une URL signée HMAC vérifiée côté serveur sans clé API.
|
|
176
|
-
*
|
|
177
|
-
* `options?.transform` (image) : appende `renderTransformParams(...)` en query string.
|
|
178
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/{*key} (clé API requise)
|
|
179
|
-
*/
|
|
180
|
-
getPublicUrl(bucketId: string, path: string, options?: {
|
|
181
|
-
transform?: ImageTransform;
|
|
182
|
-
}): string;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export { BlobDownloadBuilder, StorageService, StreamDownloadBuilder };
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { AuraResponse, BaseService, AuraClientLike, StorageBucket, UploadResult, ImageTransform, FileEntry, ObjectMeta, AuraError } from '@aurabase/core';
|
|
2
|
-
|
|
3
|
-
type DownloadFn = () => Promise<Response>;
|
|
4
|
-
/** Download paresseux (Blob par défaut). La requête ne part qu'à l'await ; résultat mémoïsé. */
|
|
5
|
-
declare class BlobDownloadBuilder implements PromiseLike<AuraResponse<Blob>> {
|
|
6
|
-
private readonly _fn;
|
|
7
|
-
private _promise;
|
|
8
|
-
constructor(_fn: DownloadFn);
|
|
9
|
-
asStream(): StreamDownloadBuilder;
|
|
10
|
-
private _run;
|
|
11
|
-
then<TR1 = AuraResponse<Blob>, TR2 = never>(onfulfilled?: ((v: AuraResponse<Blob>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2>;
|
|
12
|
-
}
|
|
13
|
-
/** Variante flux — `res.body` (ReadableStream). */
|
|
14
|
-
declare class StreamDownloadBuilder implements PromiseLike<AuraResponse<ReadableStream<Uint8Array>>> {
|
|
15
|
-
private readonly _fn;
|
|
16
|
-
private _promise;
|
|
17
|
-
constructor(_fn: DownloadFn);
|
|
18
|
-
private _run;
|
|
19
|
-
then<TR1 = AuraResponse<ReadableStream<Uint8Array>>, TR2 = never>(onfulfilled?: ((v: AuraResponse<ReadableStream<Uint8Array>>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare class StorageService extends BaseService {
|
|
23
|
-
constructor(client: AuraClientLike);
|
|
24
|
-
private get prefix();
|
|
25
|
-
listBuckets(): Promise<AuraResponse<StorageBucket[]>>;
|
|
26
|
-
getBucket(id: string): Promise<AuraResponse<StorageBucket>>;
|
|
27
|
-
createBucket(name: string, options?: {
|
|
28
|
-
public?: boolean;
|
|
29
|
-
fileSizeLimit?: number;
|
|
30
|
-
allowedMimeTypes?: string[];
|
|
31
|
-
}): Promise<AuraResponse<StorageBucket>>;
|
|
32
|
-
/**
|
|
33
|
-
* Met à jour un bucket existant (mise à jour PARTIELLE : seuls les champs
|
|
34
|
-
* fournis sont envoyés). Mapping identique à `createBucket`
|
|
35
|
-
* (`public`/`file_size_limit`/`allowed_mime_types`).
|
|
36
|
-
*
|
|
37
|
-
* Backend route: PATCH /v1/storage/{project_id}/buckets/{id}
|
|
38
|
-
*/
|
|
39
|
-
updateBucket(id: string, options?: {
|
|
40
|
-
public?: boolean;
|
|
41
|
-
fileSizeLimit?: number;
|
|
42
|
-
allowedMimeTypes?: string[];
|
|
43
|
-
}): Promise<AuraResponse<StorageBucket>>;
|
|
44
|
-
deleteBucket(id: string): Promise<AuraResponse<null>>;
|
|
45
|
-
/**
|
|
46
|
-
* Upload a file to a bucket.
|
|
47
|
-
*
|
|
48
|
-
* Le serveur génère une clé unique `<uuid>.<ext>` (relative au bucket).
|
|
49
|
-
* Réutilisez directement `data.key` pour download(), remove(), copy(), etc.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const { data } = await client.storage.upload('avatars', 'photo.png', file)
|
|
53
|
-
* await client.storage.download('avatars', data!.key) // fonctionne directement
|
|
54
|
-
*
|
|
55
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}
|
|
56
|
-
*/
|
|
57
|
-
upload(bucketId: string, path: string, file: Blob | File | ArrayBuffer, options?: {
|
|
58
|
-
contentType?: string;
|
|
59
|
-
upsert?: boolean;
|
|
60
|
-
metadata?: Record<string, string>;
|
|
61
|
-
}): Promise<AuraResponse<UploadResult>>;
|
|
62
|
-
/**
|
|
63
|
-
* Download paresseux d'un fichier. Renvoie un builder (Blob par défaut, `.asStream()` pour
|
|
64
|
-
* le flux) ; la requête part à l'`await`. Refresh proactif du token avant la requête.
|
|
65
|
-
* `options?.transform` (image) : appende `renderTransformParams(...)` à l'URL — figée à
|
|
66
|
-
* l'appel, le builder reste inchangé.
|
|
67
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/{*key}
|
|
68
|
-
*/
|
|
69
|
-
download(bucketId: string, path: string, options?: {
|
|
70
|
-
transform?: ImageTransform;
|
|
71
|
-
}): BlobDownloadBuilder;
|
|
72
|
-
/**
|
|
73
|
-
* List files in a bucket.
|
|
74
|
-
*
|
|
75
|
-
* ⚠️ `offset` n'est PAS supporté par le backend (`ListQuery` ne connaît que
|
|
76
|
-
* `prefix`+`limit`) : le paramètre est accepté pour compatibilité ascendante
|
|
77
|
-
* mais IGNORÉ (jamais envoyé au serveur). Pour restreindre les résultats,
|
|
78
|
-
* utilisez `prefix`. La vraie pagination (continuation token) relève du backend.
|
|
79
|
-
*
|
|
80
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}
|
|
81
|
-
*/
|
|
82
|
-
list(bucketId: string, options?: {
|
|
83
|
-
prefix?: string;
|
|
84
|
-
limit?: number;
|
|
85
|
-
offset?: number;
|
|
86
|
-
}): Promise<AuraResponse<FileEntry[]>>;
|
|
87
|
-
/**
|
|
88
|
-
* Delete one or more files from a bucket.
|
|
89
|
-
* Backend route: DELETE /v1/storage/{project_id}/{bucket}/{*key}
|
|
90
|
-
* Note: for single file deletion, paths[0] is used. Multi-delete is done in sequence.
|
|
91
|
-
*/
|
|
92
|
-
remove(bucketId: string, paths: string[]): Promise<AuraResponse<null>>;
|
|
93
|
-
/**
|
|
94
|
-
* Copy a file within a bucket.
|
|
95
|
-
*
|
|
96
|
-
* `fromPath`/`toPath` sont relatifs au bucket (cohérent avec `download`/
|
|
97
|
-
* `remove`/`upload`) — le SDK les préfixe par `bucketId` pour produire les
|
|
98
|
-
* clés MinIO complètes attendues par le backend.
|
|
99
|
-
*
|
|
100
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}/copy
|
|
101
|
-
*/
|
|
102
|
-
copy(bucketId: string, fromPath: string, toPath: string): Promise<AuraResponse<{
|
|
103
|
-
key: string;
|
|
104
|
-
}>>;
|
|
105
|
-
/**
|
|
106
|
-
* Move/rename a file within a bucket.
|
|
107
|
-
*
|
|
108
|
-
* `fromPath`/`toPath` sont relatifs au bucket (cohérent avec `download`/
|
|
109
|
-
* `remove`/`upload`) — le SDK les préfixe par `bucketId` pour produire les
|
|
110
|
-
* clés MinIO complètes attendues par le backend.
|
|
111
|
-
*
|
|
112
|
-
* Backend route: POST /v1/storage/{project_id}/{bucket}/move
|
|
113
|
-
*/
|
|
114
|
-
move(bucketId: string, fromPath: string, toPath: string): Promise<AuraResponse<{
|
|
115
|
-
key: string;
|
|
116
|
-
}>>;
|
|
117
|
-
/**
|
|
118
|
-
* Get file metadata.
|
|
119
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/meta/{*key}
|
|
120
|
-
*/
|
|
121
|
-
getMetadata(bucketId: string, path: string): Promise<AuraResponse<ObjectMeta>>;
|
|
122
|
-
/**
|
|
123
|
-
* Generate a signed (temporary) download URL.
|
|
124
|
-
*
|
|
125
|
-
* `options?.transform` (image) : dérisqué en réel (stack live) — les params transform
|
|
126
|
-
* sont HORS HMAC (le backend ne les couvre pas dans la signature), donc on les appende
|
|
127
|
-
* à l'URL signée APRÈS réception de `{ url, expires_in }`, sans toucher à la requête
|
|
128
|
-
* `signed-url` elle-même.
|
|
129
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/signed-url?key=...&ttl_secs=...
|
|
130
|
-
*/
|
|
131
|
-
createSignedUrl(bucketId: string, path: string, expiresInSeconds?: number, options?: {
|
|
132
|
-
transform?: ImageTransform;
|
|
133
|
-
}): Promise<AuraResponse<{
|
|
134
|
-
url: string;
|
|
135
|
-
expires_in: number;
|
|
136
|
-
}>>;
|
|
137
|
-
/**
|
|
138
|
-
* Génère plusieurs URLs signées en une passe (batch).
|
|
139
|
-
*
|
|
140
|
-
* Il n'existe pas d'endpoint batch côté backend : l'implémentation fait un
|
|
141
|
-
* fan-out `Promise.all` sur `createSignedUrl` (même patron que `remove()`),
|
|
142
|
-
* RÉSILIENT PAR-ITEM — chaque entrée est soit `{ path, url, expires_in }`
|
|
143
|
-
* (succès), soit `{ path, error }` (échec), sans faire échouer les autres.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* const { data } = await client.storage.createSignedUrls('avatars', ['a.png', 'b.png'])
|
|
147
|
-
* data?.forEach((r) => 'url' in r ? use(r.url) : console.warn(r.path, r.error))
|
|
148
|
-
*/
|
|
149
|
-
createSignedUrls(bucketId: string, paths: string[], expiresInSeconds?: number, options?: {
|
|
150
|
-
transform?: ImageTransform;
|
|
151
|
-
}): Promise<AuraResponse<Array<{
|
|
152
|
-
path: string;
|
|
153
|
-
url: string;
|
|
154
|
-
expires_in: number;
|
|
155
|
-
} | {
|
|
156
|
-
path: string;
|
|
157
|
-
error: AuraError;
|
|
158
|
-
}>>>;
|
|
159
|
-
/**
|
|
160
|
-
* Generate a signed upload URL (presigned POST/PUT).
|
|
161
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/upload-url?key=...&ttl_secs=...
|
|
162
|
-
*/
|
|
163
|
-
createSignedUploadUrl(bucketId: string, path: string, expiresInSeconds?: number): Promise<AuraResponse<{
|
|
164
|
-
url: string;
|
|
165
|
-
expires_in: number;
|
|
166
|
-
}>>;
|
|
167
|
-
/**
|
|
168
|
-
* Construit une URL vers un fichier d'un bucket.
|
|
169
|
-
*
|
|
170
|
-
* ⚠️ Cette URL N'EST PAS accessible sans authentification : le gateway exige
|
|
171
|
-
* une clé API (`apikey`/`x-api-key`) sur toutes les routes storage, y compris
|
|
172
|
-
* pour les buckets créés avec `public: true` (ce flag n'est actuellement pas
|
|
173
|
-
* vérifié côté gateway — une requête non authentifiée renvoie 401). Pour
|
|
174
|
-
* partager un fichier sans authentification, utilisez `createSignedUrl()`,
|
|
175
|
-
* qui génère une URL signée HMAC vérifiée côté serveur sans clé API.
|
|
176
|
-
*
|
|
177
|
-
* `options?.transform` (image) : appende `renderTransformParams(...)` en query string.
|
|
178
|
-
* Backend route: GET /v1/storage/{project_id}/{bucket}/{*key} (clé API requise)
|
|
179
|
-
*/
|
|
180
|
-
getPublicUrl(bucketId: string, path: string, options?: {
|
|
181
|
-
transform?: ImageTransform;
|
|
182
|
-
}): string;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export { BlobDownloadBuilder, StorageService, StreamDownloadBuilder };
|