@wireapp/api-client 27.77.0 → 27.77.2

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/lib/APIClient.js CHANGED
@@ -102,7 +102,7 @@ class APIClient extends events_1.EventEmitter {
102
102
  }
103
103
  configureApis(backendFeatures) {
104
104
  this.logger.info('configuring APIs with config', backendFeatures);
105
- const assetAPI = new asset_1.AssetAPI(this.transport.http);
105
+ const assetAPI = new asset_1.AssetAPI(this.transport.http, backendFeatures);
106
106
  // Prevents the CellsAPI from being initialized multiple times
107
107
  if (!this.cellsApi) {
108
108
  this.cellsApi = new CellsAPI_1.CellsAPI({
@@ -1,5 +1,6 @@
1
- import { QualifiedConversationId } from '@wireapp/protocol-messaging';
2
1
  import { AssetRetentionPolicy } from './AssetRetentionPolicy';
2
+ import { AssetUploadData } from './AssetUploadData';
3
+ import { BackendFeatures } from '../APIClient';
3
4
  import { HttpClient, ProgressCallback, RequestCancelable } from '../http/';
4
5
  export interface CipherOptions {
5
6
  /** Set a custom algorithm for encryption */
@@ -7,18 +8,11 @@ export interface CipherOptions {
7
8
  /** Set a custom hash for encryption */
8
9
  hash?: Buffer;
9
10
  }
10
- export interface AssetAuditData {
11
- conversationId: QualifiedConversationId;
12
- filename: string;
13
- filetype: string;
14
- }
15
11
  export interface AssetOptions extends CipherOptions {
16
12
  public?: boolean;
17
13
  retention?: AssetRetentionPolicy;
18
14
  /** If given, will upload an asset that can be shared in a federated env */
19
15
  domain?: string;
20
- /** Used for identifying the conversation the asset belongs to */
21
- auditData?: AssetAuditData;
22
16
  }
23
17
  export interface AssetResponse {
24
18
  buffer: ArrayBuffer;
@@ -26,11 +20,20 @@ export interface AssetResponse {
26
20
  }
27
21
  export declare class AssetAPI {
28
22
  private readonly client;
29
- private readonly logger;
30
- constructor(client: HttpClient);
23
+ private readonly backendFeatures;
24
+ constructor(client: HttpClient, backendFeatures: BackendFeatures);
31
25
  private getAssetShared;
32
26
  private postAssetShared;
33
- getAsset(assetId: string, assetDomain: string, token?: string | null, forceCaching?: boolean, progressCallback?: ProgressCallback): RequestCancelable<AssetResponse>;
27
+ getAssetV1(assetId: string, conversationId: string, forceCaching?: boolean, progressCallback?: ProgressCallback): {
28
+ cancel: () => void;
29
+ response: Promise<AssetResponse>;
30
+ };
31
+ getAssetV2(assetId: string, conversationId: string, forceCaching?: boolean, progressCallback?: ProgressCallback): {
32
+ cancel: () => void;
33
+ response: Promise<AssetResponse>;
34
+ };
35
+ getAssetV3(assetId: string, token?: string | null, forceCaching?: boolean, progressCallback?: ProgressCallback): RequestCancelable<AssetResponse>;
36
+ getAssetV4(assetId: string, assetDomain: string, token?: string | null, forceCaching?: boolean, progressCallback?: ProgressCallback): RequestCancelable<AssetResponse>;
34
37
  getServiceAsset(assetId: string, token?: string | null, forceCaching?: boolean, progressCallback?: ProgressCallback): RequestCancelable<AssetResponse>;
35
38
  /**
36
39
  * Uploads an asset to the backend
@@ -39,17 +42,7 @@ export declare class AssetAPI {
39
42
  * @param options?
40
43
  * @param progressCallback? Will be called at every progress of the upload
41
44
  */
42
- postAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<{
43
- key: string;
44
- token: string;
45
- expires: string;
46
- domain?: string | undefined;
47
- }>;
48
- postServiceAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<{
49
- key: string;
50
- token: string;
51
- expires: string;
52
- domain?: string | undefined;
53
- }>;
45
+ postAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<AssetUploadData>;
46
+ postServiceAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<AssetUploadData>;
54
47
  }
55
48
  //# sourceMappingURL=AssetAPI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssetAPI.d.ts","sourceRoot":"","sources":["../../src/asset/AssetAPI.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAC,u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C7B,gBAAgB,CAAC,EAAE,gBAAgB;;;;IAiDrC,UAAU,CACR,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,YAAY,GAAE,OAAe,EAC7B,gBAAgB,CAAC,EAAE,gBAAgB;;;;IA+CrC,UAAU,CACR,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,YAAY,GAAE,OAAe,EAC7B,gBAAgB,CAAC,EAAE,gBAAgB;IAarC,UAAU,CACR,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,YAAY,GAAE,OAAe,EAC7B,gBAAgB,CAAC,EAAE,gBAAgB;IAgBrC,eAAe,CACb,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,YAAY,GAAE,OAAe,EAC7B,gBAAgB,CAAC,EAAE,gBAAgB;IAUrC;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,gBAAgB,CAAC,EAAE,gBAAgB;IAKxF,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,gBAAgB,CAAC,EAAE,gBAAgB;CAIhG"}
@@ -23,20 +23,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.AssetAPI = void 0;
25
25
  const axios_1 = __importDefault(require("axios"));
26
- const commons_1 = require("@wireapp/commons");
27
- const AssetAPI_schema_1 = require("./AssetAPI.schema");
28
26
  const AssetRetentionPolicy_1 = require("./AssetRetentionPolicy");
29
27
  const AssetUtil_1 = require("./AssetUtil");
30
28
  const http_1 = require("../http/");
31
29
  const buffer_1 = require("../shims/node/buffer");
32
30
  const random_1 = require("../shims/node/random");
33
31
  const user_1 = require("../user");
32
+ const ASSET_URLS = {
33
+ ASSET_V3_URL: '/assets/v3',
34
+ ASSET_V4_URL: '/assets/v4',
35
+ ASSET_SERVICE_URL: '/bot/assets',
36
+ ASSET_V2_URL: '/otr/assets',
37
+ ASSET_V2_CONVERSATION_URL: '/conversations',
38
+ ASSET_V1_URL: '/assets',
39
+ ASSETS_URL: '/assets',
40
+ };
34
41
  class AssetAPI {
35
42
  client;
36
- logger;
37
- constructor(client) {
43
+ backendFeatures;
44
+ constructor(client, backendFeatures) {
38
45
  this.client = client;
39
- this.logger = commons_1.LogFactory.getLogger('@wireapp/api-client/AssetAPI');
46
+ this.backendFeatures = backendFeatures;
40
47
  }
41
48
  getAssetShared(assetUrl, token, forceCaching = false, progressCallback) {
42
49
  if (token && !(0, AssetUtil_1.isValidToken)(token)) {
@@ -80,17 +87,11 @@ class AssetAPI {
80
87
  }
81
88
  postAssetShared(assetBaseUrl, asset, options, progressCallback) {
82
89
  const BOUNDARY = `Frontier${(0, random_1.unsafeAlphanumeric)()}`;
83
- const metadataObject = {
90
+ const metadata = JSON.stringify({
84
91
  public: options?.public ?? true,
85
92
  retention: options?.retention || AssetRetentionPolicy_1.AssetRetentionPolicy.PERSISTENT,
86
93
  domain: options?.domain,
87
- };
88
- if (options?.auditData) {
89
- metadataObject.convId = options.auditData.conversationId;
90
- metadataObject.filename = options.auditData.filename;
91
- metadataObject.filetype = options.auditData.filetype;
92
- }
93
- const metadata = JSON.stringify(metadataObject);
94
+ });
94
95
  const body = `--${BOUNDARY}\r\n` +
95
96
  'Content-Type: application/json;charset=utf-8\r\n' +
96
97
  `Content-length: ${metadata.length}\r\n` +
@@ -117,10 +118,6 @@ class AssetAPI {
117
118
  const handleRequest = async () => {
118
119
  try {
119
120
  const response = await this.client.sendRequest(config);
120
- const validation = AssetAPI_schema_1.PostAssetsResponseSchema.safeParse(response.data);
121
- if (!validation.success) {
122
- this.logger.warn('Asset upload response validation failed:', validation.error);
123
- }
124
121
  return response.data;
125
122
  }
126
123
  catch (error) {
@@ -135,7 +132,99 @@ class AssetAPI {
135
132
  response: handleRequest(),
136
133
  };
137
134
  }
138
- getAsset(assetId, assetDomain, token, forceCaching = false, progressCallback) {
135
+ getAssetV1(assetId, conversationId, forceCaching = false, progressCallback) {
136
+ if (!(0, AssetUtil_1.isValidUUID)(assetId)) {
137
+ throw new TypeError(`Expected asset ID "${assetId}" to only contain alphanumeric values and dashes.`);
138
+ }
139
+ if (!(0, AssetUtil_1.isValidUUID)(conversationId)) {
140
+ throw new TypeError(`Expected conversation ID "${conversationId}" to only contain alphanumeric values and dashes.`);
141
+ }
142
+ const cancelSource = axios_1.default.CancelToken.source();
143
+ const config = {
144
+ cancelToken: cancelSource.token,
145
+ method: 'get',
146
+ onDownloadProgress: (0, http_1.handleProgressEvent)(progressCallback),
147
+ onUploadProgress: (0, http_1.handleProgressEvent)(progressCallback),
148
+ params: {
149
+ conv_id: conversationId,
150
+ },
151
+ responseType: 'arraybuffer',
152
+ url: `${ASSET_URLS.ASSET_V1_URL}/${assetId}`,
153
+ };
154
+ if (forceCaching) {
155
+ config.params.forceCaching = forceCaching;
156
+ }
157
+ const handleRequest = async () => {
158
+ try {
159
+ const response = await this.client.sendRequest(config);
160
+ return {
161
+ buffer: response.data,
162
+ mimeType: response.headers['content-type'],
163
+ };
164
+ }
165
+ catch (error) {
166
+ if (error.message === http_1.SyntheticErrorLabel.REQUEST_CANCELLED) {
167
+ throw new user_1.RequestCancellationError('Asset download got cancelled.');
168
+ }
169
+ throw error;
170
+ }
171
+ };
172
+ return {
173
+ cancel: () => cancelSource.cancel(http_1.SyntheticErrorLabel.REQUEST_CANCELLED),
174
+ response: handleRequest(),
175
+ };
176
+ }
177
+ getAssetV2(assetId, conversationId, forceCaching = false, progressCallback) {
178
+ if (!(0, AssetUtil_1.isValidUUID)(assetId)) {
179
+ throw new TypeError(`Expected asset ID "${assetId}" to only contain alphanumeric values and dashes.`);
180
+ }
181
+ if (!(0, AssetUtil_1.isValidUUID)(conversationId)) {
182
+ throw new TypeError(`Expected conversation ID "${conversationId}" to only contain alphanumeric values and dashes.`);
183
+ }
184
+ const cancelSource = axios_1.default.CancelToken.source();
185
+ const config = {
186
+ cancelToken: cancelSource.token,
187
+ method: 'get',
188
+ onDownloadProgress: (0, http_1.handleProgressEvent)(progressCallback),
189
+ onUploadProgress: (0, http_1.handleProgressEvent)(progressCallback),
190
+ params: {},
191
+ responseType: 'arraybuffer',
192
+ url: `${ASSET_URLS.ASSET_V2_CONVERSATION_URL}/${conversationId}${ASSET_URLS.ASSET_V2_URL}/${assetId}`,
193
+ };
194
+ if (forceCaching) {
195
+ config.params.forceCaching = forceCaching;
196
+ }
197
+ const handleRequest = async () => {
198
+ try {
199
+ const response = await this.client.sendRequest(config);
200
+ return {
201
+ buffer: response.data,
202
+ mimeType: response.headers['content-type'],
203
+ };
204
+ }
205
+ catch (error) {
206
+ if (error.message === http_1.SyntheticErrorLabel.REQUEST_CANCELLED) {
207
+ throw new user_1.RequestCancellationError('Asset download got cancelled.');
208
+ }
209
+ throw error;
210
+ }
211
+ };
212
+ return {
213
+ cancel: () => cancelSource.cancel(http_1.SyntheticErrorLabel.REQUEST_CANCELLED),
214
+ response: handleRequest(),
215
+ };
216
+ }
217
+ getAssetV3(assetId, token, forceCaching = false, progressCallback) {
218
+ const version2 = 2;
219
+ if (!(0, AssetUtil_1.isValidUUID)(assetId)) {
220
+ throw new TypeError(`Expected asset ID "${assetId}" to only contain alphanumeric values and dashes.`);
221
+ }
222
+ if (this.backendFeatures.version >= version2) {
223
+ throw new TypeError('Asset v3 is not supported on backend version 2 or higher.');
224
+ }
225
+ return this.getAssetShared(`${ASSET_URLS.ASSET_V3_URL}/${assetId}`, token, forceCaching, progressCallback);
226
+ }
227
+ getAssetV4(assetId, assetDomain, token, forceCaching = false, progressCallback) {
139
228
  if (!(0, AssetUtil_1.isValidUUID)(assetId)) {
140
229
  throw new TypeError(`Expected asset ID "${assetId}" to only contain alphanumeric values and dashes.`);
141
230
  }
@@ -143,13 +232,14 @@ class AssetAPI {
143
232
  if (!isValidDomain(assetDomain)) {
144
233
  throw new TypeError(`Invalid asset domain ${assetDomain}`);
145
234
  }
146
- return this.getAssetShared(`/assets/${assetDomain}/${assetId}`, token, forceCaching, progressCallback);
235
+ const assetBaseUrl = this.backendFeatures.version >= 2 ? ASSET_URLS.ASSETS_URL : ASSET_URLS.ASSET_V4_URL;
236
+ return this.getAssetShared(`${assetBaseUrl}/${assetDomain}/${assetId}`, token, forceCaching, progressCallback);
147
237
  }
148
238
  getServiceAsset(assetId, token, forceCaching = false, progressCallback) {
149
239
  if (!(0, AssetUtil_1.isValidUUID)(assetId)) {
150
240
  throw new TypeError(`Expected asset ID "${assetId}" to only contain alphanumeric values and dashes.`);
151
241
  }
152
- const assetBaseUrl = `/bot/assets/${assetId}`;
242
+ const assetBaseUrl = `${ASSET_URLS.ASSET_SERVICE_URL}/${assetId}`;
153
243
  return this.getAssetShared(assetBaseUrl, token, forceCaching, progressCallback);
154
244
  }
155
245
  /**
@@ -160,10 +250,12 @@ class AssetAPI {
160
250
  * @param progressCallback? Will be called at every progress of the upload
161
251
  */
162
252
  postAsset(asset, options, progressCallback) {
163
- return this.postAssetShared('/assets', asset, options, progressCallback);
253
+ const baseUrl = this.backendFeatures.version >= 2 ? ASSET_URLS.ASSETS_URL : ASSET_URLS.ASSET_V3_URL;
254
+ return this.postAssetShared(baseUrl, asset, options, progressCallback);
164
255
  }
165
256
  postServiceAsset(asset, options, progressCallback) {
166
- return this.postAssetShared('/bot/assets', asset, options, progressCallback);
257
+ const assetBaseUrl = ASSET_URLS.ASSET_SERVICE_URL;
258
+ return this.postAssetShared(assetBaseUrl, asset, options, progressCallback);
167
259
  }
168
260
  }
169
261
  exports.AssetAPI = AssetAPI;
@@ -0,0 +1,8 @@
1
+ export interface AssetUploadData {
2
+ /** ISO 8601 formatted date */
3
+ expires: string;
4
+ key: string;
5
+ domain?: string;
6
+ token: string;
7
+ }
8
+ //# sourceMappingURL=AssetUploadData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetUploadData.d.ts","sourceRoot":"","sources":["../../src/asset/AssetUploadData.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -18,19 +18,3 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.PostAssetsResponseSchema = void 0;
22
- const zod_1 = require("zod");
23
- /**
24
- * Zod schema for validating POST /assets response (201 Created)
25
- * Based on backend API specification
26
- */
27
- exports.PostAssetsResponseSchema = zod_1.z.object({
28
- /** Asset domain (example.com) */
29
- domain: zod_1.z.string().optional(),
30
- /** ISO 8601 formatted expiration date */
31
- expires: zod_1.z.string().datetime(),
32
- /** Asset key (e.g., "3-1-47de4580-ae51-4650-acbb-d10c028cb0ac") */
33
- key: zod_1.z.string().min(1),
34
- /** Base64 encoded token (e.g., "aGVsbG8") */
35
- token: zod_1.z.string().min(1),
36
- });
@@ -1,5 +1,5 @@
1
1
  export * from './AssetAPI';
2
2
  export * from './AssetRetentionPolicy';
3
- export { AssetUploadData } from './AssetAPI.schema';
3
+ export * from './AssetUploadData';
4
4
  export * from './AssetUtil';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asset/index.ts"],"names":[],"mappings":"AAmBA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asset/index.ts"],"names":[],"mappings":"AAmBA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
@@ -34,4 +34,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  __exportStar(require("./AssetAPI"), exports);
36
36
  __exportStar(require("./AssetRetentionPolicy"), exports);
37
+ __exportStar(require("./AssetUploadData"), exports);
37
38
  __exportStar(require("./AssetUtil"), exports);
@@ -65,6 +65,12 @@ class BackendErrorMapper {
65
65
  "[path] 'cnv' invalid: Failed reading: Invalid UUID": e => new conversation_1.ConversationIsUnknownError('Conversation ID is unknown.', e.label, e.code),
66
66
  "[path] 'usr' invalid: Failed reading: Invalid UUID": e => new user_1.UserIsUnknownError('User ID is unknown.', e.label, e.code),
67
67
  },
68
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_SIGNATURE]: {
69
+ 'Invalid leaf node signature': e => new conversation_1.MLSInvalidLeafNodeSignatureError('Invalid leaf node signature', e.label, e.code),
70
+ },
71
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_INDEX]: {
72
+ 'Invalid leaf node index': e => new conversation_1.MLSInvalidLeafNodeIndexError('Invalid leaf node index', e.label, e.code),
73
+ },
68
74
  },
69
75
  [http_status_codes_1.StatusCodes.FORBIDDEN]: {
70
76
  [_1.BackendErrorLabel.INVALID_CREDENTIALS]: {
@@ -75,12 +81,6 @@ class BackendErrorMapper {
75
81
  'Token expired': e => new auth_1.TokenExpiredError('Authentication failed because the token is expired.', e.label, e.code),
76
82
  'Missing cookie and token': e => new auth_1.MissingCookieAndTokenError('Authentication failed because both cookie and token are missing.', e.label, e.code),
77
83
  },
78
- [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_SIGNATURE]: {
79
- 'Invalid leaf node signature': e => new conversation_1.MLSInvalidLeafNodeSignatureError('Invalid leaf node signature', e.label, e.code),
80
- },
81
- [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_INDEX]: {
82
- 'Invalid leaf node index': e => new conversation_1.MLSInvalidLeafNodeIndexError('Invalid leaf node index', e.label, e.code),
83
- },
84
84
  [_1.BackendErrorLabel.INVALID_OPERATION]: {
85
85
  'invalid operation for 1:1 conversations': e => new conversation_1.ConversationOperationError('Cannot leave 1:1 conversation.', e.label, e.code),
86
86
  },
@@ -63,12 +63,7 @@ export declare class ServicesAPI {
63
63
  * Upload an asset.
64
64
  * Note that resumable uploads are not currently supported for services.
65
65
  */
66
- postAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): import("../http").RequestCancelable<{
67
- key: string;
68
- token: string;
69
- expires: string;
70
- domain?: string | undefined;
71
- }>;
66
+ postAsset(asset: Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): import("../http").RequestCancelable<import("../asset").AssetUploadData>;
72
67
  /**
73
68
  * Download an asset.
74
69
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ServicesAPI.d.ts","sourceRoot":"","sources":["../../src/services/ServicesAPI.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,MAAM,EACN,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAErD,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,QAAQ;IAGrC,gBAAuB,GAAG;;;;;;;;;;MAUxB;IAEF;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASxC;;OAEG;IACU,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAUzC;;OAEG;IACU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EAC7B,gBAAgB,CAAC,EAAE,gBAAgB;IAKrC;;OAEG;IACU,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxD;;OAEG;IACU,WAAW,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASrE"}
package/package.json CHANGED
@@ -70,6 +70,6 @@
70
70
  "watch": "webpack serve --config webpack.browser.js",
71
71
  "prepare": "yarn dist"
72
72
  },
73
- "version": "27.77.0",
74
- "gitHead": "90f4138a890f47d5527691a1e360df5157c2a8e6"
73
+ "version": "27.77.2",
74
+ "gitHead": "36564aadbe435668608f785e1c496b626c6fdf71"
75
75
  }
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schema for validating POST /assets response (201 Created)
4
- * Based on backend API specification
5
- */
6
- export declare const PostAssetsResponseSchema: z.ZodObject<{
7
- /** Asset domain (example.com) */
8
- domain: z.ZodOptional<z.ZodString>;
9
- /** ISO 8601 formatted expiration date */
10
- expires: z.ZodString;
11
- /** Asset key (e.g., "3-1-47de4580-ae51-4650-acbb-d10c028cb0ac") */
12
- key: z.ZodString;
13
- /** Base64 encoded token (e.g., "aGVsbG8") */
14
- token: z.ZodString;
15
- }, "strip", z.ZodTypeAny, {
16
- key: string;
17
- token: string;
18
- expires: string;
19
- domain?: string | undefined;
20
- }, {
21
- key: string;
22
- token: string;
23
- expires: string;
24
- domain?: string | undefined;
25
- }>;
26
- export type AssetUploadData = z.infer<typeof PostAssetsResponseSchema>;
27
- //# sourceMappingURL=AssetAPI.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AssetAPI.schema.d.ts","sourceRoot":"","sources":["../../src/asset/AssetAPI.schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;GAGG;AACH,eAAO,MAAM,wBAAwB;IACnC,iCAAiC;;IAEjC,yCAAyC;;IAEzC,mEAAmE;;IAEnE,6CAA6C;;;;;;;;;;;;EAE7C,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}