@flashbacktech/flashbackclient 0.1.38 → 0.1.40

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.
Files changed (50) hide show
  1. package/dist/stellarv2/wallet/transaction.js +0 -1
  2. package/package.json +1 -9
  3. package/dist/api/types.d.ts +0 -89
  4. package/dist/api/types.js +0 -20
  5. package/dist/consumer/file/delete.d.ts +0 -3
  6. package/dist/consumer/file/delete.js +0 -23
  7. package/dist/consumer/file/getUrl.d.ts +0 -3
  8. package/dist/consumer/file/getUrl.js +0 -20
  9. package/dist/consumer/file/index.d.ts +0 -30
  10. package/dist/consumer/file/index.js +0 -52
  11. package/dist/consumer/file/types.d.ts +0 -25
  12. package/dist/consumer/file/types.js +0 -2
  13. package/dist/consumer/file/upload.d.ts +0 -3
  14. package/dist/consumer/file/upload.js +0 -75
  15. package/dist/consumer/index.d.ts +0 -1
  16. package/dist/consumer/index.js +0 -17
  17. package/dist/stellar/client.d.ts +0 -282
  18. package/dist/stellar/client.js +0 -453
  19. package/dist/stellar/consumer.d.ts +0 -10
  20. package/dist/stellar/consumer.js +0 -86
  21. package/dist/stellar/decorator.d.ts +0 -1
  22. package/dist/stellar/decorator.js +0 -33
  23. package/dist/stellar/index.d.ts +0 -4
  24. package/dist/stellar/index.js +0 -5
  25. package/dist/stellar/models.d.ts +0 -55
  26. package/dist/stellar/models.js +0 -2
  27. package/dist/stellar/provider.d.ts +0 -10
  28. package/dist/stellar/provider.js +0 -86
  29. package/dist/stellar/reservation.d.ts +0 -8
  30. package/dist/stellar/reservation.js +0 -61
  31. package/dist/stellar/stats.d.ts +0 -4
  32. package/dist/stellar/stats.js +0 -12
  33. package/dist/stellar/transaction.d.ts +0 -24
  34. package/dist/stellar/transaction.js +0 -138
  35. package/dist/stellar/unit.d.ts +0 -12
  36. package/dist/stellar/unit.js +0 -100
  37. package/dist/stellarv2/bucket.d.ts +0 -111
  38. package/dist/stellarv2/bucket.js +0 -262
  39. package/dist/stellarv2/client.d.ts +0 -134
  40. package/dist/stellarv2/client.js +0 -240
  41. package/dist/stellarv2/consumer.d.ts +0 -60
  42. package/dist/stellarv2/consumer.js +0 -145
  43. package/dist/stellarv2/deal.d.ts +0 -160
  44. package/dist/stellarv2/deal.js +0 -357
  45. package/dist/stellarv2/funding.d.ts +0 -46
  46. package/dist/stellarv2/funding.js +0 -86
  47. package/dist/stellarv2/provider.d.ts +0 -72
  48. package/dist/stellarv2/provider.js +0 -174
  49. package/dist/stellarv2/transaction.d.ts +0 -36
  50. package/dist/stellarv2/transaction.js +0 -168
@@ -44,7 +44,6 @@ const getServer = (network) => {
44
44
  }
45
45
  console.log(`!!!Creating Soroban RPC server for network: ${network.network}, URL: ${serverUrl}`);
46
46
  // For Stellar SDK v13+, we need to handle the allowHttp issue
47
- // Try different approaches to create the server
48
47
  let server;
49
48
  // Approach 1: Try with allowHttp option
50
49
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -34,11 +34,6 @@
34
34
  "": "./dist/.min.js"
35
35
  },
