@sylphx/contract 0.2.1 → 0.4.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/CHANGELOG.md +12 -0
- package/dist/endpoint.d.ts +6 -0
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoints/admin-projects.d.ts +29 -0
- package/dist/endpoints/admin-projects.d.ts.map +1 -1
- package/dist/endpoints/admin-projects.js +30 -1
- package/dist/endpoints/auth.d.ts +47 -0
- package/dist/endpoints/auth.d.ts.map +1 -1
- package/dist/endpoints/auth.js +19 -1
- package/dist/endpoints/branch-databases.d.ts +27 -28
- package/dist/endpoints/branch-databases.d.ts.map +1 -1
- package/dist/endpoints/branch-databases.js +7 -7
- package/dist/endpoints/databases.d.ts +253 -3
- package/dist/endpoints/databases.d.ts.map +1 -1
- package/dist/endpoints/databases.js +19 -12
- package/dist/endpoints/organizations.d.ts +11 -0
- package/dist/endpoints/organizations.d.ts.map +1 -1
- package/dist/endpoints/organizations.js +8 -1
- package/dist/endpoints/project-manifest.d.ts +26 -18
- package/dist/endpoints/project-manifest.d.ts.map +1 -1
- package/dist/endpoints/secrets.d.ts +6 -6
- package/dist/endpoints/secrets.d.ts.map +1 -1
- package/dist/endpoints/secrets.js +6 -5
- package/dist/endpoints/storage.d.ts +183 -125
- package/dist/endpoints/storage.d.ts.map +1 -1
- package/dist/endpoints/storage.js +96 -59
- package/dist/index.d.ts +323 -164
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/admin-projects.d.ts +20 -0
- package/dist/schemas/admin-projects.d.ts.map +1 -1
- package/dist/schemas/admin-projects.js +17 -0
- package/dist/schemas/auth.d.ts +65 -0
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/auth.js +32 -0
- package/dist/schemas/branch-database.d.ts +20 -19
- package/dist/schemas/branch-database.d.ts.map +1 -1
- package/dist/schemas/branch-database.js +9 -7
- package/dist/schemas/ids.d.ts +2 -0
- package/dist/schemas/ids.d.ts.map +1 -1
- package/dist/schemas/ids.js +1 -0
- package/dist/schemas/organization.d.ts +24 -2
- package/dist/schemas/organization.d.ts.map +1 -1
- package/dist/schemas/organization.js +13 -1
- package/dist/schemas/project-manifest.d.ts +43 -21
- package/dist/schemas/project-manifest.d.ts.map +1 -1
- package/dist/schemas/project-manifest.js +11 -3
- package/dist/schemas/secret.d.ts +1 -1
- package/dist/schemas/secret.js +2 -2
- package/dist/schemas/storage.d.ts +259 -203
- package/dist/schemas/storage.d.ts.map +1 -1
- package/dist/schemas/storage.js +159 -144
- package/package.json +5 -1
|
@@ -1,165 +1,223 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storage endpoints — BaaS plane.
|
|
2
|
+
* Storage endpoints — BaaS plane. Per ADR-100.
|
|
3
|
+
*
|
|
4
|
+
* One resource (`uploads`) for upload sessions, one resource (`files`) for
|
|
5
|
+
* everything else. Verb suffix `:action` on `files` follows Google AIP-136.
|
|
6
|
+
*
|
|
7
|
+
* No legacy aliases. No polymorphic POSTs. Mirrors `@sylphx/sdk/storage.ts`.
|
|
3
8
|
*/
|
|
4
9
|
import { Schema } from 'effect';
|
|
5
10
|
export declare const storageEndpoints: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly upload: import("../endpoint.js").Endpoint<"POST", "/storage/upload", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
13
|
-
filename: typeof Schema.String;
|
|
14
|
-
contentType: Schema.optional<typeof Schema.String>;
|
|
15
|
-
size: Schema.optional<typeof Schema.Number>;
|
|
16
|
-
path: Schema.optional<typeof Schema.String>;
|
|
17
|
-
type: Schema.optional<Schema.Literal<["file", "avatar"]>>;
|
|
18
|
-
userId: Schema.optional<typeof Schema.String>;
|
|
11
|
+
readonly createUpload: import("../endpoint.js").Endpoint<"POST", "/storage/uploads", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
12
|
+
filename: Schema.filter<typeof Schema.String>;
|
|
13
|
+
contentType: Schema.filter<typeof Schema.String>;
|
|
14
|
+
size: Schema.filter<typeof Schema.Number>;
|
|
15
|
+
folder: Schema.optional<typeof Schema.String>;
|
|
16
|
+
visibility: Schema.optional<Schema.Literal<["public", "private"]>>;
|
|
19
17
|
metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
18
|
+
checksumSha256: Schema.optional<typeof Schema.String>;
|
|
19
|
+
ifNoneMatch: Schema.optional<Schema.Literal<["*"]>>;
|
|
20
|
+
}>, Schema.Union<[Schema.Struct<{
|
|
21
|
+
method: Schema.Literal<["PUT"]>;
|
|
22
|
+
uploadId: Schema.brand<typeof Schema.String, "UploadId">;
|
|
23
|
+
fileId: Schema.brand<typeof Schema.String, "FileId">;
|
|
24
|
+
url: typeof Schema.String;
|
|
25
|
+
headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
26
|
+
expiresAt: typeof Schema.DateFromString;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
method: Schema.Literal<["MULTIPART"]>;
|
|
29
|
+
uploadId: Schema.brand<typeof Schema.String, "UploadId">;
|
|
30
|
+
fileId: Schema.brand<typeof Schema.String, "FileId">;
|
|
31
|
+
partSize: typeof Schema.Number;
|
|
32
|
+
partCount: typeof Schema.Number;
|
|
33
|
+
parts: Schema.Array$<Schema.Struct<{
|
|
34
|
+
partNumber: Schema.filter<typeof Schema.Number>;
|
|
35
|
+
url: typeof Schema.String;
|
|
36
|
+
expiresAt: typeof Schema.DateFromString;
|
|
37
|
+
}>>;
|
|
38
|
+
expiresAt: typeof Schema.DateFromString;
|
|
39
|
+
}>]>>;
|
|
40
|
+
readonly abortUpload: import("../endpoint.js").Endpoint<"DELETE", "/storage/uploads/:uploadId", Schema.Struct<{
|
|
41
|
+
uploadId: typeof Schema.String;
|
|
42
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{}>>;
|
|
43
|
+
readonly presignUploadPart: import("../endpoint.js").Endpoint<"POST", "/storage/uploads/:uploadId/parts/:partNumber", Schema.Struct<{
|
|
44
|
+
uploadId: typeof Schema.String;
|
|
45
|
+
partNumber: typeof Schema.NumberFromString;
|
|
46
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
47
|
+
url: typeof Schema.String;
|
|
48
|
+
expiresAt: typeof Schema.DateFromString;
|
|
49
|
+
}>>;
|
|
50
|
+
readonly completeUpload: import("../endpoint.js").Endpoint<"POST", "/storage/uploads/:uploadId:complete", Schema.Struct<{
|
|
51
|
+
uploadId: typeof Schema.String;
|
|
52
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
53
|
+
parts: Schema.Array$<Schema.Struct<{
|
|
54
|
+
partNumber: Schema.filter<typeof Schema.Number>;
|
|
55
|
+
etag: Schema.filter<typeof Schema.String>;
|
|
56
|
+
}>>;
|
|
20
57
|
}>, Schema.Struct<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
storageKey: Schema.optional<typeof Schema.String>;
|
|
27
|
-
tokenPayload: Schema.optional<typeof Schema.String>;
|
|
28
|
-
url: Schema.optional<typeof Schema.String>;
|
|
29
|
-
uploadEndpoint: Schema.optional<typeof Schema.String>;
|
|
30
|
-
clientPayload: Schema.optional<typeof Schema.String>;
|
|
31
|
-
maxSize: Schema.optional<typeof Schema.Number>;
|
|
32
|
-
maxMultipartSize: Schema.optional<typeof Schema.Number>;
|
|
33
|
-
multipartThreshold: Schema.optional<typeof Schema.Number>;
|
|
34
|
-
allowedContentTypes: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
35
|
-
instructions: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
58
|
+
fileId: Schema.brand<typeof Schema.String, "FileId">;
|
|
59
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
60
|
+
size: typeof Schema.Number;
|
|
61
|
+
etag: typeof Schema.String;
|
|
62
|
+
checksumSha256: typeof Schema.String;
|
|
36
63
|
}>>;
|
|
37
|
-
readonly
|
|
64
|
+
readonly listFiles: import("../endpoint.js").Endpoint<"GET", "/storage/files", Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
65
|
+
folder: Schema.optional<typeof Schema.String>;
|
|
66
|
+
cursor: Schema.optional<typeof Schema.String>;
|
|
67
|
+
limit: Schema.optional<typeof Schema.Number>;
|
|
68
|
+
includeDeleted: Schema.optional<typeof Schema.Boolean>;
|
|
69
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
70
|
+
files: Schema.Array$<Schema.Struct<{
|
|
71
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
72
|
+
filename: typeof Schema.String;
|
|
73
|
+
contentType: typeof Schema.String;
|
|
74
|
+
size: typeof Schema.Number;
|
|
75
|
+
checksumSha256: typeof Schema.String;
|
|
76
|
+
etag: typeof Schema.String;
|
|
77
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
78
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
79
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
80
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
81
|
+
isDeleted: typeof Schema.Boolean;
|
|
82
|
+
createdAt: typeof Schema.DateFromString;
|
|
83
|
+
updatedAt: typeof Schema.DateFromString;
|
|
84
|
+
}>>;
|
|
85
|
+
nextCursor: Schema.NullOr<typeof Schema.String>;
|
|
86
|
+
}>>;
|
|
87
|
+
readonly getFile: import("../endpoint.js").Endpoint<"GET", "/storage/files/:fileId", Schema.Struct<{
|
|
88
|
+
fileId: typeof Schema.String;
|
|
89
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
90
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
38
91
|
filename: typeof Schema.String;
|
|
39
92
|
contentType: typeof Schema.String;
|
|
40
|
-
size:
|
|
41
|
-
|
|
42
|
-
|
|
93
|
+
size: typeof Schema.Number;
|
|
94
|
+
checksumSha256: typeof Schema.String;
|
|
95
|
+
etag: typeof Schema.String;
|
|
96
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
97
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
98
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
99
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
100
|
+
isDeleted: typeof Schema.Boolean;
|
|
101
|
+
createdAt: typeof Schema.DateFromString;
|
|
102
|
+
updatedAt: typeof Schema.DateFromString;
|
|
103
|
+
}>>;
|
|
104
|
+
readonly deleteFile: import("../endpoint.js").Endpoint<"DELETE", "/storage/files/:fileId", Schema.Struct<{
|
|
43
105
|
fileId: typeof Schema.String;
|
|
44
|
-
|
|
106
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
107
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
108
|
+
isDeleted: Schema.Literal<[true]>;
|
|
109
|
+
}>>;
|
|
110
|
+
readonly restoreFile: import("../endpoint.js").Endpoint<"POST", "/storage/files/:fileId:restore", Schema.Struct<{
|
|
111
|
+
fileId: typeof Schema.String;
|
|
112
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
113
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
114
|
+
filename: typeof Schema.String;
|
|
115
|
+
contentType: typeof Schema.String;
|
|
116
|
+
size: typeof Schema.Number;
|
|
117
|
+
checksumSha256: typeof Schema.String;
|
|
118
|
+
etag: typeof Schema.String;
|
|
119
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
120
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
121
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
122
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
123
|
+
isDeleted: typeof Schema.Boolean;
|
|
124
|
+
createdAt: typeof Schema.DateFromString;
|
|
125
|
+
updatedAt: typeof Schema.DateFromString;
|
|
45
126
|
}>>;
|
|
46
|
-
|
|
47
|
-
* Generate a time-limited signed URL for accessing a private file.
|
|
48
|
-
* Signed URLs avoid exposing permanent credentials and can be scoped
|
|
49
|
-
* to a specific user via the `userId` field.
|
|
50
|
-
*/
|
|
51
|
-
readonly signedUrl: import("../endpoint.js").Endpoint<"POST", "/storage/signed-url", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
127
|
+
readonly signFileUrl: import("../endpoint.js").Endpoint<"POST", "/storage/files/:fileId:signedUrl", Schema.Struct<{
|
|
52
128
|
fileId: typeof Schema.String;
|
|
53
|
-
|
|
129
|
+
}>, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
130
|
+
expiresIn: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
54
131
|
disposition: Schema.optional<Schema.Literal<["attachment", "inline"]>>;
|
|
55
132
|
userId: Schema.optional<typeof Schema.String>;
|
|
56
133
|
}>, Schema.Struct<{
|
|
57
134
|
url: typeof Schema.String;
|
|
58
|
-
expiresAt: typeof Schema.
|
|
135
|
+
expiresAt: typeof Schema.DateFromString;
|
|
59
136
|
file: Schema.Struct<{
|
|
60
|
-
id: typeof Schema.String
|
|
137
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
61
138
|
filename: typeof Schema.String;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
139
|
+
contentType: typeof Schema.String;
|
|
140
|
+
size: typeof Schema.Number;
|
|
141
|
+
checksumSha256: typeof Schema.String;
|
|
142
|
+
etag: typeof Schema.String;
|
|
143
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
144
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
145
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
146
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
147
|
+
isDeleted: typeof Schema.Boolean;
|
|
148
|
+
createdAt: typeof Schema.DateFromString;
|
|
149
|
+
updatedAt: typeof Schema.DateFromString;
|
|
65
150
|
}>;
|
|
66
151
|
}>>;
|
|
67
|
-
readonly
|
|
68
|
-
|
|
69
|
-
limit: Schema.optional<typeof Schema.String>;
|
|
70
|
-
cursor: Schema.optional<typeof Schema.String>;
|
|
152
|
+
readonly copyFile: import("../endpoint.js").Endpoint<"POST", "/storage/files/:fileId:copy", Schema.Struct<{
|
|
153
|
+
fileId: typeof Schema.String;
|
|
71
154
|
}>, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
72
|
-
|
|
73
|
-
id: typeof Schema.String;
|
|
74
|
-
size: typeof Schema.Number;
|
|
75
|
-
name: Schema.optional<typeof Schema.String>;
|
|
76
|
-
filename: Schema.optional<typeof Schema.String>;
|
|
77
|
-
path: Schema.optional<typeof Schema.String>;
|
|
78
|
-
key: Schema.optional<typeof Schema.String>;
|
|
79
|
-
url: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
80
|
-
contentType: Schema.optional<typeof Schema.String>;
|
|
81
|
-
mimeType: Schema.optional<typeof Schema.String>;
|
|
82
|
-
isPrivate: Schema.optional<typeof Schema.Boolean>;
|
|
83
|
-
metadata: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
|
|
84
|
-
createdAt: Schema.optional<typeof Schema.String>;
|
|
85
|
-
uploadedAt: Schema.optional<typeof Schema.String>;
|
|
86
|
-
}>>;
|
|
87
|
-
nextCursor: Schema.NullOr<typeof Schema.String>;
|
|
88
|
-
hasMore: Schema.optional<typeof Schema.Boolean>;
|
|
89
|
-
}>>;
|
|
90
|
-
readonly get: import("../endpoint.js").Endpoint<"GET", "/storage/files/:id", Schema.Struct<{
|
|
91
|
-
id: typeof Schema.String;
|
|
92
|
-
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
93
|
-
id: typeof Schema.String;
|
|
94
|
-
size: typeof Schema.Number;
|
|
95
|
-
name: Schema.optional<typeof Schema.String>;
|
|
155
|
+
folder: Schema.optional<typeof Schema.String>;
|
|
96
156
|
filename: Schema.optional<typeof Schema.String>;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
157
|
+
visibility: Schema.optional<Schema.Literal<["public", "private"]>>;
|
|
158
|
+
metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
159
|
+
}>, Schema.Struct<{
|
|
160
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
161
|
+
filename: typeof Schema.String;
|
|
162
|
+
contentType: typeof Schema.String;
|
|
163
|
+
size: typeof Schema.Number;
|
|
164
|
+
checksumSha256: typeof Schema.String;
|
|
165
|
+
etag: typeof Schema.String;
|
|
166
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
167
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
168
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
169
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
170
|
+
isDeleted: typeof Schema.Boolean;
|
|
171
|
+
createdAt: typeof Schema.DateFromString;
|
|
172
|
+
updatedAt: typeof Schema.DateFromString;
|
|
111
173
|
}>>;
|
|
112
|
-
readonly
|
|
113
|
-
|
|
174
|
+
readonly listFileVersions: import("../endpoint.js").Endpoint<"GET", "/storage/files/:fileId/versions", Schema.Struct<{
|
|
175
|
+
fileId: typeof Schema.String;
|
|
114
176
|
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
115
177
|
versions: Schema.Array$<Schema.Struct<{
|
|
116
|
-
id: typeof Schema.String
|
|
117
|
-
fileId: typeof Schema.String
|
|
178
|
+
id: Schema.brand<typeof Schema.String, "FileVersionId">;
|
|
179
|
+
fileId: Schema.brand<typeof Schema.String, "FileId">;
|
|
118
180
|
versionNumber: typeof Schema.Number;
|
|
119
|
-
|
|
120
|
-
contentType:
|
|
121
|
-
checksumSha256:
|
|
122
|
-
|
|
181
|
+
size: typeof Schema.Number;
|
|
182
|
+
contentType: typeof Schema.String;
|
|
183
|
+
checksumSha256: typeof Schema.String;
|
|
184
|
+
etag: typeof Schema.String;
|
|
185
|
+
createdAt: typeof Schema.DateFromString;
|
|
123
186
|
createdBy: Schema.NullOr<typeof Schema.String>;
|
|
124
187
|
isCurrent: typeof Schema.Boolean;
|
|
125
188
|
}>>;
|
|
126
189
|
}>>;
|
|
127
|
-
readonly
|
|
128
|
-
|
|
190
|
+
readonly restoreFileVersion: import("../endpoint.js").Endpoint<"POST", "/storage/files/:fileId/versions/:versionId:restore", Schema.Struct<{
|
|
191
|
+
fileId: typeof Schema.String;
|
|
129
192
|
versionId: typeof Schema.String;
|
|
130
193
|
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
131
|
-
|
|
194
|
+
file: Schema.Struct<{
|
|
195
|
+
id: Schema.brand<typeof Schema.String, "FileId">;
|
|
196
|
+
filename: typeof Schema.String;
|
|
197
|
+
contentType: typeof Schema.String;
|
|
198
|
+
size: typeof Schema.Number;
|
|
199
|
+
checksumSha256: typeof Schema.String;
|
|
200
|
+
etag: typeof Schema.String;
|
|
201
|
+
visibility: Schema.Literal<["public", "private"]>;
|
|
202
|
+
folder: Schema.NullOr<typeof Schema.String>;
|
|
203
|
+
metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
204
|
+
url: Schema.NullOr<typeof Schema.String>;
|
|
205
|
+
isDeleted: typeof Schema.Boolean;
|
|
206
|
+
createdAt: typeof Schema.DateFromString;
|
|
207
|
+
updatedAt: typeof Schema.DateFromString;
|
|
208
|
+
}>;
|
|
132
209
|
version: Schema.Struct<{
|
|
133
|
-
id: typeof Schema.String
|
|
134
|
-
fileId: typeof Schema.String
|
|
210
|
+
id: Schema.brand<typeof Schema.String, "FileVersionId">;
|
|
211
|
+
fileId: Schema.brand<typeof Schema.String, "FileId">;
|
|
135
212
|
versionNumber: typeof Schema.Number;
|
|
136
|
-
|
|
137
|
-
contentType:
|
|
138
|
-
checksumSha256:
|
|
139
|
-
|
|
213
|
+
size: typeof Schema.Number;
|
|
214
|
+
contentType: typeof Schema.String;
|
|
215
|
+
checksumSha256: typeof Schema.String;
|
|
216
|
+
etag: typeof Schema.String;
|
|
217
|
+
createdAt: typeof Schema.DateFromString;
|
|
140
218
|
createdBy: Schema.NullOr<typeof Schema.String>;
|
|
141
219
|
isCurrent: typeof Schema.Boolean;
|
|
142
220
|
}>;
|
|
143
221
|
}>>;
|
|
144
|
-
readonly restoreFile: import("../endpoint.js").Endpoint<"POST", "/storage/files/:id/restore", Schema.Struct<{
|
|
145
|
-
id: typeof Schema.String;
|
|
146
|
-
}>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
|
|
147
|
-
success: Schema.Literal<[true]>;
|
|
148
|
-
file: Schema.Struct<{
|
|
149
|
-
id: typeof Schema.String;
|
|
150
|
-
size: typeof Schema.Number;
|
|
151
|
-
name: Schema.optional<typeof Schema.String>;
|
|
152
|
-
filename: Schema.optional<typeof Schema.String>;
|
|
153
|
-
path: Schema.optional<typeof Schema.String>;
|
|
154
|
-
key: Schema.optional<typeof Schema.String>;
|
|
155
|
-
url: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
156
|
-
contentType: Schema.optional<typeof Schema.String>;
|
|
157
|
-
mimeType: Schema.optional<typeof Schema.String>;
|
|
158
|
-
isPrivate: Schema.optional<typeof Schema.Boolean>;
|
|
159
|
-
metadata: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
|
|
160
|
-
createdAt: Schema.optional<typeof Schema.String>;
|
|
161
|
-
uploadedAt: Schema.optional<typeof Schema.String>;
|
|
162
|
-
}>;
|
|
163
|
-
}>>;
|
|
164
222
|
};
|
|
165
223
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/endpoints/storage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/endpoints/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAgC/B,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwInB,CAAA"}
|
|
@@ -1,106 +1,143 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storage endpoints — BaaS plane.
|
|
2
|
+
* Storage endpoints — BaaS plane. Per ADR-100.
|
|
3
|
+
*
|
|
4
|
+
* One resource (`uploads`) for upload sessions, one resource (`files`) for
|
|
5
|
+
* everything else. Verb suffix `:action` on `files` follows Google AIP-136.
|
|
6
|
+
*
|
|
7
|
+
* No legacy aliases. No polymorphic POSTs. Mirrors `@sylphx/sdk/storage.ts`.
|
|
3
8
|
*/
|
|
4
9
|
import { Schema } from 'effect';
|
|
5
10
|
import { defineEndpoint } from '../endpoint.js';
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
11
|
+
import { CopyFileRequest, CopyFileResult, File, ListFilesQuery, ListFilesResult, ListFileVersionsResult, RestoreFileResult, RestoreVersionResult, SignedUrlRequest, SignedUrlResult, SoftDeleteFileResult, UploadCompleteRequest, UploadCompleteResult, UploadCreateRequest, UploadCreateResult, UploadPartPresignResult, } from '../schemas/storage.js';
|
|
12
|
+
const FileIdPath = Schema.Struct({ fileId: Schema.String });
|
|
13
|
+
const UploadIdPath = Schema.Struct({ uploadId: Schema.String });
|
|
14
|
+
const UploadPartPath = Schema.Struct({
|
|
15
|
+
uploadId: Schema.String,
|
|
16
|
+
partNumber: Schema.NumberFromString,
|
|
17
|
+
});
|
|
8
18
|
const FileVersionPath = Schema.Struct({
|
|
9
|
-
|
|
19
|
+
fileId: Schema.String,
|
|
10
20
|
versionId: Schema.String,
|
|
11
21
|
});
|
|
12
22
|
export const storageEndpoints = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* This is the SDK's primary upload path (`uploadFile` / `uploadAvatar`).
|
|
18
|
-
*/
|
|
19
|
-
upload: defineEndpoint({
|
|
23
|
+
// --------------------------------------------------------------------------
|
|
24
|
+
// Upload sessions
|
|
25
|
+
// --------------------------------------------------------------------------
|
|
26
|
+
createUpload: defineEndpoint({
|
|
20
27
|
method: 'POST',
|
|
21
|
-
path: '/storage/
|
|
22
|
-
body:
|
|
23
|
-
response:
|
|
28
|
+
path: '/storage/uploads',
|
|
29
|
+
body: UploadCreateRequest,
|
|
30
|
+
response: UploadCreateResult,
|
|
24
31
|
plane: 'baas',
|
|
25
|
-
summary: '
|
|
32
|
+
summary: 'Create an upload session. Returns a single-part PUT or a multipart plan based on size.',
|
|
26
33
|
tags: ['storage'],
|
|
27
34
|
}),
|
|
28
|
-
|
|
35
|
+
abortUpload: defineEndpoint({
|
|
36
|
+
method: 'DELETE',
|
|
37
|
+
path: '/storage/uploads/:uploadId',
|
|
38
|
+
params: UploadIdPath,
|
|
39
|
+
response: Schema.Struct({}),
|
|
40
|
+
plane: 'baas',
|
|
41
|
+
summary: 'Abort an in-progress upload session and release its parts.',
|
|
42
|
+
tags: ['storage'],
|
|
43
|
+
}),
|
|
44
|
+
presignUploadPart: defineEndpoint({
|
|
29
45
|
method: 'POST',
|
|
30
|
-
path: '/storage/
|
|
31
|
-
|
|
32
|
-
response:
|
|
46
|
+
path: '/storage/uploads/:uploadId/parts/:partNumber',
|
|
47
|
+
params: UploadPartPath,
|
|
48
|
+
response: UploadPartPresignResult,
|
|
33
49
|
plane: 'baas',
|
|
34
|
-
summary: 'Mint a
|
|
50
|
+
summary: 'Mint a fresh presigned URL for a single multipart part (used to resume long pauses).',
|
|
35
51
|
tags: ['storage'],
|
|
36
52
|
}),
|
|
37
|
-
|
|
38
|
-
* Generate a time-limited signed URL for accessing a private file.
|
|
39
|
-
* Signed URLs avoid exposing permanent credentials and can be scoped
|
|
40
|
-
* to a specific user via the `userId` field.
|
|
41
|
-
*/
|
|
42
|
-
signedUrl: defineEndpoint({
|
|
53
|
+
completeUpload: defineEndpoint({
|
|
43
54
|
method: 'POST',
|
|
44
|
-
path: '/storage/
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
path: '/storage/uploads/:uploadId:complete',
|
|
56
|
+
params: UploadIdPath,
|
|
57
|
+
body: UploadCompleteRequest,
|
|
58
|
+
response: UploadCompleteResult,
|
|
47
59
|
plane: 'baas',
|
|
48
|
-
summary: '
|
|
60
|
+
summary: 'Finalise a multipart upload by submitting per-part etags.',
|
|
49
61
|
tags: ['storage'],
|
|
50
62
|
}),
|
|
51
|
-
|
|
63
|
+
// --------------------------------------------------------------------------
|
|
64
|
+
// Files resource
|
|
65
|
+
// --------------------------------------------------------------------------
|
|
66
|
+
listFiles: defineEndpoint({
|
|
52
67
|
method: 'GET',
|
|
53
68
|
path: '/storage/files',
|
|
54
69
|
query: ListFilesQuery,
|
|
55
70
|
response: ListFilesResult,
|
|
56
71
|
plane: 'baas',
|
|
57
|
-
summary: 'List files
|
|
72
|
+
summary: 'List files (cursor-paginated).',
|
|
58
73
|
tags: ['storage'],
|
|
59
74
|
}),
|
|
60
|
-
|
|
75
|
+
getFile: defineEndpoint({
|
|
61
76
|
method: 'GET',
|
|
62
|
-
path: '/storage/files/:
|
|
63
|
-
params:
|
|
64
|
-
response:
|
|
77
|
+
path: '/storage/files/:fileId',
|
|
78
|
+
params: FileIdPath,
|
|
79
|
+
response: File,
|
|
65
80
|
plane: 'baas',
|
|
66
|
-
summary: 'Get file metadata
|
|
81
|
+
summary: 'Get file metadata.',
|
|
67
82
|
tags: ['storage'],
|
|
68
83
|
}),
|
|
69
|
-
|
|
84
|
+
deleteFile: defineEndpoint({
|
|
70
85
|
method: 'DELETE',
|
|
71
|
-
path: '/storage/files/:
|
|
72
|
-
params:
|
|
73
|
-
response:
|
|
86
|
+
path: '/storage/files/:fileId',
|
|
87
|
+
params: FileIdPath,
|
|
88
|
+
response: SoftDeleteFileResult,
|
|
74
89
|
plane: 'baas',
|
|
75
|
-
summary: 'Soft-delete a
|
|
90
|
+
summary: 'Soft-delete a file. Restorable via `:restore`.',
|
|
76
91
|
tags: ['storage'],
|
|
77
92
|
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
response: ListFileVersionsResult,
|
|
93
|
+
restoreFile: defineEndpoint({
|
|
94
|
+
method: 'POST',
|
|
95
|
+
path: '/storage/files/:fileId:restore',
|
|
96
|
+
params: FileIdPath,
|
|
97
|
+
response: RestoreFileResult,
|
|
84
98
|
plane: 'baas',
|
|
85
|
-
summary: '
|
|
99
|
+
summary: 'Restore a soft-deleted file.',
|
|
86
100
|
tags: ['storage'],
|
|
87
101
|
}),
|
|
88
|
-
|
|
102
|
+
signFileUrl: defineEndpoint({
|
|
89
103
|
method: 'POST',
|
|
90
|
-
path: '/storage/files/:
|
|
91
|
-
params:
|
|
92
|
-
|
|
104
|
+
path: '/storage/files/:fileId:signedUrl',
|
|
105
|
+
params: FileIdPath,
|
|
106
|
+
body: SignedUrlRequest,
|
|
107
|
+
response: SignedUrlResult,
|
|
93
108
|
plane: 'baas',
|
|
94
|
-
summary: '
|
|
109
|
+
summary: 'Mint a short-lived signed download URL for a private file.',
|
|
95
110
|
tags: ['storage'],
|
|
96
111
|
}),
|
|
97
|
-
|
|
112
|
+
copyFile: defineEndpoint({
|
|
98
113
|
method: 'POST',
|
|
99
|
-
path: '/storage/files/:
|
|
100
|
-
params:
|
|
101
|
-
|
|
114
|
+
path: '/storage/files/:fileId:copy',
|
|
115
|
+
params: FileIdPath,
|
|
116
|
+
body: CopyFileRequest,
|
|
117
|
+
response: CopyFileResult,
|
|
118
|
+
plane: 'baas',
|
|
119
|
+
summary: 'Server-side copy (no client bandwidth).',
|
|
120
|
+
tags: ['storage'],
|
|
121
|
+
}),
|
|
122
|
+
// --------------------------------------------------------------------------
|
|
123
|
+
// Versions
|
|
124
|
+
// --------------------------------------------------------------------------
|
|
125
|
+
listFileVersions: defineEndpoint({
|
|
126
|
+
method: 'GET',
|
|
127
|
+
path: '/storage/files/:fileId/versions',
|
|
128
|
+
params: FileIdPath,
|
|
129
|
+
response: ListFileVersionsResult,
|
|
130
|
+
plane: 'baas',
|
|
131
|
+
summary: 'List versions of a file (newest first).',
|
|
132
|
+
tags: ['storage'],
|
|
133
|
+
}),
|
|
134
|
+
restoreFileVersion: defineEndpoint({
|
|
135
|
+
method: 'POST',
|
|
136
|
+
path: '/storage/files/:fileId/versions/:versionId:restore',
|
|
137
|
+
params: FileVersionPath,
|
|
138
|
+
response: RestoreVersionResult,
|
|
102
139
|
plane: 'baas',
|
|
103
|
-
summary: 'Restore
|
|
140
|
+
summary: 'Restore an older version as the current version (append-only history).',
|
|
104
141
|
tags: ['storage'],
|
|
105
142
|
}),
|
|
106
143
|
};
|