@aepstore-dev/contracts 1.61.0 → 1.63.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.
@@ -1,171 +1,171 @@
1
- syntax = "proto3";
2
-
3
- package upload.v1;
4
-
5
- // Thin signing service. File bytes NEVER pass through this service — clients
6
- // upload/download directly to/from S3 (Yandex Object Storage) using presigned
7
- // URLs this service mints. Memory/bandwidth flat regardless of file size.
8
- //
9
- // Large files (product deliverables, up to ~1GB) use the multipart flow:
10
- // CreateMultipartUpload → (SignPart × N, client PUTs each part to S3) →
11
- // CompleteMultipartUpload (or AbortMultipartUpload on failure)
12
- //
13
- // Small files (preview images, avatars) use the single-PUT flow: CreateUploadUrl.
14
- //
15
- // Downloads are gated elsewhere (products-service verifies purchase, then calls
16
- // GenerateSignedUrl). This service does not know about purchases.
17
- service UploadService {
18
- rpc CreateMultipartUpload(CreateMultipartUploadRequest) returns (CreateMultipartUploadResponse);
19
- rpc SignPart(SignPartRequest) returns (SignPartResponse);
20
- rpc CompleteMultipartUpload(CompleteMultipartUploadRequest) returns (CompleteMultipartUploadResponse);
21
- rpc AbortMultipartUpload(AbortMultipartUploadRequest) returns (Ok);
22
-
23
- rpc CreateUploadUrl(CreateUploadUrlRequest) returns (CreateUploadUrlResponse);
24
-
25
- rpc GenerateSignedUrl(SignedUrlRequest) returns (SignedUrlResponse);
26
-
27
- // Verify an object actually exists (and read its size/type). Used by
28
- // products-service to confirm a client-echoed fileKey points at a real
29
- // uploaded object before persisting attachment metadata.
30
- rpc HeadObject(HeadObjectRequest) returns (HeadObjectResponse);
31
-
32
- rpc DeleteObject(DeleteObjectRequest) returns (Ok);
33
-
34
- // List objects under a prefix (paginated) — for GC/reconciliation jobs
35
- // (e.g. tasks-service sweeping orphaned uploads). Not for user traffic.
36
- rpc ListObjects(ListObjectsRequest) returns (ListObjectsResponse);
37
- }
38
-
39
- message ListObjectsRequest {
40
- string prefix = 1;
41
- string continuation_token = 2; // empty for the first page
42
- }
43
-
44
- message StoredObject {
45
- string key = 1;
46
- string last_modified = 2; // ISO 8601
47
- }
48
-
49
- message ListObjectsResponse {
50
- repeated StoredObject objects = 1;
51
- string next_continuation_token = 2; // empty when there are no more pages
52
- }
53
-
54
- // Determines the object key prefix (and future ACL/privacy policy).
55
- // ATTACHMENT = paid product deliverable (private; presigned GET only after purchase).
56
- // MEDIA / AVATAR / BANNER = preview assets.
57
- enum UploadKind {
58
- UPLOAD_KIND_UNSPECIFIED = 0;
59
- UPLOAD_KIND_ATTACHMENT = 1;
60
- UPLOAD_KIND_MEDIA = 2;
61
- UPLOAD_KIND_AVATAR = 3;
62
- UPLOAD_KIND_BANNER = 4;
63
- UPLOAD_KIND_ICON = 5; // taxonomy program/app brand icons → public/icons/
64
- }
65
-
66
- message Ok {
67
- bool ok = 1;
68
- }
69
-
70
- // ---------------------------------------------------------------------------
71
- // Multipart upload (large files)
72
- // ---------------------------------------------------------------------------
73
-
74
- message CreateMultipartUploadRequest {
75
- string file_name = 1;
76
- string mime_type = 2;
77
- int64 file_size = 3;
78
- UploadKind kind = 4;
79
- string owner_id = 5; // user initiating, for key namespacing + audit
80
- }
81
-
82
- message CreateMultipartUploadResponse {
83
- string upload_id = 1; // S3 multipart UploadId
84
- string file_key = 2; // object key this service generated
85
- int64 part_size = 3; // recommended part size (bytes) the client should slice with
86
- int32 part_count = 4; // number of parts for file_size at part_size
87
- }
88
-
89
- message SignPartRequest {
90
- string file_key = 1;
91
- string upload_id = 2;
92
- int32 part_number = 3; // 1-based
93
- }
94
-
95
- message SignPartResponse {
96
- string url = 1; // presigned PUT URL for this single part
97
- int32 expires_in = 2;
98
- }
99
-
100
- message CompletedPart {
101
- int32 part_number = 1;
102
- string etag = 2; // ETag the client received in the S3 PUT response header for this part
103
- }
104
-
105
- message CompleteMultipartUploadRequest {
106
- string file_key = 1;
107
- string upload_id = 2;
108
- repeated CompletedPart parts = 3;
109
- }
110
-
111
- message CompleteMultipartUploadResponse {
112
- string file_key = 1;
113
- string location = 2; // final object location (internal reference)
114
- int64 file_size = 3;
115
- }
116
-
117
- message AbortMultipartUploadRequest {
118
- string file_key = 1;
119
- string upload_id = 2;
120
- }
121
-
122
- // ---------------------------------------------------------------------------
123
- // Single-PUT upload (small files)
124
- // ---------------------------------------------------------------------------
125
-
126
- message CreateUploadUrlRequest {
127
- string file_name = 1;
128
- string mime_type = 2;
129
- UploadKind kind = 3;
130
- string owner_id = 4;
131
- }
132
-
133
- message CreateUploadUrlResponse {
134
- string url = 1; // presigned PUT URL (client PUTs the whole file)
135
- string file_key = 2;
136
- int32 expires_in = 3;
137
- string public_url = 4; // final object URL (only meaningful for public kinds)
138
- }
139
-
140
- // ---------------------------------------------------------------------------
141
- // Download
142
- // ---------------------------------------------------------------------------
143
-
144
- message SignedUrlRequest {
145
- string file_key = 1;
146
- int32 expires_in = 2; // optional, default 3600
147
- string download_file_name = 3; // optional: forces Content-Disposition attachment filename
148
- }
149
-
150
- message SignedUrlResponse {
151
- string signed_url = 1;
152
- int32 expires_in = 2;
153
- }
154
-
155
- message HeadObjectRequest {
156
- string file_key = 1;
157
- }
158
-
159
- message HeadObjectResponse {
160
- bool exists = 1; // false only when the object is definitively absent (404)
161
- double size = 2; // bytes (0 when absent)
162
- string content_type = 3;
163
- }
164
-
165
- // ---------------------------------------------------------------------------
166
- // Cleanup
167
- // ---------------------------------------------------------------------------
168
-
169
- message DeleteObjectRequest {
170
- string file_key = 1;
171
- }
1
+ syntax = "proto3";
2
+
3
+ package upload.v1;
4
+
5
+ // Thin signing service. File bytes NEVER pass through this service — clients
6
+ // upload/download directly to/from S3 (Yandex Object Storage) using presigned
7
+ // URLs this service mints. Memory/bandwidth flat regardless of file size.
8
+ //
9
+ // Large files (product deliverables, up to ~1GB) use the multipart flow:
10
+ // CreateMultipartUpload → (SignPart × N, client PUTs each part to S3) →
11
+ // CompleteMultipartUpload (or AbortMultipartUpload on failure)
12
+ //
13
+ // Small files (preview images, avatars) use the single-PUT flow: CreateUploadUrl.
14
+ //
15
+ // Downloads are gated elsewhere (products-service verifies purchase, then calls
16
+ // GenerateSignedUrl). This service does not know about purchases.
17
+ service UploadService {
18
+ rpc CreateMultipartUpload(CreateMultipartUploadRequest) returns (CreateMultipartUploadResponse);
19
+ rpc SignPart(SignPartRequest) returns (SignPartResponse);
20
+ rpc CompleteMultipartUpload(CompleteMultipartUploadRequest) returns (CompleteMultipartUploadResponse);
21
+ rpc AbortMultipartUpload(AbortMultipartUploadRequest) returns (Ok);
22
+
23
+ rpc CreateUploadUrl(CreateUploadUrlRequest) returns (CreateUploadUrlResponse);
24
+
25
+ rpc GenerateSignedUrl(SignedUrlRequest) returns (SignedUrlResponse);
26
+
27
+ // Verify an object actually exists (and read its size/type). Used by
28
+ // products-service to confirm a client-echoed fileKey points at a real
29
+ // uploaded object before persisting attachment metadata.
30
+ rpc HeadObject(HeadObjectRequest) returns (HeadObjectResponse);
31
+
32
+ rpc DeleteObject(DeleteObjectRequest) returns (Ok);
33
+
34
+ // List objects under a prefix (paginated) — for GC/reconciliation jobs
35
+ // (e.g. tasks-service sweeping orphaned uploads). Not for user traffic.
36
+ rpc ListObjects(ListObjectsRequest) returns (ListObjectsResponse);
37
+ }
38
+
39
+ message ListObjectsRequest {
40
+ string prefix = 1;
41
+ string continuation_token = 2; // empty for the first page
42
+ }
43
+
44
+ message StoredObject {
45
+ string key = 1;
46
+ string last_modified = 2; // ISO 8601
47
+ }
48
+
49
+ message ListObjectsResponse {
50
+ repeated StoredObject objects = 1;
51
+ string next_continuation_token = 2; // empty when there are no more pages
52
+ }
53
+
54
+ // Determines the object key prefix (and future ACL/privacy policy).
55
+ // ATTACHMENT = paid product deliverable (private; presigned GET only after purchase).
56
+ // MEDIA / AVATAR / BANNER = preview assets.
57
+ enum UploadKind {
58
+ UPLOAD_KIND_UNSPECIFIED = 0;
59
+ UPLOAD_KIND_ATTACHMENT = 1;
60
+ UPLOAD_KIND_MEDIA = 2;
61
+ UPLOAD_KIND_AVATAR = 3;
62
+ UPLOAD_KIND_BANNER = 4;
63
+ UPLOAD_KIND_ICON = 5; // taxonomy program/app brand icons → public/icons/
64
+ }
65
+
66
+ message Ok {
67
+ bool ok = 1;
68
+ }
69
+
70
+ // ---------------------------------------------------------------------------
71
+ // Multipart upload (large files)
72
+ // ---------------------------------------------------------------------------
73
+
74
+ message CreateMultipartUploadRequest {
75
+ string file_name = 1;
76
+ string mime_type = 2;
77
+ int64 file_size = 3;
78
+ UploadKind kind = 4;
79
+ string owner_id = 5; // user initiating, for key namespacing + audit
80
+ }
81
+
82
+ message CreateMultipartUploadResponse {
83
+ string upload_id = 1; // S3 multipart UploadId
84
+ string file_key = 2; // object key this service generated
85
+ int64 part_size = 3; // recommended part size (bytes) the client should slice with
86
+ int32 part_count = 4; // number of parts for file_size at part_size
87
+ }
88
+
89
+ message SignPartRequest {
90
+ string file_key = 1;
91
+ string upload_id = 2;
92
+ int32 part_number = 3; // 1-based
93
+ }
94
+
95
+ message SignPartResponse {
96
+ string url = 1; // presigned PUT URL for this single part
97
+ int32 expires_in = 2;
98
+ }
99
+
100
+ message CompletedPart {
101
+ int32 part_number = 1;
102
+ string etag = 2; // ETag the client received in the S3 PUT response header for this part
103
+ }
104
+
105
+ message CompleteMultipartUploadRequest {
106
+ string file_key = 1;
107
+ string upload_id = 2;
108
+ repeated CompletedPart parts = 3;
109
+ }
110
+
111
+ message CompleteMultipartUploadResponse {
112
+ string file_key = 1;
113
+ string location = 2; // final object location (internal reference)
114
+ int64 file_size = 3;
115
+ }
116
+
117
+ message AbortMultipartUploadRequest {
118
+ string file_key = 1;
119
+ string upload_id = 2;
120
+ }
121
+
122
+ // ---------------------------------------------------------------------------
123
+ // Single-PUT upload (small files)
124
+ // ---------------------------------------------------------------------------
125
+
126
+ message CreateUploadUrlRequest {
127
+ string file_name = 1;
128
+ string mime_type = 2;
129
+ UploadKind kind = 3;
130
+ string owner_id = 4;
131
+ }
132
+
133
+ message CreateUploadUrlResponse {
134
+ string url = 1; // presigned PUT URL (client PUTs the whole file)
135
+ string file_key = 2;
136
+ int32 expires_in = 3;
137
+ string public_url = 4; // final object URL (only meaningful for public kinds)
138
+ }
139
+
140
+ // ---------------------------------------------------------------------------
141
+ // Download
142
+ // ---------------------------------------------------------------------------
143
+
144
+ message SignedUrlRequest {
145
+ string file_key = 1;
146
+ int32 expires_in = 2; // optional, default 3600
147
+ string download_file_name = 3; // optional: forces Content-Disposition attachment filename
148
+ }
149
+
150
+ message SignedUrlResponse {
151
+ string signed_url = 1;
152
+ int32 expires_in = 2;
153
+ }
154
+
155
+ message HeadObjectRequest {
156
+ string file_key = 1;
157
+ }
158
+
159
+ message HeadObjectResponse {
160
+ bool exists = 1; // false only when the object is definitively absent (404)
161
+ double size = 2; // bytes (0 when absent)
162
+ string content_type = 3;
163
+ }
164
+
165
+ // ---------------------------------------------------------------------------
166
+ // Cleanup
167
+ // ---------------------------------------------------------------------------
168
+
169
+ message DeleteObjectRequest {
170
+ string file_key = 1;
171
+ }