mftsccs-browser 2.1.237-beta → 2.1.239-beta

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.
@@ -77,6 +77,8 @@ export declare class BaseUrl {
77
77
  static uploadImageUrl(): string;
78
78
  static uploadImageUrlWithSmall(): string;
79
79
  static uploadFileUrl(): string;
80
+ static uploadR2StorageUrl(): string;
81
+ static r2PresignedUploadUrl(): string;
80
82
  static sendMail(): string;
81
83
  static sendBulkMail(): string;
82
84
  static getWidgetData(): string;
@@ -1,5 +1,51 @@
1
1
  export declare const validImageFormats: string[];
2
2
  export declare const validDocumentFormats: string[];
3
+ export interface R2UploadData {
4
+ key: string;
5
+ bucket: string;
6
+ contentType: string;
7
+ size: number;
8
+ eTag: string;
9
+ url: string;
10
+ }
11
+ export interface R2PresignedUploadUrlRequest {
12
+ fileName: string;
13
+ contentType: string;
14
+ folder?: string;
15
+ expiresInSeconds?: number;
16
+ }
17
+ export interface R2PresignedUploadUrlData {
18
+ uploadUrl: string;
19
+ key: string;
20
+ bucket: string;
21
+ contentType: string;
22
+ expiresInSeconds: number;
23
+ expiresAt: string;
24
+ publicUrl: string;
25
+ }
26
+ export interface R2PresignedUploadOptions {
27
+ fileName?: string;
28
+ contentType?: string;
29
+ folder?: string;
30
+ expiresInSeconds?: number;
31
+ }
32
+ export interface R2PresignedUploadResult {
33
+ message: string;
34
+ success: boolean;
35
+ url?: string;
36
+ data?: R2PresignedUploadUrlData;
37
+ eTag?: string | null;
38
+ }
39
+ export interface UploadResponse<T = string | R2UploadData> {
40
+ message: string;
41
+ success: boolean;
42
+ data?: T;
43
+ }
44
+ type UploadFileParam = Blob & {
45
+ name?: string;
46
+ type?: string;
47
+ uri?: string;
48
+ };
3
49
  /**
4
50
  * Generic method to upload file or image
5
51
  * @param file File
@@ -10,25 +56,56 @@ export declare function uploadAttachment(file: File, token?: string): Promise<{
10
56
  success: boolean;
11
57
  url?: string;
12
58
  }>;
59
+ /**
60
+ * Method to upload a file or image to R2 storage.
61
+ * @param body FormData. Append the file under the "file" key.
62
+ * @param token string?
63
+ * @returns UploadResponse<R2UploadData> | null
64
+ */
65
+ export declare function uploadR2Storage(body: FormData, token?: string): Promise<UploadResponse<R2UploadData> | null>;
66
+ /**
67
+ * Method to request an R2 pre-signed upload URL from the backend.
68
+ * @param body Request metadata for the file to upload.
69
+ * @param token string?
70
+ * @returns UploadResponse<R2PresignedUploadUrlData> | null
71
+ */
72
+ export declare function getR2PresignedUploadUrl(body: R2PresignedUploadUrlRequest, token?: string): Promise<UploadResponse<R2PresignedUploadUrlData> | null>;
73
+ /**
74
+ * Method to upload a file body to a pre-signed R2 URL.
75
+ * @param uploadUrl URL returned by getR2PresignedUploadUrl
76
+ * @param file Blob/File, raw body, or compatible file-like object
77
+ * @param contentType Must match the contentType used when creating the signed URL.
78
+ * @returns Response from R2
79
+ */
80
+ export declare function uploadToR2PresignedUrl(uploadUrl: string, file: UploadFileParam | Blob | BodyInit | any, contentType: string): Promise<Response>;
81
+ /**
82
+ * Full R2 pre-signed upload workflow: create URL, PUT file to R2, return public URL.
83
+ * @param file Blob/File, raw body, or compatible file-like object
84
+ * @param options Optional fileName/contentType/folder/expiresInSeconds overrides.
85
+ * @param token string?
86
+ * @returns R2PresignedUploadResult
87
+ */
88
+ export declare function uploadWithR2PresignedUrl(file: UploadFileParam | Blob | BodyInit | any, options?: R2PresignedUploadOptions, token?: string): Promise<R2PresignedUploadResult>;
13
89
  /**
14
90
  * Method to upload image to server
15
91
  * @param body FormData
16
92
  * @param token string?
17
93
  * @returns JSON | string | null
18
94
  */
19
- export declare function uploadImage(body: FormData, token?: string): Promise<any>;
95
+ export declare function uploadImage(body: FormData, token?: string): Promise<R2PresignedUploadResult>;
20
96
  /**
21
97
  * Method to upload image to server
22
98
  * @param body FormData
23
99
  * @param token string?
24
100
  * @returns JSON | string | null
25
101
  */
26
- export declare function uploadImageV2(body: FormData, token?: string): Promise<any>;
102
+ export declare function uploadImageV2(body: FormData, token?: string): Promise<UploadResponse<string | R2UploadData> | null>;
27
103
  /**
28
104
  * Method to upload file to server
29
105
  * @param body FormData
30
106
  * @param token string?
31
107
  * @returns JSON | string | null
32
108
  */
33
- export declare function uploadFile(body: FormData, token?: string): Promise<any>;
109
+ export declare function uploadFile(body: FormData, token?: string): Promise<UploadResponse<R2UploadData> | null>;
34
110
  export declare function getUploadFileLimit(): Promise<{}>;
111
+ export {};
@@ -27,7 +27,8 @@ export { GetConnectionById } from './Services/GetConnections';
27
27
  export { MakeTheTimestamp } from './Services/MakeTheTimestamp';
28
28
  export { RecursiveSearchApi, RecursiveSearchApiWithInternalConnections, RecursiveSearchApiRaw, RecursiveSearchApiRawFullLinker, RecursiveSearchApiNewRawFullLinker } from './Api/RecursiveSearch';
29
29
  export { GetCompositionBulkWithDataId, GetCompositionFromConnectionsWithDataIdFromConnections, GetCompositionFromConnectionsWithIndexFromConnections, GetCompositionBulk, GetCompositionFromConnectionsWithDataId } from './Services/GetCompositionBulk';
30
- export { uploadAttachment, getUploadFileLimit, uploadFile, uploadImage, uploadImageV2, validDocumentFormats, validImageFormats } from './Services/Upload';
30
+ export { uploadAttachment, getR2PresignedUploadUrl, getUploadFileLimit, uploadFile, uploadImage, uploadImageV2, uploadR2Storage, uploadToR2PresignedUrl, uploadWithR2PresignedUrl, validDocumentFormats, validImageFormats, } from './Services/Upload';
31
+ export type { R2PresignedUploadOptions, R2PresignedUploadResult, R2PresignedUploadUrlData, R2PresignedUploadUrlRequest, R2UploadData, UploadResponse, } from './Services/Upload';
31
32
  export { GetConceptBulk } from './Api/GetConceptBulk';
32
33
  export { GetConnectionBulk } from './Api/GetConnectionBulk';
33
34
  export { GetAllConnectionsOfCompositionBulk } from './Api/GetAllConnectionsOfCompositionBulk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-browser",
3
- "version": "2.1.237-beta",
3
+ "version": "2.1.239-beta",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/main.bundle.js",
@@ -27,7 +27,10 @@
27
27
  "@babel/plugin-transform-modules-commonjs": "^7.24.8",
28
28
  "@babel/preset-env": "^7.25.4",
29
29
  "@babel/preset-typescript": "^7.24.7",
30
+ "@types/jest": "^30.0.0",
31
+ "babel-jest": "^30.4.1",
30
32
  "cross-fetch": "^4.0.0",
33
+ "jest": "^30.4.2",
31
34
  "postcss": "^8.5.6",
32
35
  "postcss-nested": "^7.0.2",
33
36
  "ts-loader": "^9.5.1",