36
36
  "exports": {
37
- "./stellar": {
38
- "types": "./dist/stellar/index.d.ts",
39
- "require": "./dist/stellar/index.js",
40
- "default": "./dist/stellar/index.js"
41
- },
42
37
  "./stellarv2": {
43
38
  "types": "./dist/stellarv2/index.d.ts",
44
39
  "require": "./dist/stellarv2/index.js",
@@ -80,9 +75,6 @@
80
75
  },
81
76
  "typesVersions": {
82
77
  "*": {
83
- "stellar": [
84
- "./dist/stellar/index.d.ts"
85
- ],
86
78
  "stellarv2": [
87
79
  "./dist/stellarv2/index.d.ts"
88
80
  ],
@@ -1,89 +0,0 @@
1
- export declare enum StorageType {
2
- S3 = "S3",
3
- GCS = "GCS",
4
- AZURE = "AZURE"
5
- }
6
- export declare enum AccessType {
7
- READ = "READ",
8
- WRITE = "WRITE",
9
- ADMIN = "ADMIN"
10
- }
11
- export declare enum ModeType {
12
- NORMAL = "NORMAL",
13
- MIRROR = "MIRROR"
14
- }
15
- export interface CreateUnitRequest {
16
- name: string;
17
- bucket: string;
18
- storageType: StorageType;
19
- key: string;
20
- secret: string;
21
- endpoint?: string;
22
- regionId?: string;
23
- }
24
- export interface CreateUnitResponse {
25
- success: boolean;
26
- unitId: string;
27
- }
28
- export interface RepoUnitInfo {
29
- id: string;
30
- folder: string;
31
- }
32
- export interface CreateRepoRequest {
33
- name: string;
34
- storageType: StorageType;
35
- mode: ModeType;
36
- repoUnits: RepoUnitInfo[];
37
- }
38
- export interface CreateRepoResponse {
39
- success: boolean;
40
- repoId: string;
41
- }
42
- export interface CreateRepoKeyRequest {
43
- repoId: string;
44
- name: string;
45
- accessType: AccessType;
46
- }
47
- export interface CreateRepoKeyResponse {
48
- success: boolean;
49
- id: string;
50
- key: string;
51
- secret: string;
52
- }
53
- export interface StorageRepo {
54
- id: string;
55
- name: string;
56
- storageType: StorageType;
57
- mode: ModeType;
58
- repoUnits: RepoUnitInfo[];
59
- apiKeys: ApiKey[];
60
- }
61
- export interface ApiKey {
62
- id: string;
63
- name: string;
64
- accessType: AccessType;
65
- key: string;
66
- secret: string;
67
- }
68
- export interface StorageUnit {
69
- id: string;
70
- name: string;
71
- bucket: string;
72
- storageType: StorageType;
73
- key: string;
74
- secret: string;
75
- endpoint?: string;
76
- regionId?: string;
77
- }
78
- export interface GetUnitsResponse {
79
- success: boolean;
80
- units: StorageUnit[];
81
- }
82
- export interface GetReposResponse {
83
- success: boolean;
84
- repos: StorageRepo[];
85
- }
86
- export interface GetRepoKeysResponse {
87
- success: boolean;
88
- keys: ApiKey[];
89
- }
package/dist/api/types.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModeType = exports.AccessType = exports.StorageType = void 0;
4
- var StorageType;
5
- (function (StorageType) {
6
- StorageType["S3"] = "S3";
7
- StorageType["GCS"] = "GCS";
8
- StorageType["AZURE"] = "AZURE";
9
- })(StorageType || (exports.StorageType = StorageType = {}));
10
- var AccessType;
11
- (function (AccessType) {
12
- AccessType["READ"] = "READ";
13
- AccessType["WRITE"] = "WRITE";
14
- AccessType["ADMIN"] = "ADMIN";
15
- })(AccessType || (exports.AccessType = AccessType = {}));
16
- var ModeType;
17
- (function (ModeType) {
18
- ModeType["NORMAL"] = "NORMAL";
19
- ModeType["MIRROR"] = "MIRROR";
20
- })(ModeType || (exports.ModeType = ModeType = {}));
@@ -1,3 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { DeleteParams, DeleteResponse } from './types';
3
- export declare function deleteFile(client: AxiosInstance, params: DeleteParams): Promise<DeleteResponse>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deleteFile = deleteFile;
7
- const axios_1 = __importDefault(require("axios"));
8
- async function deleteFile(client, params) {
9
- try {
10
- const { data } = await client.delete('/file/', {
11
- params,
12
- data: params,
13
- });
14
- return data;
15
- }
16
- catch (error) {
17
- if (axios_1.default.isAxiosError(error) && error.response?.data) {
18
- const errorData = error.response.data;
19
- throw new Error(`Delete failed: ${errorData.message}`);
20
- }
21
- throw error;
22
- }
23
- }
@@ -1,3 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { GetUrlParams } from './types';
3
- export declare function getUrl(client: AxiosInstance, params: GetUrlParams): Promise<string>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getUrl = getUrl;
7
- const axios_1 = __importDefault(require("axios"));
8
- async function getUrl(client, params) {
9
- try {
10
- const { data } = await client.get('/file/', { params });
11
- return data;
12
- }
13
- catch (error) {
14
- if (axios_1.default.isAxiosError(error) && error.response?.data) {
15
- const errorData = error.response.data;
16
- throw new Error(`Get URL failed: ${errorData.message}`);
17
- }
18
- throw error;
19
- }
20
- }
@@ -1,30 +0,0 @@
1
- import { DeleteParams, DeleteResponse, GetUrlParams, UploadRequest, UploadResponse } from './types';
2
- export type { DeleteParams, DeleteResponse, GetUrlParams, UploadRequest, UploadResponse };
3
- export interface StorageClientConfig {
4
- baseUrl: string;
5
- timeout?: number;
6
- headers?: Record<string, string>;
7
- }
8
- export declare class StorageClient {
9
- private client;
10
- private readonly config;
11
- constructor(config: StorageClientConfig);
12
- /**
13
- * Upload a file to storage
14
- * @param params Upload parameters including file data and type
15
- * @returns Promise with the file URL
16
- */
17
- upload(params: UploadRequest): Promise<UploadResponse>;
18
- /**
19
- * Get the URL for a file
20
- * @param params File identifier parameters
21
- * @returns Promise with the file URL
22
- */
23
- getUrl(params: GetUrlParams): Promise<string>;
24
- /**
25
- * Delete a file from storage
26
- * @param params File identifier parameters
27
- * @returns Promise indicating success
28
- */
29
- delete(params: DeleteParams): Promise<DeleteResponse>;
30
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StorageClient = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const upload_1 = require("./upload");
9
- const getUrl_1 = require("./getUrl");
10
- const delete_1 = require("./delete");
11
- class StorageClient {
12
- constructor(config) {
13
- this.config = {
14
- baseUrl: config.baseUrl.replace(/\/$/, ''),
15
- timeout: config.timeout || 30000,
16
- headers: {
17
- 'Content-Type': 'application/json',
18
- ...config.headers,
19
- },
20
- };
21
- this.client = axios_1.default.create({
22
- baseURL: this.config.baseUrl,
23
- timeout: this.config.timeout,
24
- headers: this.config.headers,
25
- });
26
- }
27
- /**
28
- * Upload a file to storage
29
- * @param params Upload parameters including file data and type
30
- * @returns Promise with the file URL
31
- */
32
- async upload(params) {
33
- return (0, upload_1.upload)(this.client, params);
34
- }
35
- /**
36
- * Get the URL for a file
37
- * @param params File identifier parameters
38
- * @returns Promise with the file URL
39
- */
40
- async getUrl(params) {
41
- return (0, getUrl_1.getUrl)(this.client, params);
42
- }
43
- /**
44
- * Delete a file from storage
45
- * @param params File identifier parameters
46
- * @returns Promise indicating success
47
- */
48
- async delete(params) {
49
- return (0, delete_1.deleteFile)(this.client, params);
50
- }
51
- }
52
- exports.StorageClient = StorageClient;
@@ -1,25 +0,0 @@
1
- import type { Buffer, Blob, File } from 'buffer';
2
- export interface UploadRequest {
3
- folderId: string;
4
- fileId: string;
5
- data: string | Buffer | ArrayBuffer | Blob | File | globalThis.File;
6
- type: 'base64' | 'binary' | 'multipart';
7
- }
8
- export interface UploadResponse {
9
- url: string;
10
- }
11
- export interface GetUrlParams {
12
- folderId: string;
13
- fileId: string;
14
- }
15
- export interface DeleteParams {
16
- folderId: string;
17
- fileId: string;
18
- }
19
- export interface DeleteResponse {
20
- success: boolean;
21
- }
22
- export interface ErrorResponse {
23
- error: string;
24
- message: string;
25
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- import { UploadRequest, UploadResponse } from './types';
2
- import { AxiosInstance } from 'axios';
3
- export declare function upload(client: AxiosInstance, params: UploadRequest): Promise<UploadResponse>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.upload = upload;
7
- /// <reference lib="dom" />
8
- //import type { Blob } from 'buffer';
9
- const formdata_node_1 = require("formdata-node");
10
- const axios_1 = __importDefault(require("axios"));
11
- async function upload(client, params) {
12
- try {
13
- let url = '';
14
- switch (params.type) {
15
- case 'multipart': {
16
- const formData = new formdata_node_1.FormData();
17
- formData.append('type', 'multipart');
18
- formData.append('folderId', params.folderId);
19
- formData.append('fileId', params.fileId);
20
- // If params.data is already a Blob/File, use it directly
21
- // Otherwise, create a new Blob with the correct type
22
- const fileBlob = params.data;
23
- formData.append('file', fileBlob);
24
- const response = await client.post('/file/', formData, {
25
- headers: {
26
- 'Content-Type': 'multipart/form-data',
27
- },
28
- // Prevent any data transformation
29
- transformRequest: [(data) => data],
30
- // Ensure binary data handling
31
- responseType: 'json',
32
- maxBodyLength: Infinity,
33
- maxContentLength: Infinity,
34
- });
35
- url = response.data.url;
36
- break;
37
- }
38
- case 'binary': {
39
- // Binary upload
40
- const response = await client.post('/file/', params.data, {
41
- headers: {
42
- 'Content-Type': 'application/octet-stream',
43
- 'x-upload-type': 'binary',
44
- 'x-folder-id': params.folderId,
45
- 'x-file-id': params.fileId,
46
- },
47
- });
48
- url = response.data.url;
49
- break;
50
- }
51
- case 'base64': {
52
- const response = await client.post('/file/', {
53
- type: 'base64',
54
- folderId: params.folderId,
55
- fileId: params.fileId,
56
- data: params.data,
57
- }, {
58
- headers: { 'Content-Type': 'application/json' },
59
- });
60
- url = response.data.url;
61
- break;
62
- }
63
- default:
64
- throw new Error('Invalid file type');
65
- }
66
- return { url };
67
- }
68
- catch (error) {
69
- if (axios_1.default.isAxiosError(error) && error.response?.data) {
70
- const errorData = error.response.data;
71
- throw new Error(`Upload failed: ${errorData.message}`);
72
- }
73
- throw error;
74
- }
75
- }
@@ -1 +0,0 @@
1
- export * from './file';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./file"), exports);